ovly level switch now working
This commit is contained in:
parent
35c2b8cf58
commit
e11a43644f
@ -14,8 +14,8 @@
|
|||||||
<directory_tree>
|
<directory_tree>
|
||||||
<file name="system.cnf" type="data" source="config/OverlayExample.cnf"/>
|
<file name="system.cnf" type="data" source="config/OverlayExample.cnf"/>
|
||||||
<file name="SCES_003.90" type="data" source="main.ps-exe"/>
|
<file name="SCES_003.90" type="data" source="main.ps-exe"/>
|
||||||
<file name="LEVEL.bin" type="data" source="Overlay.ovly0" />
|
<file name="LEVEL0.bin" type="data" source="Overlay.lvl0" />
|
||||||
<file name="LEVEL1.bin" type="data" source="Overlay.ovly1" />
|
<file name="LEVEL1.bin" type="data" source="Overlay.lvl1" />
|
||||||
<dummy sectors="1024"/>
|
<dummy sectors="1024"/>
|
||||||
</directory_tree>
|
</directory_tree>
|
||||||
</track>
|
</track>
|
||||||
|
@ -285,7 +285,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
|
|
||||||
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 transparent effect is in use, inhibit shadows
|
||||||
|
|
||||||
if (mesh->isPrism){
|
if (mesh->isPrism){
|
||||||
|
|
||||||
|
326
main.c
326
main.c
@ -30,7 +30,7 @@
|
|||||||
#include "space.h"
|
#include "space.h"
|
||||||
|
|
||||||
|
|
||||||
//~ #define USECD
|
#define USECD
|
||||||
|
|
||||||
// START OVERLAY
|
// START OVERLAY
|
||||||
|
|
||||||
@ -38,19 +38,19 @@ extern u_long load_all_overlays_here;
|
|||||||
extern u_long __lvl0_end;
|
extern u_long __lvl0_end;
|
||||||
extern u_long __lvl1_end;
|
extern u_long __lvl1_end;
|
||||||
|
|
||||||
#define LLEVEL 1
|
//~ #define LLEVEL 0
|
||||||
|
|
||||||
//#define USE_POINTER
|
//#define USE_POINTER
|
||||||
|
|
||||||
#if LLEVEL == 0
|
//~ #if LLEVEL == 0
|
||||||
|
|
||||||
static const char*const overlayFile = "\\level0.bin;1";
|
//~ static const char*const overlayFile = "\\level0.bin;1";
|
||||||
|
|
||||||
#else
|
//~ #else
|
||||||
|
|
||||||
static const char*const overlayFile = "\\level1.bin;1";
|
//~ static const char*const overlayFile = "\\level1.bin;1";
|
||||||
|
|
||||||
#endif
|
//~ #endif
|
||||||
|
|
||||||
//~ #ifdef USE_POINTER
|
//~ #ifdef USE_POINTER
|
||||||
|
|
||||||
@ -70,9 +70,10 @@ extern u_long __lvl1_end;
|
|||||||
|
|
||||||
#include "levels/level1.h"
|
#include "levels/level1.h"
|
||||||
|
|
||||||
//~ static char* overlayFile;
|
short level = 1;
|
||||||
|
short levelHasChanged = 0;
|
||||||
|
|
||||||
//~ char level = 0;
|
static char* overlayFile;
|
||||||
|
|
||||||
// Display and draw environments, double buffered
|
// Display and draw environments, double buffered
|
||||||
|
|
||||||
@ -139,10 +140,7 @@ VECTOR fVecActor = {0,0,0,0};
|
|||||||
|
|
||||||
u_long triCount = 0;
|
u_long triCount = 0;
|
||||||
|
|
||||||
|
// These are set to the corresponding address in the LEVEL struct of current loaded level
|
||||||
// TODO : Add switch case to get the correct pointers
|
|
||||||
|
|
||||||
// Get needed pointers from level file
|
|
||||||
|
|
||||||
MATRIX * cmat, * lgtmat;
|
MATRIX * cmat, * lgtmat;
|
||||||
|
|
||||||
@ -162,16 +160,105 @@ MESH * meshPlan;
|
|||||||
|
|
||||||
VECTOR * modelPlan_pos;
|
VECTOR * modelPlan_pos;
|
||||||
|
|
||||||
|
// Zero level : Initialize everything to 0
|
||||||
|
|
||||||
|
MATRIX Zcmat = {0}, Zlgtmat = {0};
|
||||||
|
|
||||||
|
MESH ZactorPtr = {0}, ZlevelPtr = {0} , ZpropPtr = {0}, Zmeshes[] = {0};
|
||||||
|
|
||||||
|
int Zmeshes_length = 0;
|
||||||
|
|
||||||
|
NODE ZcurNode = {0};
|
||||||
|
|
||||||
|
CAMPATH ZcamPath = {0};
|
||||||
|
|
||||||
|
CAMANGLE ZcamPtr = {0}, ZcamAngles[] = {0};
|
||||||
|
|
||||||
|
// Get rid of those
|
||||||
|
|
||||||
|
MESH ZmeshPlan = {0};
|
||||||
|
|
||||||
|
VECTOR ZmodelPlan_pos = {0};
|
||||||
|
|
||||||
|
LEVEL zero = {
|
||||||
|
&Zcmat,
|
||||||
|
&Zlgtmat,
|
||||||
|
&Zmeshes,
|
||||||
|
&Zmeshes_length,
|
||||||
|
&ZactorPtr,
|
||||||
|
&ZlevelPtr,
|
||||||
|
&ZpropPtr,
|
||||||
|
&ZcamPtr,
|
||||||
|
&ZcamPath,
|
||||||
|
&ZcamAngles,
|
||||||
|
0,
|
||||||
|
&ZmeshPlan
|
||||||
|
};
|
||||||
|
|
||||||
// Pad
|
// Pad
|
||||||
|
|
||||||
void callback();
|
void callback();
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
|
if ( level == 0 ){
|
||||||
|
|
||||||
|
overlayFile = "\\level0.bin;1";
|
||||||
|
|
||||||
|
} else if ( level == 1) {
|
||||||
|
|
||||||
|
overlayFile = "\\level1.bin;1";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use Struct to hold level's pointers
|
||||||
|
|
||||||
|
//~ LEVEL curLevel = {
|
||||||
|
//~ cmat,
|
||||||
|
//~ lgtmat,
|
||||||
|
//~ meshes,
|
||||||
|
//~ meshes_length,
|
||||||
|
//~ actorPtr,
|
||||||
|
//~ levelPtr,
|
||||||
|
//~ propPtr,
|
||||||
|
//~ camPtr,
|
||||||
|
//~ camPath,
|
||||||
|
//~ camAngles,
|
||||||
|
//~ curNode,
|
||||||
|
//~ meshPlan
|
||||||
|
//~ };
|
||||||
|
|
||||||
|
// Zeroing the level pointers
|
||||||
|
|
||||||
|
cmat = zero.cmat;
|
||||||
|
|
||||||
|
lgtmat = zero.lgtmat;
|
||||||
|
|
||||||
|
meshes = (MESH **)zero.meshes;
|
||||||
|
|
||||||
|
meshes_length = zero.meshes_length;
|
||||||
|
|
||||||
|
actorPtr = zero.actorPtr;
|
||||||
|
|
||||||
|
levelPtr = zero.levelPtr;
|
||||||
|
|
||||||
|
propPtr = zero.propPtr;
|
||||||
|
|
||||||
|
camPtr = zero.camPtr;
|
||||||
|
|
||||||
|
camPath = zero.camPath;
|
||||||
|
|
||||||
|
camAngles = (CAMANGLE **)zero.camAngles;
|
||||||
|
|
||||||
|
curNode = zero.curNode; // Blank
|
||||||
|
|
||||||
|
// Move these to drawPoly()
|
||||||
|
|
||||||
|
meshPlan = zero.meshPlan;
|
||||||
|
|
||||||
|
|
||||||
// Load overlay
|
// Load overlay
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USECD
|
#ifdef USECD
|
||||||
|
|
||||||
CdInit();
|
CdInit();
|
||||||
@ -180,7 +267,10 @@ int main() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( LLEVEL == 0 ) {
|
// TODO : Add switch case to get the correct pointers
|
||||||
|
// Get needed pointers from level file
|
||||||
|
|
||||||
|
if ( level == 0 ) {
|
||||||
|
|
||||||
cmat = level0.cmat;
|
cmat = level0.cmat;
|
||||||
|
|
||||||
@ -202,41 +292,15 @@ int main() {
|
|||||||
|
|
||||||
camAngles = (CAMANGLE **)level0.camAngles;
|
camAngles = (CAMANGLE **)level0.camAngles;
|
||||||
|
|
||||||
curNode = level0.curNode;
|
curNode = level0.curNode; // Blank
|
||||||
|
|
||||||
// Move these to drawPoly()
|
// Move these to drawPoly()
|
||||||
|
|
||||||
meshPlan = level0.meshPlan;
|
meshPlan = level0.meshPlan;
|
||||||
|
|
||||||
//~ cmat = &level_cmat;
|
//~ LvlPtrSet( &curLevel, &level0);
|
||||||
|
|
||||||
//~ lgtmat = &level_lgtmat;
|
} else if ( level == 1) {
|
||||||
|
|
||||||
//~ meshes = level_meshes;
|
|
||||||
|
|
||||||
//~ meshes_length = &level_meshes_length;
|
|
||||||
|
|
||||||
//~ actorPtr = level_actorPtr;
|
|
||||||
|
|
||||||
//~ levelPtr = level_levelPtr;
|
|
||||||
|
|
||||||
//~ propPtr = level_propPtr;
|
|
||||||
|
|
||||||
//~ camPtr = level_camPtr;
|
|
||||||
|
|
||||||
//~ camPath = &level_camPath;
|
|
||||||
|
|
||||||
//~ camAngles = level_camAngles;
|
|
||||||
|
|
||||||
//~ curNode = level_curNode;
|
|
||||||
|
|
||||||
//~ // Move these to drawPoly()
|
|
||||||
|
|
||||||
//~ meshPlan = &level_meshPlan;
|
|
||||||
|
|
||||||
//~ modelPlan_pos = &level_meshPlan.pos;
|
|
||||||
|
|
||||||
} else if ( LLEVEL == 1) {
|
|
||||||
|
|
||||||
cmat = level1.cmat;
|
cmat = level1.cmat;
|
||||||
|
|
||||||
@ -366,7 +430,152 @@ int main() {
|
|||||||
|
|
||||||
while ( VSync(1) ) {
|
while ( VSync(1) ) {
|
||||||
|
|
||||||
//~ FntPrint("%d %d %x %x\n", cdread, cdsync, &load_all_overlays_here, &__ovly0_end);
|
if (levelHasChanged){
|
||||||
|
|
||||||
|
if ( level == 0 ) {
|
||||||
|
|
||||||
|
//~ cmat = zero.cmat;
|
||||||
|
|
||||||
|
//~ lgtmat = zero.lgtmat;
|
||||||
|
|
||||||
|
//~ meshes = (MESH **)zero.meshes;
|
||||||
|
|
||||||
|
//~ meshes_length = zero.meshes_length;
|
||||||
|
|
||||||
|
//~ actorPtr = zero.actorPtr;
|
||||||
|
|
||||||
|
//~ levelPtr = zero.levelPtr;
|
||||||
|
|
||||||
|
//~ propPtr = zero.propPtr;
|
||||||
|
|
||||||
|
//~ camPtr = zero.camPtr;
|
||||||
|
|
||||||
|
//~ camPath = zero.camPath;
|
||||||
|
|
||||||
|
//~ camAngles = (CAMANGLE **)zero.camAngles;
|
||||||
|
|
||||||
|
//~ curNode = zero.curNode; // Blank
|
||||||
|
|
||||||
|
// Move these to drawPoly()
|
||||||
|
|
||||||
|
//~ meshPlan = zero.meshPlan;
|
||||||
|
|
||||||
|
ScrRst();
|
||||||
|
|
||||||
|
overlayFile = "\\level0.bin;1";
|
||||||
|
|
||||||
|
LoadLevel(overlayFile, &load_all_overlays_here);
|
||||||
|
|
||||||
|
cmat = level0.cmat;
|
||||||
|
|
||||||
|
lgtmat = level0.lgtmat;
|
||||||
|
|
||||||
|
meshes = level0.meshes;
|
||||||
|
|
||||||
|
meshes_length = level0.meshes_length;
|
||||||
|
|
||||||
|
actorPtr = level0.actorPtr;
|
||||||
|
|
||||||
|
levelPtr = level0.levelPtr;
|
||||||
|
|
||||||
|
propPtr = level0.propPtr;
|
||||||
|
|
||||||
|
camPtr = level0.camPtr;
|
||||||
|
|
||||||
|
camPath = level0.camPath;
|
||||||
|
|
||||||
|
camAngles = level0.camAngles;
|
||||||
|
|
||||||
|
curNode = level0.curNode; // Blank
|
||||||
|
|
||||||
|
// Move these to drawPoly()
|
||||||
|
|
||||||
|
meshPlan = level0.meshPlan;
|
||||||
|
|
||||||
|
//~ LvlPtrSet( &curLevel, &level0);
|
||||||
|
|
||||||
|
for (int k = 0; k < *meshes_length ; k++){
|
||||||
|
|
||||||
|
LoadTexture(meshes[k]->tim_data, meshes[k]->tim);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ( level == 1) {
|
||||||
|
|
||||||
|
//~ cmat = zero.cmat;
|
||||||
|
|
||||||
|
//~ lgtmat = zero.lgtmat;
|
||||||
|
|
||||||
|
//~ meshes = (MESH **)zero.meshes;
|
||||||
|
|
||||||
|
//~ meshes_length = zero.meshes_length;
|
||||||
|
|
||||||
|
//~ actorPtr = zero.actorPtr;
|
||||||
|
|
||||||
|
//~ levelPtr = zero.levelPtr;
|
||||||
|
|
||||||
|
//~ propPtr = zero.propPtr;
|
||||||
|
|
||||||
|
//~ camPtr = zero.camPtr;
|
||||||
|
|
||||||
|
//~ camPath = zero.camPath;
|
||||||
|
|
||||||
|
//~ camAngles = (CAMANGLE **)zero.camAngles;
|
||||||
|
|
||||||
|
//~ curNode = zero.curNode; // Blank
|
||||||
|
|
||||||
|
//~ // Move these to drawPoly()
|
||||||
|
|
||||||
|
//~ meshPlan = zero.meshPlan;
|
||||||
|
|
||||||
|
//~ ScrRst();
|
||||||
|
|
||||||
|
overlayFile = "\\level1.bin;1";
|
||||||
|
|
||||||
|
LoadLevel(overlayFile, &load_all_overlays_here);
|
||||||
|
|
||||||
|
cmat = level1.cmat;
|
||||||
|
|
||||||
|
lgtmat = level1.lgtmat;
|
||||||
|
|
||||||
|
meshes = level1.meshes;
|
||||||
|
|
||||||
|
meshes_length = level1.meshes_length;
|
||||||
|
|
||||||
|
actorPtr = level1.actorPtr;
|
||||||
|
|
||||||
|
levelPtr = level1.levelPtr;
|
||||||
|
|
||||||
|
propPtr = level1.propPtr;
|
||||||
|
|
||||||
|
camPtr = level1.camPtr;
|
||||||
|
|
||||||
|
camPath = level1.camPath;
|
||||||
|
|
||||||
|
camAngles = level1.camAngles;
|
||||||
|
|
||||||
|
curNode = level1.curNode;
|
||||||
|
|
||||||
|
// Move these to drawPoly()
|
||||||
|
|
||||||
|
meshPlan = level1.meshPlan;
|
||||||
|
|
||||||
|
//~ modelPlan_pos = level1_meshPlan->pos;
|
||||||
|
|
||||||
|
for (int k = 0; k < *meshes_length ; k++){
|
||||||
|
|
||||||
|
LoadTexture(meshes[k]->tim_data, meshes[k]->tim);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
levelHasChanged = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FntPrint("%x\n", actorPtr->tim);
|
||||||
|
|
||||||
// Clear the main OT
|
// Clear the main OT
|
||||||
|
|
||||||
@ -779,6 +988,8 @@ int main() {
|
|||||||
|
|
||||||
// Spatial partitioning
|
// Spatial partitioning
|
||||||
|
|
||||||
|
if (curNode){
|
||||||
|
|
||||||
for ( int msh = 0; msh < curNode->siblings->index; msh ++ ) {
|
for ( int msh = 0; msh < curNode->siblings->index; msh ++ ) {
|
||||||
|
|
||||||
// Actor
|
// Actor
|
||||||
@ -820,6 +1031,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Physics
|
// Physics
|
||||||
|
|
||||||
@ -930,6 +1142,8 @@ int main() {
|
|||||||
|
|
||||||
// Polygon drawing
|
// Polygon drawing
|
||||||
|
|
||||||
|
if (curNode){
|
||||||
|
|
||||||
static long Flag;
|
static long Flag;
|
||||||
|
|
||||||
if ( (camMode == 2) && (camPtr->tim_data ) ) {
|
if ( (camMode == 2) && (camPtr->tim_data ) ) {
|
||||||
@ -999,6 +1213,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find and apply light rotation matrix
|
// Find and apply light rotation matrix
|
||||||
|
|
||||||
@ -1018,7 +1233,7 @@ int main() {
|
|||||||
|
|
||||||
//~ FntPrint("CurNode : %x\nIndex: %d", curNode, curNode->siblings->index);
|
//~ FntPrint("CurNode : %x\nIndex: %d", curNode, curNode->siblings->index);
|
||||||
|
|
||||||
FntPrint("Time : %d dt :%d level: %d\n", VSync(-1) / 60, dt);
|
FntPrint("Time : %d dt :%d\n", VSync(-1) / 60, dt);
|
||||||
//~ FntPrint("%d\n", curCamAngle );
|
//~ FntPrint("%d\n", curCamAngle );
|
||||||
//~ FntPrint("%x\n", primbuff[db]);
|
//~ FntPrint("%x\n", primbuff[db]);
|
||||||
|
|
||||||
@ -1239,6 +1454,23 @@ void callback() {
|
|||||||
lastPad = pad;
|
lastPad = pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( pad & PADselect && !timer ) {
|
||||||
|
|
||||||
|
if (!levelHasChanged){
|
||||||
|
|
||||||
|
level = !level;
|
||||||
|
|
||||||
|
levelHasChanged = 1;
|
||||||
|
}
|
||||||
|
timer = 30;
|
||||||
|
|
||||||
|
lastPad = pad;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FntPrint("level :%d", level);
|
||||||
|
|
||||||
if ( cursor ) {
|
if ( cursor ) {
|
||||||
|
|
||||||
actorPtr->body->position.vy = lerpValues[cursor];}
|
actorPtr->body->position.vy = lerpValues[cursor];}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
nops /debug
|
||||||
|
|
||||||
nops /fast /bin $1 $2
|
nops /fast /bin $1 $2
|
||||||
|
|
||||||
nops /fast /exe $3
|
nops /fast /exe $3
|
||||||
|
|
||||||
|
nops /slow
|
||||||
|
56
psx.c
56
psx.c
@ -79,6 +79,24 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ScrRst(void){
|
||||||
|
|
||||||
|
RECT scr;
|
||||||
|
|
||||||
|
VSync(0); // Wait for current drawing to finish
|
||||||
|
|
||||||
|
SetDispMask(0); // Set mask to not displayed
|
||||||
|
|
||||||
|
ResetGraph(1); // Cancel current drawing
|
||||||
|
|
||||||
|
setRECT(&scr, 0, 0, 320, 480);
|
||||||
|
|
||||||
|
ClearImage(&scr, 0, 0, 0);
|
||||||
|
|
||||||
|
DrawSync(0);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, char ** nextprim, char * db){
|
void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, char ** nextprim, char * db){
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/3526503/how-to-set-pointer-reference-through-a-function
|
// https://stackoverflow.com/questions/3526503/how-to-set-pointer-reference-through-a-function
|
||||||
@ -104,6 +122,39 @@ void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, c
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void LvlPtrSet(LEVEL * curLevel, LEVEL * level){
|
||||||
|
|
||||||
|
curLevel->cmat = level->cmat;
|
||||||
|
|
||||||
|
curLevel->lgtmat = level->lgtmat;
|
||||||
|
|
||||||
|
curLevel->meshes = level->meshes;
|
||||||
|
|
||||||
|
curLevel->meshes_length = level->meshes_length;
|
||||||
|
|
||||||
|
curLevel->actorPtr = level->actorPtr;
|
||||||
|
|
||||||
|
curLevel->levelPtr = level->levelPtr;
|
||||||
|
|
||||||
|
curLevel->propPtr = level->propPtr;
|
||||||
|
|
||||||
|
curLevel->camPtr = level->camPtr;
|
||||||
|
|
||||||
|
curLevel->camPath = level->camPath;
|
||||||
|
|
||||||
|
curLevel->camAngles = level->camAngles;
|
||||||
|
|
||||||
|
curLevel->curNode = level->curNode; // Blank
|
||||||
|
|
||||||
|
// Move these to drawPoly()
|
||||||
|
|
||||||
|
curLevel->meshPlan = level->meshPlan;
|
||||||
|
|
||||||
|
//~ FntPrint("%x %x", curLevel->meshes, level->meshes);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
void LoadLevel(const char*const LevelName, u_long * LoadAddress){
|
void LoadLevel(const char*const LevelName, u_long * LoadAddress){
|
||||||
|
|
||||||
int cdread = 0, cdsync = 1;
|
int cdread = 0, cdsync = 1;
|
||||||
@ -114,14 +165,19 @@ void LoadLevel(const char*const LevelName, u_long * LoadAddress){
|
|||||||
};
|
};
|
||||||
|
|
||||||
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
|
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
|
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
|
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
|
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
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
psx.h
5
psx.h
@ -7,15 +7,20 @@
|
|||||||
#include <libcd.h>
|
#include <libcd.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "custom_types.h"
|
||||||
|
|
||||||
// PSX setup
|
// PSX setup
|
||||||
|
|
||||||
void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * BG, VECTOR * BK );
|
void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * BG, VECTOR * BK );
|
||||||
|
|
||||||
|
void ScrRst(void);
|
||||||
|
|
||||||
void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, char ** nextprim, char * db);
|
void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, char ** nextprim, char * db);
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
|
||||||
|
void LvlPtrSet( LEVEL * curLevel, LEVEL * level );
|
||||||
|
|
||||||
void LoadLevel(const char*const LevelName, u_long * LoadAddress);
|
void LoadLevel(const char*const LevelName, u_long * LoadAddress);
|
||||||
|
|
||||||
void LoadTexture(u_long * tim, TIM_IMAGE * tparam);
|
void LoadTexture(u_long * tim, TIM_IMAGE * tparam);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user