equal
deleted
inserted
replaced
5 |
5 |
6 GameState::GameState (void) : local_player(NULL), world(Vector(0, MAP_GRAVITY), Vector(MAP_WIDTH, MAP_HEIGHT)) { } |
6 GameState::GameState (void) : local_player(NULL), world(Vector(0, MAP_GRAVITY), Vector(MAP_WIDTH, MAP_HEIGHT)) { } |
7 |
7 |
8 void GameState::addProjectile (Projectile *projectile) { |
8 void GameState::addProjectile (Projectile *projectile) { |
9 projectiles.push_back(projectile); |
9 projectiles.push_back(projectile); |
10 } |
|
11 |
|
12 void GameState::addRope (Rope *rope) { |
|
13 ropes.push_back(rope); |
|
14 } |
10 } |
15 |
11 |
16 LocalPlayer *GameState::getLocalPlayer (void) { |
12 LocalPlayer *GameState::getLocalPlayer (void) { |
17 return local_player; |
13 return local_player; |
18 } |
14 } |
32 |
28 |
33 void GameState::removePlayer (Player *player) { |
29 void GameState::removePlayer (Player *player) { |
34 player_list.remove(player); |
30 player_list.remove(player); |
35 } |
31 } |
36 |
32 |
37 void GameState::draw(CL_GraphicContext *gc) { |
33 void GameState::draw(Graphics *g, bool displayWeapon) { |
38 // Draw world/terrain |
34 // Draw world/terrain |
39 world.draw(gc); |
35 world.draw(g->get_gc()); |
40 |
36 |
41 // Draw players |
37 // Draw players |
42 for (std::list<Player*>::iterator it = player_list.begin(); it != player_list.end(); it++) { |
38 for (std::list<Player*>::iterator it = player_list.begin(); it != player_list.end(); it++) { |
43 (*it)->draw(gc); |
39 Player *p = *it; |
|
40 |
|
41 // our LocalPlayer has it's own draw method |
|
42 if (p == local_player) |
|
43 local_player->draw(g, displayWeapon); |
|
44 else |
|
45 p->draw(g); |
44 } |
46 } |
|
47 |
45 // Draw projectiles |
48 // Draw projectiles |
46 for (std::list<Projectile*>::iterator it = projectiles.begin(); it != projectiles.end(); it++) { |
49 for (std::list<Projectile*>::iterator it = projectiles.begin(); it != projectiles.end(); it++) { |
47 (*it)->draw(gc); |
50 (*it)->draw(g); |
48 } |
|
49 // Draw ropes |
|
50 for (std::list<Rope*>::iterator it = ropes.begin(); it != ropes.end(); it++) { |
|
51 if ((*it)->getState() != FOLDED) |
|
52 (*it)->draw(gc); |
|
53 } |
51 } |
54 } |
52 } |
55 |
53 |