Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7044 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Feb 6, 2006, 2:09:01 AM (19 years ago)
Author:
patrick
Message:

trunk: death screen now works

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/game_rules.h

    r7035 r7044  
    2626
    2727
    28     virtual void onPlayerSpawn(Player* player) {}
    29     virtual void onPlayerDeath(Player* player) {}
     28    virtual void onPlayerSpawn() {}
     29    virtual void onPlayerDeath() {}
    3030
    3131
  • trunk/src/util/multiplayer_team_deathmatch.cc

    r7040 r7044  
    2323#include "state.h"
    2424
     25#include "player.h"
     26#include "playable.h"
     27
    2528
    2629using namespace std;
     
    4245
    4346  this->deathScreen = new Billboard();
    44   this->deathScreen->setSize(State::getResX(), State::getResY());
     47  this->deathScreen->setSize(State::getResX()/4.0, State::getResY()/4.0);
    4548  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();
    4752
    4853  if( root != NULL)
     
    5459 */
    5560MultiplayerTeamDeathmatch::~MultiplayerTeamDeathmatch()
    56 {}
     61{
     62  if( this->deathScreen)
     63    delete this->deathScreen;
     64}
    5765
    5866
     
    8795 * @param player the spawned player
    8896 */
    89 void MultiplayerTeamDeathmatch::onPlayerSpawn(Player* player)
     97void MultiplayerTeamDeathmatch::onPlayerSpawn()
    9098{
    91   this->bLocalPlayerDead = true;
     99  this->bLocalPlayerDead = false;
     100  this->deathScreen->setVisibility(false);
    92101}
    93102
     
    97106 * @param player the killed player
    98107 */
    99 void MultiplayerTeamDeathmatch::onPlayerDeath(Player* player)
     108void MultiplayerTeamDeathmatch::onPlayerDeath()
    100109{
    101   this->localPlayer = player;
    102110  this->bLocalPlayerDead = true;
     111  this->deathScreen->setVisibility(true);
    103112}
    104113
     
    118127
    119128    // long enough dead?
    120     if( dt >= this->deathTimeout)
     129    if( this->timeout >= this->deathTimeout)
    121130    {
    122131      this->timeout = 0.0f;
    123 
    124132      // respawn
     133      (State::getPlayer())->getPlayable()->respawn();
    125134    }
    126135  }
  • trunk/src/util/multiplayer_team_deathmatch.h

    r7039 r7044  
    2929
    3030
    31     virtual void onPlayerSpawn(Player* player);
    32     virtual void onPlayerDeath(Player* player);
     31    virtual void onPlayerSpawn();
     32    virtual void onPlayerDeath();
    3333
    3434
  • trunk/src/world_entities/playable.cc

    r7014 r7044  
    2727#include "power_ups/param_power_up.h"
    2828
     29#include "game_rules.h"
    2930
    3031#include "dot_emitter.h"
     
    136137
    137138
    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 
     139void 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);
    147147
    148148  if( this->getOwner()%2 == 0)
     
    150150  else
    151151    this->toList(OM_GROUP_01);
     152}
     153
     154
     155void 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);
    152170}
    153171
  • trunk/src/world_entities/playable.h

    r6994 r7044  
    3030
    3131    virtual void die();
     32    virtual void respawn();
    3233
    3334    virtual bool pickup(PowerUp* powerUp);
Note: See TracChangeset for help on using the changeset viewer.