Compare commits
5 Commits
5bd9c236d5
...
556bdc260a
Author | SHA1 | Date |
---|---|---|
sapier | 556bdc260a | |
sapier | 28854495b1 | |
sapier | af01a9577e | |
Perttu Ahola | 65d1cb8321 | |
Ciaran Gultnieks | 564e11fc2f |
|
@ -140,7 +140,8 @@ void RemoteClient::GetNextBlocks(
|
|||
*/
|
||||
s32 new_nearest_unsent_d = -1;
|
||||
|
||||
s16 d_max = g_settings->getS16("max_block_send_distance");
|
||||
const s16 full_d_max = g_settings->getS16("max_block_send_distance");
|
||||
s16 d_max = full_d_max;
|
||||
s16 d_max_gen = g_settings->getS16("max_block_generate_distance");
|
||||
|
||||
// Don't loop very much at a time
|
||||
|
@ -214,7 +215,7 @@ void RemoteClient::GetNextBlocks(
|
|||
generate = false;*/
|
||||
|
||||
// Limit the send area vertically to 1/2
|
||||
if(abs(p.Y - center.Y) > d_max / 2)
|
||||
if(abs(p.Y - center.Y) > full_d_max / 2)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
if(ntop.getContent() == c_flowing || ntop.getContent() == c_source)
|
||||
top_is_same_liquid = true;
|
||||
|
||||
u16 l = getInteriorLight(n, 0, data);
|
||||
u16 l = getInteriorLight(n, 0, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));
|
||||
|
||||
/*
|
||||
|
@ -389,10 +389,10 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
}
|
||||
// Use the light of the node on top if possible
|
||||
else if(nodedef->get(ntop).param_type == CPT_LIGHT)
|
||||
l = getInteriorLight(ntop, 0, data);
|
||||
l = getInteriorLight(ntop, 0, nodedef);
|
||||
// Otherwise use the light of this node (the liquid)
|
||||
else
|
||||
l = getInteriorLight(n, 0, data);
|
||||
l = getInteriorLight(n, 0, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));
|
||||
|
||||
u8 range = rangelim(nodedef->get(c_flowing).liquid_range, 1, 8);
|
||||
|
@ -696,7 +696,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
{
|
||||
TileSpec tile = getNodeTile(n, p, v3s16(0,0,0), data);
|
||||
|
||||
u16 l = getInteriorLight(n, 1, data);
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
for(u32 j=0; j<6; j++)
|
||||
|
@ -758,7 +758,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
TileSpec tiles[2];
|
||||
tiles[0] = getNodeTile(n, p, dirs[0], data);
|
||||
tiles[1] = getNodeTile(n, p, dirs[1], data);
|
||||
u16 l = getInteriorLight(n, 1, data);
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
v3f pos = intToFloat(p, BS);
|
||||
static const float a=BS/2;
|
||||
|
@ -876,7 +876,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
TileSpec tile_leaves = getNodeTile(n, p,
|
||||
v3s16(0,0,0), data);
|
||||
|
||||
u16 l = getInteriorLight(n, 1, data);
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
v3f pos = intToFloat(p, BS);
|
||||
|
@ -909,7 +909,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
tile.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
|
||||
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
|
||||
|
||||
u16 l = getInteriorLight(n, 1, data);
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
float s = BS/2*f.visual_scale;
|
||||
|
@ -950,7 +950,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
tile.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
|
||||
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
|
||||
|
||||
u16 l = getInteriorLight(n, 0, data);
|
||||
u16 l = getInteriorLight(n, 0, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
float d = (float)BS/16;
|
||||
|
@ -993,7 +993,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
TileSpec tile = getNodeTileN(n, p, 0, data);
|
||||
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
|
||||
|
||||
u16 l = getInteriorLight(n, 1, data);
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
float s = BS/2*f.visual_scale;
|
||||
|
@ -1045,7 +1045,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
texturestring_rot,
|
||||
&tile_rot.texture_id);
|
||||
|
||||
u16 l = getInteriorLight(n, 1, data);
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
const f32 post_rad=(f32)BS/8;
|
||||
|
@ -1294,7 +1294,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
tile.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
|
||||
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
|
||||
|
||||
u16 l = getInteriorLight(n, 0, data);
|
||||
u16 l = getInteriorLight(n, 0, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
float d = (float)BS/64;
|
||||
|
@ -1333,7 +1333,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
};
|
||||
TileSpec tiles[6];
|
||||
|
||||
u16 l = getInteriorLight(n, 0, data);
|
||||
u16 l = getInteriorLight(n, 0, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
v3f pos = intToFloat(p, BS);
|
||||
|
|
|
@ -795,8 +795,7 @@ neighbor_found:
|
|||
// Call all the trigger variations
|
||||
i->abm->trigger(m_env, p, n);
|
||||
i->abm->trigger(m_env, p, n,
|
||||
active_object_count,
|
||||
active_object_count_wider + active_object_count);
|
||||
active_object_count, active_object_count_wider);
|
||||
|
||||
// Count surrounding objects again if the abms added any
|
||||
if(m_env->m_added_objects > 0) {
|
||||
|
|
66
src/game.cpp
66
src/game.cpp
|
@ -154,6 +154,11 @@ struct LocalFormspecHandler : public TextDest
|
|||
return;
|
||||
}
|
||||
|
||||
if (fields.find("btn_change_password") != fields.end()) {
|
||||
g_gamecallback->changePassword();
|
||||
return;
|
||||
}
|
||||
|
||||
if (fields.find("quit") != fields.end()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1000,7 +1005,7 @@ static void show_chat_menu(FormspecFormSource* current_formspec,
|
|||
/******************************************************************************/
|
||||
static void show_pause_menu(FormspecFormSource* current_formspec,
|
||||
TextDest* current_textdest, IWritableTextureSource* tsrc,
|
||||
IrrlichtDevice * device)
|
||||
IrrlichtDevice * device, bool singleplayermode)
|
||||
{
|
||||
|
||||
std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
|
||||
|
@ -1016,25 +1021,34 @@ static void show_pause_menu(FormspecFormSource* current_formspec,
|
|||
"- T: chat\n"
|
||||
));
|
||||
|
||||
float ypos = singleplayermode ? 1.0 : 0.5;
|
||||
std::ostringstream os;
|
||||
os<<"Minetest\n";
|
||||
os<<minetest_build_info<<"\n";
|
||||
os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";
|
||||
|
||||
std::string formspec =
|
||||
"size[11,5.5,true]"
|
||||
"button_exit[4,1;3,0.5;btn_continue;" + wide_to_narrow(wstrgettext("Continue")) + "]"
|
||||
"button_exit[4,2;3,0.5;btn_sound;" + wide_to_narrow(wstrgettext("Sound Volume")) + "]"
|
||||
"button_exit[4,3;3,0.5;btn_exit_menu;" + wide_to_narrow(wstrgettext("Exit to Menu")) + "]"
|
||||
"button_exit[4,4;3,0.5;btn_exit_os;" + wide_to_narrow(wstrgettext("Exit to OS")) + "]"
|
||||
"textarea[7.5,0.25;3.75,6;;" + control_text + ";]"
|
||||
"textarea[0.4,0.25;3.5,6;;" + os.str() + ";]"
|
||||
;
|
||||
os << "size[11,5.5,true]"
|
||||
<< "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
|
||||
<< wide_to_narrow(wstrgettext("Continue")) << "]";
|
||||
|
||||
if (!singleplayermode) {
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
|
||||
<< wide_to_narrow(wstrgettext("Change Password")) << "]";
|
||||
}
|
||||
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
|
||||
<< wide_to_narrow(wstrgettext("Sound Volume")) << "]";
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
|
||||
<< wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
|
||||
<< wide_to_narrow(wstrgettext("Exit to OS")) << "]"
|
||||
<< "textarea[7.5,0.25;3.75,6;;" << control_text << ";]"
|
||||
<< "textarea[0.4,0.25;3.5,6;;" << "Minetest\n"
|
||||
<< minetest_build_info << "\n"
|
||||
<< "path_user = " << wrap_rows(porting::path_user, 20)
|
||||
<< "\n;]";
|
||||
|
||||
/* Create menu */
|
||||
/* Note: FormspecFormSource and LocalFormspecHandler *
|
||||
* are deleted by guiFormSpecMenu */
|
||||
current_formspec = new FormspecFormSource(formspec,¤t_formspec);
|
||||
current_formspec = new FormspecFormSource(os.str(),¤t_formspec);
|
||||
current_textdest = new LocalFormspecHandler("MT_PAUSE_MENU");
|
||||
GUIFormSpecMenu *menu =
|
||||
new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, NULL, NULL, tsrc);
|
||||
|
@ -1894,7 +1908,8 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
|||
}
|
||||
else if(input->wasKeyDown(EscapeKey))
|
||||
{
|
||||
show_pause_menu(current_formspec, current_textdest, tsrc, device);
|
||||
show_pause_menu(current_formspec, current_textdest, tsrc, device,
|
||||
simple_singleplayer_mode);
|
||||
}
|
||||
else if(input->wasKeyDown(getKeySetting("keymap_chat")))
|
||||
{
|
||||
|
@ -2292,18 +2307,17 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
|||
camera_yaw
|
||||
);
|
||||
client.setPlayerControl(control);
|
||||
u32 keyPressed=
|
||||
1*(int)input->isKeyDown(getKeySetting("keymap_forward"))+
|
||||
2*(int)input->isKeyDown(getKeySetting("keymap_backward"))+
|
||||
4*(int)input->isKeyDown(getKeySetting("keymap_left"))+
|
||||
8*(int)input->isKeyDown(getKeySetting("keymap_right"))+
|
||||
16*(int)input->isKeyDown(getKeySetting("keymap_jump"))+
|
||||
32*(int)input->isKeyDown(getKeySetting("keymap_special1"))+
|
||||
64*(int)input->isKeyDown(getKeySetting("keymap_sneak"))+
|
||||
128*(int)input->getLeftState()+
|
||||
256*(int)input->getRightState();
|
||||
LocalPlayer* player = client.getEnv().getLocalPlayer();
|
||||
player->keyPressed=keyPressed;
|
||||
player->keyPressed=
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_forward")) & 0x1) << 0) |
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_backward")) & 0x1) << 1) |
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_left")) & 0x1) << 2) |
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_right")) & 0x1) << 3) |
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_jump")) & 0x1) << 4) |
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_special1")) & 0x1) << 5) |
|
||||
(((int)input->isKeyDown(getKeySetting("keymap_sneak")) & 0x1) << 6) |
|
||||
(((int)input->getLeftState() & 0x1) << 7) |
|
||||
(((int)input->getRightState() & 0x1) << 8);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -150,9 +150,8 @@ void MeshMakeData::setSmoothLighting(bool smooth_lighting)
|
|||
Single light bank.
|
||||
*/
|
||||
static u8 getInteriorLight(enum LightBank bank, MapNode n, s32 increment,
|
||||
MeshMakeData *data)
|
||||
INodeDefManager *ndef)
|
||||
{
|
||||
INodeDefManager *ndef = data->m_gamedef->ndef();
|
||||
u8 light = n.getLight(bank, ndef);
|
||||
|
||||
while(increment > 0)
|
||||
|
@ -173,10 +172,10 @@ static u8 getInteriorLight(enum LightBank bank, MapNode n, s32 increment,
|
|||
Calculate non-smooth lighting at interior of node.
|
||||
Both light banks.
|
||||
*/
|
||||
u16 getInteriorLight(MapNode n, s32 increment, MeshMakeData *data)
|
||||
u16 getInteriorLight(MapNode n, s32 increment, INodeDefManager *ndef)
|
||||
{
|
||||
u16 day = getInteriorLight(LIGHTBANK_DAY, n, increment, data);
|
||||
u16 night = getInteriorLight(LIGHTBANK_NIGHT, n, increment, data);
|
||||
u16 day = getInteriorLight(LIGHTBANK_DAY, n, increment, ndef);
|
||||
u16 night = getInteriorLight(LIGHTBANK_NIGHT, n, increment, ndef);
|
||||
return day | (night << 8);
|
||||
}
|
||||
|
||||
|
@ -185,10 +184,8 @@ u16 getInteriorLight(MapNode n, s32 increment, MeshMakeData *data)
|
|||
Single light bank.
|
||||
*/
|
||||
static u8 getFaceLight(enum LightBank bank, MapNode n, MapNode n2,
|
||||
v3s16 face_dir, MeshMakeData *data)
|
||||
v3s16 face_dir, INodeDefManager *ndef)
|
||||
{
|
||||
INodeDefManager *ndef = data->m_gamedef->ndef();
|
||||
|
||||
u8 light;
|
||||
u8 l1 = n.getLight(bank, ndef);
|
||||
u8 l2 = n2.getLight(bank, ndef);
|
||||
|
@ -227,10 +224,10 @@ static u8 getFaceLight(enum LightBank bank, MapNode n, MapNode n2,
|
|||
Calculate non-smooth lighting at face of node.
|
||||
Both light banks.
|
||||
*/
|
||||
u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, MeshMakeData *data)
|
||||
u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, INodeDefManager *ndef)
|
||||
{
|
||||
u16 day = getFaceLight(LIGHTBANK_DAY, n, n2, face_dir, data);
|
||||
u16 night = getFaceLight(LIGHTBANK_NIGHT, n, n2, face_dir, data);
|
||||
u16 day = getFaceLight(LIGHTBANK_DAY, n, n2, face_dir, ndef);
|
||||
u16 night = getFaceLight(LIGHTBANK_NIGHT, n, n2, face_dir, ndef);
|
||||
return day | (night << 8);
|
||||
}
|
||||
|
||||
|
@ -812,7 +809,7 @@ static void getTileInfo(
|
|||
if(data->m_smooth_lighting == false)
|
||||
{
|
||||
lights[0] = lights[1] = lights[2] = lights[3] =
|
||||
getFaceLight(n0, n1, face_dir, data);
|
||||
getFaceLight(n0, n1, face_dir, ndef);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -172,8 +172,8 @@ inline video::SColor MapBlock_LightColor(u8 alpha, u16 light, u8 light_source=0)
|
|||
}
|
||||
|
||||
// Compute light at node
|
||||
u16 getInteriorLight(MapNode n, s32 increment, MeshMakeData *data);
|
||||
u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, MeshMakeData *data);
|
||||
u16 getInteriorLight(MapNode n, s32 increment, INodeDefManager *ndef);
|
||||
u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, INodeDefManager *ndef);
|
||||
u16 getSmoothLight(v3s16 p, v3s16 corner, MeshMakeData *data);
|
||||
|
||||
// Retrieves the TileSpec of a face of a node
|
||||
|
|
Loading…
Reference in New Issue