Add LoadLevelCd func

This commit is contained in:
ABelliqueux 2021-04-26 12:08:34 +02:00
parent 179c272b60
commit a77d06494f
4 changed files with 27 additions and 9 deletions

View File

@ -40,13 +40,13 @@
#define OT2LEN 8 #define OT2LEN 8
#define OTLEN 256 #define OTLEN 768
#define PRIMBUFFLEN 4096 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives #define PRIMBUFFLEN 4096 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives
// Fog // Fog
#define FOG_NEAR 1200 #define FOG_NEAR 1300
#define FOG_FAR 1600 #define FOG_FAR 1600

22
main.c
View File

@ -30,14 +30,18 @@
#include "graphics.h" #include "graphics.h"
#include "space.h" #include "space.h"
#define USECD //~ #define USECD
// START OVERLAY // START OVERLAY
extern u_long load_all_overlays_here; 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;
u_long overlaySize = 0;
//~ #define LLEVEL 0 //~ #define LLEVEL 0
//#define USE_POINTER //#define USE_POINTER
@ -192,10 +196,14 @@ int main() {
overlayFile = "\\level0.bin;1"; overlayFile = "\\level0.bin;1";
overlaySize = __lvl0_end;
} else if ( level == 1) { } else if ( level == 1) {
overlayFile = "\\level1.bin;1"; overlayFile = "\\level1.bin;1";
overlaySize = __lvl1_end;
} }
// Load overlay // Load overlay
@ -204,7 +212,7 @@ int main() {
CdInit(); CdInit();
LoadLevel(overlayFile, &load_all_overlays_here); LoadLevelCD(overlayFile, &load_all_overlays_here);
#endif #endif
@ -333,12 +341,16 @@ int main() {
overlayFile = "\\level0.bin;1"; overlayFile = "\\level0.bin;1";
overlaySize = __lvl0_end;
break; break;
case 1: case 1:
overlayFile = "\\level1.bin;1"; overlayFile = "\\level1.bin;1";
overlaySize = __lvl1_end;
break; break;
default: default:
@ -349,8 +361,14 @@ int main() {
} }
#ifdef USECD
SwitchLevel( overlayFile, &load_all_overlays_here, &curLvl, &level0); SwitchLevel( overlayFile, &load_all_overlays_here, &curLvl, &level0);
#endif
printf("%p:%s", &load_all_overlays_here, overlayFile);
levelHasChanged = 0; levelHasChanged = 0;
} }

4
psx.c
View File

@ -174,7 +174,7 @@ void LvlPtrSet(LEVEL * curLevel, LEVEL * level){
}; };
int LoadLevel(const char*const LevelName, u_long * LoadAddress){ int LoadLevelCD(const char*const LevelName, u_long * LoadAddress){
int cdread = 0, cdsync = 1; int cdread = 0, cdsync = 1;
@ -191,7 +191,7 @@ void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curL
ScrRst(); ScrRst();
LoadLevel( LevelName, LoadAddress ); LoadLevelCD( LevelName, LoadAddress );
LvlPtrSet( curLevel, loadLevel); LvlPtrSet( curLevel, loadLevel);

2
psx.h
View File

@ -24,7 +24,7 @@ void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, c
void LvlPtrSet( LEVEL * curLevel, LEVEL * level ); void LvlPtrSet( LEVEL * curLevel, LEVEL * level );
int LoadLevel(const char*const LevelName, u_long * LoadAddress); int LoadLevelCD(const char*const LevelName, u_long * LoadAddress);
void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curLevel, LEVEL * loadLevel); void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curLevel, LEVEL * loadLevel);