lil' more work on armor, nothing shouuld be broke and stuff should build, but armor isnt ready yet.
This commit is contained in:
parent
ddbb771e89
commit
22fdd7acc7
5 changed files with 76 additions and 1 deletions
|
@ -29,6 +29,7 @@
|
||||||
#define MENU_DUNGEON 14
|
#define MENU_DUNGEON 14
|
||||||
#define MENU_NPC 15
|
#define MENU_NPC 15
|
||||||
#define MENU_MULTIPLAYER 16
|
#define MENU_MULTIPLAYER 16
|
||||||
|
#define MENU_ARMOR 17
|
||||||
|
|
||||||
#define NPC_GIRL 0
|
#define NPC_GIRL 0
|
||||||
#define NPC_PRIEST 1
|
#define NPC_PRIEST 1
|
||||||
|
|
|
@ -82,6 +82,8 @@
|
||||||
#define TOOL_BOW 102
|
#define TOOL_BOW 102
|
||||||
#define TOOL_MAGIC_COMPASS 103
|
#define TOOL_MAGIC_COMPASS 103
|
||||||
|
|
||||||
|
#define ARMOR_TEST 120
|
||||||
|
|
||||||
typedef struct Inventory Inventory;
|
typedef struct Inventory Inventory;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -445,6 +445,25 @@ void tickMenu(int menu){
|
||||||
if (k_down.clicked){ ++curInvSel; if(curInvSel > player.p.inv->lastSlot-1)curInvSel=0;}
|
if (k_down.clicked){ ++curInvSel; if(curInvSel > player.p.inv->lastSlot-1)curInvSel=0;}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_ARMOR:
|
||||||
|
if (k_delete.clicked || k_decline.clicked){
|
||||||
|
currentMenu = MENU_NONE;
|
||||||
|
player.p.activeItem = &noItem;
|
||||||
|
player.p.isCarrying = false;
|
||||||
|
}
|
||||||
|
if (k_accept.clicked){ // Select item from inventory
|
||||||
|
if(player.p.inv->lastSlot!=0){
|
||||||
|
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
|
||||||
|
playerSetActiveItem(&player.p.inv->items[0]); // active item = copy.
|
||||||
|
}
|
||||||
|
currentMenu = MENU_NONE;
|
||||||
|
}
|
||||||
|
if (k_up.clicked){ --curInvSel; if(curInvSel < 0)curInvSel=player.p.inv->lastSlot-1;}
|
||||||
|
if (k_down.clicked){ ++curInvSel; if(curInvSel > player.p.inv->lastSlot-1)curInvSel=0;}
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_CRAFTING:
|
case MENU_CRAFTING:
|
||||||
if (k_menu.clicked || k_decline.clicked) currentMenu = MENU_NONE;
|
if (k_menu.clicked || k_decline.clicked) currentMenu = MENU_NONE;
|
||||||
if (k_accept.clicked){
|
if (k_accept.clicked){
|
||||||
|
@ -1176,6 +1195,21 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
drawTextColor("Inventory",24,14,0xFF6FE2E2);
|
drawTextColor("Inventory",24,14,0xFF6FE2E2);
|
||||||
renderItemList(player.p.inv, 1,1,24,14, curInvSel);
|
renderItemList(player.p.inv, 1,1,24,14, curInvSel);
|
||||||
sf2d_end_frame();
|
sf2d_end_frame();
|
||||||
|
break;
|
||||||
|
case MENU_ARMOR:
|
||||||
|
sf2d_start_frame(GFX_TOP, GFX_LEFT);
|
||||||
|
if(currentLevel == 0){
|
||||||
|
sf2d_draw_texture_part_scale(minimap[1],(-xscr/3)-256,(-yscr/3)-32,0,0,128,128,12.5,7.5);
|
||||||
|
sf2d_draw_rectangle(0,0,400,240, 0xAFDFDFDF);
|
||||||
|
}
|
||||||
|
offsetX = xscr;offsetY = yscr;
|
||||||
|
renderMenuBackground(xscr,yscr);
|
||||||
|
offsetX = 0;offsetY = 0;
|
||||||
|
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);
|
||||||
|
sf2d_end_frame();
|
||||||
break;
|
break;
|
||||||
case MENU_CRAFTING:
|
case MENU_CRAFTING:
|
||||||
sf2d_start_frame(GFX_TOP, GFX_LEFT);
|
sf2d_start_frame(GFX_TOP, GFX_LEFT);
|
||||||
|
|
|
@ -1338,6 +1338,44 @@ 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) {
|
||||||
|
// 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;
|
||||||
|
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,
|
||||||
|
(i + 1 + yo) << 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drawCursor) {
|
||||||
|
int yy = selected + 1 - io + yo;
|
||||||
|
sf2d_draw_rectangle((xo << 4) - (offsetX << 1),
|
||||||
|
(yy << 4) - (offsetY << 1), 12, 12, 0xFF);
|
||||||
|
drawText(">", (xo << 4), yy << 4);
|
||||||
|
sf2d_draw_rectangle(((xo + w) << 4) - 12 - (offsetX << 1),
|
||||||
|
(yy << 4) - (offsetY << 1), 12, 12, 0xFF);
|
||||||
|
drawText("<", ((xo + w) << 4) - 12, yy << 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void renderRecipes(RecipeManager * r, int xo, int yo, int x1, int y1, int selected) {
|
void renderRecipes(RecipeManager * r, int xo, int yo, int x1, int y1, int selected) {
|
||||||
int size = r->size;
|
int size = r->size;
|
||||||
if (size < 1)
|
if (size < 1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue