Compare commits
12 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
43ce7184e1 | ||
![]() |
7b42d7dc1d | ||
![]() |
873c7bc06e | ||
![]() |
80c95de053 | ||
![]() |
7bc9c274de | ||
![]() |
24460ee48c | ||
![]() |
52ab48ba55 | ||
![]() |
a5ea06a928 | ||
![]() |
5423be67ca | ||
![]() |
4f0e3c4dd4 | ||
![]() |
7402ac40fb | ||
![]() |
06b18f3c64 |
50 changed files with 7563 additions and 7455 deletions
BIN
3dslink.exe
BIN
3dslink.exe
Binary file not shown.
BIN
3dstool.exe
BIN
3dstool.exe
Binary file not shown.
4
Makefile
4
Makefile
|
@ -36,8 +36,8 @@ INCLUDES := include
|
|||
ROMFS := romfs
|
||||
|
||||
APP_TITLE := Minicraft 3DS
|
||||
APP_DESCRIPTION := Minicraft was originally created by Markus "Notch" Perrson. Ported to the 3DS by Davideesk.
|
||||
APP_AUTHOR := Davideesk/andre111/ElijahZAwesome
|
||||
APP_DESCRIPTION := Originally created by Notch.
|
||||
APP_AUTHOR := Davideesk/andre111/ElijahZAwesome/tognee
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
|
|
|
@ -7,7 +7,7 @@ Current Version: Version 1.6.1
|
|||
**Download:**
|
||||
|
||||
If you just want to download the game prebuilt check the releases tab in Github:
|
||||
https://github.com/ElijahZAwesome/Minicraft3DS/releases
|
||||
//TODO
|
||||
For building the game yourself look below.
|
||||
|
||||
|
||||
|
@ -75,4 +75,4 @@ If you are going to make a mod of this version, be sure to give credit to Markus
|
|||
|
||||
This source code is subject to a lot of change for better optimization/cleanliness.
|
||||
|
||||
Forum thread: https://gbatemp.net/threads/release-new-minicraft3ds-fork-v1-4.494947/
|
||||
Forum thread: //TODO
|
||||
|
|
BIN
bannertool.exe
BIN
bannertool.exe
Binary file not shown.
|
@ -1,11 +1,10 @@
|
|||
@echo off
|
||||
echo Building 3DSX/ELF/SMDH...
|
||||
set mypath=%cd%
|
||||
make
|
||||
echo Creating banner...
|
||||
bannertool.exe makebanner -i icons-banners/banner.png -a icons-banners/audio.wav -o icons-banners/banner.bnr
|
||||
bannertool makebanner -i icons-banners/banner.png -a icons-banners/audio.wav -o icons-banners/banner.bnr
|
||||
echo Creating icon...
|
||||
bannertool.exe makesmdh -s "Minicraft3DS" -l "3DS Homebrew port of Notch's ludum dare game 'Minicraft', updated." -p "Davideesk/Andre111/ElijahZAwesome" -i icons-banners/icon.png -o icons-banners/icon.icn
|
||||
bannertool makesmdh -s "Minicraft3DS" -l "3DS Homebrew port of Notch's ludum dare game 'Minicraft', updated." -p "Davideesk/Andre111/ElijahZAwesome" -i icons-banners/icon.png -o icons-banners/icon.icn
|
||||
echo Creating ROMFS...
|
||||
3dstool -cvtf romfs icons-banners/romfs.bin --romfs-dir romfs/
|
||||
echo Creating CIA...
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd "`dirname $0`"
|
||||
echo Building 3DSX/ELF/SMDH...
|
||||
make
|
||||
echo Creating banner...
|
||||
`dirname $0`/bannertool makebanner -i icons-banners/banner.png -a icons-banners/audio.wav -o icons-banners/banner.bnr
|
||||
echo Creating icon...
|
||||
`dirname $0`/bannertool makesmdh -s "Minicraft3DS" -l "3DS Homebrew port of Notch's ludum dare game 'Minicraft', updated." -p "Davideesk/Andre111/ElijahZAwesome" -i icons-banners/icon.png -o icons-banners/icon.icn
|
||||
echo Creating CIA...
|
||||
`dirname $0`/makerom -f cia -o result/Minicraft3DS.cia -DAPP_ENCRYPTED=false -rsf icons-banners/Minicraft3DS.rsf -target t -exefslogo -elf result/Minicraft3DS.elf -icon icons-banners/icon.icn -banner icons-banners/banner.bnr
|
||||
echo Creating 3DS/CCI...
|
||||
`dirname $0`/makerom -f cci -o result/Minicraft3DS.3ds -DAPP_ENCRYPTED=true -rsf icons-banners/Minicraft3DS.rsf -target t -exefslogo -elf result/Minicraft3DS.elf -icon icons-banners/icon.icn -banner icons-banners/banner.bnr
|
12
build.sh
Executable file
12
build.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
cd "`dirname $0`"
|
||||
echo Building 3DSX/ELF/SMDH...
|
||||
make
|
||||
echo Creating banner...
|
||||
bannertool makebanner -i icons-banners/banner.png -a icons-banners/audio.wav -o icons-banners/banner.bnr
|
||||
echo Creating icon...
|
||||
bannertool makesmdh -s "Minicraft3DS" -l "Original game by Notch" -p "Davideesk/Andre111/ElijahZAwesome/tognee" -i icons-banners/icon.png -o icons-banners/icon.icn
|
||||
echo Creating CIA...
|
||||
makerom -f cia -o result/Minicraft3DS.cia -DAPP_ENCRYPTED=false -rsf icons-banners/Minicraft3DS.rsf -target t -exefslogo -elf result/Minicraft3DS.elf -icon icons-banners/icon.icn -banner icons-banners/banner.bnr
|
||||
echo Creating 3DS/CCI...
|
||||
makerom -f cci -o result/Minicraft3DS.3ds -DAPP_ENCRYPTED=true -rsf icons-banners/Minicraft3DS.rsf -target t -exefslogo -elf result/Minicraft3DS.elf -icon icons-banners/icon.icn -banner icons-banners/banner.bnr
|
BIN
ctrtool.exe
BIN
ctrtool.exe
Binary file not shown.
BIN
data/icons.png
Executable file
BIN
data/icons.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
BIN
data/icons2.png
BIN
data/icons2.png
Binary file not shown.
Before Width: | Height: | Size: 37 KiB |
BIN
data/player.png
BIN
data/player.png
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
@ -1,78 +0,0 @@
|
|||
# Minicraft3DS
|
||||
3DS Homebrew port of Notch's ludum dare game "Minicraft"
|
||||
Current Version: Version 1.6.1
|
||||
|
||||
----------
|
||||
|
||||
**Download:**
|
||||
|
||||
If you just want to download the game prebuilt check the releases tab in Github:
|
||||
https://github.com/ElijahZAwesome/Minicraft3DS/releases
|
||||
For building the game yourself look below.
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
**Dependencies:**
|
||||
|
||||
For building and installing the dependencies look below.
|
||||
|
||||
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
|
||||
zlib: http://www.zlib.net/
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
**Building:**
|
||||
|
||||
**1. Install devkitARM by devkitPro**
|
||||
- On Windows download https://sourceforge.net/projects/devkitpro/files/Automated%20Installer/
|
||||
- And install atleast Minimal System and devkitARM
|
||||
- This includes make, ctrulib and citro3d
|
||||
|
||||
**2. Install zlib, libjpeg-turbo and libpng**
|
||||
- Download 3DS-Portlibs: https://github.com/devkitPro/3ds_portlibs
|
||||
- Run these commands:
|
||||
|
||||
```
|
||||
make zlib
|
||||
make install-zlib
|
||||
make libjpeg-turbo
|
||||
make libpng
|
||||
make install
|
||||
```
|
||||
|
||||
**3. Install sf2dlib**
|
||||
- Download https://github.com/xerpi/sf2dlib
|
||||
- In the libsf2d directory run these commands:
|
||||
```
|
||||
make
|
||||
make install
|
||||
```
|
||||
**4. Install sfillib**
|
||||
- Download https://github.com/xerpi/sfillib
|
||||
- In the libsfil directory run these commands:
|
||||
```
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
**5. You can now build Minicraft3DS 3dsx, elf, cia, and 3ds files by running the build.bat file.**
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
You can do anything with the source code (besides sell it) as long as you give proper credit to the right people.
|
||||
If you are going to make a mod of this version, be sure to give credit to Markus "Notch" Perrson because he did create the original game after all.
|
||||
|
||||
# Misc
|
||||
|
||||
This source code is subject to a lot of change for better optimization/cleanliness.
|
||||
|
||||
Forum thread: https://gbatemp.net/threads/release-new-minicraft3ds-fork-v1-4.494947/
|
|
@ -1,4 +0,0 @@
|
|||
theme: jekyll-theme-cayman
|
||||
title: Minicraft3DS
|
||||
description: A 2D Homebrew for 3DS
|
||||
show_downloads: true
|
BIN
makerom.exe
BIN
makerom.exe
Binary file not shown.
|
@ -1,5 +0,0 @@
|
|||
@echo off
|
||||
echo Building 3DSX/ELF/SMDH...
|
||||
make
|
||||
echo Running in citra
|
||||
%localappdata%/Citra/canary-mingw/citra-qt.exe result/Minicraft3DS.3dsx
|
|
@ -87,11 +87,16 @@ Recipe defineRecipe(int item, int amountOrLevel, int numArgs, ...){
|
|||
}
|
||||
|
||||
void initRecipes(){
|
||||
|
||||
curPlace = 0;
|
||||
workbenchRecipes.size = 22;
|
||||
|
||||
inHeadRecipes.size = 2;
|
||||
inHeadRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (inHeadRecipes.size));
|
||||
inHeadRecipes.recipes[0] = defineRecipe(ITEM_WORKBENCH,1,1,ITEM_WOOD,10);
|
||||
inHeadRecipes.recipes[1] = defineRecipe(ITEM_TORCH,1,2,ITEM_WOOD,1,ITEM_COAL,1);
|
||||
|
||||
workbenchRecipes.size = 24;
|
||||
workbenchRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (workbenchRecipes.size));
|
||||
workbenchRecipes.recipes[0] = defineRecipe(ITEM_WORKBENCH,1,1,ITEM_WOOD,20);
|
||||
workbenchRecipes.recipes[0] = defineRecipe(ITEM_WORKBENCH,1,1,ITEM_WOOD,10);
|
||||
workbenchRecipes.recipes[1] = defineRecipe(ITEM_FURNACE,1,1,ITEM_STONE,20);
|
||||
workbenchRecipes.recipes[2] = defineRecipe(ITEM_OVEN,1,1,ITEM_STONE,20);
|
||||
workbenchRecipes.recipes[3] = defineRecipe(ITEM_CHEST,1,1,ITEM_WOOD,20);
|
||||
|
@ -113,8 +118,10 @@ void initRecipes(){
|
|||
workbenchRecipes.recipes[19] = defineRecipe(ITEM_ARROW_STONE,1,3,ITEM_WOOD,1,ITEM_STONE,1,ITEM_STRING,1);
|
||||
workbenchRecipes.recipes[20] = defineRecipe(ITEM_WALL_WOOD,1,1,ITEM_WOOD,4);
|
||||
workbenchRecipes.recipes[21] = defineRecipe(ITEM_WALL_STONE,1,1,ITEM_STONE,4);
|
||||
workbenchRecipes.recipes[22] = defineRecipe(ITEM_FISHING_ROD,1,2,ITEM_WOOD,10,ITEM_STRING,3);
|
||||
workbenchRecipes.recipes[23] = defineRecipe(ITEM_TORCH,1,2,ITEM_WOOD,1,ITEM_COAL,1);
|
||||
|
||||
anvilRecipes.size = 18;
|
||||
anvilRecipes.size = 19;
|
||||
anvilRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (anvilRecipes.size));
|
||||
anvilRecipes.recipes[0] = defineRecipe(TOOL_SWORD,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5);
|
||||
anvilRecipes.recipes[1] = defineRecipe(TOOL_AXE,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5);
|
||||
|
@ -134,6 +141,7 @@ void initRecipes(){
|
|||
anvilRecipes.recipes[15] = defineRecipe(ITEM_WALL_GOLD,1,1,ITEM_GOLDINGOT,2);
|
||||
anvilRecipes.recipes[16] = defineRecipe(ITEM_COIN,3,1,ITEM_IRONINGOT,1);
|
||||
anvilRecipes.recipes[17] = defineRecipe(ITEM_POTION_MAKER,1,3,ITEM_IRONINGOT,5,ITEM_GOLDINGOT,25,ITEM_GEM,5);
|
||||
anvilRecipes.recipes[18] = defineRecipe(ITEM_SHEARS,1,1,ITEM_IRONINGOT,2);
|
||||
|
||||
furnaceRecipes.size = 3;
|
||||
furnaceRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (furnaceRecipes.size));
|
||||
|
@ -141,15 +149,17 @@ void initRecipes(){
|
|||
furnaceRecipes.recipes[1] = defineRecipe(ITEM_GOLDINGOT,1,2,ITEM_GOLDORE,4,ITEM_COAL,1);
|
||||
furnaceRecipes.recipes[2] = defineRecipe(ITEM_GLASS,1,2,ITEM_SAND,4,ITEM_COAL,1);
|
||||
|
||||
ovenRecipes.size = 3;
|
||||
ovenRecipes.size = 4;
|
||||
ovenRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (ovenRecipes.size));
|
||||
ovenRecipes.recipes[0] = defineRecipe(ITEM_BREAD,1,1,ITEM_WHEAT,4);
|
||||
ovenRecipes.recipes[1] = defineRecipe(ITEM_PORK_COOKED,1,2,ITEM_PORK_RAW,1,ITEM_COAL,1);
|
||||
ovenRecipes.recipes[2] = defineRecipe(ITEM_BEEF_COOKED,1,2,ITEM_BEEF_RAW,1,ITEM_COAL,1);
|
||||
ovenRecipes.recipes[3] = defineRecipe(ITEM_FISH_COOKED,1,2,ITEM_FISH_RAW,1,ITEM_COAL,1);
|
||||
|
||||
loomRecipes.size = 1;
|
||||
loomRecipes.size = 2;
|
||||
loomRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (loomRecipes.size));
|
||||
loomRecipes.recipes[0] = defineRecipe(ITEM_STRING,1,1,ITEM_WOOL,1);
|
||||
loomRecipes.recipes[1] = defineRecipe(ITEM_BED,1,2,ITEM_WOOD,5,ITEM_WOOL,3);
|
||||
|
||||
enchanterRecipes.size = 8;
|
||||
enchanterRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (enchanterRecipes.size));
|
||||
|
@ -172,6 +182,7 @@ void initRecipes(){
|
|||
|
||||
/* Free up allocated memory */
|
||||
void freeRecipes(){
|
||||
free(inHeadRecipes.recipes);
|
||||
free(workbenchRecipes.recipes);
|
||||
free(ovenRecipes.recipes);
|
||||
free(furnaceRecipes.recipes);
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef struct _recipeManager {
|
|||
Recipe * recipes;
|
||||
} RecipeManager;
|
||||
|
||||
|
||||
RecipeManager inHeadRecipes;
|
||||
RecipeManager workbenchRecipes;
|
||||
RecipeManager furnaceRecipes;
|
||||
RecipeManager ovenRecipes;
|
||||
|
|
|
@ -246,6 +246,3 @@ Entity newGlowwormEntity(int x, int y, int level);
|
|||
Entity newNPCEntity(int type, int x, int y, int level);
|
||||
void addEntityToList(Entity e, EntityManager* em);
|
||||
void removeEntityFromList(Entity * e,int level,EntityManager* em);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ void hurtEntity(Entity *e, int damage, int dir, u32 hurtColor, Entity *damager){
|
|||
|
||||
int i;
|
||||
|
||||
// In hindsight I should've made a generic Mob struct, but whatever. ¯\_(-.-)_/¯
|
||||
// In hindsight I should've made a generic Mob struct, but whatever. <20>\_(-.-)_/<2F>
|
||||
switch(e->type){
|
||||
case ENTITY_PLAYER:
|
||||
e->p.health -= damage;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "MapGen.h"
|
||||
#include "Quests.h"
|
||||
|
||||
#include "icons2_png.h"
|
||||
#include "icons_png.h"
|
||||
#include "player_png.h"
|
||||
#include "Font_png.h"
|
||||
#include "bottombg_png.h"
|
||||
|
@ -89,6 +89,8 @@
|
|||
//WARNING: Having this set to different values in different clients will break multiplayer!
|
||||
#define TESTGODMODE false
|
||||
|
||||
bool paused;
|
||||
|
||||
u32 localUID;
|
||||
|
||||
int loadedtp;
|
||||
|
|
|
@ -368,7 +368,6 @@ void renderGame() {
|
|||
}
|
||||
|
||||
void exitGame() {
|
||||
romfsExit();
|
||||
networkDisconnect();
|
||||
synchronizerReset();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void ingameMenuTick(PlayerData *pd, int menu) {
|
|||
}
|
||||
break;
|
||||
case MENU_INVENTORY:
|
||||
if (pd->inputs.k_menu.clicked || pd->inputs.k_decline.clicked){
|
||||
if (pd->inputs.k_menu.clicked || pd->inputs.k_use.clicked || pd->inputs.k_decline.clicked){
|
||||
pd->ingameMenu = MENU_NONE;
|
||||
pd->activeItem = &noItem;
|
||||
pd->entity.p.isCarrying = false;
|
||||
|
@ -75,7 +75,7 @@ void ingameMenuTick(PlayerData *pd, int menu) {
|
|||
break;
|
||||
|
||||
case MENU_CRAFTING:
|
||||
if (pd->inputs.k_menu.clicked || pd->inputs.k_decline.clicked) pd->ingameMenu = MENU_NONE;
|
||||
if (pd->inputs.k_menu.clicked || pd->inputs.k_use.clicked || pd->inputs.k_decline.clicked) pd->ingameMenu = MENU_NONE;
|
||||
if (pd->inputs.k_accept.clicked){
|
||||
if(craftItem(&(pd->currentRecipes), &(pd->currentRecipes.recipes[pd->ingameMenuInvSel]), &(pd->inventory))){
|
||||
playSoundPositioned(snd_craft, pd->entity.level, pd->entity.x, pd->entity.y);
|
||||
|
@ -313,7 +313,7 @@ void ingameMenuRender(PlayerData *pd, int menu) {
|
|||
int ttlCst = rec->costs[i].costAmount;
|
||||
int col = 0xFFFFFFFF; if(amnt<ttlCst) col = 0xFF7F7F7F;
|
||||
renderItemIcon(rec->costs[i].costItem,1,128,48+(i*8));
|
||||
sprintf(craftText,"%d/%d",amnt,ttlCst);
|
||||
sprintf(craftText,"%d/%d",ttlCst,amnt);
|
||||
drawTextColor(craftText,274,96+(i*18),col);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ void tickKeys(Inputs *inputs, u32 held, u32 down){
|
|||
toggleKey(&(inputs->k_right), held & localInputs.k_right.input, down & localInputs.k_right.input);
|
||||
toggleKey(&(inputs->k_pause), held & localInputs.k_pause.input, down & localInputs.k_pause.input);
|
||||
toggleKey(&(inputs->k_attack), held & localInputs.k_attack.input, down & localInputs.k_attack.input);
|
||||
toggleKey(&(inputs->k_pickup), held & localInputs.k_pickup.input, down & localInputs.k_pickup.input);
|
||||
toggleKey(&(inputs->k_use), held & localInputs.k_use.input, down & localInputs.k_use.input);
|
||||
toggleKey(&(inputs->k_menu), held & localInputs.k_menu.input, down & localInputs.k_menu.input);
|
||||
toggleKey(&(inputs->k_accept), held & localInputs.k_accept.input, down & localInputs.k_accept.input);
|
||||
toggleKey(&(inputs->k_decline), held & localInputs.k_decline.input, down & localInputs.k_decline.input);
|
||||
|
@ -31,6 +33,8 @@ void resetKeys(Inputs *inputs) {
|
|||
toggleKey(&(inputs->k_right), false, false);
|
||||
toggleKey(&(inputs->k_pause), false, false);
|
||||
toggleKey(&(inputs->k_attack), false, false);
|
||||
toggleKey(&(inputs->k_pickup), false, false);
|
||||
toggleKey(&(inputs->k_use), false, false);
|
||||
toggleKey(&(inputs->k_menu), false, false);
|
||||
toggleKey(&(inputs->k_accept), false, false);
|
||||
toggleKey(&(inputs->k_decline), false, false);
|
||||
|
@ -46,6 +50,8 @@ void resetClicked(Inputs *inputs) {
|
|||
inputs->k_right.clicked = false;
|
||||
inputs->k_pause.clicked = false;
|
||||
inputs->k_attack.clicked = false;
|
||||
inputs->k_pickup.clicked = false;
|
||||
inputs->k_use.clicked = false;
|
||||
inputs->k_menu.clicked = false;
|
||||
inputs->k_accept.clicked = false;
|
||||
inputs->k_decline.clicked = false;
|
||||
|
|
|
@ -15,6 +15,8 @@ typedef struct {
|
|||
Key k_left;
|
||||
Key k_right;
|
||||
Key k_attack;
|
||||
Key k_pickup;
|
||||
Key k_use;
|
||||
Key k_menu;
|
||||
Key k_pause;
|
||||
Key k_accept;
|
||||
|
|
|
@ -200,6 +200,20 @@ char* getItemName(int itemID, int countLevel) {
|
|||
}
|
||||
case TOOL_BOW: return "Bow";
|
||||
case TOOL_MAGIC_COMPASS: return "Magic Compass";
|
||||
case TOOL_CLAYMORE:
|
||||
switch(countLevel){
|
||||
case 1: return "Rock Claymore";
|
||||
case 2: return "Iron Claymore";
|
||||
case 3: return "Gold Claymore";
|
||||
case 4: return "Gem Claymore";
|
||||
default: return "Wood Claymore";
|
||||
}
|
||||
case ITEM_TORCH: return "Torch";
|
||||
case ITEM_BED: return "Bed";
|
||||
case ITEM_FISHING_ROD: return "Fishing Rod";
|
||||
case ITEM_SHEARS: return "Shears";
|
||||
case ITEM_FISH_RAW: sprintf(currentName,"%d Fish", countLevel); return currentName;
|
||||
case ITEM_FISH_COOKED: sprintf(currentName,"%d Cooked Fish", countLevel); return currentName;
|
||||
default: return ""; // null
|
||||
}
|
||||
}
|
||||
|
@ -316,6 +330,20 @@ char* getBasicItemName(int itemID, int countLevel) {
|
|||
}
|
||||
case TOOL_BOW: return "Bow";
|
||||
case TOOL_MAGIC_COMPASS: return "Magic Compass";
|
||||
case TOOL_CLAYMORE:
|
||||
switch(countLevel){
|
||||
case 1: return "Rock Claymore";
|
||||
case 2: return "Iron Claymore";
|
||||
case 3: return "Gold Claymore";
|
||||
case 4: return "Gem Claymore";
|
||||
default: return "Wood Claymore";
|
||||
}
|
||||
case ITEM_TORCH: return "Torch";
|
||||
case ITEM_BED: return "Bed";
|
||||
case ITEM_FISHING_ROD: return "Fishing Rod";
|
||||
case ITEM_SHEARS: return "Shears";
|
||||
case ITEM_FISH_RAW: return "Fish";
|
||||
case ITEM_FISH_COOKED: return "Cooked Fish";
|
||||
default: return ""; // null
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
#define ITEM_LOOM 34
|
||||
#define ITEM_ENCHANTER 35
|
||||
#define ITEM_POTION_MAKER 36
|
||||
#define TOOL_CLAYMORE 37
|
||||
#define ITEM_TORCH 38
|
||||
#define ITEM_BED 39
|
||||
|
||||
#define ITEM_WALL_WOOD 51
|
||||
#define ITEM_WALL_STONE 52
|
||||
|
@ -77,10 +80,14 @@
|
|||
#define ITEM_SPEED_POTION 78
|
||||
#define ITEM_REGEN_POTION 79
|
||||
#define ITEM_SWIM_BREATH_POTION 80
|
||||
#define ITEM_FISH_RAW 81
|
||||
#define ITEM_FISH_COOKED 82
|
||||
|
||||
#define TOOL_BUCKET 101
|
||||
#define TOOL_BOW 102
|
||||
#define TOOL_MAGIC_COMPASS 103
|
||||
#define ITEM_FISHING_ROD 104
|
||||
#define ITEM_SHEARS 105
|
||||
|
||||
#define ARMOR_TEST 120
|
||||
|
||||
|
|
|
@ -875,4 +875,3 @@ void createDungeonRoom(int w, int h, bool dragon, int level, u8 * map, u8 * data
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
115
source/Menu.c
115
source/Menu.c
|
@ -16,7 +16,7 @@ int keys[] = {
|
|||
KEY_L,KEY_R,KEY_ZL,KEY_ZR,
|
||||
KEY_START,KEY_SELECT
|
||||
};
|
||||
int keyProp[12] = {[0 ... 11] = 0};
|
||||
int keyProp[14] = {[0 ... 13] = 0};
|
||||
bool areYouSure = false;
|
||||
bool areYouSureSave = false;
|
||||
bool bindOpt = false;
|
||||
|
@ -218,46 +218,49 @@ void doTouchButton(){
|
|||
|
||||
void switchGameBut(bool left, int buttonID){
|
||||
int id;
|
||||
for(id = 0; id < 7; ++id){
|
||||
for(id = 0; id < 13; ++id){
|
||||
if(id > 8 && id < 12) continue;
|
||||
if(keyProp[id] & buttonID){
|
||||
keyProp[id] ^= buttonID; // Toggle buttonID bit
|
||||
if(left){
|
||||
int id2 = id - 1;
|
||||
if (id2 == 11) id2 = 8;
|
||||
if (id2 < 0) return;
|
||||
keyProp[id2] ^= buttonID;
|
||||
} else {
|
||||
int id2 = id+1;
|
||||
if (id2 > 6) return;
|
||||
if (id2 == 9) id2 = 12;
|
||||
if (id2 > 13) return;
|
||||
keyProp[id2] ^= buttonID;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(left) keyProp[6] ^= buttonID;
|
||||
if(left) keyProp[13] ^= buttonID;
|
||||
else keyProp[0] ^= buttonID;
|
||||
|
||||
}
|
||||
void switchMenuBut(bool left, int buttonID){
|
||||
int id;
|
||||
for(id = 0; id < 12; ++id){
|
||||
if(id > 3 && id < 7) continue;
|
||||
for(id = 0; id < 13; ++id){
|
||||
if(id > 3 && id < 9) continue;
|
||||
if(keyProp[id] & buttonID){
|
||||
keyProp[id] ^= buttonID; // Toggle buttonID bit
|
||||
if(left){
|
||||
int id2 = id - 1;
|
||||
if (id2 == 6) id2 = 3;
|
||||
if (id2 == 8) id2 = 3;
|
||||
if (id2 < 0) return;
|
||||
keyProp[id2] ^= buttonID;
|
||||
} else {
|
||||
int id2 = id+1;
|
||||
if (id2 == 4) id2 = 7;
|
||||
if (id2 > 11) return;
|
||||
if (id2 == 4) id2 = 9;
|
||||
if (id2 > 13) return;
|
||||
keyProp[id2] ^= buttonID;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(left) keyProp[11] ^= buttonID;
|
||||
if(left) keyProp[13] ^= buttonID;
|
||||
else keyProp[0] ^= buttonID;
|
||||
}
|
||||
|
||||
|
@ -274,6 +277,8 @@ s8 checkPropButtons(){
|
|||
if(keyProp[9] == 0) return 9;
|
||||
if(keyProp[10] == 0) return 10;
|
||||
if(keyProp[11] == 0) return 11;
|
||||
if(keyProp[12] == 0) return 12;
|
||||
if(keyProp[13] == 0) return 13;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -340,16 +345,18 @@ void tickMenu(int menu){
|
|||
localInputs.k_left.input = keyProp[2];
|
||||
localInputs.k_right.input = keyProp[3];
|
||||
localInputs.k_attack.input = keyProp[4];
|
||||
localInputs.k_menu.input = keyProp[5];
|
||||
localInputs.k_pause.input = keyProp[6];
|
||||
localInputs.k_accept.input = keyProp[7];
|
||||
localInputs.k_decline.input = keyProp[8];
|
||||
localInputs.k_delete.input = keyProp[9];
|
||||
localInputs.k_menuNext.input = keyProp[10];
|
||||
localInputs.k_menuPrev.input = keyProp[11];
|
||||
localInputs.k_pickup.input = keyProp[5];
|
||||
localInputs.k_use.input = keyProp[6];
|
||||
localInputs.k_menu.input = keyProp[7];
|
||||
localInputs.k_pause.input = keyProp[8];
|
||||
localInputs.k_accept.input = keyProp[9];
|
||||
localInputs.k_decline.input = keyProp[10];
|
||||
localInputs.k_delete.input = keyProp[11];
|
||||
localInputs.k_menuNext.input = keyProp[12];
|
||||
localInputs.k_menuPrev.input = keyProp[13];
|
||||
|
||||
FILE *fs=fopen("btnSave.bin","wb");
|
||||
fwrite(keyProp,sizeof(int),12,fs);
|
||||
fwrite(keyProp,sizeof(keyProp),1,fs);
|
||||
fclose(fs);
|
||||
|
||||
currentSelection = 0;
|
||||
|
@ -367,14 +374,16 @@ void tickMenu(int menu){
|
|||
keyProp[1] = KEY_DDOWN | KEY_CPAD_DOWN | KEY_CSTICK_DOWN;
|
||||
keyProp[2] = KEY_DLEFT | KEY_CPAD_LEFT | KEY_CSTICK_LEFT;
|
||||
keyProp[3] = KEY_DRIGHT | KEY_CPAD_RIGHT | KEY_CSTICK_RIGHT;
|
||||
keyProp[4] = KEY_A | KEY_B | KEY_L | KEY_ZR;
|
||||
keyProp[5] = KEY_X | KEY_Y | KEY_R | KEY_ZL;
|
||||
keyProp[6] = KEY_START;
|
||||
keyProp[7] = KEY_A;
|
||||
keyProp[8] = KEY_B;
|
||||
keyProp[9] = KEY_X;
|
||||
keyProp[10] = KEY_R;
|
||||
keyProp[11] = KEY_L;
|
||||
keyProp[4] = KEY_A;
|
||||
keyProp[5] = KEY_B;
|
||||
keyProp[6] = KEY_X;
|
||||
keyProp[7] = KEY_Y ;
|
||||
keyProp[8] = KEY_START;
|
||||
keyProp[9] = KEY_A;
|
||||
keyProp[10] = KEY_B;
|
||||
keyProp[11] = KEY_X;
|
||||
keyProp[12] = KEY_R | KEY_ZR;
|
||||
keyProp[13] = KEY_L | KEY_ZL;
|
||||
bindOpt = false;
|
||||
errorBut = -1;
|
||||
break;
|
||||
|
@ -490,7 +499,7 @@ void tickMenu(int menu){
|
|||
if(currentSelection > 0){
|
||||
isLoadingTP = 4;
|
||||
} else {
|
||||
icons = sfil_load_PNG_buffer(icons2_png, SF2D_PLACE_RAM);
|
||||
icons = sfil_load_PNG_buffer(icons_png, SF2D_PLACE_RAM);
|
||||
reloadColors();
|
||||
font = sfil_load_PNG_buffer(Font_png, SF2D_PLACE_RAM);
|
||||
bottombg = sfil_load_PNG_buffer(bottombg_png, SF2D_PLACE_RAM);
|
||||
|
@ -524,13 +533,15 @@ void tickMenu(int menu){
|
|||
keyProp[2] = localInputs.k_left.input;
|
||||
keyProp[3] = localInputs.k_right.input;
|
||||
keyProp[4] = localInputs.k_attack.input;
|
||||
keyProp[5] = localInputs.k_menu.input;
|
||||
keyProp[6] = localInputs.k_pause.input;
|
||||
keyProp[7] = localInputs.k_accept.input;
|
||||
keyProp[8] = localInputs.k_decline.input;
|
||||
keyProp[9] = localInputs.k_delete.input;
|
||||
keyProp[10] = localInputs.k_menuNext.input;
|
||||
keyProp[11] = localInputs.k_menuPrev.input;
|
||||
keyProp[5] = localInputs.k_pickup.input;
|
||||
keyProp[6] = localInputs.k_use.input;
|
||||
keyProp[7] = localInputs.k_menu.input;
|
||||
keyProp[8] = localInputs.k_pause.input;
|
||||
keyProp[9] = localInputs.k_accept.input;
|
||||
keyProp[10] = localInputs.k_decline.input;
|
||||
keyProp[11] = localInputs.k_delete.input;
|
||||
keyProp[12] = localInputs.k_menuNext.input;
|
||||
keyProp[13] = localInputs.k_menuPrev.input;
|
||||
left = true;
|
||||
selBut = false;
|
||||
bindOpt = false;
|
||||
|
@ -716,8 +727,12 @@ char * getButtonFunctionGame(int key){
|
|||
if(keyProp[2] & key) return "Move left";
|
||||
if(keyProp[3] & key) return "Move right";
|
||||
if(keyProp[4] & key) return "Attack";
|
||||
if(keyProp[5] & key) return "Toggle Menu";
|
||||
if(keyProp[6] & key) return "Pause";
|
||||
if(keyProp[5] & key) return "Pick up";
|
||||
if(keyProp[6] & key) return "Use";
|
||||
if(keyProp[7] & key) return "Toggle Menu";
|
||||
if(keyProp[8] & key) return "Pause";
|
||||
if(keyProp[12] & key) return "Next";
|
||||
if(keyProp[13] & key) return "Previous";
|
||||
return "Nothing";
|
||||
}
|
||||
char * getButtonFunctionMenu(int key){
|
||||
|
@ -725,11 +740,11 @@ char * getButtonFunctionMenu(int key){
|
|||
if(keyProp[1] & key) return "Down";
|
||||
if(keyProp[2] & key) return "Left";
|
||||
if(keyProp[3] & key) return "Right";
|
||||
if(keyProp[7] & key) return "Accept";
|
||||
if(keyProp[8] & key) return "Decline";
|
||||
if(keyProp[9] & key) return "Delete";
|
||||
if(keyProp[10] & key) return "Next";
|
||||
if(keyProp[11] & key) return "Previous";
|
||||
if(keyProp[9] & key) return "Accept";
|
||||
if(keyProp[10] & key) return "Decline";
|
||||
if(keyProp[11] & key) return "Delete";
|
||||
if(keyProp[12] & key) return "Next";
|
||||
if(keyProp[13] & key) return "Previous";
|
||||
return "Nothing";
|
||||
}
|
||||
|
||||
|
@ -954,7 +969,7 @@ void renderMenu(int menu,int xscr,int yscr){
|
|||
drawText("Press to return", 98, 190);
|
||||
renderButtonIcon(localInputs.k_decline.input & -localInputs.k_decline.input, 168, 188, 1);
|
||||
|
||||
if(errorBut >= 0 && errorBut < 12){
|
||||
if(errorBut >= 0 && errorBut < 14){
|
||||
char errorText[30];
|
||||
switch(errorBut){
|
||||
case 0: sprintf(errorText, "Error: Missing 'Move up'"); break;
|
||||
|
@ -962,13 +977,15 @@ void renderMenu(int menu,int xscr,int yscr){
|
|||
case 2: sprintf(errorText, "Error: Missing 'Move right'"); break;
|
||||
case 3: sprintf(errorText, "Error: Missing 'Move left'"); break;
|
||||
case 4: sprintf(errorText, "Error: Missing 'Attack'"); break;
|
||||
case 5: sprintf(errorText, "Error: Missing 'Toggle Menu'"); break;
|
||||
case 6: sprintf(errorText, "Error: Missing 'Pause'"); break;
|
||||
case 7: sprintf(errorText, "Error: Missing 'Accept'"); break;
|
||||
case 8: sprintf(errorText, "Error: Missing 'Decline'"); break;
|
||||
case 9: sprintf(errorText, "Error: Missing 'Delete'"); break;
|
||||
case 10: sprintf(errorText, "Error: Missing 'Next'"); break;
|
||||
case 11: sprintf(errorText, "Error: Missing 'Previous'"); break;
|
||||
case 5: sprintf(errorText, "Error: Missing 'Pick up'"); break;
|
||||
case 6: sprintf(errorText, "Error: Missing 'Use'"); break;
|
||||
case 7: sprintf(errorText, "Error: Missing 'Toggle Menu'"); break;
|
||||
case 8: sprintf(errorText, "Error: Missing 'Pause'"); break;
|
||||
case 9: sprintf(errorText, "Error: Missing 'Accept'"); break;
|
||||
case 10: sprintf(errorText, "Error: Missing 'Decline'"); break;
|
||||
case 11: sprintf(errorText, "Error: Missing 'Delete'"); break;
|
||||
case 12: sprintf(errorText, "Error: Missing 'Next'"); break;
|
||||
case 13: sprintf(errorText, "Error: Missing 'Previous'"); break;
|
||||
}
|
||||
drawTextColor(errorText,(400 - (strlen(errorText) * 12))/2,50,0xFF0000FF);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void networkHandleRecieve() {
|
|||
actualSize -= sizeof(u16);
|
||||
|
||||
//if the seq id was expected handle the packet
|
||||
u32 nextID = networkSeqRecvLast[sourceNetworkNodeID]+1;
|
||||
u16 nextID = networkGetExpectedSeqFrom(sourceNetworkNodeID);
|
||||
if(seqID==nextID) {
|
||||
networkSeqRecvLast[sourceNetworkNodeID] = seqID;
|
||||
ackToSend = seqID;
|
||||
|
@ -117,8 +117,8 @@ void networkHandleRecieve() {
|
|||
} else {
|
||||
processPacket(readPointer, size);
|
||||
}
|
||||
} else if(seqID<=nextID-1) {
|
||||
ackToSend = nextID-1;
|
||||
} else if(networkSeqIsLowerThan(seqID, nextID)) {
|
||||
ackToSend = seqID;
|
||||
}
|
||||
readPointer += size;
|
||||
actualSize -= size;
|
||||
|
@ -527,6 +527,24 @@ bool networkGetNodeName(u16 id, char *name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
u16 networkGetExpectedSeqFrom(u16 id) {
|
||||
u16 nextID = networkSeqRecvLast[id];
|
||||
nextID += 1;
|
||||
if(nextID==0) {
|
||||
nextID = 1;
|
||||
}
|
||||
return nextID;
|
||||
}
|
||||
|
||||
bool networkSeqIsLowerThan(u16 firstID, u16 secondID) {
|
||||
if (secondID < 100) {
|
||||
return (firstID < secondID) || (firstID > 65536-100);
|
||||
} else if (secondID > 65536-100) {
|
||||
return (firstID < secondID) && (firstID > 100);
|
||||
} else {
|
||||
return (firstID < secondID);
|
||||
}
|
||||
}
|
||||
|
||||
int fitInSendBuffer(size_t size) {
|
||||
//add "header" length
|
||||
|
|
|
@ -40,5 +40,8 @@ u16 networkGetLocalNodeID();
|
|||
bool networkIsNodeConnected(u16 id);
|
||||
bool networkGetNodeName(u16 id, char *name);
|
||||
|
||||
u16 networkGetExpectedSeqFrom(u16 id);
|
||||
bool networkSeqIsLowerThan(u16 firstID, u16 secondID);
|
||||
|
||||
void networkSend(void *packet, size_t size);
|
||||
void networkSendWaitFlush();
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
FILE *recvFile;
|
||||
size_t recvFileSize;
|
||||
|
||||
|
||||
|
||||
|
||||
void * writeBool(void *buffer, size_t *size, bool value) {
|
||||
*((bool*) buffer) = value;
|
||||
*(size) += sizeof(bool);
|
||||
|
@ -38,9 +35,6 @@ void * writeSizeT(void *buffer, size_t *size, size_t value) {
|
|||
return buffer + sizeof(size_t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void * readBool(void *buffer, size_t *size, bool *value) {
|
||||
*value = *((bool*) buffer);
|
||||
*(size) -= sizeof(bool);
|
||||
|
@ -71,9 +65,6 @@ void * readSizeT(void *buffer, size_t *size, size_t *value) {
|
|||
return buffer + sizeof(size_t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void processPacket(void *packet, size_t size) {
|
||||
//Differenciate the packets and process them
|
||||
switch(packetGetID(packet)) {
|
||||
|
@ -202,9 +193,6 @@ size_t packetGetDataSize(size_t size) {
|
|||
return size-sizeof(u8)-sizeof(u8)-sizeof(u32);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
size_t writeStartPacket(void *buffer, u32 seed) {
|
||||
size_t size = 0;
|
||||
buffer = writeU8(buffer, &size, PACKET_START);
|
||||
|
@ -245,6 +233,8 @@ size_t writeInputPacket(void *buffer, Inputs *inputs, u8 playerID, u32 turnNumbe
|
|||
buffer = writeBool(buffer, &size, inputs->k_left.down); buffer = writeBool(buffer, &size, inputs->k_left.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_right.down); buffer = writeBool(buffer, &size, inputs->k_right.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_attack.down); buffer = writeBool(buffer, &size, inputs->k_attack.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_pickup.down); buffer = writeBool(buffer, &size, inputs->k_pickup.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_use.down); buffer = writeBool(buffer, &size, inputs->k_use.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_menu.down); buffer = writeBool(buffer, &size, inputs->k_menu.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_pause.down); buffer = writeBool(buffer, &size, inputs->k_pause.clicked);
|
||||
buffer = writeBool(buffer, &size, inputs->k_accept.down); buffer = writeBool(buffer, &size, inputs->k_accept.clicked);
|
||||
|
@ -272,6 +262,10 @@ bool readInputPacketData(void *buffer, size_t size, Inputs *inputs) {
|
|||
if(size<=0) return false;
|
||||
buffer = readBool(buffer, &size, &(inputs->k_attack.down)); buffer = readBool(buffer, &size, &(inputs->k_attack.clicked));
|
||||
if(size<=0) return false;
|
||||
buffer = readBool(buffer, &size, &(inputs->k_pickup.down)); buffer = readBool(buffer, &size, &(inputs->k_pickup.clicked));
|
||||
if(size<=0) return false;
|
||||
buffer = readBool(buffer, &size, &(inputs->k_use.down)); buffer = readBool(buffer, &size, &(inputs->k_use.clicked));
|
||||
if(size<=0) return false;
|
||||
buffer = readBool(buffer, &size, &(inputs->k_menu.down)); buffer = readBool(buffer, &size, &(inputs->k_menu.clicked));
|
||||
if(size<=0) return false;
|
||||
buffer = readBool(buffer, &size, &(inputs->k_pause.down)); buffer = readBool(buffer, &size, &(inputs->k_pause.clicked));
|
||||
|
|
|
@ -61,10 +61,9 @@ void playerInitInventory(PlayerData *pd) {
|
|||
pd->inventory.lastSlot = 0;
|
||||
pd->activeItem = &noItem;
|
||||
|
||||
addItemToInventory(newItem(ITEM_WORKBENCH,0), &(pd->inventory));
|
||||
if(shouldRenderDebug && playerCount < 2) {
|
||||
addItemToInventory(newItem(ITEM_POWGLOVE,0), &(pd->inventory));
|
||||
|
||||
if(shouldRenderDebug && playerCount < 1) {
|
||||
addItemToInventory(newItem(ITEM_WORKBENCH,0), &(pd->inventory));
|
||||
addItemToInventory(newItem(ITEM_GOLD_APPLE,1), &(pd->inventory));
|
||||
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), &(pd->inventory));
|
||||
addItemToInventory(newItem(ITEM_REGEN_POTION,1), &(pd->inventory));
|
||||
|
@ -506,6 +505,81 @@ void tickPlayer(PlayerData *pd, bool inmenu) {
|
|||
}
|
||||
}
|
||||
|
||||
//picking up furniture
|
||||
if(pd->inputs.k_pickup.clicked){
|
||||
if (pd->entity.p.isCarrying){
|
||||
if (pd->entity.p.stamina != 0) {
|
||||
if(!shouldRenderDebug) pd->entity.p.stamina--;
|
||||
pd->entity.p.staminaRecharge = 0;
|
||||
playerAttack(pd);
|
||||
}
|
||||
}else{
|
||||
int yo = -2;
|
||||
int range = 12;
|
||||
// see if entity near player
|
||||
int x0, y0, x1, y1 = 0;
|
||||
switch(pd->entity.p.dir){
|
||||
case 0:
|
||||
x0 = pd->entity.x - 8;
|
||||
y0 = pd->entity.y + 4 + yo;
|
||||
x1 = pd->entity.x + 8;
|
||||
y1 = pd->entity.y + range + yo;
|
||||
break;
|
||||
case 1:
|
||||
x0 = pd->entity.x - 8;
|
||||
y0 = pd->entity.y - range + yo;
|
||||
x1 = pd->entity.x + 8;
|
||||
y1 = pd->entity.y - 4 + yo;
|
||||
break;
|
||||
case 2:
|
||||
x0 = pd->entity.x - range;
|
||||
y0 = pd->entity.y - 8 + yo;
|
||||
x1 = pd->entity.x - 4;
|
||||
y1 = pd->entity.y + 8 + yo;
|
||||
break;
|
||||
case 3:
|
||||
x0 = pd->entity.x + 4;
|
||||
y0 = pd->entity.y - 8 + yo;
|
||||
x1 = pd->entity.x + range;
|
||||
y1 = pd->entity.y + 8 + yo;
|
||||
break;
|
||||
}
|
||||
Entity * es[eManager.lastSlot[pd->entity.level]];
|
||||
int eSize = getEntities(es, pd->entity.level, x0, y0, x1, y1);
|
||||
int i;
|
||||
for (i = 0; i < eSize; ++i) {
|
||||
Entity * ent = es[i];
|
||||
if (ent != &(pd->entity)){
|
||||
if(ent->type == ENTITY_FURNITURE){
|
||||
//Important: close all crafting windows using this furniture (only applies to chest) or else they will write invalid memory
|
||||
for(int i=0; i<playerCount; i++) {
|
||||
if(players[i].curChestEntity==ent) {
|
||||
players[i].ingameMenu = MENU_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
Item nItem = newItem(ent->entityFurniture.itemID,0);
|
||||
if(ent->entityFurniture.itemID == ITEM_CHEST) nItem.chestPtr = ent->entityFurniture.inv;
|
||||
pushItemToInventoryFront(nItem, &(pd->inventory));
|
||||
|
||||
removeEntityFromList(ent, ent->level, &eManager);
|
||||
pd->activeItem = &(pd->inventory.items[0]);
|
||||
pd->entity.p.isCarrying = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// in head crafting
|
||||
if(pd->inputs.k_use.clicked){
|
||||
pd->ingameMenuInvSel = 0;
|
||||
if(!playerUse(pd)){
|
||||
pd->currentCraftTitle = "Crafting";
|
||||
openCraftingMenu(pd, &inHeadRecipes, "Crafting");
|
||||
}
|
||||
}
|
||||
|
||||
if (pd->inputs.k_menu.clicked){
|
||||
pd->ingameMenuInvSel = 0;
|
||||
if(!playerUse(pd)) pd->ingameMenu = MENU_INVENTORY;
|
||||
|
|
|
@ -1118,7 +1118,7 @@ void renderFurniture(int itemID, int x, int y) {
|
|||
render16(x, y, 240, 128, 0);
|
||||
break;
|
||||
case ITEM_POTION_MAKER:
|
||||
render16(x, y, 240, 96, 0);
|
||||
render16(x, y, 192, 168, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1523,7 +1523,7 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
|||
render(x, y, 0, 152, 0);
|
||||
break;
|
||||
case ITEM_WOOD:
|
||||
render(x, y, 8, 152, 0);
|
||||
render(x, y, 160, 168, 0);
|
||||
break;
|
||||
case ITEM_STONE:
|
||||
renderb(x, y, 16, 152, 0, rockColor[1]);
|
||||
|
@ -1559,19 +1559,19 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
|||
render(x, y, 80, 152, 0);
|
||||
break;
|
||||
case ITEM_GOLD_APPLE:
|
||||
render(x, y, 177, 160, 0);
|
||||
render(x, y, 144, 168, 0);
|
||||
break;
|
||||
case ITEM_STRENGTH_POTION:
|
||||
render(x, y, 184, 160, 0);
|
||||
render(x, y, 176, 160, 0);
|
||||
break;
|
||||
case ITEM_SPEED_POTION:
|
||||
render(x, y, 191, 160, 0);
|
||||
render(x, y, 184, 160, 0);
|
||||
break;
|
||||
case ITEM_REGEN_POTION:
|
||||
render(x, y, 198, 160, 0);
|
||||
render(x, y, 192, 160, 0);
|
||||
break;
|
||||
case ITEM_SWIM_BREATH_POTION:
|
||||
render(x, y, 219, 160, 0);
|
||||
render(x, y, 200, 160, 0);
|
||||
break;
|
||||
case ITEM_SLIME:
|
||||
renderb(x, y, 88, 152, 0, 0xFF4DC04D);
|
||||
|
@ -1604,7 +1604,7 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
|||
render(x, y, 144, 160, 0);
|
||||
break;
|
||||
case ITEM_POTION_MAKER:
|
||||
render(x, y, 216, 152, 0);
|
||||
render(x, y, 192, 168, 0);
|
||||
break;
|
||||
case ITEM_WALL_WOOD:
|
||||
renderb(x, y, 224, 144, 0, woodColor);
|
||||
|
@ -1698,5 +1698,26 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
|||
else render(x, y, 136, 168, 0);
|
||||
}
|
||||
break;
|
||||
case TOOL_CLAYMORE:
|
||||
render(x, y, countLevel * 8, 176, 0);
|
||||
break;
|
||||
case ITEM_TORCH:
|
||||
render(x, y, 168, 168, 0);
|
||||
break;
|
||||
case ITEM_BED:
|
||||
render(x, y, 176, 168, 0);
|
||||
break;
|
||||
case ITEM_SHEARS:
|
||||
render(x, y, 40, 176, 0);
|
||||
break;
|
||||
case ITEM_FISHING_ROD:
|
||||
render(x, y, 48, 176, 0);
|
||||
break;
|
||||
case ITEM_FISH_RAW:
|
||||
render(x, y, 56, 176, 0);
|
||||
break;
|
||||
case ITEM_FISH_COOKED:
|
||||
render(x, y, 64, 176, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ void loadSound(Sound * snd, char * filename){
|
|||
FILE *file = fopen(filename, "rb");
|
||||
if(file != NULL){
|
||||
fseek(file, 0, SEEK_END);
|
||||
snd->size = ftell(file);
|
||||
snd->size = ftell(file)/2;
|
||||
fseek(file, 0, SEEK_SET);
|
||||
snd->buffer = linearAlloc(snd->size);
|
||||
snd->buffer = linearAlloc(snd->size*sizeof(u16));
|
||||
fread(snd->buffer, 1, snd->size, file);
|
||||
}
|
||||
fclose(file);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
//TODO: Something still causes desyncs very rarely
|
||||
|
||||
static aptHookCookie cookie;
|
||||
|
||||
void setupGame() {
|
||||
synchronizerInit(rand(), 1, 0);
|
||||
synchronizerSetPlayerUID(0, localUID);
|
||||
|
@ -77,6 +79,16 @@ void setupBGMap() {
|
|||
|
||||
initBGMap = 0;
|
||||
}
|
||||
static void task_apt_hook(APT_HookType hook, void* param) {
|
||||
switch(hook) {
|
||||
case APTHOOK_ONSUSPEND:
|
||||
paused = true;
|
||||
stopMusic();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for rendering -> move to a better place
|
||||
|
@ -123,7 +135,7 @@ int main() {
|
|||
quitGame = false;
|
||||
initBGMap = 1;
|
||||
|
||||
icons = sfil_load_PNG_buffer(icons2_png, SF2D_PLACE_RAM);
|
||||
icons = sfil_load_PNG_buffer(icons_png, SF2D_PLACE_RAM);
|
||||
playerSprites = sfil_load_PNG_buffer(player_png, SF2D_PLACE_RAM);
|
||||
font = sfil_load_PNG_buffer(Font_png, SF2D_PLACE_RAM);
|
||||
bottombg = sfil_load_PNG_buffer(bottombg_png, SF2D_PLACE_RAM);
|
||||
|
@ -151,14 +163,16 @@ int main() {
|
|||
localInputs.k_down.input = KEY_DDOWN | KEY_CPAD_DOWN | KEY_CSTICK_DOWN;
|
||||
localInputs.k_left.input = KEY_DLEFT | KEY_CPAD_LEFT | KEY_CSTICK_LEFT;
|
||||
localInputs.k_right.input = KEY_DRIGHT | KEY_CPAD_RIGHT | KEY_CSTICK_RIGHT;
|
||||
localInputs.k_attack.input = KEY_A | KEY_B | KEY_L | KEY_ZR;
|
||||
localInputs.k_menu.input = KEY_X | KEY_Y | KEY_R | KEY_ZL;
|
||||
localInputs.k_attack.input = KEY_A;
|
||||
localInputs.k_pickup.input = KEY_B;
|
||||
localInputs.k_use.input = KEY_X;
|
||||
localInputs.k_menu.input = KEY_Y ;
|
||||
localInputs.k_pause.input = KEY_START;
|
||||
localInputs.k_accept.input = KEY_A;
|
||||
localInputs.k_decline.input = KEY_B;
|
||||
localInputs.k_delete.input = KEY_X;
|
||||
localInputs.k_menuNext.input = KEY_R;
|
||||
localInputs.k_menuPrev.input = KEY_L;
|
||||
localInputs.k_menuNext.input = KEY_R | KEY_ZR;
|
||||
localInputs.k_menuPrev.input = KEY_L | KEY_ZL;
|
||||
|
||||
/* If btnSave exists, then use that. */
|
||||
if ((file = fopen("btnSave.bin", "rb"))) {
|
||||
|
@ -167,6 +181,8 @@ int main() {
|
|||
fread(&(localInputs.k_left.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_right.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_attack.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_pickup.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_use.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_menu.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_pause.input), sizeof(int), 1, file);
|
||||
fread(&(localInputs.k_accept.input), sizeof(int), 1, file);
|
||||
|
@ -188,7 +204,9 @@ int main() {
|
|||
initPlayers();
|
||||
initRecipes();
|
||||
initTrades();
|
||||
aptHook(&cookie, task_apt_hook, NULL);
|
||||
while (aptMainLoop()) {
|
||||
if (paused == true) playMusic(&music_menu);
|
||||
if (quitGame) break;
|
||||
|
||||
if (initGame > 0 && --initGame==0) setupGame();
|
||||
|
|
|
@ -89,7 +89,7 @@ int loadTexturePack(char * filename) {
|
|||
}
|
||||
|
||||
if(texturepackUseDefaultIcons){
|
||||
icons = sfil_load_PNG_buffer(icons2_png, SF2D_PLACE_RAM);
|
||||
icons = sfil_load_PNG_buffer(icons_png, SF2D_PLACE_RAM);
|
||||
reloadColors();
|
||||
}
|
||||
if(texturepackUseDefaultPlayer) playerSprites = sfil_load_PNG_buffer(player_png, SF2D_PLACE_RAM);
|
||||
|
|
Loading…
Add table
Reference in a new issue