wider terrain
This commit is contained in:
parent
a092c10017
commit
6b8564cb0c
4 changed files with 10 additions and 8 deletions
BIN
game/client
BIN
game/client
Binary file not shown.
|
|
@ -181,7 +181,7 @@ float get_terrain_height(float x, float z) {
|
||||||
return height * 6.0f + 2.0f;
|
return height * 6.0f + 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TERRAIN_SIZE 128
|
#define TERRAIN_SIZE 256
|
||||||
#define TERRAIN_SCALE 1.0f
|
#define TERRAIN_SCALE 1.0f
|
||||||
|
|
||||||
static Mesh generate_terrain_mesh(void) {
|
static Mesh generate_terrain_mesh(void) {
|
||||||
|
|
@ -715,7 +715,7 @@ int main(void) {
|
||||||
float recoilYaw = 0.0f, recoilPitch = 0.0f, crossSpread = 0.0f;
|
float recoilYaw = 0.0f, recoilPitch = 0.0f, crossSpread = 0.0f;
|
||||||
float fireCooldown = 0.0f;
|
float fireCooldown = 0.0f;
|
||||||
int shotsInBurst = 0;
|
int shotsInBurst = 0;
|
||||||
float burstResetTimer = 0.0f;
|
float burstResetTimer = 0.0f;
|
||||||
|
|
||||||
const float pistolFireRate = 4.0f, rifleFireRate = 12.0f;
|
const float pistolFireRate = 4.0f, rifleFireRate = 12.0f;
|
||||||
const float recoilReturn = 18.0f, crossReturn = 14.0f;
|
const float recoilReturn = 18.0f, crossReturn = 14.0f;
|
||||||
|
|
@ -805,9 +805,9 @@ int main(void) {
|
||||||
|
|
||||||
if (myId != 255 && rp[myId].present) {
|
if (myId != 255 && rp[myId].present) {
|
||||||
Vector3 body = rp[myId].pos;
|
Vector3 body = rp[myId].pos;
|
||||||
camPos.x = body.x;
|
camPos.x = body.x;
|
||||||
camPos.y = body.y + 1.0f;
|
camPos.y = body.y + 1.0f;
|
||||||
camPos.z = body.z + 0.0001f;
|
camPos.z = body.z + 0.0001f;
|
||||||
|
|
||||||
// Prevent camera from clipping into terrain
|
// Prevent camera from clipping into terrain
|
||||||
float terrain_h = get_terrain_height(camPos.x, camPos.z);
|
float terrain_h = get_terrain_height(camPos.x, camPos.z);
|
||||||
|
|
@ -854,6 +854,8 @@ int main(void) {
|
||||||
if (IsKeyDown(KEY_S))
|
if (IsKeyDown(KEY_S))
|
||||||
moveZ -= 1.0f;
|
moveZ -= 1.0f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t buttons = 0;
|
uint8_t buttons = 0;
|
||||||
if (IsKeyPressed(KEY_ONE))
|
if (IsKeyPressed(KEY_ONE))
|
||||||
buttons |= BTN_SWITCH_PISTOL;
|
buttons |= BTN_SWITCH_PISTOL;
|
||||||
|
|
|
||||||
BIN
game/server
BIN
game/server
Binary file not shown.
|
|
@ -28,7 +28,7 @@ typedef int socklen_t;
|
||||||
#define MAX_PLAYERS 16
|
#define MAX_PLAYERS 16
|
||||||
#define USERNAME_MAX 16
|
#define USERNAME_MAX 16
|
||||||
|
|
||||||
#define TICK_HZ 60
|
#define TICK_HZ 30
|
||||||
#define DT (1.0f / (float)TICK_HZ)
|
#define DT (1.0f / (float)TICK_HZ)
|
||||||
|
|
||||||
#define WEAPON_PISTOL 0
|
#define WEAPON_PISTOL 0
|
||||||
|
|
@ -147,7 +147,7 @@ float get_terrain_height(float x, float z) {
|
||||||
return height * 5.0f + 2.0f;
|
return height * 5.0f + 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TERRAIN_SIZE 128
|
#define TERRAIN_SIZE 256
|
||||||
#define TERRAIN_SCALE 1.0f
|
#define TERRAIN_SCALE 1.0f
|
||||||
static dReal *gHeightData = NULL;
|
static dReal *gHeightData = NULL;
|
||||||
static dGeomID gTerrainGeom = NULL;
|
static dGeomID gTerrainGeom = NULL;
|
||||||
|
|
@ -816,7 +816,7 @@ int main(void) {
|
||||||
dz /= len;
|
dz /= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
float speed = 6.0f;
|
float speed = 10.0f;
|
||||||
float fx = sinf(p->yaw) * dz - cosf(p->yaw) * dx;
|
float fx = sinf(p->yaw) * dz - cosf(p->yaw) * dx;
|
||||||
float fz = cosf(p->yaw) * dz + sinf(p->yaw) * dx;
|
float fz = cosf(p->yaw) * dz + sinf(p->yaw) * dx;
|
||||||
dBodySetLinearVel(p->body, fx * speed, lvel[1], fz * speed);
|
dBodySetLinearVel(p->body, fx * speed, lvel[1], fz * speed);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue