Changeset 7350 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Apr 19, 2006, 3:42:23 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/aiming_turret.cc
r7221 r7350 48 48 { 49 49 this->init(); 50 this->loadParams(root); 50 if (root != NULL) 51 this->loadParams(root); 51 52 } 52 53 -
trunk/src/world_entities/weapons/weapon.cc
r7221 r7350 26 26 #include "util/loading/resource_manager.h" 27 27 #include "class_list.h" 28 #include "util/loading/factory.h" 28 29 #include "util/loading/load_param.h" 29 30 #include "state.h" … … 34 35 35 36 #include "glgui_bar.h" 37 38 using namespace std; 36 39 37 40 //////////////////// … … 66 69 67 70 /** 71 * @brief creates a new Weapon of type weaponID and returns it. 72 * @param weaponID the WeaponID type to create. 73 * @returns the newly created Weapon. 74 */ 75 Weapon* Weapon::createWeapon(ClassID weaponID) 76 { 77 BaseObject* createdObject = Factory::fabricate(weaponID); 78 if (createdObject != NULL) 79 { 80 if (createdObject->isA(CL_WEAPON)) 81 return dynamic_cast<Weapon*>(createdObject); 82 else 83 { 84 delete createdObject; 85 return NULL; 86 } 87 } 88 } 89 90 /** 68 91 * initializes the Weapon with ALL default values 69 92 * … … 72 95 void Weapon::init() 73 96 { 97 this->setClassID(CL_WEAPON, "Weapon"); 74 98 this->currentState = WS_INACTIVE; //< Normaly the Weapon is Inactive 75 99 this->requestedAction = WA_NONE; //< No action is requested by default … … 382 406 switch (action) 383 407 { 384 case WA_SHOOT:385 return this->fireW();386 break;387 case WA_CHARGE:388 return this->chargeW();389 break;390 case WA_RELOAD:391 return this->reloadW();392 break;393 case WA_DEACTIVATE:394 return this->deactivateW();395 break;396 case WA_ACTIVATE:397 return this->activateW();398 break;408 case WA_SHOOT: 409 return this->fireW(); 410 break; 411 case WA_CHARGE: 412 return this->chargeW(); 413 break; 414 case WA_RELOAD: 415 return this->reloadW(); 416 break; 417 case WA_DEACTIVATE: 418 return this->deactivateW(); 419 break; 420 case WA_ACTIVATE: 421 return this->activateW(); 422 break; 399 423 } 400 424 } … … 495 519 PRINTF(4)("Reloading Weapon %s\n", this->getName()); 496 520 if (this->ammoContainer.get() != NULL && 497 521 unlikely(this->energy + this->ammoContainer->getStoredEnergy() < this->minCharge)) 498 522 { 499 523 this->requestAction(WA_DEACTIVATE); … … 643 667 switch (action) 644 668 { 645 case WA_SHOOT:646 return "shoot";647 break;648 case WA_CHARGE:649 return "charge";650 break;651 case WA_RELOAD:652 return "reload";653 break;654 case WA_ACTIVATE:655 return "activate";656 break;657 case WA_DEACTIVATE:658 return "deactivate";659 break;660 case WA_SPECIAL1:661 return "special1";662 break;663 default:664 return "none";665 break;669 case WA_SHOOT: 670 return "shoot"; 671 break; 672 case WA_CHARGE: 673 return "charge"; 674 break; 675 case WA_RELOAD: 676 return "reload"; 677 break; 678 case WA_ACTIVATE: 679 return "activate"; 680 break; 681 case WA_DEACTIVATE: 682 return "deactivate"; 683 break; 684 case WA_SPECIAL1: 685 return "special1"; 686 break; 687 default: 688 return "none"; 689 break; 666 690 } 667 691 } … … 706 730 switch (state) 707 731 { 708 case WS_SHOOTING:709 return "shooting";710 break;711 case WS_CHARGING:712 return "charging";713 break;714 case WS_RELOADING:715 return "reloading";716 break;717 case WS_ACTIVATING:718 return "activating";719 break;720 case WS_DEACTIVATING:721 return "deactivating";722 break;723 case WS_IDLE:724 return "idle";725 break;726 case WS_INACTIVE:727 return "inactive";728 break;729 default:730 return "none";731 break;732 } 733 } 732 case WS_SHOOTING: 733 return "shooting"; 734 break; 735 case WS_CHARGING: 736 return "charging"; 737 break; 738 case WS_RELOADING: 739 return "reloading"; 740 break; 741 case WS_ACTIVATING: 742 return "activating"; 743 break; 744 case WS_DEACTIVATING: 745 return "deactivating"; 746 break; 747 case WS_IDLE: 748 return "idle"; 749 break; 750 case WS_INACTIVE: 751 return "inactive"; 752 break; 753 default: 754 return "none"; 755 break; 756 } 757 } -
trunk/src/world_entities/weapons/weapon.h
r7221 r7350 88 88 Weapon (); 89 89 virtual ~Weapon (); 90 static Weapon* createWeapon(ClassID weaponID); 90 91 91 92 void init(); -
trunk/src/world_entities/weapons/weapon_manager.cc
r7193 r7350 17 17 */ 18 18 19 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON19 #define DEBUG_SPECIAL_MODULE 4 //DEBUG_MODULE_WEAPON 20 20 21 21 #include "weapon_manager.h" … … 113 113 114 114 /** 115 * loads the settings of the WeaponManager115 * @brief loads the settings of the WeaponManager 116 116 * @param root the XML-element to load from 117 117 */ … … 133 133 134 134 /** 135 * loads a Weapon onto the WeaponManager135 * @brief loads a Weapon onto the WeaponManager 136 136 * @param root the XML-element to load the Weapons from 137 137 */ … … 148 148 149 149 /** 150 * sets the Parent of the WeaponManager.150 * @brief sets the Parent of the WeaponManager. 151 151 * @param parent the parent of the WeaponManager 152 152 * … … 168 168 169 169 /** 170 * sets the number of Slots the WeaponManager has170 * @brief sets the number of Slots the WeaponManager has 171 171 * @param slotCount the number of slots 172 172 */ … … 181 181 182 182 /** 183 * sets the position of the Slot relative to the parent183 * @brief sets the position of the Slot relative to the parent 184 184 * @param slot the slot to set-up 185 185 * @param position the position of the given slot … … 198 198 199 199 /** 200 * sets the relative rotation of the slot to its parent200 * @brief sets the relative rotation of the slot to its parent 201 201 * @param slot the slot to set-up 202 202 * @param rotation the relative rotation of the given slot … … 210 210 211 211 /** 212 * adds a weapon to the selected weaponconfiguration into the selected slot212 * @brief adds a weapon to the selected weaponconfiguration into the selected slot 213 213 * @param weapon the weapon to add 214 214 * @param configID an identifier for the slot: number between 0..7 if not specified: slotID=next free slot
Note: See TracChangeset
for help on using the changeset viewer.