mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Fix all warnings and remove -Wno-unused-but-set cflag
This commit is contained in:
parent
e36681101e
commit
38bd9e93a2
@ -656,13 +656,6 @@ else()
|
|||||||
set(RELEASE_WARNING_FLAGS "")
|
set(RELEASE_WARNING_FLAGS "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT APPLE AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
||||||
CHECK_CXX_COMPILER_FLAG("-Wno-unused-but-set-variable" HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
|
||||||
if(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
|
||||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable")
|
|
||||||
endif(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
# clang does not understand __extern_always_inline but libc headers use it
|
# clang does not understand __extern_always_inline but libc headers use it
|
||||||
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")
|
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")
|
||||||
|
32
src/client.h
32
src/client.h
@ -74,7 +74,7 @@ public:
|
|||||||
MeshUpdateQueue();
|
MeshUpdateQueue();
|
||||||
|
|
||||||
~MeshUpdateQueue();
|
~MeshUpdateQueue();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
peer_id=0 adds with nobody to send to
|
peer_id=0 adds with nobody to send to
|
||||||
*/
|
*/
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
JMutexAutoLock lock(m_mutex);
|
JMutexAutoLock lock(m_mutex);
|
||||||
return m_queue.size();
|
return m_queue.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<QueuedMeshUpdate*> m_queue;
|
std::vector<QueuedMeshUpdate*> m_queue;
|
||||||
std::set<v3s16> m_urgents;
|
std::set<v3s16> m_urgents;
|
||||||
@ -127,7 +127,7 @@ public:
|
|||||||
MutexedQueue<MeshUpdateResult> m_queue_out;
|
MutexedQueue<MeshUpdateResult> m_queue_out;
|
||||||
|
|
||||||
IGameDef *m_gamedef;
|
IGameDef *m_gamedef;
|
||||||
|
|
||||||
v3s16 m_camera_offset;
|
v3s16 m_camera_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ struct ClientEvent
|
|||||||
{
|
{
|
||||||
ClientEventType type;
|
ClientEventType type;
|
||||||
union{
|
union{
|
||||||
struct{
|
//struct{
|
||||||
} none;
|
//} none;
|
||||||
struct{
|
struct{
|
||||||
u8 amount;
|
u8 amount;
|
||||||
} player_damage;
|
} player_damage;
|
||||||
@ -171,8 +171,8 @@ struct ClientEvent
|
|||||||
std::string *formspec;
|
std::string *formspec;
|
||||||
std::string *formname;
|
std::string *formname;
|
||||||
} show_formspec;
|
} show_formspec;
|
||||||
struct{
|
//struct{
|
||||||
} textures_updated;
|
//} textures_updated;
|
||||||
struct{
|
struct{
|
||||||
v3f *pos;
|
v3f *pos;
|
||||||
v3f *vel;
|
v3f *vel;
|
||||||
@ -315,7 +315,7 @@ public:
|
|||||||
MtEventManager *event,
|
MtEventManager *event,
|
||||||
bool ipv6
|
bool ipv6
|
||||||
);
|
);
|
||||||
|
|
||||||
~Client();
|
~Client();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -362,11 +362,11 @@ public:
|
|||||||
|
|
||||||
ClientEnvironment& getEnv()
|
ClientEnvironment& getEnv()
|
||||||
{ return m_env; }
|
{ return m_env; }
|
||||||
|
|
||||||
// Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
|
// Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
|
||||||
void removeNode(v3s16 p);
|
void removeNode(v3s16 p);
|
||||||
void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
|
void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
|
||||||
|
|
||||||
void setPlayerControl(PlayerControl &control);
|
void setPlayerControl(PlayerControl &control);
|
||||||
|
|
||||||
void selectPlayerItem(u16 item);
|
void selectPlayerItem(u16 item);
|
||||||
@ -378,7 +378,7 @@ public:
|
|||||||
bool getLocalInventoryUpdated();
|
bool getLocalInventoryUpdated();
|
||||||
// Copies the inventory of the local player to parameter
|
// Copies the inventory of the local player to parameter
|
||||||
void getLocalInventory(Inventory &dst);
|
void getLocalInventory(Inventory &dst);
|
||||||
|
|
||||||
/* InventoryManager interface */
|
/* InventoryManager interface */
|
||||||
Inventory* getInventory(const InventoryLocation &loc);
|
Inventory* getInventory(const InventoryLocation &loc);
|
||||||
void inventoryAction(InventoryAction *a);
|
void inventoryAction(InventoryAction *a);
|
||||||
@ -416,13 +416,13 @@ public:
|
|||||||
// Including blocks at appropriate edges
|
// Including blocks at appropriate edges
|
||||||
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
|
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
|
||||||
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
|
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
|
||||||
|
|
||||||
void updateCameraOffset(v3s16 camera_offset)
|
void updateCameraOffset(v3s16 camera_offset)
|
||||||
{ m_mesh_update_thread.m_camera_offset = camera_offset; }
|
{ m_mesh_update_thread.m_camera_offset = camera_offset; }
|
||||||
|
|
||||||
// Get event from queue. CE_NONE is returned if queue is empty.
|
// Get event from queue. CE_NONE is returned if queue is empty.
|
||||||
ClientEvent getClientEvent();
|
ClientEvent getClientEvent();
|
||||||
|
|
||||||
bool accessDenied()
|
bool accessDenied()
|
||||||
{ return m_access_denied; }
|
{ return m_access_denied; }
|
||||||
|
|
||||||
@ -476,14 +476,14 @@ private:
|
|||||||
// Virtual methods from con::PeerHandler
|
// Virtual methods from con::PeerHandler
|
||||||
void peerAdded(con::Peer *peer);
|
void peerAdded(con::Peer *peer);
|
||||||
void deletingPeer(con::Peer *peer, bool timeout);
|
void deletingPeer(con::Peer *peer, bool timeout);
|
||||||
|
|
||||||
void ReceiveAll();
|
void ReceiveAll();
|
||||||
void Receive();
|
void Receive();
|
||||||
|
|
||||||
void sendPlayerPos();
|
void sendPlayerPos();
|
||||||
// Send the item number 'item' as player item to the server
|
// Send the item number 'item' as player item to the server
|
||||||
void sendPlayerItem(u16 item);
|
void sendPlayerItem(u16 item);
|
||||||
|
|
||||||
float m_packetcounter_timer;
|
float m_packetcounter_timer;
|
||||||
float m_connection_reinit_timer;
|
float m_connection_reinit_timer;
|
||||||
float m_avg_rtt_timer;
|
float m_avg_rtt_timer;
|
||||||
|
@ -179,7 +179,7 @@ void RemoteClient::GetNextBlocks(
|
|||||||
s32 nearest_emerged_d = -1;
|
s32 nearest_emerged_d = -1;
|
||||||
s32 nearest_emergefull_d = -1;
|
s32 nearest_emergefull_d = -1;
|
||||||
s32 nearest_sent_d = -1;
|
s32 nearest_sent_d = -1;
|
||||||
bool queue_is_full = false;
|
//bool queue_is_full = false;
|
||||||
|
|
||||||
s16 d;
|
s16 d;
|
||||||
for(d = d_start; d <= d_max; d++)
|
for(d = d_start; d <= d_max; d++)
|
||||||
@ -214,7 +214,7 @@ void RemoteClient::GetNextBlocks(
|
|||||||
// Don't select too many blocks for sending
|
// Don't select too many blocks for sending
|
||||||
if(num_blocks_selected >= max_simul_dynamic)
|
if(num_blocks_selected >= max_simul_dynamic)
|
||||||
{
|
{
|
||||||
queue_is_full = true;
|
//queue_is_full = true;
|
||||||
goto queue_full_break;
|
goto queue_full_break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
|
|||||||
v3f camera_position = m_camera_position;
|
v3f camera_position = m_camera_position;
|
||||||
v3f camera_direction = m_camera_direction;
|
v3f camera_direction = m_camera_direction;
|
||||||
f32 camera_fov = m_camera_fov;
|
f32 camera_fov = m_camera_fov;
|
||||||
v3s16 camera_offset = m_camera_offset;
|
//v3s16 camera_offset = m_camera_offset;
|
||||||
m_camera_mutex.Unlock();
|
m_camera_mutex.Unlock();
|
||||||
|
|
||||||
// Use a higher fov to accomodate faster camera movements.
|
// Use a higher fov to accomodate faster camera movements.
|
||||||
|
@ -707,14 +707,14 @@ void Channel::UpdateTimers(float dtime,bool legacy_peer)
|
|||||||
|
|
||||||
unsigned int packet_loss = 11; /* use a neutral value for initialization */
|
unsigned int packet_loss = 11; /* use a neutral value for initialization */
|
||||||
unsigned int packets_successfull = 0;
|
unsigned int packets_successfull = 0;
|
||||||
unsigned int packet_too_late = 0;
|
//unsigned int packet_too_late = 0;
|
||||||
|
|
||||||
bool reasonable_amount_of_data_transmitted = false;
|
bool reasonable_amount_of_data_transmitted = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
JMutexAutoLock internal(m_internal_mutex);
|
JMutexAutoLock internal(m_internal_mutex);
|
||||||
packet_loss = current_packet_loss;
|
packet_loss = current_packet_loss;
|
||||||
packet_too_late = current_packet_too_late;
|
//packet_too_late = current_packet_too_late;
|
||||||
packets_successfull = current_packet_successfull;
|
packets_successfull = current_packet_successfull;
|
||||||
|
|
||||||
if (current_bytes_transfered > (unsigned int) (window_size*512/2))
|
if (current_bytes_transfered > (unsigned int) (window_size*512/2))
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
// And never save to disk
|
// And never save to disk
|
||||||
bool isStaticAllowed() const
|
bool isStaticAllowed() const
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||||
const std::string &data)
|
const std::string &data)
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ public:
|
|||||||
}
|
}
|
||||||
u8 getType() const
|
u8 getType() const
|
||||||
{ return ACTIVEOBJECT_TYPE_TEST; }
|
{ return ACTIVEOBJECT_TYPE_TEST; }
|
||||||
|
|
||||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||||
const std::string &data)
|
const std::string &data)
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ class ItemSAO : public ServerActiveObject
|
|||||||
public:
|
public:
|
||||||
u8 getType() const
|
u8 getType() const
|
||||||
{ return ACTIVEOBJECT_TYPE_ITEM; }
|
{ return ACTIVEOBJECT_TYPE_ITEM; }
|
||||||
|
|
||||||
float getMinimumSavedMovement()
|
float getMinimumSavedMovement()
|
||||||
{ return 0.1*BS; }
|
{ return 0.1*BS; }
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ public:
|
|||||||
if(m_move_interval.step(dtime, interval)==false)
|
if(m_move_interval.step(dtime, interval)==false)
|
||||||
return;
|
return;
|
||||||
dtime = interval;
|
dtime = interval;
|
||||||
|
|
||||||
core::aabbox3d<f32> box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.);
|
core::aabbox3d<f32> box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.);
|
||||||
collisionMoveResult moveresult;
|
collisionMoveResult moveresult;
|
||||||
// Apply gravity
|
// Apply gravity
|
||||||
@ -223,13 +223,12 @@ public:
|
|||||||
if(m_speed_f.getLength()*dtime > pos_max_d)
|
if(m_speed_f.getLength()*dtime > pos_max_d)
|
||||||
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
|
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
|
||||||
v3f pos_f = getBasePosition();
|
v3f pos_f = getBasePosition();
|
||||||
v3f pos_f_old = pos_f;
|
|
||||||
v3f accel_f = v3f(0,0,0);
|
v3f accel_f = v3f(0,0,0);
|
||||||
f32 stepheight = 0;
|
f32 stepheight = 0;
|
||||||
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
|
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
|
||||||
pos_max_d, box, stepheight, dtime,
|
pos_max_d, box, stepheight, dtime,
|
||||||
pos_f, m_speed_f, accel_f);
|
pos_f, m_speed_f, accel_f);
|
||||||
|
|
||||||
if(send_recommended == false)
|
if(send_recommended == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -327,7 +326,7 @@ public:
|
|||||||
m_itemstring_changed = true;
|
m_itemstring_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +391,7 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
|
|||||||
ServerActiveObject::registerType(getType(), create);
|
ServerActiveObject::registerType(getType(), create);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize something to armor groups
|
// Initialize something to armor groups
|
||||||
m_armor_groups["fleshy"] = 100;
|
m_armor_groups["fleshy"] = 100;
|
||||||
}
|
}
|
||||||
@ -407,11 +406,11 @@ LuaEntitySAO::~LuaEntitySAO()
|
|||||||
void LuaEntitySAO::addedToEnvironment(u32 dtime_s)
|
void LuaEntitySAO::addedToEnvironment(u32 dtime_s)
|
||||||
{
|
{
|
||||||
ServerActiveObject::addedToEnvironment(dtime_s);
|
ServerActiveObject::addedToEnvironment(dtime_s);
|
||||||
|
|
||||||
// Create entity from name
|
// Create entity from name
|
||||||
m_registered = m_env->getScriptIface()->
|
m_registered = m_env->getScriptIface()->
|
||||||
luaentity_Add(m_id, m_init_name.c_str());
|
luaentity_Add(m_id, m_init_name.c_str());
|
||||||
|
|
||||||
if(m_registered){
|
if(m_registered){
|
||||||
// Get properties
|
// Get properties
|
||||||
m_env->getScriptIface()->
|
m_env->getScriptIface()->
|
||||||
@ -671,10 +670,10 @@ int LuaEntitySAO::punch(v3f dir,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's best that attachments cannot be punched
|
// It's best that attachments cannot be punched
|
||||||
if(isAttached())
|
if(isAttached())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ItemStack *punchitem = NULL;
|
ItemStack *punchitem = NULL;
|
||||||
ItemStack punchitem_static;
|
ItemStack punchitem_static;
|
||||||
if(puncher){
|
if(puncher){
|
||||||
@ -687,11 +686,11 @@ int LuaEntitySAO::punch(v3f dir,
|
|||||||
toolcap,
|
toolcap,
|
||||||
punchitem,
|
punchitem,
|
||||||
time_from_last_punch);
|
time_from_last_punch);
|
||||||
|
|
||||||
if(result.did_punch)
|
if(result.did_punch)
|
||||||
{
|
{
|
||||||
setHP(getHP() - result.damage);
|
setHP(getHP() - result.damage);
|
||||||
|
|
||||||
|
|
||||||
std::string punchername = "nil";
|
std::string punchername = "nil";
|
||||||
|
|
||||||
@ -701,7 +700,7 @@ int LuaEntitySAO::punch(v3f dir,
|
|||||||
actionstream<<getDescription()<<" punched by "
|
actionstream<<getDescription()<<" punched by "
|
||||||
<<punchername<<", damage "<<result.damage
|
<<punchername<<", damage "<<result.damage
|
||||||
<<" hp, health now "<<getHP()<<" hp"<<std::endl;
|
<<" hp, health now "<<getHP()<<" hp"<<std::endl;
|
||||||
|
|
||||||
{
|
{
|
||||||
std::string str = gob_cmd_punched(result.damage, getHP());
|
std::string str = gob_cmd_punched(result.damage, getHP());
|
||||||
// create message and add to list
|
// create message and add to list
|
||||||
@ -887,7 +886,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
|
|||||||
// If the object is attached client-side, don't waste bandwidth sending its position to clients
|
// If the object is attached client-side, don't waste bandwidth sending its position to clients
|
||||||
if(isAttached())
|
if(isAttached())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_last_sent_move_precision = m_base_position.getDistanceFrom(
|
m_last_sent_move_precision = m_base_position.getDistanceFrom(
|
||||||
m_last_sent_position);
|
m_last_sent_position);
|
||||||
m_last_sent_position_timer = 0;
|
m_last_sent_position_timer = 0;
|
||||||
@ -1272,7 +1271,7 @@ int PlayerSAO::punch(v3f dir,
|
|||||||
ServerActiveObject *puncher,
|
ServerActiveObject *puncher,
|
||||||
float time_from_last_punch)
|
float time_from_last_punch)
|
||||||
{
|
{
|
||||||
// It's best that attachments cannot be punched
|
// It's best that attachments cannot be punched
|
||||||
if(isAttached())
|
if(isAttached())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1488,15 +1487,12 @@ bool PlayerSAO::checkMovementCheat()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
float player_max_speed = 0;
|
float player_max_speed = 0;
|
||||||
float player_max_speed_up = 0;
|
|
||||||
if(m_privs.count("fast") != 0){
|
if(m_privs.count("fast") != 0){
|
||||||
// Fast speed
|
// Fast speed
|
||||||
player_max_speed = m_player->movement_speed_fast;
|
player_max_speed = m_player->movement_speed_fast;
|
||||||
player_max_speed_up = m_player->movement_speed_fast;
|
|
||||||
} else {
|
} else {
|
||||||
// Normal speed
|
// Normal speed
|
||||||
player_max_speed = m_player->movement_speed_walk;
|
player_max_speed = m_player->movement_speed_walk;
|
||||||
player_max_speed_up = m_player->movement_speed_walk;
|
|
||||||
}
|
}
|
||||||
// Tolerance. With the lag pool we shouldn't need it.
|
// Tolerance. With the lag pool we shouldn't need it.
|
||||||
//player_max_speed *= 2.5;
|
//player_max_speed *= 2.5;
|
||||||
|
@ -167,7 +167,7 @@ video::ITexture* draw_image(const v2u32& screensize,
|
|||||||
image = images[1];
|
image = images[1];
|
||||||
else
|
else
|
||||||
image = images[0];
|
image = images[0];
|
||||||
|
|
||||||
driver->setRenderTarget(image, true, true,
|
driver->setRenderTarget(image, true, true,
|
||||||
irr::video::SColor(255,
|
irr::video::SColor(255,
|
||||||
skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
|
skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
|
||||||
@ -421,79 +421,74 @@ void draw_scene(video::IVideoDriver* driver, scene::ISceneManager* smgr,
|
|||||||
gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
|
gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
|
||||||
const v2u32& screensize, video::SColor skycolor, bool show_hud)
|
const v2u32& screensize, video::SColor skycolor, bool show_hud)
|
||||||
{
|
{
|
||||||
//TODO check if usefull
|
TimeTaker timer("smgr");
|
||||||
u32 scenetime = 0;
|
|
||||||
{
|
|
||||||
TimeTaker timer("smgr");
|
|
||||||
|
|
||||||
bool draw_wield_tool = (show_hud &&
|
bool draw_wield_tool = (show_hud &&
|
||||||
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
|
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
|
||||||
camera.getCameraMode() < CAMERA_MODE_THIRD );
|
camera.getCameraMode() < CAMERA_MODE_THIRD );
|
||||||
|
|
||||||
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
|
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
|
||||||
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
|
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
try {
|
try {
|
||||||
draw_crosshair = !g_settings->getBool("touchtarget");
|
draw_crosshair = !g_settings->getBool("touchtarget");
|
||||||
}
|
}
|
||||||
catch(SettingNotFoundException) {}
|
catch(SettingNotFoundException) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string draw_mode = g_settings->get("3d_mode");
|
std::string draw_mode = g_settings->get("3d_mode");
|
||||||
|
|
||||||
smgr->drawAll();
|
smgr->drawAll();
|
||||||
|
|
||||||
if (draw_mode == "anaglyph")
|
if (draw_mode == "anaglyph")
|
||||||
{
|
{
|
||||||
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||||
smgr, draw_wield_tool, client, guienv);
|
smgr, draw_wield_tool, client, guienv);
|
||||||
draw_crosshair = false;
|
draw_crosshair = false;
|
||||||
}
|
}
|
||||||
else if (draw_mode == "interlaced")
|
else if (draw_mode == "interlaced")
|
||||||
{
|
{
|
||||||
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||||
draw_crosshair = false;
|
draw_crosshair = false;
|
||||||
}
|
}
|
||||||
else if (draw_mode == "sidebyside")
|
else if (draw_mode == "sidebyside")
|
||||||
{
|
{
|
||||||
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||||
show_hud = false;
|
show_hud = false;
|
||||||
}
|
}
|
||||||
else if (draw_mode == "topbottom")
|
else if (draw_mode == "topbottom")
|
||||||
{
|
{
|
||||||
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||||
show_hud = false;
|
show_hud = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
draw_plain(camera, show_hud, hud, hilightboxes, driver,
|
draw_plain(camera, show_hud, hud, hilightboxes, driver,
|
||||||
draw_wield_tool, client, guienv);
|
draw_wield_tool, client, guienv);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Post effects
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO how to make those 3d too
|
|
||||||
if (show_hud)
|
|
||||||
{
|
|
||||||
if (draw_crosshair)
|
|
||||||
hud.drawCrosshair();
|
|
||||||
hud.drawHotbar(client.getPlayerItem());
|
|
||||||
hud.drawLuaElements(camera.getOffset());
|
|
||||||
}
|
|
||||||
|
|
||||||
guienv->drawAll();
|
|
||||||
|
|
||||||
scenetime = timer.stop(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Post effects
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO how to make those 3d too
|
||||||
|
if (show_hud)
|
||||||
|
{
|
||||||
|
if (draw_crosshair)
|
||||||
|
hud.drawCrosshair();
|
||||||
|
hud.drawHotbar(client.getPlayerItem());
|
||||||
|
hud.drawLuaElements(camera.getOffset());
|
||||||
|
}
|
||||||
|
|
||||||
|
guienv->drawAll();
|
||||||
|
|
||||||
|
timer.stop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
Player * getNearestConnectedPlayer(v3f pos);
|
Player * getNearestConnectedPlayer(v3f pos);
|
||||||
std::list<Player*> getPlayers();
|
std::list<Player*> getPlayers();
|
||||||
std::list<Player*> getPlayers(bool ignore_disconnected);
|
std::list<Player*> getPlayers(bool ignore_disconnected);
|
||||||
|
|
||||||
u32 getDayNightRatio();
|
u32 getDayNightRatio();
|
||||||
|
|
||||||
// 0-23999
|
// 0-23999
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
void stepTimeOfDay(float dtime);
|
void stepTimeOfDay(float dtime);
|
||||||
|
|
||||||
void setTimeOfDaySpeed(float speed);
|
void setTimeOfDaySpeed(float speed);
|
||||||
|
|
||||||
float getTimeOfDaySpeed();
|
float getTimeOfDaySpeed();
|
||||||
|
|
||||||
void setDayNightRatioOverride(bool enable, u32 value)
|
void setDayNightRatioOverride(bool enable, u32 value)
|
||||||
@ -132,7 +132,7 @@ protected:
|
|||||||
* a later release.
|
* a later release.
|
||||||
*/
|
*/
|
||||||
bool m_cache_enable_shaders;
|
bool m_cache_enable_shaders;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JMutex m_lock;
|
JMutex m_lock;
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ class ActiveBlockModifier
|
|||||||
public:
|
public:
|
||||||
ActiveBlockModifier(){};
|
ActiveBlockModifier(){};
|
||||||
virtual ~ActiveBlockModifier(){};
|
virtual ~ActiveBlockModifier(){};
|
||||||
|
|
||||||
// Set of contents to trigger on
|
// Set of contents to trigger on
|
||||||
virtual std::set<std::string> getTriggerContents()=0;
|
virtual std::set<std::string> getTriggerContents()=0;
|
||||||
// Set of required neighbors (trigger doesn't happen if none are found)
|
// Set of required neighbors (trigger doesn't happen if none are found)
|
||||||
@ -255,7 +255,7 @@ public:
|
|||||||
Returns 0 if not added and thus deleted.
|
Returns 0 if not added and thus deleted.
|
||||||
*/
|
*/
|
||||||
u16 addActiveObject(ServerActiveObject *object);
|
u16 addActiveObject(ServerActiveObject *object);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add an active object as a static object to the corresponding
|
Add an active object as a static object to the corresponding
|
||||||
MapBlock.
|
MapBlock.
|
||||||
@ -264,7 +264,7 @@ public:
|
|||||||
(note: not used, pending removal from engine)
|
(note: not used, pending removal from engine)
|
||||||
*/
|
*/
|
||||||
//bool addActiveObjectAsStatic(ServerActiveObject *object);
|
//bool addActiveObjectAsStatic(ServerActiveObject *object);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Find out what new objects have been added to
|
Find out what new objects have been added to
|
||||||
inside a radius around a position
|
inside a radius around a position
|
||||||
@ -282,7 +282,7 @@ public:
|
|||||||
s16 player_radius,
|
s16 player_radius,
|
||||||
std::set<u16> ¤t_objects,
|
std::set<u16> ¤t_objects,
|
||||||
std::set<u16> &removed_objects);
|
std::set<u16> &removed_objects);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the next message emitted by some active object.
|
Get the next message emitted by some active object.
|
||||||
Returns a message with id=0 if no messages are available.
|
Returns a message with id=0 if no messages are available.
|
||||||
@ -311,16 +311,16 @@ public:
|
|||||||
bool setNode(v3s16 p, const MapNode &n);
|
bool setNode(v3s16 p, const MapNode &n);
|
||||||
bool removeNode(v3s16 p);
|
bool removeNode(v3s16 p);
|
||||||
bool swapNode(v3s16 p, const MapNode &n);
|
bool swapNode(v3s16 p, const MapNode &n);
|
||||||
|
|
||||||
// Find all active objects inside a radius around a point
|
// Find all active objects inside a radius around a point
|
||||||
std::set<u16> getObjectsInsideRadius(v3f pos, float radius);
|
std::set<u16> getObjectsInsideRadius(v3f pos, float radius);
|
||||||
|
|
||||||
// Clear all objects, loading and going through every MapBlock
|
// Clear all objects, loading and going through every MapBlock
|
||||||
void clearAllObjects();
|
void clearAllObjects();
|
||||||
|
|
||||||
// This makes stuff happen
|
// This makes stuff happen
|
||||||
void step(f32 dtime);
|
void step(f32 dtime);
|
||||||
|
|
||||||
//check if there's a line of sight between two positions
|
//check if there's a line of sight between two positions
|
||||||
bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL);
|
bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL);
|
||||||
|
|
||||||
@ -328,9 +328,9 @@ public:
|
|||||||
|
|
||||||
void reportMaxLagEstimate(float f) { m_max_lag_estimate = f; }
|
void reportMaxLagEstimate(float f) { m_max_lag_estimate = f; }
|
||||||
float getMaxLagEstimate() { return m_max_lag_estimate; }
|
float getMaxLagEstimate() { return m_max_lag_estimate; }
|
||||||
|
|
||||||
std::set<v3s16>* getForceloadedBlocks() { return &m_active_blocks.m_forceloaded_list; };
|
std::set<v3s16>* getForceloadedBlocks() { return &m_active_blocks.m_forceloaded_list; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -349,17 +349,17 @@ private:
|
|||||||
Returns 0 if not added and thus deleted.
|
Returns 0 if not added and thus deleted.
|
||||||
*/
|
*/
|
||||||
u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed, u32 dtime_s);
|
u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed, u32 dtime_s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Remove all objects that satisfy (m_removed && m_known_by_count==0)
|
Remove all objects that satisfy (m_removed && m_known_by_count==0)
|
||||||
*/
|
*/
|
||||||
void removeRemovedObjects();
|
void removeRemovedObjects();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert stored objects from block to active
|
Convert stored objects from block to active
|
||||||
*/
|
*/
|
||||||
void activateObjects(MapBlock *block, u32 dtime_s);
|
void activateObjects(MapBlock *block, u32 dtime_s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert objects that are not in active blocks to static.
|
Convert objects that are not in active blocks to static.
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ private:
|
|||||||
/*
|
/*
|
||||||
Member variables
|
Member variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// The map
|
// The map
|
||||||
ServerMap *m_map;
|
ServerMap *m_map;
|
||||||
// Lua state
|
// Lua state
|
||||||
@ -433,8 +433,8 @@ struct ClientEnvEvent
|
|||||||
{
|
{
|
||||||
ClientEnvEventType type;
|
ClientEnvEventType type;
|
||||||
union {
|
union {
|
||||||
struct{
|
//struct{
|
||||||
} none;
|
//} none;
|
||||||
struct{
|
struct{
|
||||||
u8 amount;
|
u8 amount;
|
||||||
bool send_to_server;
|
bool send_to_server;
|
||||||
@ -463,7 +463,7 @@ public:
|
|||||||
|
|
||||||
virtual void addPlayer(Player *player);
|
virtual void addPlayer(Player *player);
|
||||||
LocalPlayer * getLocalPlayer();
|
LocalPlayer * getLocalPlayer();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ClientSimpleObjects
|
ClientSimpleObjects
|
||||||
*/
|
*/
|
||||||
@ -473,7 +473,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
ActiveObjects
|
ActiveObjects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ClientActiveObject* getActiveObject(u16 id);
|
ClientActiveObject* getActiveObject(u16 id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -501,11 +501,11 @@ public:
|
|||||||
/*
|
/*
|
||||||
Client likes to call these
|
Client likes to call these
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Get all nearby objects
|
// Get all nearby objects
|
||||||
void getActiveObjects(v3f origin, f32 max_d,
|
void getActiveObjects(v3f origin, f32 max_d,
|
||||||
std::vector<DistanceSortedActiveObject> &dest);
|
std::vector<DistanceSortedActiveObject> &dest);
|
||||||
|
|
||||||
// Get event from queue. CEE_NONE is returned if queue is empty.
|
// Get event from queue. CEE_NONE is returned if queue is empty.
|
||||||
ClientEnvEvent getClientEvent();
|
ClientEnvEvent getClientEvent();
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ public:
|
|||||||
{ m_camera_offset = camera_offset; }
|
{ m_camera_offset = camera_offset; }
|
||||||
v3s16 getCameraOffset()
|
v3s16 getCameraOffset()
|
||||||
{ return m_camera_offset; }
|
{ return m_camera_offset; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ClientMap *m_map;
|
ClientMap *m_map;
|
||||||
scene::ISceneManager *m_smgr;
|
scene::ISceneManager *m_smgr;
|
||||||
|
@ -364,15 +364,14 @@ void GUIEngine::cloudPostProcess()
|
|||||||
{
|
{
|
||||||
float fps_max = g_settings->getFloat("fps_max");
|
float fps_max = g_settings->getFloat("fps_max");
|
||||||
// Time of frame without fps limit
|
// Time of frame without fps limit
|
||||||
float busytime;
|
|
||||||
u32 busytime_u32;
|
u32 busytime_u32;
|
||||||
|
|
||||||
// not using getRealTime is necessary for wine
|
// not using getRealTime is necessary for wine
|
||||||
u32 time = m_device->getTimer()->getTime();
|
u32 time = m_device->getTimer()->getTime();
|
||||||
if(time > m_cloud.lasttime)
|
if(time > m_cloud.lasttime)
|
||||||
busytime_u32 = time - m_cloud.lasttime;
|
busytime_u32 = time - m_cloud.lasttime;
|
||||||
else
|
else
|
||||||
busytime_u32 = 0;
|
busytime_u32 = 0;
|
||||||
busytime = busytime_u32 / 1000.0;
|
|
||||||
|
|
||||||
// FPS limiter
|
// FPS limiter
|
||||||
u32 frametime_min = 1000./fps_max;
|
u32 frametime_min = 1000./fps_max;
|
||||||
|
@ -146,10 +146,7 @@ bool JThread::IsSameThread()
|
|||||||
|
|
||||||
void *JThread::TheThread(void *param)
|
void *JThread::TheThread(void *param)
|
||||||
{
|
{
|
||||||
JThread *jthread;
|
JThread *jthread = (JThread *)param;
|
||||||
void *ret;
|
|
||||||
|
|
||||||
jthread = (JThread *)param;
|
|
||||||
|
|
||||||
jthread->continuemutex2.Lock();
|
jthread->continuemutex2.Lock();
|
||||||
jthread->running = true;
|
jthread->running = true;
|
||||||
@ -157,7 +154,7 @@ void *JThread::TheThread(void *param)
|
|||||||
jthread->continuemutex.Lock();
|
jthread->continuemutex.Lock();
|
||||||
jthread->continuemutex.Unlock();
|
jthread->continuemutex.Unlock();
|
||||||
|
|
||||||
ret = jthread->Thread();
|
jthread->Thread();
|
||||||
|
|
||||||
jthread->running = false;
|
jthread->running = false;
|
||||||
|
|
||||||
|
@ -74,8 +74,6 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
|
|
||||||
v3f position = getPosition();
|
v3f position = getPosition();
|
||||||
|
|
||||||
v3f old_speed = m_speed;
|
|
||||||
|
|
||||||
// Copy parent position if local player is attached
|
// Copy parent position if local player is attached
|
||||||
if(isAttached)
|
if(isAttached)
|
||||||
{
|
{
|
||||||
@ -100,7 +98,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
/*
|
/*
|
||||||
Collision detection
|
Collision detection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool is_valid_position;
|
bool is_valid_position;
|
||||||
MapNode node;
|
MapNode node;
|
||||||
v3s16 pp;
|
v3s16 pp;
|
||||||
@ -191,7 +189,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
v3f lwn_f = intToFloat(m_sneak_node, BS);
|
v3f lwn_f = intToFloat(m_sneak_node, BS);
|
||||||
position.X = rangelim(position.X, lwn_f.X-maxd, lwn_f.X+maxd);
|
position.X = rangelim(position.X, lwn_f.X-maxd, lwn_f.X+maxd);
|
||||||
position.Z = rangelim(position.Z, lwn_f.Z-maxd, lwn_f.Z+maxd);
|
position.Z = rangelim(position.Z, lwn_f.Z-maxd, lwn_f.Z+maxd);
|
||||||
|
|
||||||
if(!is_climbing)
|
if(!is_climbing)
|
||||||
{
|
{
|
||||||
f32 min_y = lwn_f.Y + 0.5*BS;
|
f32 min_y = lwn_f.Y + 0.5*BS;
|
||||||
@ -211,7 +209,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
player_stepheight += (0.5 * BS);
|
player_stepheight += (0.5 * BS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
v3f accel_f = v3f(0,0,0);
|
v3f accel_f = v3f(0,0,0);
|
||||||
|
|
||||||
collisionMoveResult result = collisionMoveSimple(env, m_gamedef,
|
collisionMoveResult result = collisionMoveSimple(env, m_gamedef,
|
||||||
@ -226,7 +224,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
*/
|
*/
|
||||||
bool touching_ground_was = touching_ground;
|
bool touching_ground_was = touching_ground;
|
||||||
touching_ground = result.touching_ground;
|
touching_ground = result.touching_ground;
|
||||||
|
|
||||||
//bool standing_on_unloaded = result.standing_on_unloaded;
|
//bool standing_on_unloaded = result.standing_on_unloaded;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -277,7 +275,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
f32 max_axis_distance_f = MYMAX(
|
f32 max_axis_distance_f = MYMAX(
|
||||||
fabs(player_p2df.X-node_p2df.X),
|
fabs(player_p2df.X-node_p2df.X),
|
||||||
fabs(player_p2df.Y-node_p2df.Y));
|
fabs(player_p2df.Y-node_p2df.Y));
|
||||||
|
|
||||||
if(distance_f > min_distance_f ||
|
if(distance_f > min_distance_f ||
|
||||||
max_axis_distance_f > 0.5*BS + sneak_max + 0.1*BS)
|
max_axis_distance_f > 0.5*BS + sneak_max + 0.1*BS)
|
||||||
continue;
|
continue;
|
||||||
@ -301,7 +299,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
min_distance_f = distance_f;
|
min_distance_f = distance_f;
|
||||||
new_sneak_node = p;
|
new_sneak_node = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sneak_node_found = (min_distance_f < 100000.0*BS*0.9);
|
bool sneak_node_found = (min_distance_f < 100000.0*BS*0.9);
|
||||||
|
|
||||||
m_sneak_node = new_sneak_node;
|
m_sneak_node = new_sneak_node;
|
||||||
@ -314,12 +312,12 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
if(sneak_node_found && control.sneak)
|
if(sneak_node_found && control.sneak)
|
||||||
touching_ground = true;
|
touching_ground = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set new position
|
Set new position
|
||||||
*/
|
*/
|
||||||
setPosition(position);
|
setPosition(position);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Report collisions
|
Report collisions
|
||||||
*/
|
*/
|
||||||
@ -367,7 +365,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
*/
|
*/
|
||||||
m_old_node_below = floatToInt(position - v3f(0,BS/2,0), BS);
|
m_old_node_below = floatToInt(position - v3f(0,BS/2,0), BS);
|
||||||
m_old_node_below_type = nodemgr->get(map->getNodeNoEx(m_old_node_below)).name;
|
m_old_node_below_type = nodemgr->get(map->getNodeNoEx(m_old_node_below)).name;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check properties of the node on which the player is standing
|
Check properties of the node on which the player is standing
|
||||||
*/
|
*/
|
||||||
@ -400,10 +398,10 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
|
|
||||||
v3f move_direction = v3f(0,0,1);
|
v3f move_direction = v3f(0,0,1);
|
||||||
move_direction.rotateXZBy(getYaw());
|
move_direction.rotateXZBy(getYaw());
|
||||||
|
|
||||||
v3f speedH = v3f(0,0,0); // Horizontal (X, Z)
|
v3f speedH = v3f(0,0,0); // Horizontal (X, Z)
|
||||||
v3f speedV = v3f(0,0,0); // Vertical (Y)
|
v3f speedV = v3f(0,0,0); // Vertical (Y)
|
||||||
|
|
||||||
bool fly_allowed = m_gamedef->checkLocalPrivilege("fly");
|
bool fly_allowed = m_gamedef->checkLocalPrivilege("fly");
|
||||||
bool fast_allowed = m_gamedef->checkLocalPrivilege("fast");
|
bool fast_allowed = m_gamedef->checkLocalPrivilege("fast");
|
||||||
|
|
||||||
@ -415,7 +413,7 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
|
|
||||||
// Whether superspeed mode is used or not
|
// Whether superspeed mode is used or not
|
||||||
bool superspeed = false;
|
bool superspeed = false;
|
||||||
|
|
||||||
if(g_settings->getBool("always_fly_fast") && free_move && fast_move)
|
if(g_settings->getBool("always_fly_fast") && free_move && fast_move)
|
||||||
superspeed = true;
|
superspeed = true;
|
||||||
|
|
||||||
@ -425,7 +423,7 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
// If free movement and fast movement, always move fast
|
// If free movement and fast movement, always move fast
|
||||||
if(free_move && fast_move)
|
if(free_move && fast_move)
|
||||||
superspeed = true;
|
superspeed = true;
|
||||||
|
|
||||||
// Auxiliary button 1 (E)
|
// Auxiliary button 1 (E)
|
||||||
if(control.aux1)
|
if(control.aux1)
|
||||||
{
|
{
|
||||||
@ -548,7 +546,7 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
{
|
{
|
||||||
speedJ.Y = movement_speed_jump * physics_override_jump;
|
speedJ.Y = movement_speed_jump * physics_override_jump;
|
||||||
setSpeed(speedJ);
|
setSpeed(speedJ);
|
||||||
|
|
||||||
MtEvent *e = new SimpleTriggerEvent("PlayerJump");
|
MtEvent *e = new SimpleTriggerEvent("PlayerJump");
|
||||||
m_gamedef->event()->put(e);
|
m_gamedef->event()->put(e);
|
||||||
}
|
}
|
||||||
|
@ -3220,8 +3220,6 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
|
|||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
MapSector *sector = NULL;
|
|
||||||
|
|
||||||
// The directory layout we're going to load from.
|
// The directory layout we're going to load from.
|
||||||
// 1 - original sectors/xxxxzzzz/
|
// 1 - original sectors/xxxxzzzz/
|
||||||
// 2 - new sectors2/xxx/zzz/
|
// 2 - new sectors2/xxx/zzz/
|
||||||
@ -3241,7 +3239,7 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
sector = loadSectorMeta(sectordir, loadlayout != 2);
|
loadSectorMeta(sectordir, loadlayout != 2);
|
||||||
}
|
}
|
||||||
catch(InvalidFilenameException &e)
|
catch(InvalidFilenameException &e)
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ MapBlock::MapBlock(Map *parent, v3s16 pos, IGameDef *gamedef, bool dummy):
|
|||||||
data = NULL;
|
data = NULL;
|
||||||
if(dummy == false)
|
if(dummy == false)
|
||||||
reallocate();
|
reallocate();
|
||||||
|
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
mesh = NULL;
|
mesh = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -73,7 +73,7 @@ MapBlock::~MapBlock()
|
|||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
{
|
{
|
||||||
//JMutexAutoLock lock(mesh_mutex);
|
//JMutexAutoLock lock(mesh_mutex);
|
||||||
|
|
||||||
if(mesh)
|
if(mesh)
|
||||||
{
|
{
|
||||||
delete mesh;
|
delete mesh;
|
||||||
@ -115,7 +115,7 @@ MapNode MapBlock::getNodeParent(v3s16 p, bool *is_valid_position)
|
|||||||
/*
|
/*
|
||||||
Propagates sunlight down through the block.
|
Propagates sunlight down through the block.
|
||||||
Doesn't modify nodes that are not affected by sunlight.
|
Doesn't modify nodes that are not affected by sunlight.
|
||||||
|
|
||||||
Returns false if sunlight at bottom block is invalid.
|
Returns false if sunlight at bottom block is invalid.
|
||||||
Returns true if sunlight at bottom block is valid.
|
Returns true if sunlight at bottom block is valid.
|
||||||
Returns true if bottom block doesn't exist.
|
Returns true if bottom block doesn't exist.
|
||||||
@ -138,16 +138,16 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
|||||||
|
|
||||||
// Whether the sunlight at the top of the bottom block is valid
|
// Whether the sunlight at the top of the bottom block is valid
|
||||||
bool block_below_is_valid = true;
|
bool block_below_is_valid = true;
|
||||||
|
|
||||||
v3s16 pos_relative = getPosRelative();
|
v3s16 pos_relative = getPosRelative();
|
||||||
|
|
||||||
for(s16 x=0; x<MAP_BLOCKSIZE; x++)
|
for(s16 x=0; x<MAP_BLOCKSIZE; x++)
|
||||||
{
|
{
|
||||||
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
bool no_sunlight = false;
|
bool no_sunlight = false;
|
||||||
bool no_top_block = false;
|
//bool no_top_block = false;
|
||||||
|
|
||||||
// Check if node above block has sunlight
|
// Check if node above block has sunlight
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
no_top_block = true;
|
//no_top_block = true;
|
||||||
|
|
||||||
// NOTE: This makes over-ground roofed places sunlighted
|
// NOTE: This makes over-ground roofed places sunlighted
|
||||||
// Assume sunlight, unless is_underground==true
|
// Assume sunlight, unless is_underground==true
|
||||||
if(is_underground)
|
if(is_underground)
|
||||||
@ -211,19 +211,19 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
|||||||
<<", is_underground="<<is_underground
|
<<", is_underground="<<is_underground
|
||||||
<<", no_sunlight="<<no_sunlight
|
<<", no_sunlight="<<no_sunlight
|
||||||
<<std::endl;*/
|
<<std::endl;*/
|
||||||
|
|
||||||
s16 y = MAP_BLOCKSIZE-1;
|
s16 y = MAP_BLOCKSIZE-1;
|
||||||
|
|
||||||
// This makes difference to diminishing in water.
|
// This makes difference to diminishing in water.
|
||||||
bool stopped_to_solid_object = false;
|
bool stopped_to_solid_object = false;
|
||||||
|
|
||||||
u8 current_light = no_sunlight ? 0 : LIGHT_SUN;
|
u8 current_light = no_sunlight ? 0 : LIGHT_SUN;
|
||||||
|
|
||||||
for(; y >= 0; y--)
|
for(; y >= 0; y--)
|
||||||
{
|
{
|
||||||
v3s16 pos(x, y, z);
|
v3s16 pos(x, y, z);
|
||||||
MapNode &n = getNodeRef(pos);
|
MapNode &n = getNodeRef(pos);
|
||||||
|
|
||||||
if(current_light == 0)
|
if(current_light == 0)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
@ -236,7 +236,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
|||||||
{
|
{
|
||||||
// A solid object is on the way.
|
// A solid object is on the way.
|
||||||
stopped_to_solid_object = true;
|
stopped_to_solid_object = true;
|
||||||
|
|
||||||
// Light stops.
|
// Light stops.
|
||||||
current_light = 0;
|
current_light = 0;
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
|||||||
{
|
{
|
||||||
n.setLight(LIGHTBANK_DAY, current_light, nodemgr);
|
n.setLight(LIGHTBANK_DAY, current_light, nodemgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(diminish_light(current_light) != 0)
|
if(diminish_light(current_light) != 0)
|
||||||
{
|
{
|
||||||
light_sources.insert(pos_relative + pos);
|
light_sources.insert(pos_relative + pos);
|
||||||
@ -275,7 +275,7 @@ bool MapBlock::propagateSunlight(std::set<v3s16> & light_sources,
|
|||||||
|
|
||||||
Check if the node below the block has proper sunlight at top.
|
Check if the node below the block has proper sunlight at top.
|
||||||
If not, the block below is invalid.
|
If not, the block below is invalid.
|
||||||
|
|
||||||
Ignore non-transparent nodes as they always have no light
|
Ignore non-transparent nodes as they always have no light
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ void MapBlock::copyTo(VoxelManipulator &dst)
|
|||||||
{
|
{
|
||||||
v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
|
v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
|
||||||
VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
|
VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
|
||||||
|
|
||||||
// Copy from data to VoxelManipulator
|
// Copy from data to VoxelManipulator
|
||||||
dst.copyFrom(data, data_area, v3s16(0,0,0),
|
dst.copyFrom(data, data_area, v3s16(0,0,0),
|
||||||
getPosRelative(), data_size);
|
getPosRelative(), data_size);
|
||||||
@ -321,7 +321,7 @@ void MapBlock::copyFrom(VoxelManipulator &dst)
|
|||||||
{
|
{
|
||||||
v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
|
v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE);
|
||||||
VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
|
VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1));
|
||||||
|
|
||||||
// Copy from VoxelManipulator to data
|
// Copy from VoxelManipulator to data
|
||||||
dst.copyTo(data, data_area, v3s16(0,0,0),
|
dst.copyTo(data, data_area, v3s16(0,0,0),
|
||||||
getPosRelative(), data_size);
|
getPosRelative(), data_size);
|
||||||
@ -520,18 +520,18 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
|||||||
{
|
{
|
||||||
if(!ser_ver_supported(version))
|
if(!ser_ver_supported(version))
|
||||||
throw VersionMismatchException("ERROR: MapBlock format not supported");
|
throw VersionMismatchException("ERROR: MapBlock format not supported");
|
||||||
|
|
||||||
if(data == NULL)
|
if(data == NULL)
|
||||||
{
|
{
|
||||||
throw SerializationError("ERROR: Not writing dummy block.");
|
throw SerializationError("ERROR: Not writing dummy block.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't do this anymore; we have 16-bit dynamically allocated node IDs
|
// Can't do this anymore; we have 16-bit dynamically allocated node IDs
|
||||||
// in memory; conversion just won't work in this direction.
|
// in memory; conversion just won't work in this direction.
|
||||||
if(version < 24)
|
if(version < 24)
|
||||||
throw SerializationError("MapBlock::serialize: serialization to "
|
throw SerializationError("MapBlock::serialize: serialization to "
|
||||||
"version < 24 not possible");
|
"version < 24 not possible");
|
||||||
|
|
||||||
// First byte
|
// First byte
|
||||||
u8 flags = 0;
|
u8 flags = 0;
|
||||||
if(is_underground)
|
if(is_underground)
|
||||||
@ -543,7 +543,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
|||||||
if(m_generated == false)
|
if(m_generated == false)
|
||||||
flags |= 0x08;
|
flags |= 0x08;
|
||||||
writeU8(os, flags);
|
writeU8(os, flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bulk node data
|
Bulk node data
|
||||||
*/
|
*/
|
||||||
@ -573,7 +573,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
|||||||
MapNode::serializeBulk(os, version, data, nodecount,
|
MapNode::serializeBulk(os, version, data, nodecount,
|
||||||
content_width, params_width, true);
|
content_width, params_width, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Node metadata
|
Node metadata
|
||||||
*/
|
*/
|
||||||
@ -599,7 +599,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
|
|||||||
|
|
||||||
// Write block-specific node definition id mapping
|
// Write block-specific node definition id mapping
|
||||||
nimap.serialize(os);
|
nimap.serialize(os);
|
||||||
|
|
||||||
if(version >= 25){
|
if(version >= 25){
|
||||||
// Node timers
|
// Node timers
|
||||||
m_node_timers.serialize(os, version);
|
m_node_timers.serialize(os, version);
|
||||||
@ -626,7 +626,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
|
|||||||
{
|
{
|
||||||
if(!ser_ver_supported(version))
|
if(!ser_ver_supported(version))
|
||||||
throw VersionMismatchException("ERROR: MapBlock format not supported");
|
throw VersionMismatchException("ERROR: MapBlock format not supported");
|
||||||
|
|
||||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())<<std::endl);
|
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())<<std::endl);
|
||||||
|
|
||||||
m_day_night_differs_expired = false;
|
m_day_night_differs_expired = false;
|
||||||
@ -702,13 +702,13 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
|
|||||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||||
<<": Static objects"<<std::endl);
|
<<": Static objects"<<std::endl);
|
||||||
m_static_objects.deSerialize(is);
|
m_static_objects.deSerialize(is);
|
||||||
|
|
||||||
// Timestamp
|
// Timestamp
|
||||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||||
<<": Timestamp"<<std::endl);
|
<<": Timestamp"<<std::endl);
|
||||||
setTimestamp(readU32(is));
|
setTimestamp(readU32(is));
|
||||||
m_disk_timestamp = m_timestamp;
|
m_disk_timestamp = m_timestamp;
|
||||||
|
|
||||||
// Dynamically re-set ids based on node names
|
// Dynamically re-set ids based on node names
|
||||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||||
<<": NameIdMapping"<<std::endl);
|
<<": NameIdMapping"<<std::endl);
|
||||||
@ -722,7 +722,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
|
|||||||
m_node_timers.deSerialize(is, version);
|
m_node_timers.deSerialize(is, version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
|
||||||
<<": Done."<<std::endl);
|
<<": Done."<<std::endl);
|
||||||
}
|
}
|
||||||
@ -809,7 +809,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
|||||||
databuf_nodelist[i*ser_length + 1] = s[i];
|
databuf_nodelist[i*ser_length + 1] = s[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(version >= 10)
|
if(version >= 10)
|
||||||
{
|
{
|
||||||
// Uncompress and set param2 data
|
// Uncompress and set param2 data
|
||||||
@ -852,7 +852,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
|||||||
databuf_nodelist[i*ser_length + 1] = s[i+nodecount];
|
databuf_nodelist[i*ser_length + 1] = s[i+nodecount];
|
||||||
databuf_nodelist[i*ser_length + 2] = s[i+nodecount*2];
|
databuf_nodelist[i*ser_length + 2] = s[i+nodecount*2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NodeMetadata
|
NodeMetadata
|
||||||
*/
|
*/
|
||||||
@ -989,12 +989,12 @@ std::string analyze_block(MapBlock *block)
|
|||||||
return "NULL";
|
return "NULL";
|
||||||
|
|
||||||
std::ostringstream desc;
|
std::ostringstream desc;
|
||||||
|
|
||||||
v3s16 p = block->getPos();
|
v3s16 p = block->getPos();
|
||||||
char spos[20];
|
char spos[20];
|
||||||
snprintf(spos, 20, "(%2d,%2d,%2d), ", p.X, p.Y, p.Z);
|
snprintf(spos, 20, "(%2d,%2d,%2d), ", p.X, p.Y, p.Z);
|
||||||
desc<<spos;
|
desc<<spos;
|
||||||
|
|
||||||
switch(block->getModified())
|
switch(block->getModified())
|
||||||
{
|
{
|
||||||
case MOD_STATE_CLEAN:
|
case MOD_STATE_CLEAN:
|
||||||
@ -1051,21 +1051,21 @@ std::string analyze_block(MapBlock *block)
|
|||||||
else
|
else
|
||||||
full_air = false;
|
full_air = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc<<"content {";
|
desc<<"content {";
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
||||||
if(full_ignore)
|
if(full_ignore)
|
||||||
ss<<"IGNORE (full), ";
|
ss<<"IGNORE (full), ";
|
||||||
else if(some_ignore)
|
else if(some_ignore)
|
||||||
ss<<"IGNORE, ";
|
ss<<"IGNORE, ";
|
||||||
|
|
||||||
if(full_air)
|
if(full_air)
|
||||||
ss<<"AIR (full), ";
|
ss<<"AIR (full), ";
|
||||||
else if(some_air)
|
else if(some_air)
|
||||||
ss<<"AIR, ";
|
ss<<"AIR, ";
|
||||||
|
|
||||||
if(ss.str().size()>=2)
|
if(ss.str().size()>=2)
|
||||||
desc<<ss.str().substr(0, ss.str().size()-2);
|
desc<<ss.str().substr(0, ss.str().size()-2);
|
||||||
|
|
||||||
|
@ -310,7 +310,6 @@ void Mapgen::spreadLight(v3s16 nmin, v3s16 nmax)
|
|||||||
{
|
{
|
||||||
//TimeTaker t("spreadLight");
|
//TimeTaker t("spreadLight");
|
||||||
VoxelArea a(nmin, nmax);
|
VoxelArea a(nmin, nmax);
|
||||||
v3s16 em = vm->m_area.getExtent();
|
|
||||||
|
|
||||||
for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) {
|
for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) {
|
||||||
for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) {
|
for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) {
|
||||||
|
@ -438,7 +438,6 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
|||||||
this->ndef = data->nodedef;
|
this->ndef = data->nodedef;
|
||||||
|
|
||||||
// Hack: use minimum block coords for old code that assumes a single block
|
// Hack: use minimum block coords for old code that assumes a single block
|
||||||
v3s16 blockpos = data->blockpos_requested;
|
|
||||||
v3s16 blockpos_min = data->blockpos_min;
|
v3s16 blockpos_min = data->blockpos_min;
|
||||||
v3s16 blockpos_max = data->blockpos_max;
|
v3s16 blockpos_max = data->blockpos_max;
|
||||||
|
|
||||||
|
@ -1025,10 +1025,6 @@ int ModApiMainMenu::l_download_file(lua_State *L)
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
int ModApiMainMenu::l_get_video_drivers(lua_State *L)
|
int ModApiMainMenu::l_get_video_drivers(lua_State *L)
|
||||||
{
|
{
|
||||||
unsigned int index = 1;
|
|
||||||
lua_newtable(L);
|
|
||||||
int top = lua_gettop(L);
|
|
||||||
|
|
||||||
std::vector<irr::video::E_DRIVER_TYPE> drivers
|
std::vector<irr::video::E_DRIVER_TYPE> drivers
|
||||||
= porting::getSupportedVideoDrivers();
|
= porting::getSupportedVideoDrivers();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "lua_api/l_base.h"
|
#include "lua_api/l_base.h"
|
||||||
|
|
||||||
class INodeDefManager;
|
class INodeDefManager;
|
||||||
class NodeResolveInfo;
|
struct NodeResolveInfo;
|
||||||
class DecoSimple;
|
class DecoSimple;
|
||||||
class DecoSchematic;
|
class DecoSchematic;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user