Update to newest ctrulib (finally)

Also updated other dependencies, now also requires citro3d to build.
Also had to modify glowworm lights??? (small textures dont work?)
This commit is contained in:
André Schweiger 2017-01-23 21:13:48 +01:00
parent 3699414dcd
commit 31d576e879
4 changed files with 28 additions and 20 deletions

View file

@ -52,7 +52,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lsfil -lpng -ljpeg -lz -lsf2d -lctru -lm
LIBS := -lsfil -lpng -ljpeg -lz -lsf2d -lcitro3d -lctru -lm
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing

View file

@ -5,6 +5,8 @@ Dependencies:
ctrulib by smea: https://github.com/smealum/ctrulib
citro3d by fincs: https://github.com/fincs/citro3d
sf2dlib by xerpi: https://github.com/xerpi/sf2dlib
sfillib by xerpi: https://github.com/xerpi/sfillib

View file

@ -988,7 +988,10 @@ void tickTile(int x, int y){
switch(tile){
case TILE_SAPLING_TREE:
if(season!=3) setData(++data,x,y); if(data>100){setData(0,x,y); setTile(TILE_TREE,x,y);}
if(season!=3) {
setData(++data,x,y);
if(data>100){setData(0,x,y); setTile(TILE_TREE,x,y);}
}
break;
case TILE_TREE:
if(eManager.lastSlot[currentLevel]<800 && (daytime>18000 || daytime<5000) && rand()%800==0) {
@ -1002,7 +1005,10 @@ void tickTile(int x, int y){
}
break;
case TILE_SAPLING_CACTUS:
if(season!=3) setData(++data,x,y); if(data>100){setData(0,x,y); setTile(TILE_CACTUS,x,y);}
if(season!=3) {
setData(++data,x,y);
if(data>100){setData(0,x,y); setTile(TILE_CACTUS,x,y);}
}
break;
case TILE_WHEAT:
if(data<100 && season!=3) setData(++data,x,y);

View file

@ -276,8 +276,8 @@ void bakeLights() {
playerLightBake = sf2d_create_texture(64, 64, TEXFMT_RGBA8, SF2D_PLACE_RAM);
lanternLightBake = sf2d_create_texture(128, 128, TEXFMT_RGBA8, SF2D_PLACE_RAM);
glowwormLightBake = sf2d_create_texture(16, 16, TEXFMT_RGBA8, SF2D_PLACE_RAM);
glowwormBigLightBake = sf2d_create_texture(32, 32, TEXFMT_RGBA8, SF2D_PLACE_RAM);
glowwormLightBake = sf2d_create_texture(32, 32, TEXFMT_RGBA8, SF2D_PLACE_RAM);
glowwormBigLightBake = sf2d_create_texture(64, 64, TEXFMT_RGBA8, SF2D_PLACE_RAM);
bakeLight(playerLightBake, 32, 32, 32);
bakeLight(lanternLightBake, 64, 64, 64);
@ -296,11 +296,11 @@ void freeLightBakes() {
void renderLightsToStencil(bool force, bool invert, bool rplayer) {
if (force || (currentLevel > 1 && currentLevel != 5)) {
GPU_SetDepthTestAndWriteMask(true, GPU_NEVER, 0);
GPU_SetStencilTest(true, GPU_NEVER, 1, 0xFF, 0xFF);
GPU_SetStencilOp(GPU_STENCIL_REPLACE, GPU_STENCIL_KEEP,
GPU_STENCIL_KEEP);
GPU_SetAlphaTest(true, GPU_GREATER, 0);
C3D_DepthTest(true, GPU_NEVER, 0);
C3D_StencilTest(true, GPU_NEVER, 1, 0xFF, 0xFF);
C3D_StencilOp(GPU_STENCIL_REPLACE, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP);
C3D_AlphaTest(true, GPU_GREATER, 0);
if(player.p.activeItem->id == ITEM_LANTERN) renderLight(player.x, player.y, lanternLightBake);
else if(rplayer) renderLight(player.x, player.y, playerLightBake);
@ -313,8 +313,8 @@ void renderLightsToStencil(bool force, bool invert, bool rplayer) {
renderLight(e.x, e.y, lanternLightBake);
} else if(e.type == ENTITY_GLOWWORM && e.x > player.x - 160 && e.y > player.y - 125 && e.x < player.x + 160 && e.y < player.y + 125) { //TODO could be made smaller becuase of smaller light radius
if(rand()%10==0) continue;
else if(rand()%100==0) renderLight(e.x+4, e.y-4, glowwormBigLightBake);
else renderLight(e.x, e.y, glowwormLightBake);
else if(rand()%100==0) renderLight(e.x+20, e.y-20, glowwormBigLightBake);
else renderLight(e.x+8, e.y-8, glowwormLightBake);
}
}
@ -336,21 +336,21 @@ void renderLightsToStencil(bool force, bool invert, bool rplayer) {
}
GPU_SetDepthTestAndWriteMask(true, GPU_GEQUAL, GPU_WRITE_ALL);
C3D_DepthTest(true, GPU_GEQUAL, GPU_WRITE_ALL);
if(invert) {
GPU_SetStencilTest(true, GPU_EQUAL, 0, 0xFF, 0x0);
C3D_StencilTest(true, GPU_EQUAL, 0, 0xFF, 0x0);
} else {
GPU_SetStencilTest(true, GPU_EQUAL, 1, 0xFF, 0x0);
C3D_StencilTest(true, GPU_EQUAL, 1, 0xFF, 0x0);
}
GPU_SetAlphaTest(false, GPU_ALWAYS, 0x00);
GPU_SetStencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_REPLACE);
C3D_AlphaTest(false, GPU_ALWAYS, 0x00);
C3D_StencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_REPLACE);
}
}
void resetStencilStuff() {
//if (currentLevel > 1) {
GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
GPU_SetStencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP);
C3D_StencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
C3D_StencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP);
//}
}