minor changes
This commit is contained in:
parent
dafe52c4cd
commit
dbed4abb0b
@ -1,3 +1,5 @@
|
||||
|
||||
syntax: regexp
|
||||
^build$
|
||||
syntax: regexp
|
||||
^libs/log4cplus/src/Makefile\.am$
|
@ -16,6 +16,7 @@ endif(UNIX)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/glfw/include)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/spark/include)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/enet/include)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/log4cplus/include)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/bullet)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/yaml-cpp/include)
|
||||
include_directories (${GREMLIN_SOURCE_DIR}/libs/trimeshloader/include)
|
||||
@ -26,6 +27,7 @@ add_subdirectory (libs/enet)
|
||||
add_subdirectory (libs/pugixml)
|
||||
add_subdirectory (libs/bullet)
|
||||
add_subdirectory (libs/yaml-cpp)
|
||||
add_subdirectory (libs/log4cplus)
|
||||
add_subdirectory (libs/trimeshloader)
|
||||
add_subdirectory (src/common)
|
||||
add_subdirectory (src/server)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "Explosion.h"
|
||||
#include "Time.h"
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include <GL/glfw.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -106,9 +107,10 @@ void draw_bomb(bomb_t *bomb) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glTranslated(bomb->x, bomb->y, bomb->z);
|
||||
gluSphere(quadratic, 3.f, 4, 4);
|
||||
gluSphere(quadratic, 0.5f, 4, 4);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void draw_point(point_t *point) {
|
||||
if (point->status == 0)
|
||||
return;
|
||||
@ -328,21 +330,24 @@ void Client::accelerate(double x, double y, double z) {
|
||||
m << msg;
|
||||
network.send(m);
|
||||
}
|
||||
#if 0
|
||||
|
||||
void Client::drop_bomb(double rx, double ry, double rz, double ttl) {
|
||||
bomb_drop_meesage_t msg;
|
||||
msg.x = game.local_player->x + rx * 20;
|
||||
msg.y = game.local_player->y + ry * 20;
|
||||
msg.z = game.local_player->z + rz * 20;
|
||||
msg.vx = game.local_player->vx + rx * 100;
|
||||
msg.vy = game.local_player->vy + ry * 100;
|
||||
msg.vz = game.local_player->vz + rz * 100;
|
||||
btVector3 p = game.local_player->body->getWorldTransform().getOrigin();
|
||||
btVector3 v = game.local_player->body->getLinearVelocity();
|
||||
|
||||
msg.x = p.x() + rx * 1;
|
||||
msg.y = p.y() + ry * 1;
|
||||
msg.z = p.z() + rz * 1;
|
||||
msg.vx = v.x() + rx * 500;
|
||||
msg.vy = v.y() + ry * 500;
|
||||
msg.vz = v.z() + rz * 500;
|
||||
msg.ttl = ttl;
|
||||
YAML::Emitter m;
|
||||
m << msg;
|
||||
network.send(m);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Client::loadConsoleFont() {
|
||||
GLuint font_id = 0;
|
||||
|
||||
@ -380,8 +385,8 @@ void Client::prepareFrame(double rx, double ry, double rz) {
|
||||
// Select and setup the modelview matrix
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(camX, camY, camZ, camX + rx * 10.0f, camY + ry * 10.0f, camZ + rz
|
||||
* 10.0f, 0.0f, 1.0f, 0.0f);
|
||||
gluLookAt(camX, camY, camZ, camX + rx * 10.0f, camY + ry * 10.0f,
|
||||
camZ + rz * 10.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
}
|
||||
|
||||
@ -413,6 +418,9 @@ void Client::initialize(Arguments &arg) {
|
||||
accelerate_schudule.setExact(true);
|
||||
accelerate_schudule.setInterval(0.05);
|
||||
|
||||
theta = 0.0;
|
||||
phi = 0.0;
|
||||
|
||||
loadConsoleFont();
|
||||
|
||||
// setup signals
|
||||
@ -435,6 +443,7 @@ void Client::update() {
|
||||
}
|
||||
last_x = x;
|
||||
last_y = y;
|
||||
|
||||
double rx = cos(phi) * cos(theta);
|
||||
double ry = sin(theta);
|
||||
double rz = sin(phi) * cos(theta);
|
||||
@ -453,30 +462,33 @@ void Client::update() {
|
||||
} else if (glfwGetKey('D')) {
|
||||
accelerate(-rz * v, 0, rx * v);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (glfwGetKey(GLFW_KEY_SPACE)) {
|
||||
accelerate(game.local_player->vx * -0.1, game.local_player->vy
|
||||
* -0.1, game.local_player->vz * -0.1);
|
||||
accelerate(game.local_player->vx * -0.1,
|
||||
game.local_player->vy * -0.1, game.local_player->vz * -0.1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
if (glfwGetKey(GLFW_KEY_LCTRL)) {
|
||||
if (time - last_bomb > 1.0) {
|
||||
last_bomb = time;
|
||||
drop_bomb(rx, ry, rz, 5.0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (game.local_player) {
|
||||
camX = game.local_player->m[12];
|
||||
camY = game.local_player->m[13];
|
||||
camZ = game.local_player->m[14];
|
||||
btVector3 p = game.local_player->body->getWorldTransform().getOrigin();
|
||||
|
||||
camX = p.x();
|
||||
camY = p.y();
|
||||
camZ = p.z();
|
||||
} else {
|
||||
camX = 1000.0;
|
||||
camY = 1000.0;
|
||||
camZ = 1000.0;
|
||||
}
|
||||
|
||||
prepareFrame(rx, ry, rz);
|
||||
setup_light();
|
||||
glEnable(GL_LIGHT0);
|
||||
@ -489,19 +501,20 @@ void Client::update() {
|
||||
for (size_t i = 0; i < GAME_PLAYER_COUNT; i++)
|
||||
drawPlayer(&game.player[i]);
|
||||
|
||||
// for (size_t i = 0; i < GAME_BOMB_COUNT; i++)
|
||||
// draw_bomb(&game.bomb[i]);
|
||||
for (size_t i = 0; i < GAME_BOMB_COUNT; i++)
|
||||
draw_bomb(&game.bomb[i]);
|
||||
//
|
||||
// for (size_t i = 0; i < GAME_POINT_COUNT; i++)
|
||||
// draw_point(&game.point[i]);
|
||||
|
||||
drawLevel();
|
||||
|
||||
explosion.update(dt * 1000.0, camX, camY, camZ);
|
||||
explosion.render();
|
||||
|
||||
glDisable(GL_LIGHT0);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_CULL_FACE);
|
||||
explosion.update(dt * 1000.0, camX, camY, camZ);
|
||||
explosion.render();
|
||||
oglf_begin(&font, width, height);
|
||||
size_t fy = 1;
|
||||
if (game.local_player) {
|
||||
@ -523,8 +536,8 @@ void Client::update() {
|
||||
|
||||
{
|
||||
std::stringstream sstr;
|
||||
sstr << "FPS: " << (int) (1 / dt) << " Time: " << floor(dt * 10000.0
|
||||
+ 0.5) / 10.0;
|
||||
sstr << "FPS: " << (int) (1 / dt) << " Time: "
|
||||
<< floor(dt * 10000.0 + 0.5) / 10.0;
|
||||
oglf_print(&font, 10, 25 * fy++, sstr.str().c_str());
|
||||
}
|
||||
|
||||
|
@ -214,6 +214,7 @@ player_t *Game::getFreePlayer() {
|
||||
if (player[i].status == 0)
|
||||
return &player[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
player_t *Game::spawnPlayer(Team *team) {
|
||||
|
Loading…
Reference in New Issue
Block a user