Changeset 2192 in orxonox.OLD for orxonox/branches/chris
- Timestamp:
- Jul 17, 2004, 7:40:40 PM (20 years ago)
- Location:
- orxonox/branches/chris/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/chris/src/message_structures.h
r2141 r2192 26 26 } Command; 27 27 28 enum DAMAGETYPE{ DMG_ENERY}; 29 30 //! structure that contains a damage message 31 typedef struct 32 { 33 DAMAGETYPE type; //!< The type of the damage delivered 34 float dmg; //!< The amount of damage delivered 35 } Damage; 36 28 37 #endif -
orxonox/branches/chris/src/player.cc
r2115 r2192 47 47 } 48 48 49 void Player::hit ( WorldEntity* weapon, Vector loc)49 void Player::hit (Damage* dmg, WorldEntity* instigator, Uint32 hitflags) 50 50 { 51 51 } -
orxonox/branches/chris/src/player.h
r2141 r2192 20 20 virtual void post_spawn (); 21 21 virtual void tick (float time); 22 virtual void hit ( WorldEntity* weapon, Vector loc);22 virtual void hit (Damage* dmg, WorldEntity* instigator, Uint32 hitflags); 23 23 virtual void destroy (); 24 24 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); -
orxonox/branches/chris/src/world.cc
r2141 r2192 70 70 { 71 71 unsigned long ahitflg, bhitflg; 72 if( check_collision ( &aobj->place, aobj->collisioncluster, &ahitflg, &bobj->place, bobj->collisioncluster, &bhitflg)) ;72 if( check_collision ( &aobj->place, aobj->collisioncluster, &ahitflg, &bobj->place, bobj->collisioncluster, &bhitflg)) 73 73 { 74 74 aobj->collide (bobj, ahitflg, bhitflg); … … 183 183 else 184 184 { 185 while( track[t] .map_coords( loc, plc))185 while( track[t]->map_coords( loc, plc)) 186 186 { 187 track[t] .post_leave (entity);187 track[t]->post_leave (entity); 188 188 if( loc->part >= tracklen) 189 189 { … … 192 192 break; 193 193 } 194 track[loc->part] .post_enter (entity);194 track[loc->part]->post_enter (entity); 195 195 } 196 196 } … … 227 227 } 228 228 229 for( int i = 0; i < tracklen; i++) track[i] .tick (seconds);229 for( int i = 0; i < tracklen; i++) track[i]->tick (seconds); 230 230 } 231 231 … … 255 255 // create the tracks 256 256 tracklen = 6; 257 track = new Track [6];257 track = new Track*[6]; 258 258 for( int i = 0; i < tracklen; i++) 259 259 { 260 track[i] = Track( i, (i+1)%tracklen, &pathnodes[i], &pathnodes[(i+1)%tracklen]);260 track[i] = new Track( i, (i+1)%tracklen, &pathnodes[i], &pathnodes[(i+1)%tracklen]); 261 261 } 262 262 … … 277 277 void World::calc_camera_pos (Location* loc, Placement* plc) 278 278 { 279 track[loc->part].map_camera (loc, plc); 280 } 279 track[loc->part]->map_camera (loc, plc); 280 } 281 282 void World::explosion (Location* loc, Damage* dmg, float r, WorldEntity* instigator) 283 { 284 Placement mapped; 285 286 track[loc->part]->map_coords (loc, &mapped); 287 CollisionCluster boom( r, Vector(0,0,0)); 288 289 unsigned long boomflags, hflags; 290 List<WorldEntity> *a; 291 WorldEntity *aobj; 292 293 a = entities->get_next(); 294 295 while( a != NULL) 296 { 297 aobj = a->get_object(); 298 if( aobj->bCollide && aobj->collisioncluster != NULL) 299 { 300 hflags = 0; 301 if( check_collision ( &aobj->place, aobj->collisioncluster, &hflags, &mapped, &boom, &boomflags)) 302 { 303 aobj->hit (dmg, instigator, hflags); 304 } 305 } 306 a = a->get_next(); 307 } 308 } 309 310 void World::explosion (Placement* plc, Damage* dmg, float r, WorldEntity* instigator) 311 { 312 CollisionCluster boom( r, Vector(0,0,0)); 313 314 unsigned long boomflags, hflags; 315 List<WorldEntity> *a; 316 WorldEntity *aobj; 317 318 a = entities->get_next(); 319 320 while( a != NULL) 321 { 322 aobj = a->get_object(); 323 if( aobj->bCollide && aobj->collisioncluster != NULL) 324 { 325 hflags = 0; 326 if( check_collision ( &aobj->place, aobj->collisioncluster, &hflags, plc, &boom, &boomflags)) 327 { 328 aobj->hit (dmg, instigator, hflags); 329 } 330 } 331 a = a->get_next(); 332 } 333 } -
orxonox/branches/chris/src/world.h
r2141 r2192 30 30 void calc_camera_pos (Location* loc, Placement* plc); 31 31 32 void explosion (Location* loc, Damage* dmg, float r, WorldEntity* instigator); 33 void explosion (Placement* plc, Damage* dmg, float r, WorldEntity* instigator); 34 32 35 void unload (); 33 36 … … 39 42 40 43 // base level data 41 Track* track;44 Track** track; 42 45 Uint32 tracklen; 43 46 Vector* pathnodes; … … 72 75 if (entity->bFree) 73 76 { 74 track[loc->part] .map_coords( loc, entity->get_placement());77 track[loc->part]->map_coords( loc, entity->get_placement()); 75 78 } 76 79 entity->post_spawn (); -
orxonox/branches/chris/src/world_entity.cc
r2141 r2192 94 94 Handle all stuff that should update with time inside this method (movement, animation, etc.) 95 95 */ 96 void WorldEntity::tick(float time) 97 { 98 } 96 void WorldEntity::tick(float time) {} 99 97 100 98 /** … … 103 101 This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn. 104 102 */ 105 void WorldEntity::draw() 106 { 107 } 103 void WorldEntity::draw() {} 108 104 109 105 /** … … 118 114 119 115 /** 120 \brief this function is called, when the ship is hit by a waepon 121 \param weapon: the laser/rocket/shoot that hits. 122 \param loc: place where it is hit 123 124 calculate the damage depending 116 \brief this function is called when the entity takes damage 117 \param dmg: a pointer to a structure containing information about the damage 118 \param instigator: the world entity that dealt the damage 119 \param hitflags: an integer full of flags signifying the places the enitiy had been hit 120 121 You're free to do what you want with the damage you register here. This function is called from World::explosion() when 122 dealing splash damage, but can be called from virtually anywhere you want. 125 123 */ 126 void WorldEntity::hit (WorldEntity* weapon, Vector loc) {}124 void WorldEntity::hit (Damage* dmg, WorldEntity* instigator, Uint32 hitflags) {} 127 125 128 126 /** … … 158 156 DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted. 159 157 */ 160 void WorldEntity::post_spawn () 161 { 162 } 158 void WorldEntity::post_spawn () {} 163 159 164 160 /** … … 169 165 to send commands from one WorldEntity to another. 170 166 */ 171 void WorldEntity::command (Command* cmd) 172 { 173 } 167 void WorldEntity::command (Command* cmd) {} 174 168 175 169 /** … … 180 174 to look at the location you return with this. 181 175 */ 182 void WorldEntity::get_lookat (Location* locbuf) 183 { 184 } 176 void WorldEntity::get_lookat (Location* locbuf) {} 185 177 186 178 /** … … 190 182 place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy). 191 183 */ 192 void WorldEntity::left_world () 193 { 194 } 184 void WorldEntity::left_world () {} -
orxonox/branches/chris/src/world_entity.h
r2141 r2192 31 31 virtual void post_spawn (); 32 32 virtual void tick (float time); 33 virtual void hit ( WorldEntity* weapon, Vector loc);33 virtual void hit (Damage* dmg, WorldEntity* instigator, Uint32 hitflags); 34 34 virtual void destroy (); 35 35 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags);
Note: See TracChangeset
for help on using the changeset viewer.