diff --git a/game/client b/game/client index 2164e96..dd120e6 100755 Binary files a/game/client and b/game/client differ diff --git a/game/client.c b/game/client.c index 33a9dc0..c9ac211 100644 --- a/game/client.c +++ b/game/client.c @@ -41,6 +41,7 @@ typedef int socklen_t; #define BTN_SWITCH_RIFLE (1u << 2) #define BTN_PICK (1u << 3) #define BTN_USE_MEDKIT (1u << 4) +#define BTN_JUMP (1u << 5) // ============== SIMPLEX NOISE ============== static const uint8_t perm[512] = { @@ -555,6 +556,7 @@ int main(void) { if (myId != 255 && rp[myId].present) { Vector3 body = rp[myId].pos; camPos.x = body.x; + camPos.y = body.y + 1.0f; camPos.z = body.z + 0.0001f; } } else if (type == MSG_ITEMS && n >= (int)sizeof(MsgItems)) { @@ -609,6 +611,8 @@ int main(void) { buttons |= BTN_PICK; if (IsKeyPressed(KEY_H)) buttons |= BTN_USE_MEDKIT; + if (IsKeyPressed(KEY_SPACE)) + buttons |= BTN_JUMP; if (myId != 255) { MsgInput in = {0}; @@ -736,7 +740,7 @@ int main(void) { 18, (rp[myId].medkits > 0) ? (Color){120, 255, 120, 120} : (Color){120, 120, 120, 120}); - DrawText("1=Pistol 2=Rifle R=Reload F=Pick", 20, 95, 14, + DrawText("1=Pistol 2=Rifle R=Reload F=Pick SPACE=Jump", 20, 95, 12, (Color){150, 150, 150, 150}); const char *weaponName = diff --git a/game/server b/game/server index 80cf392..c460ae1 100755 Binary files a/game/server and b/game/server differ diff --git a/game/server.c b/game/server.c index cbc6aeb..c497376 100644 --- a/game/server.c +++ b/game/server.c @@ -46,6 +46,7 @@ typedef int socklen_t; #define BTN_SWITCH_RIFLE (1u << 2) #define BTN_PICK (1u << 3) #define BTN_USE_MEDKIT (1u << 4) +#define BTN_JUMP (1u << 5) #define CAT_WORLD (1u << 0) #define CAT_PLAYER (1u << 1) @@ -708,6 +709,12 @@ int main(void) { p->hp = 100; } } + + if (m->buttons & BTN_JUMP) { + const dReal *lvel = dBodyGetLinearVel(p->body); + dBodySetLinearVel(p->body, lvel[0], 12.0f, lvel[2]); // Set upward velocity + printf("Player %d jumped\n", pid); + } } } else if (type == MSG_SHOOT && n >= (int)sizeof(MsgShoot)) { const MsgShoot *m = (const MsgShoot *)buf;