aboutsummaryrefslogtreecommitdiff
path: root/src/content_inventory.h
blob: 91550bb9a42c0e46881337024bbf8b4d08be5351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
Minetest-c55
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CONTENT_INVENTORY_HEADER
#define CONTENT_INVENTORY_HEADER

#include "common_irrlicht.h" // For u8, s16
#include <string>
#include "mapnode.h" // For content_t

class InventoryItem;
class ServerActiveObject;
class ServerEnvironment;

bool           item_material_is_cookable(content_t content);
InventoryItem* item_material_create_cook_result(content_t content);

std::string         item_craft_get_image_name(const std::string &subname);
ServerActiveObject* item_craft_create_object(const std::string &subname,
		ServerEnvironment *env, u16 id, v3f pos);
s16                 item_craft_get_drop_count(const std::string &subname);
bool                item_craft_is_cookable(const std::string &subname);
InventoryItem*      item_craft_create_cook_result(const std::string &subname);
bool                item_craft_is_eatable(const std::string &subname);
s16                 item_craft_eat_hp_change(const std::string &subname);

#endif

HUD_ELEM_IMAGE = 0, HUD_ELEM_TEXT = 1, HUD_ELEM_STATBAR = 2, HUD_ELEM_INVENTORY = 3 }; enum HudElementStat { HUD_STAT_POS, HUD_STAT_NAME, HUD_STAT_SCALE, HUD_STAT_TEXT, HUD_STAT_NUMBER, HUD_STAT_ITEM, HUD_STAT_DIR, HUD_STAT_ALIGN, HUD_STAT_OFFSET }; struct HudElement { HudElementType type; v2f pos; std::string name; v2f scale; std::string text; u32 number; u32 item; u32 dir; v2f align; v2f offset; }; inline u32 hud_get_free_id(Player *player) { size_t size = player->hud.size(); for (size_t i = 0; i != size; i++) { if (!player->hud[i]) return i; } return size; } #ifndef SERVER #include <IGUIFont.h> #include "gamedef.h" #include "inventory.h" #include "localplayer.h" class Hud { public: video::IVideoDriver *driver; gui::IGUIEnvironment *guienv; gui::IGUIFont *font; u32 text_height; IGameDef *gamedef; LocalPlayer *player; Inventory *inventory; ITextureSource *tsrc; v2u32 screensize; v2s32 displaycenter; s32 hotbar_imagesize; s32 hotbar_itemcount; video::SColor crosshair_argb; video::SColor selectionbox_argb; bool use_crosshair_image; Hud(video::IVideoDriver *driver, gui::IGUIEnvironment* guienv, gui::IGUIFont *font, u32 text_height, IGameDef *gamedef, LocalPlayer *player, Inventory *inventory); void drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount, InventoryList *mainlist, u16 selectitem, u16 direction); void drawLuaElements(); void drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, s32 count, v2s32 offset); void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem); void resizeHotbar(); void drawCrosshair(); void drawSelectionBoxes(std::vector<aabb3f> &hilightboxes); }; #endif #endif