Add cammode defines
This commit is contained in:
parent
fa14c1ab7b
commit
9743d47465
8
camera.h
8
camera.h
@ -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
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#define OT2LEN 8
|
||||
|
||||
#define OTLEN 768
|
||||
#define OTLEN 768
|
||||
|
||||
#define PRIMBUFFLEN 4096 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives
|
||||
|
||||
|
109
main.c
109
main.c
@ -5,8 +5,8 @@
|
||||
// @Impiaa
|
||||
// @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,27 +70,27 @@ 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
|
||||
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;
|
||||
|
||||
CAMERA camera = {0};
|
||||
@ -142,7 +113,7 @@ u_short timer = 0;
|
||||
|
||||
// Cam stuff
|
||||
|
||||
int camMode = 2;
|
||||
int camMode = FIXED;
|
||||
|
||||
VECTOR angle = {250,0,0,0};
|
||||
|
||||
@ -183,27 +154,27 @@ VECTOR modelPlan_pos = {0};
|
||||
LEVEL curLvl = {
|
||||
|
||||
&cmat,
|
||||
|
||||
|
||||
&lgtmat,
|
||||
|
||||
|
||||
(MESH **)&meshes,
|
||||
|
||||
|
||||
&meshes_length,
|
||||
|
||||
|
||||
&actorPtr,
|
||||
|
||||
|
||||
&levelPtr,
|
||||
|
||||
|
||||
&propPtr,
|
||||
|
||||
|
||||
&camPtr,
|
||||
|
||||
|
||||
&camPath,
|
||||
|
||||
|
||||
(CAMANGLE **)&camAngles,
|
||||
|
||||
|
||||
&curNode,
|
||||
|
||||
|
||||
&meshPlan
|
||||
};
|
||||
|
||||
@ -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,8 +326,8 @@ int main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Main loop
|
||||
|
||||
// Main loop
|
||||
|
||||
//~ while (1) {
|
||||
|
||||
while ( VSync(1) ) {
|
||||
@ -403,7 +374,7 @@ int main() {
|
||||
|
||||
#endif
|
||||
|
||||
SwitchLevel( overlayFile, &load_all_overlays_here, &curLvl, loadLvl);
|
||||
SwitchLevel( &curLvl, loadLvl);
|
||||
|
||||
//~ levelHasChanged = 0;
|
||||
levelWas = level;
|
||||
@ -414,9 +385,9 @@ int main() {
|
||||
//~ FntPrint("%x\n", curLvl.actorPtr->tim);
|
||||
|
||||
// Clear the main OT
|
||||
|
||||
|
||||
ClearOTagR(otdisc[db], OT2LEN);
|
||||
|
||||
|
||||
// Clear Secondary OT
|
||||
|
||||
ClearOTagR(ot[db], OTLEN);
|
||||
@ -1073,7 +1044,7 @@ int main() {
|
||||
|
||||
// Find and apply light rotation matrix
|
||||
|
||||
RotMatrix(&lgtang, &rotlgt);
|
||||
RotMatrix(&lgtang, &rotlgt);
|
||||
|
||||
MulMatrix0(curLvl.lgtmat, &rotlgt, &light);
|
||||
|
||||
@ -1102,13 +1073,13 @@ int main() {
|
||||
//~ FntPrint(" %d %d %d\n", wp.vx, wp.vy, wp.vz);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
60
psx.c
60
psx.c
@ -16,23 +16,23 @@ 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();
|
||||
|
||||
|
||||
SetGeomOffset( CENTERX, CENTERY ); // x, y offset
|
||||
|
||||
|
||||
SetGeomScreen( FOV ); // Distance between eye and screen - Camera FOV
|
||||
|
||||
|
||||
// Set the display and draw environments
|
||||
|
||||
|
||||
SetDefDispEnv(&disp[0], 0, 0 , SCREENXRES, SCREENYRES);
|
||||
|
||||
|
||||
SetDefDispEnv(&disp[1], 0, SCREENYRES, SCREENXRES, SCREENYRES);
|
||||
|
||||
|
||||
|
||||
SetDefDrawEnv(&draw[0], 0, SCREENYRES, SCREENXRES, SCREENYRES);
|
||||
|
||||
|
||||
SetDefDrawEnv(&draw[1], 0, 0, SCREENXRES, SCREENYRES);
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
|
||||
|
||||
disp[1].screen.y += 8;
|
||||
}
|
||||
|
||||
|
||||
// Set Draw area color
|
||||
|
||||
setRGB0(&draw[0], BGc->r, BGc->g, BGc->b);
|
||||
@ -63,13 +63,13 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
|
||||
|
||||
PutDispEnv(&disp[db]);
|
||||
|
||||
PutDrawEnv(&draw[db]);
|
||||
|
||||
// Init font system
|
||||
PutDrawEnv(&draw[db]);
|
||||
|
||||
// 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,
|
||||
|
||||
@ -177,9 +177,9 @@ void LvlPtrSet(LEVEL * curLevel, LEVEL * level){
|
||||
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);
|
||||
|
||||
// return loaded size
|
||||
@ -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();
|
||||
|
||||
@ -211,20 +211,20 @@ void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curL
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
|
||||
LoadImage(tparam->prect, tparam->paddr); // Transfer the data from memory to VRAM at position prect.x, prect.y
|
||||
|
||||
|
||||
DrawSync(0); // Wait for the drawing to end
|
||||
|
||||
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
|
||||
|
||||
DrawSync(0); // Wait for drawing to end
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
DrawSync(0); // Wait for drawing to end
|
||||
}
|
||||
|
||||
};
|
||||
|
2
psx.h
2
psx.h
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user