wider terrain

This commit is contained in:
Masashi 2025-12-18 21:51:21 +05:30
commit 6b8564cb0c
4 changed files with 10 additions and 8 deletions

Binary file not shown.

View file

@ -181,7 +181,7 @@ float get_terrain_height(float x, float z) {
return height * 6.0f + 2.0f;
}
#define TERRAIN_SIZE 128
#define TERRAIN_SIZE 256
#define TERRAIN_SCALE 1.0f
static Mesh generate_terrain_mesh(void) {
@ -715,7 +715,7 @@ int main(void) {
float recoilYaw = 0.0f, recoilPitch = 0.0f, crossSpread = 0.0f;
float fireCooldown = 0.0f;
int shotsInBurst = 0;
float burstResetTimer = 0.0f;
float burstResetTimer = 0.0f;
const float pistolFireRate = 4.0f, rifleFireRate = 12.0f;
const float recoilReturn = 18.0f, crossReturn = 14.0f;
@ -805,9 +805,9 @@ 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;
camPos.x = body.x;
camPos.y = body.y + 1.0f;
camPos.z = body.z + 0.0001f;
// Prevent camera from clipping into terrain
float terrain_h = get_terrain_height(camPos.x, camPos.z);
@ -854,6 +854,8 @@ int main(void) {
if (IsKeyDown(KEY_S))
moveZ -= 1.0f;
uint8_t buttons = 0;
if (IsKeyPressed(KEY_ONE))
buttons |= BTN_SWITCH_PISTOL;

Binary file not shown.

View file

@ -28,7 +28,7 @@ typedef int socklen_t;
#define MAX_PLAYERS 16
#define USERNAME_MAX 16
#define TICK_HZ 60
#define TICK_HZ 30
#define DT (1.0f / (float)TICK_HZ)
#define WEAPON_PISTOL 0
@ -147,7 +147,7 @@ float get_terrain_height(float x, float z) {
return height * 5.0f + 2.0f;
}
#define TERRAIN_SIZE 128
#define TERRAIN_SIZE 256
#define TERRAIN_SCALE 1.0f
static dReal *gHeightData = NULL;
static dGeomID gTerrainGeom = NULL;
@ -816,7 +816,7 @@ int main(void) {
dz /= len;
}
float speed = 6.0f;
float speed = 10.0f;
float fx = sinf(p->yaw) * dz - cosf(p->yaw) * dx;
float fz = cosf(p->yaw) * dz + sinf(p->yaw) * dx;
dBodySetLinearVel(p->body, fx * speed, lvel[1], fz * speed);