diff --git a/Makefile b/Makefile index 55a3334..1d7cf8c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 94eec7b..0fe484d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/source/Globals.c b/source/Globals.c index cd1a606..a60546d 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -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); diff --git a/source/Render.c b/source/Render.c index 9e5302b..b06c6d0 100644 --- a/source/Render.c +++ b/source/Render.c @@ -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); } } @@ -335,22 +335,22 @@ 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); //} }