From e54122951d2994d2a968aa409e202f7a70e1fcec Mon Sep 17 00:00:00 2001 From: ElijahZAwesome Date: Sun, 28 Jan 2018 08:27:51 -0600 Subject: [PATCH] lil' more armor shit, attempting to put music into ROMFS --- Makefile | 11 +++++-- {resources => romfs/resources}/bossdeath.raw | Bin {resources => romfs/resources}/craft.raw | Bin {resources => romfs/resources}/death.raw | Bin .../resources}/monsterhurt.raw | Bin .../resources}/music/floor0.raw | Bin .../resources}/music/floor1.raw | Bin .../resources}/music/floor1_night.raw | Bin .../resources}/music/floor2_3.raw | Bin .../resources}/music/floor4.raw | Bin {resources => romfs/resources}/music/menu.raw | Bin {resources => romfs/resources}/pickup.raw | Bin {resources => romfs/resources}/playerhurt.raw | Bin {resources => romfs/resources}/test.raw | Bin run in Citra.bat | 2 +- source/Menu.c | 2 +- source/Render.c | 27 +++++++++++------- source/Render.h | 1 + source/Sound.c | 26 ++++++++--------- 19 files changed, 40 insertions(+), 29 deletions(-) rename {resources => romfs/resources}/bossdeath.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/craft.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/death.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/monsterhurt.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/music/floor0.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/music/floor1.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/music/floor1_night.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/music/floor2_3.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/music/floor4.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/music/menu.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/pickup.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/playerhurt.raw (100%) mode change 100755 => 100644 rename {resources => romfs/resources}/test.raw (100%) mode change 100755 => 100644 diff --git a/Makefile b/Makefile index 8d0b6bd..2b06994 100755 --- a/Makefile +++ b/Makefile @@ -27,12 +27,13 @@ include $(DEVKITARM)/3ds_rules # - /default_icon.png #--------------------------------------------------------------------------------- TARGET := result/Minicraft3DS -ICON_TARGET := icons-banners/icon -RESULT := result +ICON_TARGET := icons-banners/icon +RESULT := result BUILD := build SOURCES := source source/minizip DATA := data INCLUDES := include +ROMFS := romfs APP_TITLE := Minicraft 3DS APP_DESCRIPTION := Minicraft was originally created by Markus "Notch" Perrson. Ported to the 3DS by Davideesk. @@ -117,6 +118,10 @@ ifeq ($(strip $(NO_SMDH)),) export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh endif +ifneq ($(ROMFS),) + export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) +endif + .PHONY: $(BUILD) clean all #--------------------------------------------------------------------------------- @@ -140,7 +145,7 @@ cci: $(TARGET)-strip.elf @echo "built ... Minicraft3DS.3ds" #--------------------------------------------------------------------------------- cia: $(TARGET)-strip.elf - @makerom -f cia -o $(TARGET).cia -elf $(TARGET)-strip.elf -rsf resources/$(TARGET).rsf -exefslogo -target t + @makerom -f cia -o $(TARGET).cia -elf $(TARGET)-strip.elf -rsf icons-banners/$(TARGET).rsf -exefslogo -target t @echo "built ... Minicraft3DS.cia" #--------------------------------------------------------------------------------- send: $(BUILD) diff --git a/resources/bossdeath.raw b/romfs/resources/bossdeath.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/bossdeath.raw rename to romfs/resources/bossdeath.raw diff --git a/resources/craft.raw b/romfs/resources/craft.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/craft.raw rename to romfs/resources/craft.raw diff --git a/resources/death.raw b/romfs/resources/death.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/death.raw rename to romfs/resources/death.raw diff --git a/resources/monsterhurt.raw b/romfs/resources/monsterhurt.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/monsterhurt.raw rename to romfs/resources/monsterhurt.raw diff --git a/resources/music/floor0.raw b/romfs/resources/music/floor0.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/music/floor0.raw rename to romfs/resources/music/floor0.raw diff --git a/resources/music/floor1.raw b/romfs/resources/music/floor1.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/music/floor1.raw rename to romfs/resources/music/floor1.raw diff --git a/resources/music/floor1_night.raw b/romfs/resources/music/floor1_night.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/music/floor1_night.raw rename to romfs/resources/music/floor1_night.raw diff --git a/resources/music/floor2_3.raw b/romfs/resources/music/floor2_3.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/music/floor2_3.raw rename to romfs/resources/music/floor2_3.raw diff --git a/resources/music/floor4.raw b/romfs/resources/music/floor4.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/music/floor4.raw rename to romfs/resources/music/floor4.raw diff --git a/resources/music/menu.raw b/romfs/resources/music/menu.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/music/menu.raw rename to romfs/resources/music/menu.raw diff --git a/resources/pickup.raw b/romfs/resources/pickup.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/pickup.raw rename to romfs/resources/pickup.raw diff --git a/resources/playerhurt.raw b/romfs/resources/playerhurt.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/playerhurt.raw rename to romfs/resources/playerhurt.raw diff --git a/resources/test.raw b/romfs/resources/test.raw old mode 100755 new mode 100644 similarity index 100% rename from resources/test.raw rename to romfs/resources/test.raw diff --git a/run in Citra.bat b/run in Citra.bat index 353f7ea..bf237b2 100644 --- a/run in Citra.bat +++ b/run in Citra.bat @@ -2,4 +2,4 @@ echo Building 3DSX/ELF/SMDH... make echo Running in citra -C:/Users/computer/AppData/Local/Citra/canary-mingw/citra-qt.exe result/Minicraft3DS.3dsx \ No newline at end of file +%localappdata%/Citra/canary-mingw/citra-qt.exe result/Minicraft3DS.3dsx \ No newline at end of file diff --git a/source/Menu.c b/source/Menu.c index c2afec5..ea43653 100755 --- a/source/Menu.c +++ b/source/Menu.c @@ -1208,7 +1208,7 @@ void renderMenu(int menu,int xscr,int yscr){ renderFrame(1,1,24,14,0xFFFF1010); drawTextColor("Armor",24+1,14+1,0xFF000000); drawTextColor("Armor",24,14,0xFF6FE2E2); - renderArmorList(player.p.inv, 1,1,24,14, curInvSel); + renderArmorList(player.p.inv, 1,1,24,14, 1); sf2d_end_frame(); break; case MENU_CRAFTING: diff --git a/source/Render.c b/source/Render.c index 8cc64f1..2c25d05 100755 --- a/source/Render.c +++ b/source/Render.c @@ -1339,25 +1339,30 @@ void renderItemList(Inventory * inv, int xo, int yo, int x1, int y1, } void renderArmorList(Inventory * inv, int xo, int yo, int x1, int y1, - int selected) { + int selected) { // If lastSlot is 0, then there are no items are in the inventory. bool drawCursor = true; - if (selected < 0) { - drawCursor = false; - selected = 0; - } int w = x1 - xo; int h = y1 - yo - 2; int i1 = inv->lastSlot; if (i1 > h) i1 = h; - int io = selected - h / 2; - if (io > inv->lastSlot - h) - io = inv->lastSlot - h; - if (io < 0) - io = 0; - int i; + int io = selected - h / 2; + int armorcount; + for (i = 0; i < i1; ++i) { + if(inv->items[i + io].id > 119 && inv->items[i + io].id < 141) { + armorcount = armorcount + 1; + } + } + if (selected < 0) { + drawCursor = false; + selected = 0; + } + if (io > inv->lastSlot - h) + io = armorcount; + if (io < 0) + io = 1; for (i = 0; i < i1; ++i) { if(inv->items[i + io].id > 119 && inv->items[i + io].id < 141) { renderItemWithText(&inv->items[i + io], (1 + xo) << 4, diff --git a/source/Render.h b/source/Render.h index e7b157c..880be56 100755 --- a/source/Render.h +++ b/source/Render.h @@ -58,6 +58,7 @@ void renderEntities(int x, int y, EntityManager* em); void renderRecipes(RecipeManager * r, int xo, int yo, int x1, int y1, int selected); void renderItemList(Inventory * inv, int xo, int yo, int x1, int y1, int selected); +void renderArmorList(Inventory * inv, int xo, int yo, int x1, int y1, int selected); void renderItemWithText(Item* item, int x, int y); void renderItemStuffWithText(int itemID, int itemCL, bool onlyOne, int x, int y); void renderItemWithTextCentered(Item* item, int width, int y); diff --git a/source/Sound.c b/source/Sound.c index dd5be02..fd28ac0 100755 --- a/source/Sound.c +++ b/source/Sound.c @@ -47,20 +47,20 @@ void updateMusic(int lvl, int time) { } void loadSounds() { - loadSound(&snd_playerHurt, "/resources/playerhurt.raw"); - loadSound(&snd_playerDeath, "/resources/playerdeath.raw"); - loadSound(&snd_monsterHurt, "/resources/monsterhurt.raw"); - loadSound(&snd_test, "/resources/test.raw"); - loadSound(&snd_pickup, "/resources/pickup.raw"); - loadSound(&snd_bossdeath, "/resources/bossdeath.raw"); - loadSound(&snd_craft, "/resources/craft.raw"); + loadSound(&snd_playerHurt, "romfs:/resources/playerhurt.raw"); + loadSound(&snd_playerDeath, "romfs:/resources/playerdeath.raw"); + loadSound(&snd_monsterHurt, "romsfs:/resources/monsterhurt.raw"); + loadSound(&snd_test, "romfs:/resources/test.raw"); + loadSound(&snd_pickup, "romfs:/resources/pickup.raw"); + loadSound(&snd_bossdeath, "romfs:/resources/bossdeath.raw"); + loadSound(&snd_craft, "romfs:/resources/craft.raw"); - loadSound(&music_menu, "/resources/music/menu.raw"); - loadSound(&music_floor0, "/resources/music/floor0.raw"); - loadSound(&music_floor1, "/resources/music/floor1.raw"); - loadSound(&music_floor1_night, "/resources/music/floor1_night.raw"); - loadSound(&music_floor23, "/resources/music/floor2_3.raw"); - loadSound(&music_floor4, "/resources/music/floor4.raw"); + loadSound(&music_menu, "romfs:/resources/music/menu.raw"); + loadSound(&music_floor0, "romfs:/resources/music/floor0.raw"); + loadSound(&music_floor1, "romfs:/resources/music/floor1.raw"); + loadSound(&music_floor1_night, "romfs:/resources/music/floor1_night.raw"); + loadSound(&music_floor23, "romfs:/resources/music/floor2_3.raw"); + loadSound(&music_floor4, "romfs:/resources/music/floor4.raw"); } void freeSounds(){