Add isRound flag
This commit is contained in:
parent
2ac1d3d912
commit
298d59626d
167
custom_types.h
167
custom_types.h
@ -16,65 +16,66 @@ struct NODE;
|
||||
struct QUAD;
|
||||
|
||||
typedef struct BODY {
|
||||
VECTOR gForce;
|
||||
VECTOR position;
|
||||
SVECTOR velocity;
|
||||
int mass;
|
||||
int invMass;
|
||||
VECTOR min;
|
||||
VECTOR max;
|
||||
int restitution;
|
||||
} BODY;
|
||||
VECTOR gForce;
|
||||
VECTOR position;
|
||||
SVECTOR velocity;
|
||||
int mass;
|
||||
int invMass;
|
||||
VECTOR min;
|
||||
VECTOR max;
|
||||
int restitution;
|
||||
} BODY;
|
||||
|
||||
typedef struct VANIM {
|
||||
int nframes; // number of frames e.g 20
|
||||
int nvert; // number of vertices e.g 21
|
||||
int cursor; // anim cursor
|
||||
int lerpCursor; // anim cursor
|
||||
int dir; // playback direction (1 or -1)
|
||||
int interpolate; // use lerp to interpolate keyframes
|
||||
SVECTOR data[]; // vertex pos as SVECTORs e.g 20 * 21 SVECTORS
|
||||
} VANIM;
|
||||
int nframes; // number of frames e.g 20
|
||||
int nvert; // number of vertices e.g 21
|
||||
int cursor; // anim cursor
|
||||
int lerpCursor; // anim cursor
|
||||
int dir; // playback direction (1 or -1)
|
||||
int interpolate; // use lerp to interpolate keyframes
|
||||
SVECTOR data[]; // vertex pos as SVECTORs e.g 20 * 21 SVECTORS
|
||||
} VANIM;
|
||||
|
||||
typedef struct PRIM {
|
||||
VECTOR order;
|
||||
int code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3,
|
||||
VECTOR order;
|
||||
int code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3,
|
||||
// GT3 = 4) Code (F4 = 5, FT4 = 6, G4 = 7, GT4 = 8)
|
||||
} PRIM;
|
||||
} PRIM;
|
||||
|
||||
typedef struct MESH {
|
||||
TMESH * tmesh;
|
||||
PRIM * index;
|
||||
TIM_IMAGE * tim;
|
||||
unsigned long * tim_data;
|
||||
MATRIX mat;
|
||||
VECTOR pos;
|
||||
SVECTOR rot;
|
||||
short isRigidBody;
|
||||
short isStaticBody;
|
||||
short isPrism;
|
||||
short isAnim;
|
||||
short isActor;
|
||||
short isLevel;
|
||||
short isBG;
|
||||
short isSprite;
|
||||
long p;
|
||||
long OTz;
|
||||
BODY * body;
|
||||
VANIM * anim;
|
||||
struct NODE * node;
|
||||
VECTOR pos2D;
|
||||
} MESH;
|
||||
TMESH * tmesh;
|
||||
PRIM * index;
|
||||
TIM_IMAGE * tim;
|
||||
unsigned long * tim_data;
|
||||
MATRIX mat;
|
||||
VECTOR pos;
|
||||
SVECTOR rot;
|
||||
short isRigidBody;
|
||||
short isStaticBody;
|
||||
short isRound;
|
||||
short isPrism;
|
||||
short isAnim;
|
||||
short isActor;
|
||||
short isLevel;
|
||||
short isBG;
|
||||
short isSprite;
|
||||
long p;
|
||||
long OTz;
|
||||
BODY * body;
|
||||
VANIM * anim;
|
||||
struct NODE * node;
|
||||
VECTOR pos2D;
|
||||
} MESH;
|
||||
|
||||
typedef struct QUAD {
|
||||
VECTOR v0, v1;
|
||||
VECTOR v2, v3;
|
||||
} QUAD;
|
||||
VECTOR v0, v1;
|
||||
VECTOR v2, v3;
|
||||
} QUAD;
|
||||
|
||||
typedef struct CAMPOS {
|
||||
VECTOR pos;
|
||||
SVECTOR rot;
|
||||
} CAMPOS;
|
||||
VECTOR pos;
|
||||
SVECTOR rot;
|
||||
} CAMPOS;
|
||||
|
||||
|
||||
// Blender cam ~= PSX cam with these settings :
|
||||
@ -84,48 +85,48 @@ typedef struct CAMPOS {
|
||||
// Lower values mean wider angle
|
||||
|
||||
typedef struct CAMANGLE {
|
||||
CAMPOS * campos;
|
||||
TIM_IMAGE * BGtim;
|
||||
unsigned long * tim_data;
|
||||
QUAD bw, fw;
|
||||
int index;
|
||||
MESH * objects[];
|
||||
} CAMANGLE;
|
||||
CAMPOS * campos;
|
||||
TIM_IMAGE * BGtim;
|
||||
unsigned long * tim_data;
|
||||
QUAD bw, fw;
|
||||
int index;
|
||||
MESH * objects[];
|
||||
} CAMANGLE;
|
||||
|
||||
typedef struct CAMPATH {
|
||||
short len, cursor, pos;
|
||||
VECTOR points[];
|
||||
} CAMPATH;
|
||||
short len, cursor, pos;
|
||||
VECTOR points[];
|
||||
} CAMPATH;
|
||||
|
||||
typedef struct SIBLINGS {
|
||||
int index;
|
||||
struct NODE * list[];
|
||||
} SIBLINGS ;
|
||||
int index;
|
||||
struct NODE * list[];
|
||||
} SIBLINGS ;
|
||||
|
||||
typedef struct CHILDREN {
|
||||
int index;
|
||||
MESH * list[];
|
||||
} CHILDREN ;
|
||||
int index;
|
||||
MESH * list[];
|
||||
} CHILDREN ;
|
||||
|
||||
typedef struct NODE {
|
||||
MESH * plane;
|
||||
SIBLINGS * siblings;
|
||||
CHILDREN * objects;
|
||||
CHILDREN * rigidbodies;
|
||||
} NODE;
|
||||
MESH * plane;
|
||||
SIBLINGS * siblings;
|
||||
CHILDREN * objects;
|
||||
CHILDREN * rigidbodies;
|
||||
} NODE;
|
||||
|
||||
typedef struct LEVEL {
|
||||
CVECTOR * BGc;
|
||||
MATRIX * cmat;
|
||||
MATRIX * lgtmat;
|
||||
MESH ** meshes;
|
||||
int * meshes_length;
|
||||
MESH * actorPtr;
|
||||
MESH * levelPtr;
|
||||
MESH * propPtr;
|
||||
CAMANGLE * camPtr;
|
||||
CAMPATH * camPath;
|
||||
CAMANGLE ** camAngles;
|
||||
NODE * curNode;
|
||||
MESH * meshPlan; // This one is temporary
|
||||
} LEVEL;
|
||||
CVECTOR * BGc;
|
||||
MATRIX * cmat;
|
||||
MATRIX * lgtmat;
|
||||
MESH ** meshes;
|
||||
int * meshes_length;
|
||||
MESH * actorPtr;
|
||||
MESH * levelPtr;
|
||||
MESH * propPtr;
|
||||
CAMANGLE * camPtr;
|
||||
CAMPATH * camPath;
|
||||
CAMANGLE ** camAngles;
|
||||
NODE * curNode;
|
||||
MESH * meshPlan; // This one is temporary
|
||||
} LEVEL;
|
||||
|
@ -25,8 +25,8 @@
|
||||
#define PRIMBUFFLEN 4096 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives
|
||||
|
||||
// Fog
|
||||
#define FOG_NEAR 1300
|
||||
#define FOG_FAR 1600
|
||||
#define FOG_NEAR 2300
|
||||
#define FOG_FAR 2600
|
||||
|
||||
// Physics
|
||||
#define GRAVITY 10
|
||||
|
@ -10005,6 +10005,7 @@ MESH level1_meshSphere_001 = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&level1_modelSphere_001_body,
|
||||
0,
|
||||
&level1_nodegnd,
|
||||
|
@ -492,11 +492,11 @@ int main() {
|
||||
if (col_sphere_act.vx && col_sphere_act.vz ) {
|
||||
curLvl.propPtr->body->velocity.vx += curLvl.actorPtr->body->velocity.vx;
|
||||
curLvl.propPtr->body->velocity.vz += curLvl.actorPtr->body->velocity.vz;
|
||||
if ( curLvl.propPtr->body->velocity.vx ) {
|
||||
if ( curLvl.propPtr->isRound && curLvl.propPtr->body->velocity.vx ) {
|
||||
VECTOR L = angularMom( *curLvl.propPtr->body );
|
||||
curLvl.propPtr->rot.vz -= L.vx;
|
||||
}
|
||||
if ( curLvl.propPtr->body->velocity.vz ) {
|
||||
if ( curLvl.propPtr->isRound && curLvl.propPtr->body->velocity.vz ) {
|
||||
VECTOR L = angularMom( *curLvl.propPtr->body );
|
||||
curLvl.propPtr->rot.vx -= L.vz;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user