minor fixes
This commit is contained in:
parent
1006f94ba0
commit
89a4b6ffb2
@ -399,7 +399,7 @@ void Client::initialize(Arguments &arg) {
|
||||
|
||||
if (isMaster()) {
|
||||
Team *team = game.getTeam(0);
|
||||
game.local_player = game.spawn_player(team);
|
||||
game.local_player = game.spawnPlayer(team);
|
||||
std::cout << "[Game] local player " << game.local_player->id
|
||||
<< std::endl;
|
||||
}
|
||||
|
@ -102,6 +102,9 @@ void Game::loadLevelShape() {
|
||||
levelMesh = tlLoadTrimesh("data/level.obj", TL_FVF_XYZ | TL_FVF_UV
|
||||
| TL_FVF_NORMAL);
|
||||
|
||||
if (levelMesh == 0)
|
||||
throw("level mesh not found! (data/level.obj)");
|
||||
|
||||
btIndexedMesh im;
|
||||
im.m_numTriangles = levelMesh->face_count;
|
||||
im.m_triangleIndexBase = (unsigned char *) levelMesh->faces;
|
||||
@ -120,8 +123,6 @@ void Game::loadLevelShape() {
|
||||
btVector3 center;
|
||||
btScalar radius;
|
||||
_levelShape->getBoundingSphere(center, radius);
|
||||
std::cout << center.x() << " " << center.y() << " " << center.y() << ", "
|
||||
<< radius << std::endl;
|
||||
levelShape.reset(_levelShape);
|
||||
}
|
||||
|
||||
@ -218,7 +219,7 @@ player_t *Game::getFreePlayer() {
|
||||
}
|
||||
}
|
||||
|
||||
player_t *Game::spawn_player(Team *team) {
|
||||
player_t *Game::spawnPlayer(Team *team) {
|
||||
player_t *player = getFreePlayer();
|
||||
player->team = team;
|
||||
player->status = 1;
|
||||
@ -226,7 +227,7 @@ player_t *Game::spawn_player(Team *team) {
|
||||
reset_player(player);
|
||||
|
||||
if (player->body.get() == 0) {
|
||||
std::cout << "Game::spawn_player: create body" << std::endl;
|
||||
std::cout << "[Game] create body" << std::endl;
|
||||
/// Create Dynamic Objects
|
||||
btTransform startTransform;
|
||||
startTransform.setIdentity();
|
||||
@ -245,7 +246,7 @@ player_t *Game::spawn_player(Team *team) {
|
||||
return player;
|
||||
}
|
||||
|
||||
player_t *Game::spawn_player_id(Team *team, uint16_t id) {
|
||||
player_t *Game::spawnPlayerWithId(Team *team, uint16_t id) {
|
||||
player_t *player = getFreePlayer();
|
||||
player->team = team;
|
||||
player->id = id;
|
||||
|
@ -79,8 +79,8 @@ public:
|
||||
void setup();
|
||||
void reset();
|
||||
Team *team_with_least_players();
|
||||
player_t *spawn_player(Team *team);
|
||||
player_t *spawn_player_id(Team *team, uint16_t id);
|
||||
player_t *spawnPlayer(Team *team);
|
||||
player_t *spawnPlayerWithId(Team *team, uint16_t id);
|
||||
Team *getTeam(uint16_t id);
|
||||
player_t *getPlayer(uint16_t id);
|
||||
bomb_t *getBomb(uint16_t index);
|
||||
|
@ -114,7 +114,7 @@ void Network::dispatch(enet_uint8 *data, size_t length) {
|
||||
case MESSAGE_PLAYER_SPAWN: {
|
||||
player_spawn_message_t *sm = (player_spawn_message_t *) data;
|
||||
Team *team = game->getTeam(sm->team_id);
|
||||
player_t *player = game->spawn_player_id(team, sm->player_id);
|
||||
player_t *player = game->spawnPlayerWithId(team, sm->player_id);
|
||||
break;
|
||||
}
|
||||
case MESSAGE_PLAYER_KILL: {
|
||||
@ -132,7 +132,6 @@ void Network::dispatch(enet_uint8 *data, size_t length) {
|
||||
}
|
||||
case MESSAGE_PLAYER_UPDATE: {
|
||||
player_update_message_t *um = (player_update_message_t *) data;
|
||||
std::cout << "[Network] update player " << um->player_id << std::endl;
|
||||
player_t *player = game->getPlayer(um->player_id);
|
||||
#if 1
|
||||
btVector3 v = player->body->getLinearVelocity();
|
||||
@ -271,7 +270,7 @@ void Network::service(uint32_t timeout) {
|
||||
}
|
||||
|
||||
Team *team = game->team_with_least_players();
|
||||
player_t *player = game->spawn_player(team);
|
||||
player_t *player = game->spawnPlayer(team);
|
||||
event.peer->data = player;
|
||||
|
||||
// send player spawn message
|
||||
|
Loading…
Reference in New Issue
Block a user