use LEVEL struct for LvlSwitch

This commit is contained in:
ABelliqueux 2021-04-20 16:45:11 +02:00
parent d9a598b723
commit 31e5f5f541
3 changed files with 263 additions and 403 deletions

645
main.c

File diff suppressed because it is too large Load Diff

19
psx.c
View File

@ -157,6 +157,9 @@ void LvlPtrSet(LEVEL * curLevel, LEVEL * level){
//~ FntPrint("%x %x", curLevel->meshes, level->meshes);
};
void LoadLevel(const char*const LevelName, u_long * LoadAddress){
@ -168,6 +171,22 @@ void LoadLevel(const char*const LevelName, u_long * LoadAddress){
cdsync = CdReadSync(0, 0);
};
void SwitchLevel(const char*const LevelName, u_long * LoadAddress, LEVEL * curLevel, LEVEL * loadLevel ){
ScrRst();
LoadLevel( LevelName, LoadAddress );
LvlPtrSet( curLevel, loadLevel);
for (int k = 0; k < *curLevel->meshes_length ; k++){
LoadTexture(curLevel->meshes[k]->tim_data, curLevel->meshes[k]->tim);
}
};
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

2
psx.h
View File

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