3dcam-headers/include/custom_types.h

211 lines
4.1 KiB
C
Raw Permalink Normal View History

2021-04-13 16:52:48 +02:00
#pragma once
2021-04-10 18:33:20 +02:00
#include <sys/types.h>
#include <libgte.h>
2021-11-28 19:59:05 +01:00
#include <stdint.h>
2021-04-10 18:33:20 +02:00
#include <libgpu.h>
struct BODY;
2021-11-28 19:59:05 +01:00
struct BVECTOR;
2021-04-10 18:33:20 +02:00
struct VANIM;
2021-09-25 19:39:49 +02:00
struct MESH_ANIMS_TRACKS;
2021-04-10 18:33:20 +02:00
struct PRIM;
struct MESH;
struct CAMPOS;
struct CAMPATH;
struct CAMANGLE;
struct SIBLINGS;
struct CHILDREN;
struct NODE;
2021-08-26 19:55:00 +02:00
struct QUAD;
2021-08-16 14:42:07 +02:00
struct LEVEL;
struct VAGsound;
struct VAGbank;
2021-08-16 16:20:36 +02:00
struct XAsound;
2021-08-26 19:55:00 +02:00
struct XAbank;
struct XAfiles;
struct SOUND_OBJECT;
struct LEVEL_SOUNDS;
2021-04-10 18:33:20 +02:00
typedef struct BODY {
2021-08-26 19:55:00 +02:00
VECTOR gForce;
VECTOR position;
SVECTOR velocity;
int mass;
int invMass;
VECTOR min;
VECTOR max;
int restitution;
2021-11-28 19:59:05 +01:00
SVECTOR normal;
2021-08-26 19:55:00 +02:00
} BODY;
2021-04-10 18:33:20 +02:00
2021-11-28 19:59:05 +01:00
typedef struct BVECTOR {
int8_t vx, vy;
int8_t vz;
// int8_t factor; // could be useful for anims where delta is > 256
} BVECTOR;
2021-04-10 18:33:20 +02:00
typedef struct VANIM {
2021-08-26 19:55:00 +02:00
int nframes; // number of frames e.g 20
int nvert; // number of vertices e.g 21
2021-09-25 19:39:49 +02:00
int cursor; // anim cursor : -1 == not playing, n>=0 == current frame number
2021-08-26 19:55:00 +02:00
int lerpCursor; // anim cursor
2021-09-25 19:39:49 +02:00
int loop; // loop anim : -1 == infinite, n>0 == play n times
2021-08-26 19:55:00 +02:00
int dir; // playback direction (1 or -1)
2021-09-25 19:39:49 +02:00
int pingpong; // ping pong animation (A>B>A)
2021-08-26 19:55:00 +02:00
int interpolate; // use lerp to interpolate keyframes
2021-11-28 19:59:05 +01:00
BVECTOR data[]; // vertex pos as SVECTORs e.g 20 * 21 SVECTORS
2021-08-26 19:55:00 +02:00
} VANIM;
2021-04-10 18:33:20 +02:00
2021-09-25 19:39:49 +02:00
typedef struct MESH_ANIMS_TRACKS {
u_short index;
VANIM * strips[];
} MESH_ANIMS_TRACKS;
2021-04-10 18:33:20 +02:00
typedef struct PRIM {
2021-08-26 19:55:00 +02:00
VECTOR order;
int code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3,
2021-04-10 18:33:20 +02:00
// GT3 = 4) Code (F4 = 5, FT4 = 6, G4 = 7, GT4 = 8)
2021-08-26 19:55:00 +02:00
} PRIM;
2021-04-10 18:33:20 +02:00
typedef struct MESH {
2021-08-26 19:55:00 +02:00
int totalVerts;
TMESH * tmesh;
PRIM * index;
TIM_IMAGE * tim;
unsigned long * tim_data;
MATRIX mat;
VECTOR pos;
SVECTOR rot;
short isProp;
short isRigidBody;
short isStaticBody;
short isRound;
short isPrism;
short isAnim;
short isActor;
short isLevel;
short isWall;
short isBG;
short isSprite;
long p;
long OTz;
BODY * body;
2021-09-25 19:39:49 +02:00
MESH_ANIMS_TRACKS * anim_tracks;
VANIM * currentAnim;
2021-08-26 19:55:00 +02:00
struct NODE * node;
VECTOR pos2D;
} MESH;
2021-04-10 18:33:20 +02:00
typedef struct QUAD {
2021-08-26 19:55:00 +02:00
VECTOR v0, v1;
VECTOR v2, v3;
} QUAD;
2021-04-10 18:33:20 +02:00
typedef struct CAMPOS {
2021-08-26 19:55:00 +02:00
SVECTOR pos;
SVECTOR rot;
} CAMPOS;
2021-06-23 19:38:16 +02:00
2021-04-10 18:33:20 +02:00
// Blender cam ~= PSX cam with these settings :
// NTSC - 320x240, PAL 320x256, pixel ratio 1:1,
// cam focal length : perspective 90° ( 16 mm ))
// With a FOV of 1/2, camera focal length is ~= 16 mm / 90°
// Lower values mean wider angle
typedef struct CAMANGLE {
2021-08-26 19:55:00 +02:00
CAMPOS * campos;
TIM_IMAGE * BGtim;
unsigned long * tim_data;
QUAD bw, fw;
int index;
MESH * objects[];
} CAMANGLE;
2021-04-10 18:33:20 +02:00
typedef struct CAMPATH {
2021-08-26 19:55:00 +02:00
short len, cursor, pos;
VECTOR points[];
} CAMPATH;
2021-04-10 18:33:20 +02:00
typedef struct SIBLINGS {
2021-08-26 19:55:00 +02:00
int index;
struct NODE * list[];
} SIBLINGS ;
2021-04-10 18:33:20 +02:00
typedef struct CHILDREN {
2021-08-26 19:55:00 +02:00
int index;
MESH * list[];
} CHILDREN ;
2021-04-10 18:33:20 +02:00
typedef struct NODE {
2021-08-26 19:55:00 +02:00
MESH * plane;
SIBLINGS * siblings;
CHILDREN * objects;
CHILDREN * rigidbodies;
} NODE;
2021-08-16 14:42:07 +02:00
2021-08-26 19:55:00 +02:00
//VAG
2021-08-16 14:42:07 +02:00
typedef struct VAGsound {
2021-08-26 19:55:00 +02:00
u_char * VAGfile; // Pointer to VAG data address
u_long spu_channel; // SPU voice to playback to
u_long spu_address; // SPU address for memory freeing spu mem
} VAGsound;
2021-08-16 14:42:07 +02:00
typedef struct VAGbank {
2021-08-26 19:55:00 +02:00
u_int index;
VAGsound samples[];
} VAGbank;
2021-08-16 14:42:07 +02:00
// XA
typedef struct XAsound {
2021-08-26 19:55:00 +02:00
u_int id;
u_int size;
u_char file, channel;
u_int start, end;
int cursor;
} XAsound;
2021-08-16 14:42:07 +02:00
typedef struct XAbank {
2021-08-26 19:55:00 +02:00
char name[16];
u_int index;
int offset;
XAsound samples[];
} XAbank;
typedef struct XAfiles {
u_int index;
XAbank * banks[];
} XAfiles;
typedef struct SOUND_OBJECT {
VECTOR location;
2021-09-01 18:37:00 +02:00
int volumeL, volumeR, volume_min, volume_max;
2021-08-26 19:55:00 +02:00
VAGsound * VAGsample;
XAsound * XAsample;
MESH * parent;
} SOUND_OBJECT;
typedef struct LEVEL_SOUNDS {
int index;
SOUND_OBJECT * sounds[];
} LEVEL_SOUNDS;
2021-04-10 18:33:20 +02:00
2021-04-15 18:18:39 +02:00
typedef struct LEVEL {
2021-08-26 19:55:00 +02:00
CVECTOR * BGc;
VECTOR * BKc;
MATRIX * cmat;
MATRIX * lgtmat;
MESH ** meshes;
int * meshes_length;
MESH * actorPtr;
MESH * levelPtr;
MESH * propPtr;
CAMANGLE * camPtr;
CAMPATH * camPath;
CAMANGLE ** camAngles;
NODE * curNode;
LEVEL_SOUNDS * levelSounds;
VAGbank * VAG;
XAfiles * XA;
} LEVEL;