and default clothing works... some inv textures missing

This commit is contained in:
darkrose 2014-10-31 15:41:24 +10:00
parent 7e53f1067d
commit 562c4733ad
10 changed files with 2995 additions and 113 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1421,6 +1421,15 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
case 4:
inv = player->inventory.getList("boots");
break;
case 5:
inv = player->inventory.getList("decorative");
break;
case 6:
inv = player->inventory.getList("jacket");
break;
case 7:
inv = player->inventory.getList("belt");
break;
}
if (inv == NULL)
continue;

File diff suppressed because it is too large Load Diff

View File

@ -637,6 +637,26 @@ void setHelmetRecipe(u16 input, u16 result)
};
setRecipe(r,result,1);
}
// like boots, but the top 2 input are replaced with string
void setShoesRecipe(u16 input, u16 result)
{
u16 r[9] = {
CONTENT_CRAFTITEM_STRING, CONTENT_IGNORE, CONTENT_CRAFTITEM_STRING,
input, CONTENT_IGNORE, input,
CONTENT_IGNORE, CONTENT_IGNORE, CONTENT_IGNORE
};
setRecipe(r,result,1);
}
// pants recipe 5 input in an upside-down V yields one result
void setShortsRecipe(u16 input, u16 result)
{
u16 r[9] = {
CONTENT_IGNORE, input, CONTENT_IGNORE,
input, CONTENT_IGNORE, input,
input, CONTENT_IGNORE, input
};
setRecipe(r,result,1);
}
InventoryItem *getResult(InventoryItem **items)
{

View File

@ -264,6 +264,10 @@ namespace crafting {
void setHatRecipe(u16 input, u16 result);
// helmet recipe, 5 input in an upside down u around a glass pane yields one result
void setHelmetRecipe(u16 input, u16 result);
// like boots, but the top 2 input are replaced with string
void setShoesRecipe(u16 input, u16 result);
// pants recipe 5 input in an upside-down V yields one result
void setShortsRecipe(u16 input, u16 result);
InventoryItem *getResult(InventoryItem **items);
content_t *getRecipe(InventoryItem *item);

View File

@ -194,16 +194,33 @@ public:
}
std::string getForm()
{
if (m_show_appearance) {
return
std::string("size[8,9]"
"list[current_player;main;0,5;8,4;]"
"label[0.3,0.2;")+gettext("Clothes")+"]"
"list[current_player;hat;0,0.5;1,1;]"
"list[current_player;shirt;0,1.5;1,1;]"
"list[current_player;pants;0,2.5;1,1;]"
"list[current_player;boots;0,3.5;1,1;]"
"label[1.4,1.7;"+gettext("Drop to Ground")+"]"
"list[current_player;discard;1.75,2;1,1;]"
"button[0.5,3;3,1;show_craft;Show Crafting]"
"label[1,2;")+gettext("Clothes")+"]"
"label[4.9,-0.1;Hat/Helmet]"
"list[current_player;hat;5,0;1,1;]"
"label[6.6,1.2;Jacket]"
"list[current_player;jacket;6.3,1.3;1,1;]"
"label[3.7,0.9;Decorative]"
"list[current_player;decorative;3.7,1;1,1;]"
"label[5.4,1.2;Shirt]"
"list[current_player;shirt;5,1.3;1,1;]"
"label[4.1,2.2;Belt]"
"list[current_player;belt;3.7,2.3;1,1;]"
"label[5.3,2.5;Pants]"
"list[current_player;pants;5,2.6;1,1;]"
"label[5.3,3.8;Boots]"
"list[current_player;boots;5,3.9;1,1;]";
}
return
std::string("size[8,9]"
"list[current_player;main;0,5;8,4;]"
"label[1,1.7;")+gettext("Drop to Ground")+"]"
"list[current_player;discard;1.2,2;1,1;]"
"button[0.5,3.5;3,1;show_appearance;Change Clothing]"
"list[current_player;craft;3.5,1;3,3;]"
"list[current_player;craftresult;7,2;1,1;]";
}
@ -641,16 +658,13 @@ void update_skybox(video::IVideoDriver* driver,
float brightness)
{
if (skybox)
{
skybox->remove();
}
/*// Disable skybox if FarMesh is enabled
if(g_settings->getBool("enable_farmesh"))
return;*/
if(brightness >= 0.5)
{
if (brightness >= 0.5) {
skybox = smgr->addSkyBoxSceneNode(
driver->getTexture(getTexturePath("skybox2.png").c_str()),
driver->getTexture(getTexturePath("skybox3.png").c_str()),
@ -658,9 +672,7 @@ void update_skybox(video::IVideoDriver* driver,
driver->getTexture(getTexturePath("skybox1.png").c_str()),
driver->getTexture(getTexturePath("skybox1.png").c_str()),
driver->getTexture(getTexturePath("skybox1.png").c_str()));
}
else if(brightness >= 0.2)
{
}else if(brightness >= 0.2) {
skybox = smgr->addSkyBoxSceneNode(
driver->getTexture(getTexturePath("skybox2_dawn.png").c_str()),
driver->getTexture(getTexturePath("skybox3_dawn.png").c_str()),
@ -668,9 +680,7 @@ void update_skybox(video::IVideoDriver* driver,
driver->getTexture(getTexturePath("skybox1_dawn.png").c_str()),
driver->getTexture(getTexturePath("skybox1_dawn.png").c_str()),
driver->getTexture(getTexturePath("skybox1_dawn.png").c_str()));
}
else
{
}else{
skybox = smgr->addSkyBoxSceneNode(
driver->getTexture(getTexturePath("skybox2_night.png").c_str()),
driver->getTexture(getTexturePath("skybox3_night.png").c_str()),
@ -726,12 +736,9 @@ void update_profiler_gui(gui::IGUIStaticText *guitext_profiler,
gui::IGUIFont *font, u32 text_height,
u32 show_profiler, u32 show_profiler_max)
{
if(show_profiler == 0)
{
if (show_profiler == 0) {
guitext_profiler->setVisible(false);
}
else
{
}else{
std::ostringstream os(std::ios_base::binary);
g_profiler->printPage(os, show_profiler, show_profiler_max);

View File

@ -713,17 +713,10 @@ void ExtrudedSpriteSceneNode::setArm(video::ITexture *texture)
m_meshnode->setScale(v3f(1));
// Get the tile texture and atlas transformation
if (texture == NULL) {
std::string tex;
if (getTexturePath("player.png") != "") {
tex = "player.png^[forcesingle";
}else{
tex = "character.png^[forcesingle";
}
texture = g_texturesource->getTextureRaw(tex);
}
v2f pos(0.625,0.5);
v2f size(0.0625,-0.0625);
if (texture == NULL)
texture = g_texturesource->getTextureRaw("character.png");
v2f pos(0.75,0.5);
v2f size(0.0625,0.125);
// Set material flags and texture
video::SMaterial& material = m_meshnode->getMaterial(0);
@ -737,7 +730,7 @@ void ExtrudedSpriteSceneNode::setArm(video::ITexture *texture)
for (int i = 1; i < 6; ++i) {
// Get the tile texture and atlas transformation
v2f pos(0.625,1);
v2f pos(0.75,1.);
v2f size(0.0625,-0.375);
// Set material flags and texture

View File

@ -114,8 +114,14 @@ void Player::checkInventory()
InventoryList *b = inventory.getList("boots");
h->setStackable(false);
h->clearAllowed();
j->setStackable(false);
j->clearAllowed();
s->setStackable(false);
s->clearAllowed();
d->setStackable(false);
d->clearAllowed();
t->setStackable(false);
t->clearAllowed();
p->setStackable(false);
p->clearAllowed();
b->setStackable(false);
@ -668,6 +674,7 @@ LocalPlayer::LocalPlayer():
// doesn't support health points
hp = 0;
hunger = 0;
m_character = g_settings->get("character_definition");
}
LocalPlayer::~LocalPlayer()
@ -1041,5 +1048,38 @@ void LocalPlayer::applyControl(float dtime)
// Accelerate to target speed with maximum increment
accelerate(speed, inc);
}
video::ITexture* LocalPlayer::getTexture()
{
std::string clothes[7];
const char* list[7] = {"hat","shirt","jacket","decorative","belt","pants","boots"};
std::vector<std::string> parts;
getSkin(parts);
for (int j=0; j<7; j++) {
InventoryList *l = inventory.getList(list[j]);
if (l == NULL)
continue;
InventoryItem *i = l->getItem(0);
if (i == NULL)
continue;
clothes[j] = content_clothesitem_features(i->getContent()).overlay_texture;
}
std::string tex = "";
tex += parts[0]; // skin
tex += "^" + parts[1]; // face
tex += "^" + parts[2]; // eyes
tex += "^" + clothes[5]; // pants
tex += "^" + clothes[1]; // shirt
tex += "^" + clothes[4]; // belt
tex += "^" + clothes[3]; // deco
tex += "^" + parts[3]; // hair
tex += "^" + clothes[2]; // jacket
tex += "^" + clothes[6]; // boots
tex += "^" + clothes[0]; // hat
return g_texturesource->getTextureRaw(tex);
}
#endif

View File

@ -493,21 +493,7 @@ public:
void applyControl(float dtime);
video::ITexture* getTexture()
{
const char* list[4] = {"hat","shirt","pants","boots"};
std::string tex = getSkin();
for (int j=0; j<4; j++) {
InventoryList *l = inventory.getList(list[j]);
if (l == NULL)
continue;
InventoryItem *i = l->getItem(0);
if (i == NULL)
continue;
tex += "^" + content_clothesitem_features(i->getContent()).overlay_texture;
}
return g_texturesource->getTextureRaw(tex);
}
video::ITexture* getTexture();
PlayerControl control;

View File

@ -5086,7 +5086,7 @@ void Server::SendPlayerItems()
writeU16(os, TOCLIENT_PLAYERITEMS);
writeU16(os, players.size());
writeU16(os, 5);
writeU16(os, 8);
for (core::list<Player *>::Iterator i = players.begin(); i != players.end(); i++) {
Player *p = *i;
writeU16(os, p->peer_id);
@ -5096,8 +5096,8 @@ void Server::SendPlayerItems()
}else{
writeU16(os,item->getContent());
}
const char* list[4] = {"hat","shirt","pants","boots"};
for (int j=0; j<4; j++) {
const char* list[7] = {"hat","shirt","pants","boots","decorative","jacket","belt"};
for (int j=0; j<7; j++) {
InventoryList *l = p->inventory.getList(list[j]);
if (l == NULL)
continue;
@ -5125,7 +5125,7 @@ void Server::SendPlayerItems(Player *player)
writeU16(os, TOCLIENT_PLAYERITEMS);
writeU16(os, 1);
writeU16(os, 5);
writeU16(os, 8);
writeU16(os, player->peer_id);
InventoryItem *item = (InventoryItem*)player->getWieldItem();
if (item == NULL) {
@ -5133,8 +5133,8 @@ void Server::SendPlayerItems(Player *player)
}else{
writeU16(os,item->getContent());
}
const char* list[4] = {"hat","shirt","pants","boots"};
for (int j=0; j<4; j++) {
const char* list[7] = {"hat","shirt","pants","boots","decorative","jacket","belt"};
for (int j=0; j<7; j++) {
InventoryList *l = player->inventory.getList(list[j]);
if (l == NULL)
continue;