This commit is contained in:
Masashi 2025-12-18 20:42:54 +05:30
commit 70c860e1ca
4 changed files with 12 additions and 1 deletions

Binary file not shown.

View file

@ -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 =

Binary file not shown.

View file

@ -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;