aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>2012-11-22 21:01:31 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-11-25 19:14:24 +0200
commit3d1c481f0bdf03b59871237d810685278e87613b (patch)
treefe49c10e926b1e452e4f98561a148e2f145c27e9 /src/game.cpp
parent756db8174aa6a05eb998cfcec8eb5127053c5ea9 (diff)
downloaddragonfireclient-3d1c481f0bdf03b59871237d810685278e87613b.tar.xz
RealBadAngel's patch which allows the lua api to read pressed player keys. This should make it possible to change the player's animation based on what he is doing
Correct lua api version number Always update animations and attachments after the entity is added to scene client side. Fixes animations not being applied in client initialization for some reason. Attachments should be re-tested now just to be safe. Fix a segmentation fault caused by reaching materials that didn't exist in a loop for setting texture
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index a1a197219..5ce214cb8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1881,6 +1881,8 @@ void the_game(
bool a_jump,
bool a_superspeed,
bool a_sneak,
+ bool a_LMB,
+ bool a_RMB,
float a_pitch,
float a_yaw*/
PlayerControl control(
@@ -1891,10 +1893,24 @@ void the_game(
input->isKeyDown(getKeySetting("keymap_jump")),
input->isKeyDown(getKeySetting("keymap_special1")),
input->isKeyDown(getKeySetting("keymap_sneak")),
+ input->getLeftState(),
+ input->getRightState(),
camera_pitch,
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;
}
/*