Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10443 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 28, 2007, 3:06:13 PM (18 years ago)
Author:
patrick
Message:

weapon now added to the main model

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r10430 r10443  
    250250  if ( this->dataTank->localPlayer != NULL)
    251251    this->dataTank->localPlayer->hud().notifyUser(text);
    252   PRINTF(0)("===============\n==========\n========\n");
    253252}
    254253
  • trunk/src/world_entities/npcs/npc.cc

    r10440 r10443  
    185185    if( obj != NULL && obj->isA( Weapon::staticClassID()))
    186186    {
     187      Weapon* w = dynamic_cast<Weapon*>(obj);
    187188      PRINTF(0)("created a weapon\n");
     189      int preferedSlot = w->getPreferedSlot();
     190      int preferedSide = w->getPreferedSide();
     191
     192      this->addWeapon( w, preferedSide, preferedSlot);
    188193    }
    189194  }
     
    210215  {
    211216    if (weapon != NULL)
    212       PRINTF(2)("Unable to add Weapon (%s::%s) to %s::%s\n",
     217      PRINTF(1)("Unable to add Weapon (%s::%s) to %s::%s\n",
    213218                weapon->getClassCName(), weapon->getCName(), this->getClassCName(), this->getCName());
    214219    else
    215       PRINTF(2)("No weapon defined\n");
     220      PRINTF(1)("No weapon defined\n");
    216221    return false;
    217222
  • trunk/src/world_entities/weapons/weapon.cc

    r10368 r10443  
    124124  this->segs = 1;
    125125
     126  this->preferedSide = -1;
     127  this->preferedSlot = -1;
     128
    126129  this->shootAnim = new Animation3D**[this->getBarrels()];
    127130  for (int i = 0; i < this->getBarrels(); i++)
     
    159162 * needed, if there are more than one barrel or segments
    160163 */
    161 void Weapon::init2() 
     164void Weapon::init2()
    162165{
    163166  if (this->barrels == 1 && this->segs == 1)
     
    206209  LoadParam(root, "projectile", this, Weapon, setProjectileTypeC)
    207210  .describe("Sets the name of the Projectile to load onto the Entity");
     211
     212  LoadParam(root, "energy", this, Weapon, setEnergyMax)
     213  .describe("number of shoots/ energy whatever");
     214
     215  LoadParam(root, "slot", this, Weapon, setPreferedSlot)
     216  .describe("slot this weapon will be added");
    208217/*
    209218  LoadParam(root, "emission-point", this, Weapon, setEmissionPoint)
     
    463472    return energyToAdd - maxAddEnergy;
    464473  }
    465  
     474
    466475}
    467476
  • trunk/src/world_entities/weapons/weapon.h

    r10368 r10443  
    187187    void deconstr();
    188188
     189    inline int getPreferedSide() { return this->preferedSide; }
     190    inline int getPreferedSlot() { return this->preferedSlot; }
     191
     192
    189193  protected:
    190194    //! ACTION: these functions are handled by the Weapon itself, and must be called by requestAction(WeaponAction);
     
    202206    static const char*   stateToChar(WeaponState state);
    203207
     208    void setPreferedSlot(int slot, int side) { this->preferedSlot = slot; this->preferedSide = side; }
    204209
    205210
     
    261266    Animation3D***         shootAnim;
    262267
     268    int                    preferedSlot;                    //!< prefered slot to add
     269    int                    preferedSide;                    //!< prefered side (left/right) to be added
     270
    263271  };
    264272
Note: See TracChangeset for help on using the changeset viewer.