- Timestamp:
- Feb 7, 2006, 3:46:43 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.h
r7003 r7076 185 185 static const char* parentingModeToChar(int parentingMode); 186 186 static PARENT_MODE charToParentingMode(const char* parentingMode); 187 float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); }; 187 188 188 189 int writeState(const byte* data, int length, int sender); -
trunk/src/story_entities/game_world_data.cc
r7039 r7076 230 230 // Create a Player 231 231 this->localPlayer = new Player(); 232 State::setPlayer(this->localPlayer); 232 233 233 234 Playable* playable; … … 251 252 FastFactory::flushAll(true); 252 253 GraphicsEngine::getInstance()->displayFPS(false); 253 254 State::setPlayer(NULL); 254 255 // erease everything that is left. 255 256 // delete PNode::getNullParent(); // not needed as this is also done in the next step (and also much cleaner) -
trunk/src/world_entities/npcs/ground_turret.cc
r6815 r7076 18 18 #include "world_entities/weapons/turret.h" 19 19 20 #include "state.h" 21 #include "playable.h" 22 #include "player.h" 23 24 20 25 #include "factory.h" 21 26 #include "network_game_manager.h" … … 58 63 this->left = NULL; 59 64 this->right = NULL; 65 66 this->setHealthMax(300); 67 this->setHealth(300); 60 68 61 69 /* left = new Turret(); … … 113 121 void GroundTurret::tick(float dt) 114 122 { 123 if(this->getHealth() > 0.0f && State::getPlayer() && 124 State::getPlayer()->getPlayable() && 125 State::getPlayer()->getPlayable()->distance(this) < 150) // HACK 126 { 115 127 if (likely(this->left != NULL)) 116 128 { … … 123 135 this->right->requestAction(WA_SHOOT); 124 136 } 125 137 } 126 138 } 127 139 … … 140 152 141 153 142 /**143 *144 *145 */146 void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location)147 {148 if (entity->isA(CL_PROJECTILE))149 this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);150 }151 154 152 155 /** … … 166 169 { 167 170 171 } 172 173 void GroundTurret::destroy() 174 { 175 this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90); 168 176 } 169 177 -
trunk/src/world_entities/npcs/ground_turret.h
r6512 r7076 25 25 virtual void leftWorld (); 26 26 27 virtual void destroy(); 27 28 28 29 virtual void draw() const; 29 30 virtual void tick(float time); 30 virtual void collidesWith (WorldEntity* entity, const Vector& location);31 31 32 32 virtual int writeBytes(const byte* data, int length, int sender); -
trunk/src/world_entities/npcs/npc.cc
r6341 r7076 41 41 void NPC::collidesWith(WorldEntity* entity, const Vector& location) 42 42 { 43 if (entity->isA(CL_PROJECTILE) && entity != this->collider) 43 44 if (entity == collider) 45 return; 46 collider = entity; 47 48 if (entity->isA(CL_PROJECTILE)) 44 49 { 45 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);46 // this->applyForce(Vector(0,0,0)-location*1000); 47 if ( (float)rand()/RAND_MAX < .3)50 this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX); 51 // EXTREME HACK 52 if (this->getHealth() <= 0.0f) 48 53 { 49 WorldEntity* powerUp = new TurretPowerUp(); 50 powerUp->setAbsCoor(this->getAbsCoor()); 51 // powerUp->toList(OM_COMMON); 54 this->destroy(); 52 55 } 53 else if ((float)rand()/RAND_MAX < .3) 54 { 55 WorldEntity* powerUp = new LaserPowerUp(); 56 powerUp->setAbsCoor(this->getAbsCoor()); 57 powerUp->toList(OM_COMMON); 58 } 59 this->toList(OM_DEAD); 60 this->removeNode(); 56 } 61 57 62 this->collider = entity; 63 } 64 // else if (entity->isA(CL_PLAYER)) 65 // this->applyForce(Vector(0,0,0)-location*100); 66 else if (entity->isA(CL_NPC)) 67 { 68 this->setVisibiliy(false); 69 this->toList(OM_DEAD); 70 this->removeNode(); 71 } 58 59 // // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 60 // // this->applyForce(Vector(0,0,0)-location*1000); 61 // if ((float)rand()/RAND_MAX < .3) 62 // { 63 // WorldEntity* powerUp = new TurretPowerUp(); 64 // powerUp->setAbsCoor(this->getAbsCoor()); 65 // // powerUp->toList(OM_COMMON); 66 // } 67 // else if ((float)rand()/RAND_MAX < .3) 68 // { 69 // WorldEntity* powerUp = new LaserPowerUp(); 70 // powerUp->setAbsCoor(this->getAbsCoor()); 71 // powerUp->toList(OM_COMMON); 72 // } 73 // this->toList(OM_DEAD); 74 // this->removeNode(); 75 // 76 // this->collider = entity; 77 // } 78 // // else if (entity->isA(CL_PLAYER)) 79 // // this->applyForce(Vector(0,0,0)-location*100); 80 // else if (entity->isA(CL_NPC)) 81 // { 82 // this->setVisibiliy(false); 83 // this->toList(OM_DEAD); 84 // this->removeNode(); 85 // } 72 86 } -
trunk/src/world_entities/projectiles/hyperblast.cc
r6826 r7076 41 41 this->loadModel("models/projectiles/hyperblast.obj", 5); 42 42 43 this->setMinEnergy( 1);44 this->setHealthMax(10 );43 this->setMinEnergy(50); 44 this->setHealthMax(1000); 45 45 this->lifeSpan = 1; 46 46 this->size = 4.0; … … 91 91 this->emitter->setEmissionRate(5000.0); 92 92 this->emitter->setEmissionVelocity(50.0); 93 94 this->setHealth(200); 93 95 } 94 96 -
trunk/src/world_entities/skysphere.h
r5511 r7076 28 28 Skysphere(char* fileName = NULL); 29 29 virtual ~Skysphere(); 30 void destroy();31 30 32 31 void setRadius(float radius); -
trunk/src/world_entities/weapons/hyperblaster.cc
r7045 r7076 69 69 this->setStateDuration(WS_DEACTIVATING, .8); 70 70 71 this->setEnergyMax( 10);72 this->increaseEnergy( 10);71 this->setEnergyMax(5000); 72 this->increaseEnergy(5000); 73 73 //this->minCharge = 2; 74 74 -
trunk/src/world_entities/world_entity.h
r7064 r7076 55 55 virtual void postSpawn (); 56 56 virtual void leaveWorld (); 57 virtual void destroy() {}; 57 58 58 59 virtual void tick (float time);
Note: See TracChangeset
for help on using the changeset viewer.