"Crouch" renaimed to "crawl"
This commit is contained in:
parent
1324d39db9
commit
253481300b
@ -36,7 +36,7 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("keymap_jump", "KEY_SPACE");
|
settings->setDefault("keymap_jump", "KEY_SPACE");
|
||||||
settings->setDefault("keymap_sneak", "KEY_LSHIFT");
|
settings->setDefault("keymap_sneak", "KEY_LSHIFT");
|
||||||
settings->setDefault("keymap_drop", "KEY_KEY_Q");
|
settings->setDefault("keymap_drop", "KEY_KEY_Q");
|
||||||
settings->setDefault("keymap_crouch", "KEY_LCONTROL");
|
settings->setDefault("keymap_crawl", "KEY_LCONTROL");
|
||||||
settings->setDefault("keymap_inventory", "KEY_KEY_I");
|
settings->setDefault("keymap_inventory", "KEY_KEY_I");
|
||||||
settings->setDefault("keymap_special1", "KEY_KEY_E");
|
settings->setDefault("keymap_special1", "KEY_KEY_E");
|
||||||
settings->setDefault("keymap_chat", "KEY_KEY_T");
|
settings->setDefault("keymap_chat", "KEY_KEY_T");
|
||||||
|
@ -1665,7 +1665,7 @@ void the_game(
|
|||||||
input->isKeyDown(getKeySetting("keymap_sneak")),
|
input->isKeyDown(getKeySetting("keymap_sneak")),
|
||||||
camera_pitch,
|
camera_pitch,
|
||||||
camera_yaw,
|
camera_yaw,
|
||||||
input->isKeyDown(getKeySetting("keymap_crouch"))
|
input->isKeyDown(getKeySetting("keymap_crawl"))
|
||||||
);
|
);
|
||||||
client.setPlayerControl(control);
|
client.setPlayerControl(control);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ LocalPlayer::LocalPlayer(IGameDef *gamedef):
|
|||||||
Player(gamedef),
|
Player(gamedef),
|
||||||
m_sneak_node(32767,32767,32767),
|
m_sneak_node(32767,32767,32767),
|
||||||
m_sneak_node_exists(false),
|
m_sneak_node_exists(false),
|
||||||
m_must_crouch(false)
|
m_must_crawl(false)
|
||||||
{
|
{
|
||||||
// Initialize hp to 0, so that no hearts will be shown if server
|
// Initialize hp to 0, so that no hearts will be shown if server
|
||||||
// doesn't support health points
|
// doesn't support health points
|
||||||
@ -600,9 +600,9 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if player must crouch
|
Check if player must crawl
|
||||||
*/
|
*/
|
||||||
bool must_crouch = false;
|
bool must_crawl = false;
|
||||||
v3s16 pos_head_i = floatToInt(v3f(position.X,position.Y+m_eyeOffsetMax+BS*0.05f,position.Z), BS);
|
v3s16 pos_head_i = floatToInt(v3f(position.X,position.Y+m_eyeOffsetMax+BS*0.05f,position.Z), BS);
|
||||||
for(s16 z = -1; z <= 1; z++)
|
for(s16 z = -1; z <= 1; z++)
|
||||||
for(s16 x = -1; x <= 1; x++)
|
for(s16 x = -1; x <= 1; x++)
|
||||||
@ -613,18 +613,17 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
|
|||||||
if(nodemgr->get(map.getNode(np)).walkable == false)
|
if(nodemgr->get(map.getNode(np)).walkable == false)
|
||||||
continue;
|
continue;
|
||||||
core::aabbox3d<f32> nodebox = getNodeBox(np, BS);
|
core::aabbox3d<f32> nodebox = getNodeBox(np, BS);
|
||||||
if( (m_must_crouch || control.crouch) //shall we test it?
|
if( (m_must_crawl || control.crawl) //shall we test it?
|
||||||
&& playerbox_standing.intersectsWithBox(nodebox) //colliding with the node?
|
&& playerbox_standing.intersectsWithBox(nodebox) //colliding with the node?
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
must_crouch = true;
|
must_crawl = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(InvalidPositionException &e)
|
catch(InvalidPositionException &e)
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
m_must_crouch = must_crouch;
|
m_must_crawl = must_crawl;
|
||||||
std::cout << "must_crouch = " << (must_crouch?"true":"false") << std::endl; //j@@@
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set new position
|
Set new position
|
||||||
@ -687,10 +686,8 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
if(free_move && fast_move)
|
if(free_move && fast_move)
|
||||||
superspeed = true;
|
superspeed = true;
|
||||||
|
|
||||||
// If must crouch - then crouch ;)
|
// If must crawl - then crawl ;)
|
||||||
if(m_must_crouch) control.crouch = true;
|
if(m_must_crawl) control.crawl = true;
|
||||||
|
|
||||||
//if(control.crouch) control.sneak = true;
|
|
||||||
|
|
||||||
// Auxiliary button 1 (E)
|
// Auxiliary button 1 (E)
|
||||||
if(control.aux1)
|
if(control.aux1)
|
||||||
@ -784,7 +781,7 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
// The speed of the player (Y is ignored)
|
// The speed of the player (Y is ignored)
|
||||||
if(superspeed)
|
if(superspeed)
|
||||||
speed = speed.normalize() * walkspeed_max * 5.0;
|
speed = speed.normalize() * walkspeed_max * 5.0;
|
||||||
else if(control.sneak || control.crouch)
|
else if(control.sneak || control.crawl)
|
||||||
speed = speed.normalize() * walkspeed_max / 3.0;
|
speed = speed.normalize() * walkspeed_max / 3.0;
|
||||||
else
|
else
|
||||||
speed = speed.normalize() * walkspeed_max;
|
speed = speed.normalize() * walkspeed_max;
|
||||||
@ -799,8 +796,8 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
accelerate(speed, inc);
|
accelerate(speed, inc);
|
||||||
|
|
||||||
static const f32 eyes_delta = 10.f;
|
static const f32 eyes_delta = 10.f;
|
||||||
if(control.crouch){
|
if(control.crawl){
|
||||||
//crouching
|
//crawling
|
||||||
if(m_eyeOffset.Y > m_eyeOffsetMin + 0.01f)
|
if(m_eyeOffset.Y > m_eyeOffsetMin + 0.01f)
|
||||||
m_eyeOffset.Y += (m_eyeOffsetMin-m_eyeOffset.Y) * eyes_delta * dtime;
|
m_eyeOffset.Y += (m_eyeOffsetMin-m_eyeOffset.Y) * eyes_delta * dtime;
|
||||||
else m_eyeOffset.Y = m_eyeOffsetMin;
|
else m_eyeOffset.Y = m_eyeOffsetMin;
|
||||||
|
10
src/player.h
10
src/player.h
@ -192,7 +192,7 @@ struct PlayerControl
|
|||||||
sneak = false;
|
sneak = false;
|
||||||
pitch = 0;
|
pitch = 0;
|
||||||
yaw = 0;
|
yaw = 0;
|
||||||
crouch = false;
|
crawl = false;
|
||||||
}
|
}
|
||||||
PlayerControl(
|
PlayerControl(
|
||||||
bool a_up,
|
bool a_up,
|
||||||
@ -204,7 +204,7 @@ struct PlayerControl
|
|||||||
bool a_sneak,
|
bool a_sneak,
|
||||||
float a_pitch,
|
float a_pitch,
|
||||||
float a_yaw,
|
float a_yaw,
|
||||||
bool a_crouch
|
bool a_crawl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
up = a_up;
|
up = a_up;
|
||||||
@ -216,7 +216,7 @@ struct PlayerControl
|
|||||||
sneak = a_sneak;
|
sneak = a_sneak;
|
||||||
pitch = a_pitch;
|
pitch = a_pitch;
|
||||||
yaw = a_yaw;
|
yaw = a_yaw;
|
||||||
crouch = a_crouch;
|
crawl = a_crawl;
|
||||||
}
|
}
|
||||||
bool up;
|
bool up;
|
||||||
bool down;
|
bool down;
|
||||||
@ -227,7 +227,7 @@ struct PlayerControl
|
|||||||
bool sneak;
|
bool sneak;
|
||||||
float pitch;
|
float pitch;
|
||||||
float yaw;
|
float yaw;
|
||||||
bool crouch;
|
bool crawl;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalPlayer : public Player
|
class LocalPlayer : public Player
|
||||||
@ -255,7 +255,7 @@ private:
|
|||||||
// Whether the player is allowed to sneak
|
// Whether the player is allowed to sneak
|
||||||
bool m_sneak_node_exists;
|
bool m_sneak_node_exists;
|
||||||
// Whether player can't stand
|
// Whether player can't stand
|
||||||
bool m_must_crouch;
|
bool m_must_crawl;
|
||||||
};
|
};
|
||||||
#endif // !SERVER
|
#endif // !SERVER
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user