mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Cleanup (some stuff went wrong when reverting 4-byte mapnodes); fix legacy_wallmounted
This commit is contained in:
parent
4799a8f761
commit
c241902b40
@ -1157,28 +1157,24 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||
if(nodedef->getId("default:stone") == data[i].getContent()
|
||||
&& data[i].getParam1() == 1)
|
||||
{
|
||||
//dstream << "legacy coal\n";
|
||||
data[i].setContent(nodedef->getId("default:stone_with_coal"));
|
||||
data[i].setParam1(0);
|
||||
}
|
||||
else if(nodedef->getId("default:stone") == data[i].getContent()
|
||||
&& data[i].getParam1() == 2)
|
||||
{
|
||||
//dstream << "legacy iron\n";
|
||||
data[i].setContent(nodedef->getId("default:stone_with_iron"));
|
||||
data[i].setParam1(0);
|
||||
}
|
||||
// facedir_simple
|
||||
if(f.legacy_facedir_simple)
|
||||
{
|
||||
dstream << "legacy_facedir_simple\n";
|
||||
data[i].setParam2(data[i].getParam1());
|
||||
data[i].setParam1(0);
|
||||
}
|
||||
// wall_mounted
|
||||
if(f.legacy_wallmounted)
|
||||
{
|
||||
dstream << "legacy_wallmounted\n";
|
||||
u8 wallmounted_new_to_old[8] = {0x04, 0x08, 0x01, 0x02, 0x10, 0x20, 0, 0};
|
||||
u8 dir_old_format = data[i].getParam2();
|
||||
u8 dir_new_format = 0;
|
||||
|
@ -291,31 +291,31 @@ void MapNode::serialize_pre22(u8 *dest, u8 version)
|
||||
// Translate to wanted version
|
||||
MapNode n_foreign = mapnode_translate_from_internal(*this, version);
|
||||
|
||||
u16 actual_content = n_foreign.param0;
|
||||
u8 actual_param0 = n_foreign.param0;
|
||||
|
||||
// Convert special values from new version to old
|
||||
if(version <= 18)
|
||||
{
|
||||
// In these versions, CONTENT_IGNORE and CONTENT_AIR
|
||||
// are 255 and 254
|
||||
if(actual_content == CONTENT_IGNORE)
|
||||
actual_content = 255;
|
||||
else if(actual_content == CONTENT_AIR)
|
||||
actual_content = 254;
|
||||
if(actual_param0 == CONTENT_IGNORE)
|
||||
actual_param0 = 255;
|
||||
else if(actual_param0 == CONTENT_AIR)
|
||||
actual_param0 = 254;
|
||||
}
|
||||
|
||||
if(version == 0)
|
||||
{
|
||||
dest[0] = actual_content;
|
||||
dest[0] = actual_param0;
|
||||
}
|
||||
else if(version <= 9)
|
||||
{
|
||||
dest[0] = actual_content;
|
||||
dest[0] = actual_param0;
|
||||
dest[1] = n_foreign.param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[0] = actual_content;
|
||||
dest[0] = actual_param0;
|
||||
dest[1] = n_foreign.param1;
|
||||
dest[2] = n_foreign.param2;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ struct MapNode
|
||||
{
|
||||
param1 = a_param1;
|
||||
param2 = a_param2;
|
||||
// Set content (param0 and param2&0xf0)) after other params
|
||||
// Set content (param0 and (param2&0xf0)) after other params
|
||||
// because this needs to override part of param2
|
||||
setContent(content);
|
||||
}
|
||||
|
@ -394,6 +394,8 @@ public:
|
||||
def.param_type_2 == CPT2_FULL
|
||||
||
|
||||
def.param_type_2 == CPT2_FLOWINGLIQUID
|
||||
||
|
||||
def.legacy_wallmounted
|
||||
);
|
||||
// Get some id
|
||||
id = getFreeId(require_full_param2);
|
||||
|
Loading…
Reference in New Issue
Block a user