Add cammode defines

This commit is contained in:
ABelliqueux 2021-06-22 17:24:52 +02:00
parent fa14c1ab7b
commit 9743d47465
5 changed files with 80 additions and 101 deletions

View File

@ -3,6 +3,14 @@
#include <sys/types.h>
#include <libgte.h>
// Camera modes
#define ACTOR 0
#define ROTATE 1
#define FIXED 2
#define TRACK 3
#define FLYCAM 4
#define FOLLOW 5
typedef struct{
int x, xv; // x: current value += xv : new value

71
main.c
View File

@ -6,7 +6,7 @@
// @paul
/* PSX screen coordinate system
/* PSX screen coordinate system
*
* Z+
* /
@ -15,7 +15,7 @@
* /|
* / |
* / Y+
* eye */
* eye */
// Blender debug mode
// bpy. app. debug = True
@ -29,7 +29,6 @@
#include "physics.h"
#include "graphics.h"
#include "space.h"
//~ #include "pcdrv.h"
#define USECD
@ -43,34 +42,6 @@ extern u_long __lvl1_end;
u_long overlaySize = 0;
//~ #define LLEVEL 0
//#define USE_POINTER
//~ #if LLEVEL == 0
//~ static const char*const overlayFile = "\\level0.bin;1";
//~ #else
//~ static const char*const overlayFile = "\\level1.bin;1";
//~ #endif
//~ #ifdef USE_POINTER
//~ #if LEVEL == 0
//~ #include "levels/level.h"
//~ #else
//~ #include "levels/level1.h"
//~ #endif
//~ #else
//~ #define str (char*)(&__load_start_ovly0)
//~ #endif
// END OVERLAY
#include "levels/level0.h"
#include "levels/level1.h"
@ -99,26 +70,26 @@ u_long otdisc[2][OT2LEN] = {0};
// Main OT
u_long ot[2][OTLEN] = {0}; // Ordering table (contains addresses to primitives)
u_long ot[2][OTLEN] = {0}; // Ordering table (contains addresses to primitives)
char primbuff[2][PRIMBUFFLEN] = {0}; // Primitive list // That's our prim buffer
char primbuff[2][PRIMBUFFLEN] = {0}; // Primitive list // That's our prim buffer
int primcnt=0; // Primitive counter
int primcnt=0; // Primitive counter
char * nextpri = primbuff[0]; // Primitive counter
char * nextpri = primbuff[0]; // Primitive counter
char db = 0; // Current buffer counter
char db = 0; // Current buffer counter
CVECTOR BGc = {50, 50, 75, 0}; // Far color
VECTOR BKc = {128, 128, 128, 0}; // Back color
MATRIX rotlgt;
MATRIX rotlgt;
SVECTOR lgtang = {0, 0, 0};
SVECTOR lgtang = {0, 0, 0};
MATRIX light;
MATRIX light;
short vs;
@ -142,7 +113,7 @@ u_short timer = 0;
// Cam stuff
int camMode = 2;
int camMode = FIXED;
VECTOR angle = {250,0,0,0};
@ -265,18 +236,18 @@ int main() {
// FIXME : Poly subdiv
//~ DIVPOLYGON4 div4 = { 0 };
//~ DIVPOLYGON4 div4 = { 0 };
//~ div4.pih = SCREENXRES;
//~ div4.piv = SCREENYRES;
//~ div4.piv = SCREENYRES;
//~ div4.ndiv = 2;
//~ long OTc = 0;
//~ DIVPOLYGON3 div3 = { 0 };
//~ DIVPOLYGON3 div3 = { 0 };
//~ div3.pih = SCREENXRES;
//~ div3.piv = SCREENYRES;
//~ div3.piv = SCREENYRES;
//~ div3.ndiv = 1;
init(disp, draw, db, curLvl.cmat, &BGc, &BKc);
init(disp, draw, db, curLvl.cmat, &BGc, &BKc);
InitPAD(controllers[0].pad, 34, controllers[1].pad, 34);
@ -355,7 +326,7 @@ int main() {
}
}
// Main loop
// Main loop
//~ while (1) {
@ -403,7 +374,7 @@ int main() {
#endif
SwitchLevel( overlayFile, &load_all_overlays_here, &curLvl, loadLvl);
SwitchLevel( &curLvl, loadLvl);
//~ levelHasChanged = 0;
levelWas = level;
@ -1103,12 +1074,12 @@ int main() {
FntFlush(-1);
display( &disp[db], &draw[db], otdisc[db], primbuff[db], &nextpri, &db);
//~ display(disp, draw, otdisc[db], primbuff[db], nextpri, db);
display( &disp[db], &draw[db], otdisc[db], primbuff[db], &nextpri, &db);
//~ display(disp, draw, otdisc[db], primbuff[db], nextpri, db);
//~ frame = VSync(-1);
}
}
return 0;
}

22
psx.c
View File

@ -16,7 +16,7 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
ResetGraph( 0 );
// Initialize and setup the GTE
// Initialize and setup the GTE
InitGeom();
@ -63,13 +63,13 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
PutDrawEnv(&draw[db]);
// Init font system
// Init font system
FntLoad(FNT_VRAM_X, FNT_VRAM_Y);
FntLoad(FNT_VRAM_X, FNT_VRAM_Y);
FntOpen( FNT_SCR_X,
FntOpen( FNT_SCR_X,
FNT_SCR_Y,
@ -178,7 +178,7 @@ int LoadLevelCD(const char*const LevelName, u_long * LoadAddress){
int cdread = 0, cdsync = 1;
cdread = CdReadFile( (char *)(LevelName), LoadAddress, 0);
cdread = CdReadFile( (char *)(LevelName), LoadAddress, 0);
cdsync = CdReadSync(0, 0);
@ -187,7 +187,7 @@ int LoadLevelCD(const char*const LevelName, u_long * LoadAddress){
return cdread;
};
void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curLevel, LEVEL * loadLevel ){
void SwitchLevel( LEVEL * curLevel, LEVEL * loadLevel ){
//~ ScrRst();
@ -220,11 +220,11 @@ void LoadTexture(u_long * tim, TIM_IMAGE * tparam){ // This part is from Lam
DrawSync(0); // Wait for the drawing to end
if (tparam->mode & 0x8){ // check 4th bit // If 4th bit == 1, TIM has a CLUT
if (tparam->mode & 0x8){ // check 4th bit // If 4th bit == 1, TIM has a CLUT
LoadImage(tparam->crect, tparam->caddr); // Load it to VRAM at position crect.x, crect.y
LoadImage(tparam->crect, tparam->caddr); // Load it to VRAM at position crect.x, crect.y
DrawSync(0); // Wait for drawing to end
}
DrawSync(0); // Wait for drawing to end
}
};

2
psx.h
View File

@ -26,6 +26,6 @@ void LvlPtrSet( LEVEL * curLevel, LEVEL * level );
int LoadLevelCD(const char*const LevelName, u_long * LoadAddress);
void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curLevel, LEVEL * loadLevel);
void SwitchLevel( LEVEL * curLevel, LEVEL * loadLevel);
void LoadTexture(u_long * tim, TIM_IMAGE * tparam);