This commit is contained in:
Filippo Maria Castelli 2022-08-14 23:07:25 +02:00
parent 4014b76c34
commit a9761aa4a8
4 changed files with 36 additions and 6 deletions

View File

@ -16,6 +16,7 @@
<file name="SCES_313.37" type="data" source="3dcam.ps-exe"/>
<file name="LEVEL0.bin" type="data" source="Overlay.lvl0" />
<file name="LEVEL1.bin" type="data" source="Overlay.lvl1" />
<file name="LEVEL2.bin" type="data" source="Overlay.lvl2" />
<file name="INTER8.XA" type="xa" source="XA/inter8.xa"/>
<file name="INTER_0.XA" type="xa" source="XA/inter_0.xa"/>

View File

@ -21,6 +21,7 @@ src/space.c \
src/sound.c \
levels/level0.c \
levels/level1.c \
levels/level2.c \
TIM/home.tim \
TIM/cat.tim \
TIM/lara.tim \
@ -45,6 +46,6 @@ VAG/7_wron.vag \
VAG/8_yooo.vag \
OVERLAYSCRIPT ?= overlay.ld
OVERLAYSECTION ?= .lvl0 .lvl1
OVERLAYSECTION ?= .lvl0 .lvl1 .lvl2
include ./common.mk

View File

@ -51,5 +51,22 @@ SECTIONS {
. = ALIGN(4);
__lvl1_end = .;
}
.lvl2
{
KEEP(levels/level2.o(.text))
__lvl2_ctor = .;
KEEP(levels/level2.o(.text.startup._GLOBAL__*))
KEEP(levels/level2.o(.text.*))
KEEP(levels/level2.o(.rodata*))
KEEP(levels/level2.o(.sdata*))
KEEP(levels/level2.o(.data*))
KEEP(levels/level2.o(.sbss*))
KEEP(levels/level2.o(.bss*))
KEEP(levels/level2.o(.ctors))
. = ALIGN(4);
__lvl2_end = .;
}
}
}

View File

@ -32,14 +32,17 @@
extern u_long load_all_overlays_here;
extern u_long __lvl0_end;
extern u_long __lvl1_end;
extern u_long __lvl2_end;
u_long overlaySize = 0;
#include "../levels/level0.h"
#include "../levels/level1.h"
#include "../levels/level2.h"
// Levels
u_char level = 0;
u_short levelWas = 0;
u_char level = 2;
u_short levelWas = 2;
u_short levelHasChanged = 0;
// Overlay
static char* overlayFile;
@ -131,6 +134,9 @@ int main() {
overlayFile = "\\level1.bin;1";
overlaySize = __lvl1_end;
//~ loadLvl = &level1;
} else if (level == 2) {
overlayFile = "\\level2.bin;1";
overlaySize = __lvl2_end;
}
// Load overlay from cd
#ifdef USECD
@ -143,8 +149,10 @@ int main() {
if ( level == 0 ) {
LvlPtrSet( &curLvl, &level0);
} else if ( level == 1) {
//~ LvlPtrSet( &curLvl, &level1);
}
LvlPtrSet( &curLvl, &level1);
} else if ( level == 2) {
LvlPtrSet( &curLvl, &level2);
}
levelWas = level;
// Copy light matrices / vector to scratchpad
setDCLightEnv(curLvl.cmat, curLvl.lgtmat, &lgtang);
@ -218,7 +226,10 @@ int main() {
overlaySize = __lvl1_end;
//~ loadLvl = &level1;
// Copy light matrices / vector to scratchpad
break;
case 2:
overlayFile = "\\level2.bin;1";
overlaySize = __lvl2_end;
break;
default:
overlayFile = "\\level0.bin;1";