Add LEVEL struc

This commit is contained in:
ABelliqueux 2021-04-15 18:18:39 +02:00
parent d722a7ebdb
commit 563ee40f28
12 changed files with 7542 additions and 2895 deletions

View File

@ -8,7 +8,7 @@ physics.c \
graphics.c \
psx.c \
space.c \
levels/level.c \
levels/level0.c \
levels/level1.c \
../common/crt0/crt0.s \
TIM/home.tim \
@ -22,7 +22,7 @@ TIM/bg_camPath_004.tim \
TIM/bg_camPath_005.tim \
OVERLAYSCRIPT ?= overlay.ld
OVERLAYSECTION ?= .ovly0 .ovly1
OVERLAYSECTION ?= .lvl0 .lvl1
# img2tim -t -bpp 8 -org 320 0 -plt 0 481 -o bg.tim bg.png

View File

@ -47,19 +47,19 @@ typedef struct MESH {
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;
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;
@ -114,3 +114,17 @@ typedef struct NODE {
CHILDREN * rigidbodies;
} NODE;
typedef struct LEVEL {
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;

View File

@ -7,11 +7,11 @@ void transformMesh(CAMERA * camera, MESH * mesh){
// Apply rotation matrix
RotMatrix_gte(mesh->rot, &mat);
RotMatrix_gte(&mesh->rot, &mat);
// Apply translation matrix
TransMatrix(&mat, mesh->pos);
TransMatrix(&mat, &mesh->pos);
// Compose matrix with cam
@ -44,13 +44,13 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
// If mesh is not part of precalculated background, draw them, else, discard
if ( !( *mesh->isBG ) || *camMode != 2) {
if ( !( mesh->isBG ) || *camMode != 2) {
poly = (POLY_GT3 *)*nextpri;
// If Vertex Anim flag is set, use it
if (*mesh->isAnim){
if (mesh->isAnim){
// If interpolation flag is set, use it
@ -137,9 +137,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
mesh->p,
&mesh->p,
mesh->OTz,
&mesh->OTz,
Flag
);
@ -160,9 +160,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
mesh->p,
&mesh->p,
mesh->OTz,
&mesh->OTz,
Flag
);
@ -184,9 +184,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
( long * ) &poly->x0, ( long * ) &poly->x1, ( long * ) &poly->x2,
mesh->p,
&mesh->p,
mesh->OTz,
&mesh->OTz,
Flag
);
@ -195,7 +195,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
// Do not draw invisible meshes
if ( nclip > 0 && *mesh->OTz > 0 && (*mesh->p < 4096) ) {
if ( nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096) ) {
SetPolyGT3( poly );
@ -204,7 +204,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
// FIXME : Doesn't work with pre-rendered BGs
if ( *mesh->isPrism ) {
if ( mesh->isPrism ) {
// Transparency effect :
@ -266,7 +266,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
mesh->tim->crect->y);
}
if (*mesh->isSprite){
if ( mesh->isSprite ) {
SetShadeTex( poly, 1 );
@ -279,15 +279,15 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
CVECTOR outCol2 = { 128,128,128,0 };
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ mesh->index[t].order.vx ], *mesh->p, &outCol);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ mesh->index[t].order.vx ], mesh->p, &outCol);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ mesh->index[t].order.vz ], *mesh->p, &outCol1);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ mesh->index[t].order.vz ], mesh->p, &outCol1);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ mesh->index[t].order.vy ], *mesh->p, &outCol2);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ mesh->index[t].order.vy ], mesh->p, &outCol2);
// If transparent effect is in use, inhibate shadows
if (*mesh->isPrism){
if (mesh->isPrism){
// Use un-interpolated (i.e: no light, no fog) colors
@ -306,9 +306,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
setRGB2(poly, outCol2.r, outCol2.g, outCol2.b);
}
if ( (*mesh->OTz > 0) /*&& (*mesh->OTz < OTLEN)*/ && (*mesh->p < 4096) ) {
if ( (mesh->OTz > 0) /*&& (*mesh->OTz < OTLEN)*/ && (mesh->p < 4096) ) {
AddPrim(&ot[ *mesh->OTz-2 ], poly);
AddPrim(&ot[ mesh->OTz-2 ], poly);
}
//~ mesh->pos2D.vx = *(&poly->x0);
@ -336,13 +336,13 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
// if mesh is not part of BG, draw them, else, discard
if ( !(*mesh->isBG) || *camMode != 2 ) {
if ( !(mesh->isBG) || *camMode != 2 ) {
poly4 = (POLY_GT4 *)*nextpri;
// Vertex Anim
if (*mesh->isAnim){
if (mesh->isAnim){
// with interpolation
@ -420,9 +420,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
mesh->p,
&mesh->p,
mesh->OTz,
&mesh->OTz,
Flag
@ -444,9 +444,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
mesh->p,
&mesh->p,
mesh->OTz,
&mesh->OTz,
Flag
);
@ -469,15 +469,15 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
mesh->p,
&mesh->p,
mesh->OTz,
&mesh->OTz,
Flag
);
}
if (nclip > 0 && *mesh->OTz > 0 && (*mesh->p < 4096)) {
if (nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096)) {
SetPolyGT4(poly4);
@ -521,7 +521,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
// Transparency effect
if (*mesh->isPrism){
if (mesh->isPrism){
// Use current DRAWENV clip as TPAGE
@ -580,7 +580,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
}
if (*mesh->isSprite){
if (mesh->isSprite){
SetShadeTex( poly4, 1 );
@ -606,15 +606,15 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
CVECTOR outCol3 = {128,128,128,0};
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.pad ] , &mesh->tmesh->c[ mesh->index[t].order.pad ], *mesh->p, &outCol);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.pad ] , &mesh->tmesh->c[ mesh->index[t].order.pad ], mesh->p, &outCol);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ mesh->index[t].order.vz ], *mesh->p, &outCol1);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ mesh->index[t].order.vz ], mesh->p, &outCol1);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ mesh->index[t].order.vx ], *mesh->p, &outCol2);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ mesh->index[t].order.vx ], mesh->p, &outCol2);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ mesh->index[t].order.vy ], *mesh->p, &outCol3);
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ mesh->index[t].order.vy ], mesh->p, &outCol3);
if (*mesh->isPrism){
if (mesh->isPrism){
setRGB0(poly4, mesh->tmesh->c[i].r, mesh->tmesh->c[i].g, mesh->tmesh->c[i].b);
@ -635,9 +635,9 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
setRGB3(poly4, outCol3.r, outCol3.g, outCol3.b);
}
if ( (*mesh->OTz > 0) /*&& (*mesh->OTz < OTLEN)*/ && (*mesh->p < 4096) ) {
if ( (mesh->OTz > 0) /*&& (*mesh->OTz < OTLEN)*/ && (mesh->p < 4096) ) {
AddPrim( &ot[ *mesh->OTz-3 ], poly4 );
AddPrim( &ot[ mesh->OTz-3 ], poly4 );
}
*nextpri += sizeof( POLY_GT4 );

View File

@ -1,686 +0,0 @@
#pragma once
#include "../custom_types.h"
extern CAMPOS level_camPos_camPath;
extern CAMPOS level_camPos_camPath_001;
extern CAMPOS level_camPos_camPath_002;
extern CAMPOS level_camPos_camPath_003;
extern CAMPOS level_camPos_camPath_004;
extern CAMPOS level_camPos_camPath_005;
extern CAMPATH level_camPath;
extern MATRIX level_lgtmat;
extern MATRIX level_cmat;
extern SVECTOR modelCube_mesh[];
extern SVECTOR level_modelCube_normal[];
extern SVECTOR level_modelCube_uv[];
extern CVECTOR level_modelCube_color[];
extern PRIM level_modelCube_index[];
extern MATRIX level_modelCube_matrix;
extern VECTOR level_modelCube_pos;
extern SVECTOR level_modelCube_rot;
extern short level_modelCube_isRigidBody;
extern short level_modelCube_isStaticBody;
extern short level_modelCube_isPrism;
extern short level_modelCube_isAnim;
extern short level_modelCube_isActor;
extern short level_modelCube_isLevel;
extern short level_modelCube_isBG;
extern short level_modelCube_isSprite;
extern long level_modelCube_p;
extern long level_modelCube_OTz;
extern BODY level_modelCube_body;
extern TMESH level_modelCube;
extern unsigned long _binary_TIM_cat_tim_start[];
extern unsigned long _binary_TIM_cat_tim_end[];
extern unsigned long _binary_TIM_cat_tim_length;
extern TIM_IMAGE tim_cat;
extern MESH level_meshCube;
extern SVECTOR modelCylindre_mesh[];
extern SVECTOR level_modelCylindre_normal[];
extern SVECTOR level_modelCylindre_uv[];
extern CVECTOR level_modelCylindre_color[];
extern PRIM level_modelCylindre_index[];
extern VANIM level_modelCylindre_anim;
extern MATRIX level_modelCylindre_matrix;
extern VECTOR level_modelCylindre_pos;
extern SVECTOR level_modelCylindre_rot;
extern short level_modelCylindre_isRigidBody;
extern short level_modelCylindre_isStaticBody;
extern short level_modelCylindre_isPrism;
extern short level_modelCylindre_isAnim;
extern short level_modelCylindre_isActor;
extern short level_modelCylindre_isLevel;
extern short level_modelCylindre_isBG;
extern short level_modelCylindre_isSprite;
extern long level_modelCylindre_p;
extern long level_modelCylindre_OTz;
extern BODY level_modelCylindre_body;
extern TMESH level_modelCylindre;
extern unsigned long _binary_TIM_home_tim_start[];
extern unsigned long _binary_TIM_home_tim_end[];
extern unsigned long _binary_TIM_home_tim_length;
extern TIM_IMAGE tim_home;
extern MESH level_meshCylindre;
extern SVECTOR modelgnd_mesh[];
extern SVECTOR level_modelgnd_normal[];
extern SVECTOR level_modelgnd_uv[];
extern CVECTOR level_modelgnd_color[];
extern PRIM level_modelgnd_index[];
extern MATRIX level_modelgnd_matrix;
extern VECTOR level_modelgnd_pos;
extern SVECTOR level_modelgnd_rot;
extern short level_modelgnd_isRigidBody;
extern short level_modelgnd_isStaticBody;
extern short level_modelgnd_isPrism;
extern short level_modelgnd_isAnim;
extern short level_modelgnd_isActor;
extern short level_modelgnd_isLevel;
extern short level_modelgnd_isBG;
extern short level_modelgnd_isSprite;
extern long level_modelgnd_p;
extern long level_modelgnd_OTz;
extern BODY level_modelgnd_body;
extern TMESH level_modelgnd;
extern MESH level_meshgnd;
extern SVECTOR modelgnd_001_mesh[];
extern SVECTOR level_modelgnd_001_normal[];
extern SVECTOR level_modelgnd_001_uv[];
extern CVECTOR level_modelgnd_001_color[];
extern PRIM level_modelgnd_001_index[];
extern MATRIX level_modelgnd_001_matrix;
extern VECTOR level_modelgnd_001_pos;
extern SVECTOR level_modelgnd_001_rot;
extern short level_modelgnd_001_isRigidBody;
extern short level_modelgnd_001_isStaticBody;
extern short level_modelgnd_001_isPrism;
extern short level_modelgnd_001_isAnim;
extern short level_modelgnd_001_isActor;
extern short level_modelgnd_001_isLevel;
extern short level_modelgnd_001_isBG;
extern short level_modelgnd_001_isSprite;
extern long level_modelgnd_001_p;
extern long level_modelgnd_001_OTz;
extern BODY level_modelgnd_001_body;
extern TMESH level_modelgnd_001;
extern MESH level_meshgnd_001;
extern SVECTOR modelgnd_003_mesh[];
extern SVECTOR level_modelgnd_003_normal[];
extern SVECTOR level_modelgnd_003_uv[];
extern CVECTOR level_modelgnd_003_color[];
extern PRIM level_modelgnd_003_index[];
extern MATRIX level_modelgnd_003_matrix;
extern VECTOR level_modelgnd_003_pos;
extern SVECTOR level_modelgnd_003_rot;
extern short level_modelgnd_003_isRigidBody;
extern short level_modelgnd_003_isStaticBody;
extern short level_modelgnd_003_isPrism;
extern short level_modelgnd_003_isAnim;
extern short level_modelgnd_003_isActor;
extern short level_modelgnd_003_isLevel;
extern short level_modelgnd_003_isBG;
extern short level_modelgnd_003_isSprite;
extern long level_modelgnd_003_p;
extern long level_modelgnd_003_OTz;
extern BODY level_modelgnd_003_body;
extern TMESH level_modelgnd_003;
extern MESH level_meshgnd_003;
extern SVECTOR modelgnd_002_mesh[];
extern SVECTOR level_modelgnd_002_normal[];
extern SVECTOR level_modelgnd_002_uv[];
extern CVECTOR level_modelgnd_002_color[];
extern PRIM level_modelgnd_002_index[];
extern MATRIX level_modelgnd_002_matrix;
extern VECTOR level_modelgnd_002_pos;
extern SVECTOR level_modelgnd_002_rot;
extern short level_modelgnd_002_isRigidBody;
extern short level_modelgnd_002_isStaticBody;
extern short level_modelgnd_002_isPrism;
extern short level_modelgnd_002_isAnim;
extern short level_modelgnd_002_isActor;
extern short level_modelgnd_002_isLevel;
extern short level_modelgnd_002_isBG;
extern short level_modelgnd_002_isSprite;
extern long level_modelgnd_002_p;
extern long level_modelgnd_002_OTz;
extern BODY level_modelgnd_002_body;
extern TMESH level_modelgnd_002;
extern MESH level_meshgnd_002;
extern SVECTOR modelobject_mesh[];
extern SVECTOR level_modelobject_normal[];
extern SVECTOR level_modelobject_uv[];
extern CVECTOR level_modelobject_color[];
extern PRIM level_modelobject_index[];
extern MATRIX level_modelobject_matrix;
extern VECTOR level_modelobject_pos;
extern SVECTOR level_modelobject_rot;
extern short level_modelobject_isRigidBody;
extern short level_modelobject_isStaticBody;
extern short level_modelobject_isPrism;
extern short level_modelobject_isAnim;
extern short level_modelobject_isActor;
extern short level_modelobject_isLevel;
extern short level_modelobject_isBG;
extern short level_modelobject_isSprite;
extern long level_modelobject_p;
extern long level_modelobject_OTz;
extern BODY level_modelobject_body;
extern TMESH level_modelobject;
extern MESH level_meshobject;
extern SVECTOR modelPlan_mesh[];
extern SVECTOR level_modelPlan_normal[];
extern SVECTOR level_modelPlan_uv[];
extern CVECTOR level_modelPlan_color[];
extern PRIM level_modelPlan_index[];
extern MATRIX level_modelPlan_matrix;
extern VECTOR level_modelPlan_pos;
extern SVECTOR level_modelPlan_rot;
extern short level_modelPlan_isRigidBody;
extern short level_modelPlan_isStaticBody;
extern short level_modelPlan_isPrism;
extern short level_modelPlan_isAnim;
extern short level_modelPlan_isActor;
extern short level_modelPlan_isLevel;
extern short level_modelPlan_isBG;
extern short level_modelPlan_isSprite;
extern long level_modelPlan_p;
extern long level_modelPlan_OTz;
extern BODY level_modelPlan_body;
extern TMESH level_modelPlan;
extern MESH level_meshPlan;
extern SVECTOR modelSphere_mesh[];
extern SVECTOR level_modelSphere_normal[];
extern SVECTOR level_modelSphere_uv[];
extern CVECTOR level_modelSphere_color[];
extern PRIM level_modelSphere_index[];
extern MATRIX level_modelSphere_matrix;
extern VECTOR level_modelSphere_pos;
extern SVECTOR level_modelSphere_rot;
extern short level_modelSphere_isRigidBody;
extern short level_modelSphere_isStaticBody;
extern short level_modelSphere_isPrism;
extern short level_modelSphere_isAnim;
extern short level_modelSphere_isActor;
extern short level_modelSphere_isLevel;
extern short level_modelSphere_isBG;
extern short level_modelSphere_isSprite;
extern long level_modelSphere_p;
extern long level_modelSphere_OTz;
extern BODY level_modelSphere_body;
extern TMESH level_modelSphere;
extern MESH level_meshSphere;
extern SVECTOR modelSphere_001_mesh[];
extern SVECTOR level_modelSphere_001_normal[];
extern SVECTOR level_modelSphere_001_uv[];
extern CVECTOR level_modelSphere_001_color[];
extern PRIM level_modelSphere_001_index[];
extern MATRIX level_modelSphere_001_matrix;
extern VECTOR level_modelSphere_001_pos;
extern SVECTOR level_modelSphere_001_rot;
extern short level_modelSphere_001_isRigidBody;
extern short level_modelSphere_001_isStaticBody;
extern short level_modelSphere_001_isPrism;
extern short level_modelSphere_001_isAnim;
extern short level_modelSphere_001_isActor;
extern short level_modelSphere_001_isLevel;
extern short level_modelSphere_001_isBG;
extern short level_modelSphere_001_isSprite;
extern long level_modelSphere_001_p;
extern long level_modelSphere_001_OTz;
extern BODY level_modelSphere_001_body;
extern TMESH level_modelSphere_001;
extern MESH level_meshSphere_001;
extern SVECTOR modelwall_mesh[];
extern SVECTOR level_modelwall_normal[];
extern SVECTOR level_modelwall_uv[];
extern CVECTOR level_modelwall_color[];
extern PRIM level_modelwall_index[];
extern MATRIX level_modelwall_matrix;
extern VECTOR level_modelwall_pos;
extern SVECTOR level_modelwall_rot;
extern short level_modelwall_isRigidBody;
extern short level_modelwall_isStaticBody;
extern short level_modelwall_isPrism;
extern short level_modelwall_isAnim;
extern short level_modelwall_isActor;
extern short level_modelwall_isLevel;
extern short level_modelwall_isBG;
extern short level_modelwall_isSprite;
extern long level_modelwall_p;
extern long level_modelwall_OTz;
extern BODY level_modelwall_body;
extern TMESH level_modelwall;
extern MESH level_meshwall;
extern SVECTOR modelwall_001_mesh[];
extern SVECTOR level_modelwall_001_normal[];
extern SVECTOR level_modelwall_001_uv[];
extern CVECTOR level_modelwall_001_color[];
extern PRIM level_modelwall_001_index[];
extern MATRIX level_modelwall_001_matrix;
extern VECTOR level_modelwall_001_pos;
extern SVECTOR level_modelwall_001_rot;
extern short level_modelwall_001_isRigidBody;
extern short level_modelwall_001_isStaticBody;
extern short level_modelwall_001_isPrism;
extern short level_modelwall_001_isAnim;
extern short level_modelwall_001_isActor;
extern short level_modelwall_001_isLevel;
extern short level_modelwall_001_isBG;
extern short level_modelwall_001_isSprite;
extern long level_modelwall_001_p;
extern long level_modelwall_001_OTz;
extern BODY level_modelwall_001_body;
extern TMESH level_modelwall_001;
extern MESH level_meshwall_001;
extern SVECTOR modelwall_002_mesh[];
extern SVECTOR level_modelwall_002_normal[];
extern SVECTOR level_modelwall_002_uv[];
extern CVECTOR level_modelwall_002_color[];
extern PRIM level_modelwall_002_index[];
extern MATRIX level_modelwall_002_matrix;
extern VECTOR level_modelwall_002_pos;
extern SVECTOR level_modelwall_002_rot;
extern short level_modelwall_002_isRigidBody;
extern short level_modelwall_002_isStaticBody;
extern short level_modelwall_002_isPrism;
extern short level_modelwall_002_isAnim;
extern short level_modelwall_002_isActor;
extern short level_modelwall_002_isLevel;
extern short level_modelwall_002_isBG;
extern short level_modelwall_002_isSprite;
extern long level_modelwall_002_p;
extern long level_modelwall_002_OTz;
extern BODY level_modelwall_002_body;
extern TMESH level_modelwall_002;
extern MESH level_meshwall_002;
extern SVECTOR modelwall_003_mesh[];
extern SVECTOR level_modelwall_003_normal[];
extern SVECTOR level_modelwall_003_uv[];
extern CVECTOR level_modelwall_003_color[];
extern PRIM level_modelwall_003_index[];
extern MATRIX level_modelwall_003_matrix;
extern VECTOR level_modelwall_003_pos;
extern SVECTOR level_modelwall_003_rot;
extern short level_modelwall_003_isRigidBody;
extern short level_modelwall_003_isStaticBody;
extern short level_modelwall_003_isPrism;
extern short level_modelwall_003_isAnim;
extern short level_modelwall_003_isActor;
extern short level_modelwall_003_isLevel;
extern short level_modelwall_003_isBG;
extern short level_modelwall_003_isSprite;
extern long level_modelwall_003_p;
extern long level_modelwall_003_OTz;
extern BODY level_modelwall_003_body;
extern TMESH level_modelwall_003;
extern MESH level_meshwall_003;
extern MESH * level_meshes[14];
extern int level_meshes_length;
extern CAMANGLE level_camAngle_camPath_001;
extern CAMANGLE * level_camAngles[0];
extern SIBLINGS level_nodegnd_003_siblings;
extern CHILDREN level_nodegnd_003_objects;
extern CHILDREN level_nodegnd_003_rigidbodies;
extern NODE level_nodegnd_003;
extern SIBLINGS level_nodegnd_001_siblings;
extern CHILDREN level_nodegnd_001_objects;
extern CHILDREN level_nodegnd_001_rigidbodies;
extern NODE level_nodegnd_001;
extern SIBLINGS level_nodegnd_002_siblings;
extern CHILDREN level_nodegnd_002_objects;
extern CHILDREN level_nodegnd_002_rigidbodies;
extern NODE level_nodegnd_002;
extern SIBLINGS level_nodegnd_siblings;
extern CHILDREN level_nodegnd_objects;
extern CHILDREN level_nodegnd_rigidbodies;
extern NODE level_nodegnd;
extern MESH * level_actorPtr;
extern MESH * level_levelPtr;
extern MESH * level_propPtr;
extern CAMANGLE * level_camPtr;
extern NODE * level_curNode;
extern NODE level_nodegnd_003;
extern NODE level_nodegnd_001;
extern NODE level_nodegnd_002;
extern NODE level_nodegnd;

File diff suppressed because it is too large Load Diff

324
levels/level0.h Normal file
View File

@ -0,0 +1,324 @@
#pragma once
#include "../custom_types.h"
extern LEVEL level0;
extern CAMPOS level0_camPos_camPath;
extern CAMPOS level0_camPos_camPath_001;
extern CAMPOS level0_camPos_camPath_002;
extern CAMPOS level0_camPos_camPath_003;
extern CAMPOS level0_camPos_camPath_004;
extern CAMPOS level0_camPos_camPath_005;
extern CAMPATH level0_camPath;
extern MATRIX level0_lgtmat;
extern MATRIX level0_cmat;
extern SVECTOR modelCube_mesh[];
extern SVECTOR level0_modelCube_normal[];
extern SVECTOR level0_modelCube_uv[];
extern CVECTOR level0_modelCube_color[];
extern PRIM level0_modelCube_index[];
extern BODY level0_modelCube_body;
extern TMESH level0_modelCube;
extern unsigned long _binary_TIM_cat_tim_start[];
extern unsigned long _binary_TIM_cat_tim_end[];
extern unsigned long _binary_TIM_cat_tim_length;
extern TIM_IMAGE level0_tim_cat;
extern MESH level0_meshCube;
extern SVECTOR modelCylindre_mesh[];
extern SVECTOR level0_modelCylindre_normal[];
extern SVECTOR level0_modelCylindre_uv[];
extern CVECTOR level0_modelCylindre_color[];
extern PRIM level0_modelCylindre_index[];
extern VANIM level0_modelCylindre_anim;
extern BODY level0_modelCylindre_body;
extern TMESH level0_modelCylindre;
extern unsigned long _binary_TIM_home_tim_start[];
extern unsigned long _binary_TIM_home_tim_end[];
extern unsigned long _binary_TIM_home_tim_length;
extern TIM_IMAGE level0_tim_home;
extern MESH level0_meshCylindre;
extern SVECTOR modelgnd_mesh[];
extern SVECTOR level0_modelgnd_normal[];
extern SVECTOR level0_modelgnd_uv[];
extern CVECTOR level0_modelgnd_color[];
extern PRIM level0_modelgnd_index[];
extern BODY level0_modelgnd_body;
extern TMESH level0_modelgnd;
extern MESH level0_meshgnd;
extern SVECTOR modelgnd_001_mesh[];
extern SVECTOR level0_modelgnd_001_normal[];
extern SVECTOR level0_modelgnd_001_uv[];
extern CVECTOR level0_modelgnd_001_color[];
extern PRIM level0_modelgnd_001_index[];
extern BODY level0_modelgnd_001_body;
extern TMESH level0_modelgnd_001;
extern MESH level0_meshgnd_001;
extern SVECTOR modelgnd_003_mesh[];
extern SVECTOR level0_modelgnd_003_normal[];
extern SVECTOR level0_modelgnd_003_uv[];
extern CVECTOR level0_modelgnd_003_color[];
extern PRIM level0_modelgnd_003_index[];
extern BODY level0_modelgnd_003_body;
extern TMESH level0_modelgnd_003;
extern MESH level0_meshgnd_003;
extern SVECTOR modelgnd_002_mesh[];
extern SVECTOR level0_modelgnd_002_normal[];
extern SVECTOR level0_modelgnd_002_uv[];
extern CVECTOR level0_modelgnd_002_color[];
extern PRIM level0_modelgnd_002_index[];
extern BODY level0_modelgnd_002_body;
extern TMESH level0_modelgnd_002;
extern MESH level0_meshgnd_002;
extern SVECTOR modelobject_mesh[];
extern SVECTOR level0_modelobject_normal[];
extern SVECTOR level0_modelobject_uv[];
extern CVECTOR level0_modelobject_color[];
extern PRIM level0_modelobject_index[];
extern BODY level0_modelobject_body;
extern TMESH level0_modelobject;
extern MESH level0_meshobject;
extern SVECTOR modelPlan_mesh[];
extern SVECTOR level0_modelPlan_normal[];
extern SVECTOR level0_modelPlan_uv[];
extern CVECTOR level0_modelPlan_color[];
extern PRIM level0_modelPlan_index[];
extern BODY level0_modelPlan_body;
extern TMESH level0_modelPlan;
extern MESH level0_meshPlan;
extern SVECTOR modelSphere_mesh[];
extern SVECTOR level0_modelSphere_normal[];
extern SVECTOR level0_modelSphere_uv[];
extern CVECTOR level0_modelSphere_color[];
extern PRIM level0_modelSphere_index[];
extern BODY level0_modelSphere_body;
extern TMESH level0_modelSphere;
extern MESH level0_meshSphere;
extern SVECTOR modelSphere_001_mesh[];
extern SVECTOR level0_modelSphere_001_normal[];
extern SVECTOR level0_modelSphere_001_uv[];
extern CVECTOR level0_modelSphere_001_color[];
extern PRIM level0_modelSphere_001_index[];
extern BODY level0_modelSphere_001_body;
extern TMESH level0_modelSphere_001;
extern MESH level0_meshSphere_001;
extern SVECTOR modelwall_mesh[];
extern SVECTOR level0_modelwall_normal[];
extern SVECTOR level0_modelwall_uv[];
extern CVECTOR level0_modelwall_color[];
extern PRIM level0_modelwall_index[];
extern BODY level0_modelwall_body;
extern TMESH level0_modelwall;
extern MESH level0_meshwall;
extern SVECTOR modelwall_001_mesh[];
extern SVECTOR level0_modelwall_001_normal[];
extern SVECTOR level0_modelwall_001_uv[];
extern CVECTOR level0_modelwall_001_color[];
extern PRIM level0_modelwall_001_index[];
extern BODY level0_modelwall_001_body;
extern TMESH level0_modelwall_001;
extern MESH level0_meshwall_001;
extern SVECTOR modelwall_002_mesh[];
extern SVECTOR level0_modelwall_002_normal[];
extern SVECTOR level0_modelwall_002_uv[];
extern CVECTOR level0_modelwall_002_color[];
extern PRIM level0_modelwall_002_index[];
extern BODY level0_modelwall_002_body;
extern TMESH level0_modelwall_002;
extern MESH level0_meshwall_002;
extern SVECTOR modelwall_003_mesh[];
extern SVECTOR level0_modelwall_003_normal[];
extern SVECTOR level0_modelwall_003_uv[];
extern CVECTOR level0_modelwall_003_color[];
extern PRIM level0_modelwall_003_index[];
extern BODY level0_modelwall_003_body;
extern TMESH level0_modelwall_003;
extern MESH level0_meshwall_003;
extern MESH * level0_meshes[14];
extern int level0_meshes_length;
extern CAMANGLE level0_camAngle_camPath_001;
extern CAMANGLE * level0_camAngles[0];
extern SIBLINGS level0_nodegnd_siblings;
extern CHILDREN level0_nodegnd_objects;
extern CHILDREN level0_nodegnd_rigidbodies;
extern NODE level0_nodegnd;
extern SIBLINGS level0_nodegnd_001_siblings;
extern CHILDREN level0_nodegnd_001_objects;
extern CHILDREN level0_nodegnd_001_rigidbodies;
extern NODE level0_nodegnd_001;
extern SIBLINGS level0_nodegnd_002_siblings;
extern CHILDREN level0_nodegnd_002_objects;
extern CHILDREN level0_nodegnd_002_rigidbodies;
extern NODE level0_nodegnd_002;
extern SIBLINGS level0_nodegnd_003_siblings;
extern CHILDREN level0_nodegnd_003_objects;
extern CHILDREN level0_nodegnd_003_rigidbodies;
extern NODE level0_nodegnd_003;
extern MESH * level0_actorPtr;
extern MESH * level0_levelPtr;
extern MESH * level0_propPtr;
extern CAMANGLE * level0_camPtr;
extern NODE * level0_curNode;
extern NODE level0_nodegnd;
extern NODE level0_nodegnd_001;
extern NODE level0_nodegnd_002;
extern NODE level0_nodegnd_003;

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
#include "../custom_types.h"
extern LEVEL level1;
extern CAMPOS level1_camPos_camPath;
extern CAMPOS level1_camPos_camPath_001;
@ -30,32 +32,6 @@ extern CVECTOR level1_modelCube_color[];
extern PRIM level1_modelCube_index[];
extern MATRIX level1_modelCube_matrix;
extern VECTOR level1_modelCube_pos;
extern SVECTOR level1_modelCube_rot;
extern short level1_modelCube_isRigidBody;
extern short level1_modelCube_isStaticBody;
extern short level1_modelCube_isPrism;
extern short level1_modelCube_isAnim;
extern short level1_modelCube_isActor;
extern short level1_modelCube_isLevel;
extern short level1_modelCube_isBG;
extern short level1_modelCube_isSprite;
extern long level1_modelCube_p;
extern long level1_modelCube_OTz;
extern BODY level1_modelCube_body;
extern TMESH level1_modelCube;
@ -82,32 +58,6 @@ extern PRIM level1_modelCylindre_index[];
extern VANIM level1_modelCylindre_anim;
extern MATRIX level1_modelCylindre_matrix;
extern VECTOR level1_modelCylindre_pos;
extern SVECTOR level1_modelCylindre_rot;
extern short level1_modelCylindre_isRigidBody;
extern short level1_modelCylindre_isStaticBody;
extern short level1_modelCylindre_isPrism;
extern short level1_modelCylindre_isAnim;
extern short level1_modelCylindre_isActor;
extern short level1_modelCylindre_isLevel;
extern short level1_modelCylindre_isBG;
extern short level1_modelCylindre_isSprite;
extern long level1_modelCylindre_p;
extern long level1_modelCylindre_OTz;
extern BODY level1_modelCylindre_body;
extern TMESH level1_modelCylindre;
@ -132,32 +82,6 @@ extern CVECTOR level1_modelgnd_color[];
extern PRIM level1_modelgnd_index[];
extern MATRIX level1_modelgnd_matrix;
extern VECTOR level1_modelgnd_pos;
extern SVECTOR level1_modelgnd_rot;
extern short level1_modelgnd_isRigidBody;
extern short level1_modelgnd_isStaticBody;
extern short level1_modelgnd_isPrism;
extern short level1_modelgnd_isAnim;
extern short level1_modelgnd_isActor;
extern short level1_modelgnd_isLevel;
extern short level1_modelgnd_isBG;
extern short level1_modelgnd_isSprite;
extern long level1_modelgnd_p;
extern long level1_modelgnd_OTz;
extern BODY level1_modelgnd_body;
extern TMESH level1_modelgnd;
@ -174,32 +98,6 @@ extern CVECTOR level1_modelgnd_001_color[];
extern PRIM level1_modelgnd_001_index[];
extern MATRIX level1_modelgnd_001_matrix;
extern VECTOR level1_modelgnd_001_pos;
extern SVECTOR level1_modelgnd_001_rot;
extern short level1_modelgnd_001_isRigidBody;
extern short level1_modelgnd_001_isStaticBody;
extern short level1_modelgnd_001_isPrism;
extern short level1_modelgnd_001_isAnim;
extern short level1_modelgnd_001_isActor;
extern short level1_modelgnd_001_isLevel;
extern short level1_modelgnd_001_isBG;
extern short level1_modelgnd_001_isSprite;
extern long level1_modelgnd_001_p;
extern long level1_modelgnd_001_OTz;
extern BODY level1_modelgnd_001_body;
extern TMESH level1_modelgnd_001;
@ -216,32 +114,6 @@ extern CVECTOR level1_modelgnd_003_color[];
extern PRIM level1_modelgnd_003_index[];
extern MATRIX level1_modelgnd_003_matrix;
extern VECTOR level1_modelgnd_003_pos;
extern SVECTOR level1_modelgnd_003_rot;
extern short level1_modelgnd_003_isRigidBody;
extern short level1_modelgnd_003_isStaticBody;
extern short level1_modelgnd_003_isPrism;
extern short level1_modelgnd_003_isAnim;
extern short level1_modelgnd_003_isActor;
extern short level1_modelgnd_003_isLevel;
extern short level1_modelgnd_003_isBG;
extern short level1_modelgnd_003_isSprite;
extern long level1_modelgnd_003_p;
extern long level1_modelgnd_003_OTz;
extern BODY level1_modelgnd_003_body;
extern TMESH level1_modelgnd_003;
@ -258,38 +130,36 @@ extern CVECTOR level1_modelgnd_002_color[];
extern PRIM level1_modelgnd_002_index[];
extern MATRIX level1_modelgnd_002_matrix;
extern VECTOR level1_modelgnd_002_pos;
extern SVECTOR level1_modelgnd_002_rot;
extern short level1_modelgnd_002_isRigidBody;
extern short level1_modelgnd_002_isStaticBody;
extern short level1_modelgnd_002_isPrism;
extern short level1_modelgnd_002_isAnim;
extern short level1_modelgnd_002_isActor;
extern short level1_modelgnd_002_isLevel;
extern short level1_modelgnd_002_isBG;
extern short level1_modelgnd_002_isSprite;
extern long level1_modelgnd_002_p;
extern long level1_modelgnd_002_OTz;
extern BODY level1_modelgnd_002_body;
extern TMESH level1_modelgnd_002;
extern MESH level1_meshgnd_002;
extern SVECTOR modelLara_mesh[];
extern SVECTOR level1_modelLara_normal[];
extern SVECTOR level1_modelLara_uv[];
extern CVECTOR level1_modelLara_color[];
extern PRIM level1_modelLara_index[];
extern BODY level1_modelLara_body;
extern TMESH level1_modelLara;
extern unsigned long _binary_TIM_lara_tim_start[];
extern unsigned long _binary_TIM_lara_tim_end[];
extern unsigned long _binary_TIM_lara_tim_length;
extern TIM_IMAGE level1_tim_lara;
extern MESH level1_meshLara;
extern SVECTOR modelobject_mesh[];
extern SVECTOR level1_modelobject_normal[];
@ -300,32 +170,6 @@ extern CVECTOR level1_modelobject_color[];
extern PRIM level1_modelobject_index[];
extern MATRIX level1_modelobject_matrix;
extern VECTOR level1_modelobject_pos;
extern SVECTOR level1_modelobject_rot;
extern short level1_modelobject_isRigidBody;
extern short level1_modelobject_isStaticBody;
extern short level1_modelobject_isPrism;
extern short level1_modelobject_isAnim;
extern short level1_modelobject_isActor;
extern short level1_modelobject_isLevel;
extern short level1_modelobject_isBG;
extern short level1_modelobject_isSprite;
extern long level1_modelobject_p;
extern long level1_modelobject_OTz;
extern BODY level1_modelobject_body;
extern TMESH level1_modelobject;
@ -342,32 +186,6 @@ extern CVECTOR level1_modelPlan_color[];
extern PRIM level1_modelPlan_index[];
extern MATRIX level1_modelPlan_matrix;
extern VECTOR level1_modelPlan_pos;
extern SVECTOR level1_modelPlan_rot;
extern short level1_modelPlan_isRigidBody;
extern short level1_modelPlan_isStaticBody;
extern short level1_modelPlan_isPrism;
extern short level1_modelPlan_isAnim;
extern short level1_modelPlan_isActor;
extern short level1_modelPlan_isLevel;
extern short level1_modelPlan_isBG;
extern short level1_modelPlan_isSprite;
extern long level1_modelPlan_p;
extern long level1_modelPlan_OTz;
extern BODY level1_modelPlan_body;
extern TMESH level1_modelPlan;
@ -384,32 +202,6 @@ extern CVECTOR level1_modelSphere_color[];
extern PRIM level1_modelSphere_index[];
extern MATRIX level1_modelSphere_matrix;
extern VECTOR level1_modelSphere_pos;
extern SVECTOR level1_modelSphere_rot;
extern short level1_modelSphere_isRigidBody;
extern short level1_modelSphere_isStaticBody;
extern short level1_modelSphere_isPrism;
extern short level1_modelSphere_isAnim;
extern short level1_modelSphere_isActor;
extern short level1_modelSphere_isLevel;
extern short level1_modelSphere_isBG;
extern short level1_modelSphere_isSprite;
extern long level1_modelSphere_p;
extern long level1_modelSphere_OTz;
extern BODY level1_modelSphere_body;
extern TMESH level1_modelSphere;
@ -426,32 +218,6 @@ extern CVECTOR level1_modelSphere_001_color[];
extern PRIM level1_modelSphere_001_index[];
extern MATRIX level1_modelSphere_001_matrix;
extern VECTOR level1_modelSphere_001_pos;
extern SVECTOR level1_modelSphere_001_rot;
extern short level1_modelSphere_001_isRigidBody;
extern short level1_modelSphere_001_isStaticBody;
extern short level1_modelSphere_001_isPrism;
extern short level1_modelSphere_001_isAnim;
extern short level1_modelSphere_001_isActor;
extern short level1_modelSphere_001_isLevel;
extern short level1_modelSphere_001_isBG;
extern short level1_modelSphere_001_isSprite;
extern long level1_modelSphere_001_p;
extern long level1_modelSphere_001_OTz;
extern BODY level1_modelSphere_001_body;
extern TMESH level1_modelSphere_001;
@ -468,32 +234,6 @@ extern CVECTOR level1_modelwall_color[];
extern PRIM level1_modelwall_index[];
extern MATRIX level1_modelwall_matrix;
extern VECTOR level1_modelwall_pos;
extern SVECTOR level1_modelwall_rot;
extern short level1_modelwall_isRigidBody;
extern short level1_modelwall_isStaticBody;
extern short level1_modelwall_isPrism;
extern short level1_modelwall_isAnim;
extern short level1_modelwall_isActor;
extern short level1_modelwall_isLevel;
extern short level1_modelwall_isBG;
extern short level1_modelwall_isSprite;
extern long level1_modelwall_p;
extern long level1_modelwall_OTz;
extern BODY level1_modelwall_body;
extern TMESH level1_modelwall;
@ -510,32 +250,6 @@ extern CVECTOR level1_modelwall_001_color[];
extern PRIM level1_modelwall_001_index[];
extern MATRIX level1_modelwall_001_matrix;
extern VECTOR level1_modelwall_001_pos;
extern SVECTOR level1_modelwall_001_rot;
extern short level1_modelwall_001_isRigidBody;
extern short level1_modelwall_001_isStaticBody;
extern short level1_modelwall_001_isPrism;
extern short level1_modelwall_001_isAnim;
extern short level1_modelwall_001_isActor;
extern short level1_modelwall_001_isLevel;
extern short level1_modelwall_001_isBG;
extern short level1_modelwall_001_isSprite;
extern long level1_modelwall_001_p;
extern long level1_modelwall_001_OTz;
extern BODY level1_modelwall_001_body;
extern TMESH level1_modelwall_001;
@ -552,32 +266,6 @@ extern CVECTOR level1_modelwall_002_color[];
extern PRIM level1_modelwall_002_index[];
extern MATRIX level1_modelwall_002_matrix;
extern VECTOR level1_modelwall_002_pos;
extern SVECTOR level1_modelwall_002_rot;
extern short level1_modelwall_002_isRigidBody;
extern short level1_modelwall_002_isStaticBody;
extern short level1_modelwall_002_isPrism;
extern short level1_modelwall_002_isAnim;
extern short level1_modelwall_002_isActor;
extern short level1_modelwall_002_isLevel;
extern short level1_modelwall_002_isBG;
extern short level1_modelwall_002_isSprite;
extern long level1_modelwall_002_p;
extern long level1_modelwall_002_OTz;
extern BODY level1_modelwall_002_body;
extern TMESH level1_modelwall_002;
@ -594,39 +282,13 @@ extern CVECTOR level1_modelwall_003_color[];
extern PRIM level1_modelwall_003_index[];
extern MATRIX level1_modelwall_003_matrix;
extern VECTOR level1_modelwall_003_pos;
extern SVECTOR level1_modelwall_003_rot;
extern short level1_modelwall_003_isRigidBody;
extern short level1_modelwall_003_isStaticBody;
extern short level1_modelwall_003_isPrism;
extern short level1_modelwall_003_isAnim;
extern short level1_modelwall_003_isActor;
extern short level1_modelwall_003_isLevel;
extern short level1_modelwall_003_isBG;
extern short level1_modelwall_003_isSprite;
extern long level1_modelwall_003_p;
extern long level1_modelwall_003_OTz;
extern BODY level1_modelwall_003_body;
extern TMESH level1_modelwall_003;
extern MESH level1_meshwall_003;
extern MESH * level1_meshes[14];
extern MESH * level1_meshes[15];
extern int level1_meshes_length;
@ -634,13 +296,13 @@ extern CAMANGLE level1_camAngle_camPath_001;
extern CAMANGLE * level1_camAngles[0];
extern SIBLINGS level1_nodegnd_003_siblings;
extern SIBLINGS level1_nodegnd_siblings;
extern CHILDREN level1_nodegnd_003_objects;
extern CHILDREN level1_nodegnd_objects;
extern CHILDREN level1_nodegnd_003_rigidbodies;
extern CHILDREN level1_nodegnd_rigidbodies;
extern NODE level1_nodegnd_003;
extern NODE level1_nodegnd;
extern SIBLINGS level1_nodegnd_001_siblings;
@ -658,13 +320,13 @@ extern CHILDREN level1_nodegnd_002_rigidbodies;
extern NODE level1_nodegnd_002;
extern SIBLINGS level1_nodegnd_siblings;
extern SIBLINGS level1_nodegnd_003_siblings;
extern CHILDREN level1_nodegnd_objects;
extern CHILDREN level1_nodegnd_003_objects;
extern CHILDREN level1_nodegnd_rigidbodies;
extern CHILDREN level1_nodegnd_003_rigidbodies;
extern NODE level1_nodegnd;
extern NODE level1_nodegnd_003;
extern MESH * level1_actorPtr;
@ -676,10 +338,11 @@ extern CAMANGLE * level1_camPtr;
extern NODE * level1_curNode;
extern NODE level1_nodegnd_003;
extern NODE level1_nodegnd;
extern NODE level1_nodegnd_001;
extern NODE level1_nodegnd_002;
extern NODE level1_nodegnd;
extern NODE level1_nodegnd_003;

227
main.c
View File

@ -20,7 +20,7 @@
// Blender debug mode
// bpy. app. debug = True
//~ #define _WCHAR_T
#define _WCHAR_T
#include "psx.h"
#include "math.h"
@ -29,22 +29,28 @@
#include "graphics.h"
#include "space.h"
#include <libcd.h>
//~ #include "defines.h"
//~ #define USECD
// START OVERLAY
extern u_long __load_start_ovly0;
extern u_long load_all_overlays_here;
extern u_long __lvl0_end;
extern u_long __lvl1_end;
#define LLEVEL 1
//~ #define LEVEL 0
//#define USE_POINTER
//~ #if LEVEL == 0
//~ static const char*const overlayFile = "\\level.bin;1";
//~ #else
//~ static const char*const overlayFile = "\\level1.bin;1";
//~ #endif
#if LLEVEL == 0
static const char*const overlayFile = "\\level0.bin;1";
#else
static const char*const overlayFile = "\\level1.bin;1";
#endif
//~ #ifdef USE_POINTER
@ -60,15 +66,13 @@ extern u_long __load_start_ovly0;
// END OVERLAY
//~ #if LEVEL == 0
#include "levels/level.h"
//~ #elif LEVEL == 1
#include "levels/level0.h"
#include "levels/level1.h"
//~ #endif
static char* overlayFile;
//~ static char* overlayFile;
char level = 1;
//~ char level = 0;
// Display and draw environments, double buffered
@ -138,25 +142,25 @@ u_long triCount = 0;
// TODO : Add switch case to get the correct pointers
// Get needed pointers from level file
// Get needed pointers from level file
MATRIX * cmat, *lgtmat;
MATRIX * cmat, *lgtmat;
MESH * actorPtr, * levelPtr, * propPtr, ** meshes;
MESH * actorPtr, * levelPtr, * propPtr, ** meshes;
int * meshes_length;
int * meshes_length;
NODE * curNode;
NODE * curNode;
CAMPATH * camPath;
CAMPATH * camPath;
CAMANGLE * camPtr, ** camAngles;
CAMANGLE * camPtr, ** camAngles;
// Get rid of those
// Get rid of those
MESH * meshPlan;
MESH * meshPlan;
VECTOR * modelPlan_pos;
VECTOR * modelPlan_pos;
// Pad
@ -164,84 +168,106 @@ void callback();
int main() {
// Load overlay
#ifdef USECD
CdInit();
int cdread = 0, cdsync = 1;
LoadLevel(overlayFile, &load_all_overlays_here);
if ( level == 0) {
#endif
overlayFile = "\\level.bin;1";
if ( LLEVEL == 0 ) {
} else {
cmat = level0.cmat;
overlayFile = "\\level1.bin;1";
}
lgtmat = level0.lgtmat;
cdread = CdReadFile( (char *)(overlayFile), &__load_start_ovly0, 0);
meshes = (MESH **)level0.meshes;
cdsync = CdReadSync(0, NULL);
meshes_length = level0.meshes_length;
if ( level == 0) {
actorPtr = level0.actorPtr;
cmat = &level_cmat;
levelPtr = level0.levelPtr;
lgtmat = &level_lgtmat;
propPtr = level0.propPtr;
meshes = level_meshes;
camPtr = level0.camPtr;
meshes_length = &level_meshes_length;
camPath = level0.camPath;
actorPtr = level_actorPtr;
camAngles = (CAMANGLE **)level0.camAngles;
levelPtr = level_levelPtr;
propPtr = level_propPtr;
camPtr = level_camPtr;
camPath = &level_camPath;
camAngles = level_camAngles;
curNode = level_curNode;
curNode = level0.curNode;
// Move these to drawPoly()
meshPlan = &level_meshPlan;
meshPlan = level0.meshPlan;
modelPlan_pos = &level_modelPlan_pos;
//~ cmat = &level_cmat;
} else if ( level == 1) {
//~ lgtmat = &level_lgtmat;
cmat = &level1_cmat;
//~ meshes = level_meshes;
lgtmat = &level1_lgtmat;
//~ meshes_length = &level_meshes_length;
meshes = level1_meshes;
//~ actorPtr = level_actorPtr;
meshes_length = &level1_meshes_length;
//~ levelPtr = level_levelPtr;
actorPtr = level1_actorPtr;
//~ propPtr = level_propPtr;
levelPtr = level1_levelPtr;
//~ camPtr = level_camPtr;
propPtr = level1_propPtr;
//~ camPath = &level_camPath;
camPtr = level1_camPtr;
//~ camAngles = level_camAngles;
camPath = &level1_camPath;
//~ curNode = level_curNode;
camAngles = level1_camAngles;
//~ // Move these to drawPoly()
curNode = level1_curNode;
//~ meshPlan = &level_meshPlan;
//~ modelPlan_pos = &level_meshPlan.pos;
} else if ( LLEVEL == 1) {
cmat = level1.cmat;
lgtmat = level1.lgtmat;
meshes = (MESH **)level1.meshes;
meshes_length = level1.meshes_length;
actorPtr = level1.actorPtr;
levelPtr = level1.levelPtr;
propPtr = level1.propPtr;
camPtr = level1.camPtr;
camPath = level1.camPath;
camAngles = (CAMANGLE **)level1.camAngles;
curNode = level1.curNode;
// Move these to drawPoly()
meshPlan = &level1_meshPlan;
meshPlan = level1.meshPlan;
modelPlan_pos = &level1_modelPlan_pos;
//~ modelPlan_pos = level1_meshPlan->pos;
}
// Overlay
VECTOR sp = {CENTERX,CENTERY,0};
@ -340,7 +366,7 @@ int main() {
while ( VSync(1) ) {
FntPrint("%d %d %x\n", cdread, cdsync, __load_start_ovly0);
//~ FntPrint("%d %d %x %x\n", cdread, cdsync, &load_all_overlays_here, &__ovly0_end);
// Clear the main OT
@ -388,27 +414,27 @@ int main() {
//~ meshPlan.rot->vx = ( (objAngleToCam.vx >> 4) - 3076 ) * ( (objAngleToCam.vz >> 4) - 3076 ) >> 12 ;
meshPlan->rot->vy = -( (objAngleToCam.vy >> 4) + 1024 ) ;
meshPlan->rot.vy = -( (objAngleToCam.vy >> 4) + 1024 ) ;
//~ posToCam = getVectorTo(*meshPlan.pos, camera.pos);
//~ posToCam = getVectorTo(camera.pos, *meshPlan.pos);
posToCam.vx = -camera.pos.vx - modelPlan_pos->vx ;
posToCam.vx = -camera.pos.vx - meshPlan->pos.vx ;
posToCam.vz = -camera.pos.vz - modelPlan_pos->vz ;
posToCam.vz = -camera.pos.vz - meshPlan->pos.vz ;
posToCam.vy = -camera.pos.vy - modelPlan_pos->vy ;
posToCam.vy = -camera.pos.vy - meshPlan->pos.vy ;
//~ psqrt(posToCam.vx * posToCam.vx + posToCam.vy * posToCam.vy);
// Actor Forward vector for 3d relative orientation
fVecActor = *actorPtr->pos;
fVecActor = actorPtr->pos;
fVecActor.vx = actorPtr->pos->vx + (nsin(actorPtr->rot->vy/2));
fVecActor.vx = actorPtr->pos.vx + (nsin(actorPtr->rot.vy/2));
fVecActor.vz = actorPtr->pos->vz - (ncos(actorPtr->rot->vy/2));
fVecActor.vz = actorPtr->pos.vz - (ncos(actorPtr->rot.vy/2));
// Camera modes
@ -448,11 +474,11 @@ int main() {
//~ applyVector(&InvCamPos, -1,-1,-1, *=);
angle = -actorPtr->rot->vy / 2;
angle = -actorPtr->rot.vy / 2;
//~ angle = actorPtr->rot->vy;
getCameraXZ(&camera.x, &camera.z, actorPtr->pos->vx, actorPtr->pos->vz, angle, dist);
getCameraXZ(&camera.x, &camera.z, actorPtr->pos.vx, actorPtr->pos.vz, angle, dist);
// FIXME! camera lerping to pos
//~ angle += lerp(camera.rot.vy, -actorPtr->rot->vy, 128);
@ -478,7 +504,7 @@ int main() {
//~ fVecActor.vz = actorPtr->pos->vz - (ncos(actorPtr->rot->vy));
getCameraXZ(&camera.x, &camera.z, actorPtr->pos->vx, actorPtr->pos->vz, angle, dist);
getCameraXZ(&camera.x, &camera.z, actorPtr->pos.vx, actorPtr->pos.vz, angle, dist);
angle += 10;
}
@ -804,12 +830,12 @@ int main() {
for ( int k = 0; k < *meshes_length; k ++ ) {
//~ for ( int k = 0; k < curNode->objects->index ; k ++){
if ( ( *meshes[k]->isRigidBody == 1 ) ) {
if ( ( meshes[k]->isRigidBody == 1 ) ) {
//~ if ( ( *curNode->rigidbodies->list[k]->isRigidBody == 1 ) ) {
//~ applyAcceleration(curNode->rigidbodies->list[k]->body);
applyAcceleration(meshes[k]->body);
applyAcceleration( meshes[k]->body );
// Get col with level ( modelgnd_body )
@ -852,24 +878,24 @@ int main() {
if ( propPtr->body->velocity.vx ) {
VECTOR L = angularMom(*propPtr->body);
VECTOR L = angularMom( *propPtr->body );
propPtr->rot->vz -= L.vx;
propPtr->rot.vz -= L.vx;
}
if ( propPtr->body->velocity.vz ) {
VECTOR L = angularMom( *propPtr->body );
propPtr->rot->vx -= L.vz;
propPtr->rot.vx -= L.vz;
}
}
meshes[k]->pos->vx = meshes[k]->body->position.vx;
meshes[k]->pos.vx = meshes[k]->body->position.vx;
meshes[k]->pos->vy = meshes[k]->body->position.vy ;
meshes[k]->pos.vy = meshes[k]->body->position.vy ;
meshes[k]->pos->vz = meshes[k]->body->position.vz;
meshes[k]->pos.vz = meshes[k]->body->position.vz;
}
@ -887,7 +913,7 @@ int main() {
if ( (camMode == 2) && (camPtr->tim_data ) ) {
worldToScreen(actorPtr->pos, &actorPtr->pos2D);
worldToScreen( &actorPtr->pos, &actorPtr->pos2D );
}
@ -896,11 +922,11 @@ int main() {
// position of cam relative to actor
posToActor.vx = actorPtr->pos->vx + camera.pos.vx;
posToActor.vx = actorPtr->pos.vx + camera.pos.vx;
posToActor.vz = actorPtr->pos->vz + camera.pos.vz;
posToActor.vz = actorPtr->pos.vz + camera.pos.vz;
posToActor.vy = actorPtr->pos->vy + camera.pos.vy;
posToActor.vy = actorPtr->pos.vy + camera.pos.vy;
// Polygon drawing
@ -992,7 +1018,7 @@ int main() {
//~ FntPrint("CurNode : %x\nIndex: %d", curNode, curNode->siblings->index);
FntPrint("Time : %d dt :%d level: %d\n", VSync(-1) / 60, dt, level);
FntPrint("Time : %d dt :%d level: %d\n", VSync(-1) / 60, dt);
//~ FntPrint("%d\n", curCamAngle );
//~ FntPrint("%x\n", primbuff[db]);
@ -1111,19 +1137,18 @@ void callback() {
if ( pad & PADL1 ) {
lgtang.vz += 32;
level = !level;
}
if ( pad & PADRup && !timer ){
if (*actorPtr->isPrism){
if (actorPtr->isPrism){
*actorPtr->isPrism = 0;
actorPtr->isPrism = 0;
} else {
*actorPtr->isPrism = 1;
actorPtr->isPrism = 1;
}
@ -1166,9 +1191,9 @@ void callback() {
if ( pad & PADLup ) {
actorPtr->body->gForce.vz = getVectorTo(fVecActor, *actorPtr->pos).vz >> 8 ;
actorPtr->body->gForce.vz = getVectorTo(fVecActor, actorPtr->pos).vz >> 8 ;
actorPtr->body->gForce.vx = -getVectorTo(fVecActor, *actorPtr->pos).vx >> 8 ;
actorPtr->body->gForce.vx = -getVectorTo(fVecActor, actorPtr->pos).vx >> 8 ;
lastPad = pad;
}
@ -1182,9 +1207,9 @@ void callback() {
if ( pad & PADLdown ) {
actorPtr->body->gForce.vz = -getVectorTo(fVecActor, *actorPtr->pos).vz >> 8 ;
actorPtr->body->gForce.vz = -getVectorTo(fVecActor, actorPtr->pos).vz >> 8 ;
actorPtr->body->gForce.vx = getVectorTo(fVecActor, *actorPtr->pos).vx >> 8 ;
actorPtr->body->gForce.vx = getVectorTo(fVecActor, actorPtr->pos).vx >> 8 ;
lastPad = pad;
}
@ -1201,7 +1226,7 @@ void callback() {
if ( pad & PADLleft ) {
actorPtr->rot->vy -= 32;
actorPtr->rot.vy -= 32;
lastPad = pad;
@ -1209,7 +1234,7 @@ void callback() {
if ( pad & PADLright ) {
actorPtr->rot->vy += 32;
actorPtr->rot.vy += 32;
lastPad = pad;
}

View File

@ -1,29 +1,44 @@
__heap_base = MAX(__ovly0_end, __ovly1_end);
__heap_base = MAX(__lvl0_end, __lvl1_end);
SECTIONS {
OVERLAY __bss_end : NOCROSSREFS SUBALIGN(4)
{
.ovly0
.lvlload
{
KEEP(levels/level.o(.text))
__ovly0_ctor = .;
KEEP(levels/level.o(.text.startup._GLOBAL__*))
KEEP(levels/level.o(.text.*))
KEEP(levels/level.o(.rodata*))
KEEP(levels/level.o(.sdata*))
KEEP(levels/level.o(.data*))
KEEP(levels/level.o(.sbss*))
KEEP(levels/level.o(.bss*))
KEEP(levels/level.o(.ctors))
load_all_overlays_here = .;
}
.lvl0
{
KEEP(levels/level0.o(.text))
__lvl0_ctor = .;
KEEP(levels/level0.o(.text.startup._GLOBAL__*))
KEEP(levels/level0.o(.text.*))
KEEP(levels/level0.o(.rodata*))
KEEP(levels/level0.o(.sdata*))
KEEP(levels/level0.o(.data*))
KEEP(levels/level0.o(.sbss*))
KEEP(levels/level0.o(.bss*))
KEEP(levels/level0.o(.ctors))
/*KEEP(TIM/bg_camPath_*.o(.text))
__lvl0_ctor = .;
KEEP(TIM/bg_camPath_*.o(.text.startup._GLOBAL__*))
KEEP(TIM/bg_camPath_*.o(.text.*))
KEEP(TIM/bg_camPath_*.o(.rodata*))
KEEP(TIM/bg_camPath_*.o(.sdata*))
KEEP(TIM/bg_camPath_*.o(.data*))
KEEP(TIM/bg_camPath_*.o(.sbss*))
KEEP(TIM/bg_camPath_*.o(.bss*))
KEEP(TIM/bg_camPath_*.o(.ctors))
*/
. = ALIGN(4);
__ovly0_end = .;
__lvl0_end = .;
}
.ovly1
.lvl1
{
KEEP(levels/level1.o(.text))
__ovly1_ctor = .;
__lvl1_ctor = .;
KEEP(levels/level1.o(.text.startup._GLOBAL__*))
KEEP(levels/level1.o(.text.*))
KEEP(levels/level1.o(.rodata*))
@ -34,7 +49,7 @@ SECTIONS {
KEEP(levels/level1.o(.ctors))
. = ALIGN(4);
__ovly1_end = .;
__lvl1_end = .;
}
}
}

11
psx.c
View File

@ -10,6 +10,8 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
PadInit(0);
//~ CdInit();
// Initialize and setup the GTE
InitGeom();
@ -102,6 +104,15 @@ void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, c
};
void LoadLevel(const char*const LevelName, u_long * LoadAddress){
int cdread = 0, cdsync = 1;
cdread = CdReadFile( (char *)(LevelName), LoadAddress, 0);
cdsync = CdReadSync(0, 0);
};
void LoadTexture(u_long * tim, TIM_IMAGE * tparam){ // This part is from Lameguy64's tutorial series : lameguy64.net/svn/pstutorials/chapter1/3-textures.html login/pw: annoyingmous
OpenTIM(tim); // Open the tim binary data, feed it the address of the data in memory
ReadTIM(tparam); // This read the header of the TIM data and sets the corresponding members of the TIM_IMAGE structure

3
psx.h
View File

@ -4,6 +4,7 @@
#include <libgte.h>
#include <libgpu.h>
#include <libetc.h>
#include <libcd.h>
#include "defines.h"
@ -15,4 +16,6 @@ void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, c
// Utils
void LoadLevel(const char*const LevelName, u_long * LoadAddress);
void LoadTexture(u_long * tim, TIM_IMAGE * tparam);