diff --git a/data/bottombg.png b/data/bottombg.png index 33a08a4..0c174bf 100644 Binary files a/data/bottombg.png and b/data/bottombg.png differ diff --git a/source/Globals.c b/source/Globals.c index 1b5bf2f..21b8c9b 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -192,12 +192,31 @@ void tickTouchMap(){ } } else { // touch minimap to bring up zoomed map. - if(k_touch.py > 100 && k_touch.py < 228 && k_touch.px > 96 && k_touch.px < 228){ + if(k_touch.py > 100 && k_touch.py < 228 && k_touch.px > 10 && k_touch.px < 142){ shouldRenderMap = true; } } } +void tickTouchQuickSelect() { + if (currentMenu == 0) { + int i = 0; + Inventory * inv = player.p.inv; + Item * item; + + for (i = 0; i < 8; ++i) { + if((inv->lastSlot) > i) { + int xip = i % 4; + int yip = i / 4; + + if(k_touch.py > 72*2+yip*21*2 && k_touch.py < 72*2+yip*21*2+21*2 && k_touch.px > 76*2+xip*21*2 && k_touch.px < 76*2+xip*21*2+21*2) { + playerSetActiveItem(&inv->items[i]); + } + } + } + } +} + void hurtEntity(Entity* e, int damage, int dir, u32 hurtColor){ if (e->hurtTime > 0) return; int xd = player.x - e->x; @@ -1461,6 +1480,12 @@ bool isSwimming(){ return getTile(player.x>>4,player.y>>4)==TILE_WATER; } +void playerSetActiveItem(Item * item) { + player.p.activeItem = item; + if(player.p.activeItem->id > 27 && player.p.activeItem->id < 34) player.p.isCarrying = true; + else player.p.isCarrying = false; +} + void reloadColors() { dirtColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 16, 0)); dirtColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 16, 1)); diff --git a/source/Globals.h b/source/Globals.h index be50ad1..ba4a0f8 100644 --- a/source/Globals.h +++ b/source/Globals.h @@ -105,6 +105,7 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) void tickEntity(Entity* e); void tickTouchMap(); +void tickTouchQuickSelect(); void trySpawn(int count, int level); @@ -128,5 +129,6 @@ bool playerUseEnergy(int amount); void playerHurtTile(int tile, int xt, int yt, int damage, int dir); bool playerIntersectsEntity(Entity* e); void playerEntityInteract(Entity* e); +void playerSetActiveItem(Item * item); void reloadColors(); \ No newline at end of file diff --git a/source/Menu.c b/source/Menu.c index 7a49e77..6bd9951 100644 --- a/source/Menu.c +++ b/source/Menu.c @@ -409,9 +409,7 @@ void tickMenu(int menu){ median = player.p.inv->items[curInvSel]; // create copy of item. removeItemFromInventory(curInvSel, player.p.inv); // remove original pushItemToInventoryFront(median, player.p.inv); // add copy to front - player.p.activeItem = &player.p.inv->items[0]; // active item = copy. - if(player.p.activeItem->id > 27 && player.p.activeItem->id < 34) player.p.isCarrying = true; - else player.p.isCarrying = false; + playerSetActiveItem(&player.p.inv->items[0]); // active item = copy. } currentMenu = MENU_NONE; } diff --git a/source/Render.c b/source/Render.c index 2f5601b..921989b 100644 --- a/source/Render.c +++ b/source/Render.c @@ -626,15 +626,30 @@ void renderGui() { else render(i * 8 + 6, 14, 191, 152, 0); } - sf2d_draw_texture(minimap[currentLevel], 96, 102); + sf2d_draw_texture(minimap[currentLevel], 10, 102); renderItemWithTextCentered(player.p.activeItem, 320, 66); itoa(player.p.score, scoreT, 10); // integer to base10 string drawText("Score:",214,12); drawText(scoreT,(140-(strlen(scoreT)*12))/2 + 180,29); if(currentLevel == 0){ - renderc(44 + (awX/32), 47 + (awY/32), 88, 216, 8, 8, 0); // Mini-AWizard head. + renderc(1 + (awX/32), 47 + (awY/32), 88, 216, 8, 8, 0); // Mini-AWizard head. } - renderc(44 + (player.x/32), 47 + (player.y/32), 88, 208, 8, 8, 0); // Mini-Player head. + renderc(1 + (player.x/32), 47 + (player.y/32), 88, 208, 8, 8, 0); // Mini-Player head. + + //quick select + drawText("Quickselect:",164,118); + + Inventory * inv = player.p.inv; + Item * item; + for (i = 0; i < 8; ++i) { + if((inv->lastSlot) > i) { + int xip = i % 4; + int yip = i / 4; + + item = &inv->items[i]; + renderItemIcon(item->id, item->countLevel, 81+xip*21, 77+yip*21); + } + } } void renderPlayer() { diff --git a/source/main.c b/source/main.c index cee125a..fcf2853 100644 --- a/source/main.c +++ b/source/main.c @@ -110,6 +110,7 @@ void tick() { } tickTouchMap(); + tickTouchQuickSelect(); int i; for (i = 0; i < 324; ++i) {