- Timestamp:
- Feb 6, 2006, 2:09:01 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/game_rules.h
r7035 r7044 26 26 27 27 28 virtual void onPlayerSpawn( Player* player) {}29 virtual void onPlayerDeath( Player* player) {}28 virtual void onPlayerSpawn() {} 29 virtual void onPlayerDeath() {} 30 30 31 31 -
trunk/src/util/multiplayer_team_deathmatch.cc
r7040 r7044 23 23 #include "state.h" 24 24 25 #include "player.h" 26 #include "playable.h" 27 25 28 26 29 using namespace std; … … 42 45 43 46 this->deathScreen = new Billboard(); 44 this->deathScreen->setSize(State::getResX() , State::getResY());47 this->deathScreen->setSize(State::getResX()/4.0, State::getResY()/4.0); 45 48 this->deathScreen->setAbsCoor2D(State::getResX()/2.0f, State::getResY()/2.0f); 46 //this->deathScreen->setVisibility(false); 49 this->deathScreen->setVisibility(false); 50 51 this->localPlayer = State::getPlayer(); 47 52 48 53 if( root != NULL) … … 54 59 */ 55 60 MultiplayerTeamDeathmatch::~MultiplayerTeamDeathmatch() 56 {} 61 { 62 if( this->deathScreen) 63 delete this->deathScreen; 64 } 57 65 58 66 … … 87 95 * @param player the spawned player 88 96 */ 89 void MultiplayerTeamDeathmatch::onPlayerSpawn( Player* player)97 void MultiplayerTeamDeathmatch::onPlayerSpawn() 90 98 { 91 this->bLocalPlayerDead = true; 99 this->bLocalPlayerDead = false; 100 this->deathScreen->setVisibility(false); 92 101 } 93 102 … … 97 106 * @param player the killed player 98 107 */ 99 void MultiplayerTeamDeathmatch::onPlayerDeath( Player* player)108 void MultiplayerTeamDeathmatch::onPlayerDeath() 100 109 { 101 this->localPlayer = player;102 110 this->bLocalPlayerDead = true; 111 this->deathScreen->setVisibility(true); 103 112 } 104 113 … … 118 127 119 128 // long enough dead? 120 if( dt >= this->deathTimeout)129 if( this->timeout >= this->deathTimeout) 121 130 { 122 131 this->timeout = 0.0f; 123 124 132 // respawn 133 (State::getPlayer())->getPlayable()->respawn(); 125 134 } 126 135 } -
trunk/src/util/multiplayer_team_deathmatch.h
r7039 r7044 29 29 30 30 31 virtual void onPlayerSpawn( Player* player);32 virtual void onPlayerDeath( Player* player);31 virtual void onPlayerSpawn(); 32 virtual void onPlayerDeath(); 33 33 34 34 -
trunk/src/world_entities/playable.cc
r7014 r7044 27 27 #include "power_ups/param_power_up.h" 28 28 29 #include "game_rules.h" 29 30 30 31 #include "dot_emitter.h" … … 136 137 137 138 138 void Playable::die() 139 { 140 //this->deactivateNode(); 141 this->toList(OM_DEAD); 142 this->emitter->setSystem(explosionParticles); 143 this->setAbsCoor(0, 0, 0); 144 //this->setAbsDir(Vector(1,0,0), 0); 145 this->emitter->setSystem(NULL); 146 139 void Playable::respawn() 140 { 141 PRINTF(0)("Playable respawn\n"); 142 // only if this is the spaceship of the player 143 if( this == State::getPlayer()->getPlayable()) 144 State::getGameRules()->onPlayerSpawn(); 145 146 this->setAbsCoor(0.0, 0.0, 0.0); 147 147 148 148 if( this->getOwner()%2 == 0) … … 150 150 else 151 151 this->toList(OM_GROUP_01); 152 } 153 154 155 void Playable::die() 156 { 157 PRINTF(0)("Playable dies\n"); 158 // only if this is the spaceship of the player 159 if( this == State::getPlayer()->getPlayable()) 160 State::getGameRules()->onPlayerDeath(); 161 162 this->toList(OM_DEAD); 163 //.HACK: moves the entity to an unknown place far far away: in the future, GameRules will look for that 164 this->setAbsCoor(-2000.0, -2000.0, -2000.0); 165 166 //explosion hack 167 this->emitter->setSystem(explosionParticles); 168 this->setAbsCoor(0, 0, 0); 169 this->emitter->setSystem(NULL); 152 170 } 153 171 -
trunk/src/world_entities/playable.h
r6994 r7044 30 30 31 31 virtual void die(); 32 virtual void respawn(); 32 33 33 34 virtual bool pickup(PowerUp* powerUp);
Note: See TracChangeset
for help on using the changeset viewer.