From f039485e9c4864962188d64cb1891c719fc0d5da Mon Sep 17 00:00:00 2001 From: DavidSM64 Date: Sun, 15 Nov 2015 22:38:00 -0600 Subject: [PATCH] Fixed N3DS Speedup option not working --- source/Globals.c | 18 +++--------------- source/Menu.c | 8 ++++---- source/main.c | 2 ++ 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/source/Globals.c b/source/Globals.c index 018fb41..fe4457c 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -1,6 +1,6 @@ #include "Globals.h" -char versionText[34] = "BETA BUILD 5 (pre 1.0)"; +char versionText[34] = "BETA BUILD 5.01 (pre 1.0)"; char fpsstr[34]; u8 currentMenu = 0; @@ -553,11 +553,7 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) if(rand()%5==0)addEntityToList(newItemEntity(newItem(ITEM_SEEDS,1),(x<<4)+8, (y<<4)+8,currentLevel),&eManager); setTile(TILE_DIRT,x,y); return 1; - } - else if(item->id == ITEM_STONE){ - setTile(TILE_ROCK,x,y); - --item->countLevel; - }break; + } break; case TILE_SAND: if(item->id == ITEM_CACTUS){ setTile(TILE_SAPLING_CACTUS,x,y); @@ -568,12 +564,7 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) addEntityToList(newItemEntity(newItem(ITEM_SAND,1), (x<<4)+8, (y<<4)+8, currentLevel), &eManager); setTile(TILE_DIRT,x,y); return 1; - } - else if(item->id == ITEM_STONE){ - setTile(TILE_ROCK,x,y); - --item->countLevel; - } - break; + } break; case TILE_DIRT: if(item->id == TOOL_HOE && playerUseEnergy(4-item->countLevel)){ setTile(TILE_FARM,x,y); @@ -583,9 +574,6 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) addEntityToList(newItemEntity(newItem(ITEM_DIRT,1), (x<<4)+8, (y<<4)+8, currentLevel), &eManager); setTile(TILE_HOLE,x,y); return 1; - }else if(item->id == ITEM_STONE){ - setTile(TILE_ROCK,x,y); - --item->countLevel; } break; case TILE_HOLE: case TILE_WATER: diff --git a/source/Menu.c b/source/Menu.c index 38d1296..0cc7f0c 100644 --- a/source/Menu.c +++ b/source/Menu.c @@ -581,12 +581,12 @@ void tickMenu(int menu){ case MENU_SETTINGS: if (k_up.clicked){ --currentSelection; - if(currentSelection == 3 && !(MODEL_3DS & 6)) --currentSelection; + if(currentSelection == 3 && !((MODEL_3DS & 6) != 0)) --currentSelection; if(currentSelection < 0)currentSelection=4; } if (k_down.clicked){ ++currentSelection; - if(currentSelection == 3 && !(MODEL_3DS & 6)) ++currentSelection; + if(currentSelection == 3 && !((MODEL_3DS & 6) != 0)) ++currentSelection; if(currentSelection > 4)currentSelection=0; } if(k_decline.clicked){ @@ -623,7 +623,7 @@ void tickMenu(int menu){ shouldRenderDebug = !shouldRenderDebug; // toggle option break; case 3: - if(MODEL_3DS & 6){ // detect if user is using a New 3DS + if((MODEL_3DS & 6) != 0){ // detect if user is using a New 3DS shouldSpeedup = !shouldSpeedup; // toggle option osSetSpeedupEnable(shouldSpeedup); } @@ -1146,7 +1146,7 @@ void renderMenu(int menu,int xscr,int yscr){ else drawSizedTextColor("Off",142, ((8 + i) * 32 - 190) >> 1,2.0, 0xDF0000FF); } else if(i == 3){ - if(MODEL_3DS & 6){ // detect if user is using a New 3DS + if((MODEL_3DS & 6) != 0){ // detect if user is using a New 3DS if(shouldSpeedup) drawSizedTextColor("On",142, ((8 + i) * 32 - 190) >> 1,2.0, 0x00DF00FF); else drawSizedTextColor("Off",142, ((8 + i) * 32 - 190) >> 1,2.0, 0xDF0000FF); } else { diff --git a/source/main.c b/source/main.c index e640b01..e826b49 100644 --- a/source/main.c +++ b/source/main.c @@ -204,6 +204,7 @@ void clearScreen(int* data, u8 fill, int size) { char debugText[34]; char bossHealthText[34]; int main() { + initCfgu(); CFGU_GetSystemModel(&MODEL_3DS); FILE * file; shouldRenderDebug = true; @@ -357,6 +358,7 @@ int main() { sf2d_free_texture(minimap[4]); freeSounds(); csndExit(); + exitCfgu(); sf2d_fini(); return 0; }