Changeset 10111 for code/branches/pickupsFS14
- Timestamp:
- Nov 5, 2014, 4:06:09 PM (10 years ago)
- Location:
- code/branches/pickupsFS14/src/modules/jump
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickupsFS14/src/modules/jump/Jump.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file Jump.cc 31 @brief Implementation of the Jump class.31 @brief This is the gametype for the awesome minigame. Here the level is randomly created, the camera is shifted, ... 32 32 */ 33 33 34 34 #include "Jump.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/EventIncludes.h" 38 37 #include "core/command/Executor.h" 39 38 #include "core/config/ConfigValueIncludes.h" 40 41 39 #include "gamestates/GSLevel.h" 42 40 #include "chat/ChatManager.h" 43 44 41 #include "JumpCenterpoint.h" 45 42 #include "JumpPlatform.h" … … 59 56 #include "JumpBoots.h" 60 57 #include "JumpShield.h" 61 62 58 #include "infos/PlayerInfo.h" 63 59 64 60 namespace orxonox 65 61 { 66 // Events to allow to react to scoring of a player, in the level-file.67 CreateEventName(JumpCenterpoint, right);68 CreateEventName(JumpCenterpoint, left);69 70 62 RegisterUnloadableClass(Jump); 71 63 72 /**73 @brief74 Constructor. Registers and initializes the object.75 */76 64 Jump::Jump(Context* context) : Deathmatch(context) 77 65 { … … 81 69 figure_ = 0; 82 70 camera = 0; 83 84 71 setHUDTemplate("JumpHUD"); 85 72 86 scoreLimit_ = 10;87 73 setConfigValues(); 88 74 } 89 75 90 /**91 @brief92 Destructor. Cleans up, if initialized.93 */94 76 Jump::~Jump() 95 77 { … … 103 85 { 104 86 SUPER(Jump, tick, dt); 87 105 88 if (figure_ != NULL) 106 89 { … … 108 91 Vector3 figureVelocity = figure_->getVelocity(); 109 92 110 float boundary = totalScreenShift +center_->getCameraOffset();93 float boundary = totalScreenShift_+center_->getCameraOffset(); 111 94 112 95 if (figurePosition.z > boundary) 113 96 { 114 screenShiftSinceLastUpdate += figurePosition.z - boundary;115 totalScreenShift = figurePosition.z - center_->getCameraOffset();116 117 // Falls noetig neue Platformen im neuen Bereich einfuegen118 if (screenShiftSinceLastUpdate > center_->getSectionLength())97 screenShiftSinceLastUpdate_ += figurePosition.z - boundary; 98 totalScreenShift_ = figurePosition.z - center_->getCameraOffset(); 99 100 // Create new platforms if needed 101 if (screenShiftSinceLastUpdate_ > center_->getSectionLength()) 119 102 { 120 screenShiftSinceLastUpdate -= center_->getSectionLength(); 121 if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0) 103 if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == false && figure_->rocketActive_ == false && addAdventure(adventureNumber_) == true) 122 104 { 123 if (addAdventure(adventureNumber_) == false) 124 { 125 addSection(); 126 } 127 else 128 { 129 ++ adventureNumber_; 130 } 105 screenShiftSinceLastUpdate_ -= 2*center_->getSectionLength(); 106 ++ adventureNumber_; 131 107 } 132 108 else 133 109 { 110 screenShiftSinceLastUpdate_ -= center_->getSectionLength(); 134 111 addSection(); 135 112 } … … 137 114 } 138 115 139 // Spiel verloren wegen Ansturz? 140 if (figurePosition.z < totalScreenShift - center_->getFieldDimension().y + platformHeight_ && figureVelocity.z < 0) 116 if (figurePosition.z < totalScreenShift_ - center_->getFieldDimension().y + platformHeight_ && figureVelocity.z < 0) 141 117 { 142 end();118 figure_->dead_ = true; 143 119 } 144 120 145 // Schiessen 146 147 if (figure_->fireSignal) 121 if (figure_->fireSignal_ == true) 148 122 { 149 figure_->fireSignal = false; 150 addProjectile(figurePosition.x, figurePosition.z + figure_->getPropellerPos()); 123 if (figure_->dead_ == true) 124 { 125 end(); 126 } 127 else 128 { 129 figure_->fireSignal_ = false; 130 addProjectile(figurePosition.x, figurePosition.z + figure_->getPropellerPos()); 131 } 151 132 } 152 133 … … 154 135 if (camera != NULL) 155 136 { 156 Vector3 cameraPosition = Vector3(0, totalScreenShift , 0);137 Vector3 cameraPosition = Vector3(0, totalScreenShift_, 0); 157 138 camera->setPosition(cameraPosition); 158 139 } … … 160 141 { 161 142 orxout() << "No camera found." << endl; 162 //camera = figure_->getCamera();163 143 } 164 144 } 165 else 166 { 167 //orxout() << "No figure found." << endl; 168 } 169 170 // Platformen, die zu weit unten sind entfernen 145 171 146 ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin(); 172 147 ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end(); … … 177 152 { 178 153 platformPosition = itPlatform->getPosition(); 179 if (platformPosition.z < totalScreenShift - center_->getFieldDimension().y)154 if (platformPosition.z < totalScreenShift_ - center_->getFieldDimension().y) 180 155 { 181 156 ObjectList<JumpPlatform>::iterator temp = itPlatform; … … 190 165 } 191 166 192 // DAS GEHT NICHT!!! it++ funktioniert nicht, falls eine Platform geloescht wurde -> Segmentation Error 193 /* 194 for (ObjectList<JumpPlatformDisappear>::iterator it = ObjectList<JumpPlatformDisappear>::begin(); orxout() << "E" << endl, it != ObjectList<JumpPlatformDisappear>::end(); orxout() << "F" << endl, ++it) 195 { 196 if (!it->isActive()) 197 { 198 // Entferne Platform 199 center_->detach(*it); 200 it->destroy(); 201 } 202 } 203 */ 204 205 // Deaktivierte Platformen entfernen 167 // Deleted deactivated platforms 206 168 ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin(); 207 169 ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end(); … … 223 185 } 224 186 225 // Abgelaufene Timer-Platformen entfernen226 187 ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin(); 227 188 ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end(); … … 243 204 } 244 205 245 // Projektile, die zu weit oben sind entfernen246 206 ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin(); 247 207 ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end(); … … 252 212 { 253 213 projectilePosition = itProjectile->getPosition(); 254 if (projectilePosition.z > totalScreenShift + 5*center_->getFieldDimension().y)214 if (projectilePosition.z > totalScreenShift_ + 5*center_->getFieldDimension().y) 255 215 { 256 216 ObjectList<JumpProjectile>::iterator temp = itProjectile; … … 265 225 } 266 226 267 // Gegner, die zu weit unten oder abgeschossen sind entfernen268 227 ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin(); 269 228 ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end(); … … 274 233 { 275 234 enemyPosition = itEnemy->getPosition(); 276 if (enemyPosition.z < totalScreenShift - center_->getFieldDimension().y || itEnemy->dead_ == true)235 if (enemyPosition.z < totalScreenShift_ - center_->getFieldDimension().y || itEnemy->dead_ == true) 277 236 { 278 237 ObjectList<JumpEnemy>::iterator temp = itEnemy; … … 287 246 } 288 247 289 // Items, die zu weit unten sind entfernen290 248 ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin(); 291 249 ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end(); … … 299 257 WorldEntity* parent = itItem->getParent(); 300 258 301 if (itItem->attachedToFigure_ == false && itemPosition.z < totalScreenShift - center_->getFieldDimension().y && parent == center_)259 if (itItem->attachedToFigure_ == false && itemPosition.z < totalScreenShift_ - center_->getFieldDimension().y && parent == center_) 302 260 { 303 261 ObjectList<JumpItem>::iterator temp = itItem; … … 313 271 } 314 272 315 void Jump::setConfigValues()316 {317 SetConfigValue(scoreLimit_, 10).description("The player first reaching those points wins.");318 }319 320 /**321 @brief322 Cleans up the Gametype by destroying the ball and the bats.323 */324 273 void Jump::cleanup() 325 274 { 326 if (figure_ != NULL)327 {328 //this->figure_->destroy();329 //this->figure_ = 0;330 }331 275 camera = 0; 332 276 } … … 354 298 } 355 299 356 // Set variable to temporarily force the player to spawn.357 bool temp = bForceSpawn_;358 bForceSpawn_ = true;359 360 300 // Call start for the parent class. 361 301 Deathmatch::start(); 362 363 // Reset the variable.364 bForceSpawn_ = temp;365 302 366 303 if (figure_ != NULL) … … 369 306 } 370 307 371 totalScreenShift = 0.0;372 screenShiftSinceLastUpdate = 0.0;308 totalScreenShift_ = 0.0; 309 screenShiftSinceLastUpdate_ = 0.0; 373 310 sectionNumber_ = 0; 374 311 adventureNumber_ = 0; … … 379 316 } 380 317 381 /**382 @brief383 Ends the Jump minigame.384 */385 318 void Jump::end() 386 319 { … … 388 321 GSLevel::startMainMenu(); 389 322 390 // Call end for the parent class.391 323 Deathmatch::end(); 392 324 } 393 325 394 /**395 @brief396 Spawns the input player.397 @param player398 The player to be spawned.399 */400 326 void Jump::spawnPlayer(PlayerInfo* player) 401 327 { 402 328 assert(player); 403 329 404 // If the first (left) bat has no player. 405 if (this->figure_->getPlayer() == NULL) 330 if (figure_->getPlayer() == NULL) 406 331 { 407 player->startControl( this->figure_);408 this->players_[player].state_ = PlayerState::Alive;332 player->startControl(figure_); 333 players_[player].state_ = PlayerState::Alive; 409 334 } 410 335 } 411 336 412 /**413 @brief414 Is called when the player scored.415 */416 void Jump::playerScored(PlayerInfo* player, int score)417 {418 419 }420 421 /**422 @brief423 Starts the ball with some default speed.424 */425 void Jump::startBall()426 {427 428 }429 430 /**431 @brief432 Get the left player.433 @return434 Returns a pointer to the player playing on the left. If there is no left player, NULL is returned.435 */436 337 PlayerInfo* Jump::getPlayer() const 437 338 { … … 494 395 JumpPlatformTimer* Jump::addPlatformTimer(float xPosition, float zPosition, float time, float variance) 495 396 { 496 float additionalTime = (float)(rand()%100)/ (100*variance) - variance/2;397 float additionalTime = (float)(rand()%100)/100.0*variance - variance/2.0; 497 398 498 399 JumpPlatformTimer* newPlatform = new JumpPlatformTimer(center_->getContext()); … … 752 653 } 753 654 else if (rand()%2 == 0 && sectionNumber_ > 3) 754 switch(rand()%4) 755 { 756 case 0: 757 itemType = ITEM_PROPELLER; 758 break; 759 case 1: 760 itemType = ITEM_ROCKET; 761 break; 762 case 2: 763 itemType = ITEM_BOOTS; 764 break; 765 case 3: 766 itemType = ITEM_SHIELD; 767 break; 768 default: 769 break; 770 } 655 { 656 switch(rand()%4) 657 { 658 case 0: 659 itemType = ITEM_PROPELLER; 660 break; 661 case 1: 662 itemType = ITEM_ROCKET; 663 break; 664 case 2: 665 itemType = ITEM_BOOTS; 666 break; 667 case 3: 668 itemType = ITEM_SHIELD; 669 break; 670 default: 671 break; 672 } 673 } 771 674 772 675 switch((sectionNumber_ > 28) ? rand()%29 : rand()%(sectionNumber_+1)) … … 894 797 } 895 798 896 // Fill Matrix with selected platform types799 // Fill matrix with selected platform types 897 800 for (int i = 0; i < numI; ++ i) 898 801 { 899 802 for (int j = 0; j < numJ; ++ j) 900 803 { 901 if (rand()% (sectionNumber_+1)== 0)804 if (rand()%3 == 0) 902 805 { 903 806 matrix[i][j].type = platformtype1; … … 911 814 } 912 815 913 // Delete some platforms or replace them with fake platforms 914 if (platformtype1 == platformtype2 && sectionNumber_ > 10) 816 if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0) 915 817 { 916 int j = rand()%numJ; 917 if (rand()%2 == 0) 918 { 919 for (int i = 0; i <= j; ++ i) 920 { 921 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 922 } 923 } 924 else 925 { 926 for (int i = 0; i <= j; ++ i) 927 { 928 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 929 } 930 } 818 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 819 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 820 } 821 822 // Delete some planned platforms or replace them with fake platforms 823 if (sectionNumber_ > 5) 824 { 825 if (rand()%2 == 0) 826 { 827 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 828 } 829 else 830 { 831 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 832 } 833 } 834 else if (sectionNumber_ > 10) 835 { 836 if (rand()%2 == 0) 837 { 838 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 839 } 840 else 841 { 842 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 843 } 844 if (rand()%2 == 0) 845 { 846 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 847 } 848 else 849 { 850 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 851 } 852 } 853 else if (sectionNumber_ > 15) 854 { 855 if (rand()%2 == 0) 856 { 857 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 858 } 859 else 860 { 861 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 862 } 863 if (rand()%2 == 0) 864 { 865 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 866 } 867 else 868 { 869 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 870 } 871 if (rand()%2 == 0) 872 { 873 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY; 874 } 875 else 876 { 877 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE; 878 } 931 879 } 932 880 … … 968 916 xPosition = randomXPosition(numJ, j); 969 917 zPosition = sectionBegin + i*sectionLength/numI; 970 platformList.push_back(addPlatformTimer(xPosition, zPosition, 1 0.0, 1.5));918 platformList.push_back(addPlatformTimer(xPosition, zPosition, 12.0, 1.5)); 971 919 matrix[i][j].done = true; 972 920 break; … … 1044 992 break; 1045 993 default: 1046 // 994 //ERROR 1047 995 break; 1048 996 1049 997 } 1050 1051 /*if (platformtype1 != PLATFORM_TIMER && platformtype2 != PLATFORM_TIMER)1052 {1053 switch (itemType)1054 {1055 case ITEM_SPRING:1056 addSpring(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);1057 itemType = ITEM_NOTHING;1058 break;1059 case ITEM_ROCKET:1060 addRocket(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);1061 itemType = ITEM_NOTHING;1062 break;1063 case ITEM_PROPELLER:1064 addPropeller(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);1065 itemType = ITEM_NOTHING;1066 break;1067 case ITEM_BOOTS:1068 addBoots(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);1069 itemType = ITEM_NOTHING;1070 break;1071 case ITEM_SHIELD:1072 addShield(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);1073 itemType = ITEM_NOTHING;1074 break;1075 default:1076 // ERROR1077 break;1078 }1079 }*/1080 998 } 1081 999 } … … 1085 1003 int numNewPlatforms = platformList.size(); 1086 1004 1087 if ( numNewPlatforms >0)1005 if (rand()%4 == 0) 1088 1006 { 1089 JumpPlatform* itemPlatform = platformList[rand()%numNewPlatforms]; 1090 1091 switch (ITEM_BOOTS) 1092 { 1093 case ITEM_SPRING: 1094 addSpring(itemPlatform); 1095 break; 1096 case ITEM_ROCKET: 1097 addRocket(itemPlatform); 1098 break; 1099 case ITEM_PROPELLER: 1100 addPropeller(itemPlatform); 1101 break; 1102 case ITEM_BOOTS: 1103 addBoots(itemPlatform); 1104 break; 1105 case ITEM_SHIELD: 1106 addShield(itemPlatform); 1107 break; 1108 default: 1109 break; 1110 } 1007 if (rand()%2 == 0) 1008 { 1009 switch (itemType) 1010 { 1011 case ITEM_ROCKET: 1012 addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1013 break; 1014 case ITEM_PROPELLER: 1015 addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1016 break; 1017 case ITEM_BOOTS: 1018 addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1019 break; 1020 case ITEM_SHIELD: 1021 addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1022 break; 1023 default: 1024 break; 1025 } 1026 } 1027 else 1028 { 1029 switch (itemType) 1030 { 1031 case ITEM_ROCKET: 1032 addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1033 break; 1034 case ITEM_PROPELLER: 1035 addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1036 break; 1037 case ITEM_BOOTS: 1038 addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1039 break; 1040 case ITEM_SHIELD: 1041 addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1042 break; 1043 default: 1044 break; 1045 } 1046 } 1047 } 1048 else 1049 { 1050 if (numNewPlatforms > 0) 1051 { 1052 JumpPlatform* itemPlatform = platformList[rand()%numNewPlatforms]; 1053 1054 switch (itemType) 1055 { 1056 case ITEM_SPRING: 1057 addSpring(itemPlatform); 1058 break; 1059 case ITEM_ROCKET: 1060 addRocket(itemPlatform); 1061 break; 1062 case ITEM_PROPELLER: 1063 addPropeller(itemPlatform); 1064 break; 1065 case ITEM_BOOTS: 1066 addBoots(itemPlatform); 1067 break; 1068 case ITEM_SHIELD: 1069 addShield(itemPlatform); 1070 break; 1071 default: 1072 break; 1073 } 1074 } 1111 1075 } 1112 1076 1113 1077 if (sectionNumber_ >= 5 && rand()%3 == 0) 1114 1078 { 1115 // BEWEGUNG Verbessern, Grenzen anpassen !!!!!!!! Auch Vertikale Bewegung zulassen1116 1117 1118 1079 switch(rand()%4) 1119 1080 { 1120 1081 case 0: 1121 addEnemy(1, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth , fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);1082 addEnemy(1, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0); 1122 1083 break; 1123 1084 case 1: 1124 addEnemy(2, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth , fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);1085 addEnemy(2, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0); 1125 1086 break; 1126 1087 case 2: 1127 addEnemy(3, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth , fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);1088 addEnemy(3, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0); 1128 1089 break; 1129 1090 case 3: 1130 addEnemy(4, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth , fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);1091 addEnemy(4, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0); 1131 1092 break; 1132 1093 } … … 1147 1108 { 1148 1109 int numI = 10; 1149 for (int i = 0; i < numI; ++ i)1110 if (rand()%2 == 0) 1150 1111 { 1151 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+i*sectionLength/numI); 1112 for (int i = 0; i < numI; ++ i) 1113 { 1114 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+i*sectionLength/numI); 1115 } 1116 } 1117 else 1118 { 1119 for (int i = 0; i < numI; ++ i) 1120 { 1121 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+(numI-i)*sectionLength/numI); 1122 } 1152 1123 } 1153 1124 break; … … 1158 1129 1159 1130 addPlatformStatic(0.0, sectionBegin); 1160 for (int i = 1; i < numI; ++ i) 1161 { 1162 addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI); 1163 addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI); 1131 if (rand()%2 == 0) 1132 { 1133 for (int i = 1; i < numI; ++ i) 1134 { 1135 addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI); 1136 addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI); 1137 } 1138 } 1139 else 1140 { 1141 for (int i = 1; i < numI; ++ i) 1142 { 1143 addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+(numI-i)*sectionLength/numI); 1144 addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+(numI-i)*sectionLength/numI); 1145 } 1164 1146 } 1165 1147 break; … … 1168 1150 { 1169 1151 int numI = 5; 1170 for (int i = 0; i < numI; ++ i)1152 for (int i = 0; i <= numI; ++ i) 1171 1153 { 1172 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth +platformWidth_/2, sectionBegin);1173 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth +platformWidth_/2, sectionBegin+sectionLength/5);1174 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth +platformWidth_/2, sectionBegin+sectionLength*2/5);1175 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth +platformWidth_/2, sectionBegin+sectionLength*3/5);1176 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth +platformWidth_/2, sectionBegin+sectionLength*4/5);1154 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin); 1155 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength/5); 1156 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*2/5); 1157 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*3/5); 1158 addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*4/5); 1177 1159 addEnemy(4, (2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength/2, -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 0.0, 0.0); 1178 1160 } 1161 break; 1162 } 1163 case 3: 1164 { 1165 addRocket(addPlatformStatic(0.0, sectionBegin)); 1166 addEnemy(2, 0.0, sectionBegin+sectionLength/5, 0.0,0.0, 0.0, 0.0, 0.0, 0.0); 1167 break; 1168 } 1169 case 4: 1170 { 1171 addPropeller(addPlatformStatic(0.0, sectionBegin)); 1172 addPropeller(addPlatformStatic(-fieldWidth/2, sectionBegin)); 1173 addPropeller(addPlatformStatic(fieldWidth/2, sectionBegin)); 1179 1174 break; 1180 1175 } … … 1195 1190 float Jump::randomXPosition(int totalColumns, int culomn) 1196 1191 { 1197 float fieldWidth = center_->getFieldDimension().x; //Width of the half field1198 1199 float halfWidth = fieldWidth/totalColumns; //Width of a half column1200 float leftBound = culomn*halfWidth*2-fieldWidth; //Left beginning of the column1192 float fieldWidth = center_->getFieldDimension().x; 1193 1194 float halfWidth = fieldWidth/totalColumns; 1195 float leftBound = culomn*halfWidth*2-fieldWidth; 1201 1196 float rightBound = leftBound + 2*halfWidth; 1202 1197 … … 1206 1201 float Jump::randomXPositionLeft(int totalColumns, int culomn) 1207 1202 { 1208 float fieldWidth = center_->getFieldDimension().x; //Width of the half field1209 1210 float halfWidth = fieldWidth/totalColumns; //Width of a half column1211 float leftBound = culomn*halfWidth*2-fieldWidth; //LeftBeginning of the column1203 float fieldWidth = center_->getFieldDimension().x; 1204 1205 float halfWidth = fieldWidth/totalColumns; 1206 float leftBound = culomn*halfWidth*2-fieldWidth; 1212 1207 float rightBound = leftBound + 2*halfWidth/3; 1213 1208 … … 1217 1212 float Jump::randomXPositionRight(int totalColumns, int culomn) 1218 1213 { 1219 float fieldWidth = center_->getFieldDimension().x; //Width of the half field1220 1221 float halfWidth = fieldWidth/totalColumns; //Width of a half column1214 float fieldWidth = center_->getFieldDimension().x; 1215 1216 float halfWidth = fieldWidth/totalColumns; 1222 1217 float rightBound = (culomn+1)*halfWidth*2-fieldWidth; 1223 1218 float leftBound = rightBound - 2*halfWidth/3; … … 1227 1222 float Jump::randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd) 1228 1223 { 1229 float fieldHeight = SectionEnd - sectionBegin; //Heigt of the half field1230 float halfHeight = fieldHeight/totalRows; //Height of a half row1231 float lowerBound = row*halfHeight*2+sectionBegin; //Lower beginning of the row1224 float fieldHeight = SectionEnd - sectionBegin; 1225 float halfHeight = fieldHeight/totalRows; 1226 float lowerBound = row*halfHeight*2+sectionBegin; 1232 1227 float upperBound = lowerBound + 2*halfHeight; 1233 1228 … … 1237 1232 float Jump::randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd) 1238 1233 { 1239 float fieldHeight = SectionEnd - sectionBegin; //Heigt of the half field1240 float rowHeight = fieldHeight/totalRows; //Height of a row1241 float lowerBound = row*rowHeight+sectionBegin; //Lower beginning of the row1234 float fieldHeight = SectionEnd - sectionBegin; 1235 float rowHeight = fieldHeight/totalRows; 1236 float lowerBound = row*rowHeight+sectionBegin; 1242 1237 float upperBound = lowerBound + rowHeight/3; 1243 1238 … … 1247 1242 float Jump::randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd) 1248 1243 { 1249 float fieldHeight = SectionEnd - sectionBegin; //Heigt of the half field1250 float rowHeight = fieldHeight/totalRows; //Height of a row1251 float lowerBound = (row+1)*rowHeight+sectionBegin; //Upper end of the row1244 float fieldHeight = SectionEnd - sectionBegin; 1245 float rowHeight = fieldHeight/totalRows; 1246 float lowerBound = (row+1)*rowHeight+sectionBegin; 1252 1247 float upperBound = lowerBound - rowHeight/3; 1253 1248 -
code/branches/pickupsFS14/src/modules/jump/Jump.h
r10074 r10111 27 27 */ 28 28 29 /**30 @file Jump.h31 @brief Declaration of the Jump class.32 @ingroup Jump33 */34 35 29 #ifndef _Jump_H__ 36 30 #define _Jump_H__ 37 31 38 32 #include "jump/JumpPrereqs.h" 39 40 33 #include "tools/Timer.h" 41 34 #include "graphics/Camera.h" 42 43 35 #include "gametypes/Deathmatch.h" 44 36 #include "JumpCenterpoint.h" 45 46 37 #include <list> 47 38 48 39 namespace orxonox 49 40 { 50 51 /**52 @brief53 Implements a Jump minigame (<a href="http://en.wikipedia.org/wiki/Jump">Wikipedia::Jump</a>).54 It connects the different entities present in a game of Jump.55 56 - The @ref orxonox::JumpCenterpoint "JumpCenterpoint" is the playing field for the Jump minigame, it allows for configuration of the minigame, e.g. by setting the size of the playing field, or the length of the @ref orxonox::JumpFigure "JumpFigures". The playing field is always in the x,y-plane, the x-axis being the horizontal and the z-axis being the vertical axis.<br />57 The Jump class redistributes the important parameters defined in @ref orxonox::JumpCenterpoint "JumpCenterpoint" to the other entities, that need to know them, e.g. the @ref orxonox::JumpPlatform "JumpPlatform" and the @ref orxonox::JumpFigure "JumpFigures".<br />58 The @ref orxonox::JumpCenterpoint "JumpCenterpoint" needs to exist in a level with the @ref orxonox::Gametype "Gametype" <em>Jump</em>.59 - The @ref orxonox::JumpPlatform "JumpPlatform" is the ball both players play with. The @ref orxonox::JumpPlatform "JumpPlatform" both implements the movement of the ball, as well as the influence of the boundaries and consequently, also the bouncing (off the upper and lower delimiters, and as off the @ref orxonox::JumpFigure "JumpFigures") of the ball and the effects of the failure of a player to catch the ball (i.e. the scoring of the other player).60 - The two @ref orxonox::JumpFigure "JumpFigures" are the entities through which the players can actively participate in the game, by controlling them. The @ref orxonox::JumpFigure "JumpFigure" class manages the movement (and restrictions thereof) and the influence of the players on the bats.61 62 @author63 Fabian 'x3n' Landau64 65 @ingroup Jump66 */67 41 class _JumpExport Jump : public Deathmatch 68 42 { 69 43 public: 70 Jump(Context* context); //!< Constructor. Registers and initializes the object. 71 virtual ~Jump(); //!< Destructor. Cleans up, if initialized. 72 44 Jump(Context* context); 45 virtual ~Jump(); 73 46 virtual void tick(float dt); 74 75 virtual void start(); //!< Starts the Jump minigame. 76 virtual void end(); ///!< Ends the Jump minigame. 77 78 virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player. 79 80 virtual void playerScored(PlayerInfo* player, int score = 1); //!< Is called when the player scored. 81 47 virtual void start(); 48 virtual void end(); 49 virtual void spawnPlayer(PlayerInfo* player); 82 50 int getScore(PlayerInfo* player) const; 83 51 bool getDead(PlayerInfo* player) const; 84 85 /**86 @brief Set the JumpCenterpoint (the playing field).87 @param center A pointer to the JumpCenterpoint to be set.88 */89 52 void setCenterpoint(JumpCenterpoint* center) 90 53 { center_ = center; } 91 void setConfigValues(); //!< Makes scoreLimit configurable. 92 93 PlayerInfo* getPlayer() const; //!< Get the left player. 54 PlayerInfo* getPlayer() const; 94 55 95 56 protected: 96 void startBall(); //!< Starts the ball with some default speed. 97 void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats. 98 57 void cleanup(); 99 58 virtual void addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition); 100 101 59 virtual JumpPlatformStatic* addPlatformStatic(float xPosition, float zPosition); 102 60 virtual JumpPlatformHMove* addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed); … … 117 75 virtual void addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity); 118 76 virtual void addShield(JumpPlatform* platform); 119 120 77 virtual void addStartSection(); 121 78 virtual void addSection(); 122 79 virtual bool addAdventure(int number); 123 124 80 virtual float randomXPosition(); 125 81 virtual float randomXPosition(int totalColumns, int culomn); … … 129 85 virtual float randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd); 130 86 virtual float randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd); 131 132 87 virtual float randomPosition(float lowerBoundary, float upperBoundary); 133 88 virtual float randomSpeed(); 134 89 135 WeakPtr<JumpCenterpoint> center_; //!< The playing field.136 WeakPtr<JumpFigure> figure_; //!< The two bats.90 WeakPtr<JumpCenterpoint> center_; 91 WeakPtr<JumpFigure> figure_; 137 92 WeakPtr<Camera> camera; 138 int scoreLimit_; //!< If a player scored that much points, the game is ended. 139 140 float totalScreenShift; 141 float screenShiftSinceLastUpdate; 93 float totalScreenShift_; 94 float screenShiftSinceLastUpdate_; 142 95 int sectionNumber_; 143 96 int adventureNumber_; -
code/branches/pickupsFS14/src/modules/jump/JumpBoots.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpBoots.cc 31 @brief Implementation of the JumpBoots class.31 @brief These boots give the figure a speed bonus when it jumpes. 32 32 */ 33 33 … … 48 48 RegisterClass(JumpBoots); 49 49 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 50 JumpBoots::JumpBoots(Context* context) : JumpItem(context) 55 51 { … … 57 53 58 54 fuel_ = 3.0; 55 attachedToFigure_ = false; 59 56 60 57 setPosition(Vector3(0,0,0)); … … 64 61 } 65 62 66 /**67 @brief68 Destructor.69 */70 63 JumpBoots::~JumpBoots() 71 64 { … … 73 66 } 74 67 75 //xml port for loading sounds76 68 void JumpBoots::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 69 { … … 79 71 } 80 72 81 /**82 @brief83 Is called every tick.84 Handles the movement of the ball and its interaction with the boundaries and bats.85 @param dt86 The time since the last tick.87 */88 73 void JumpBoots::tick(float dt) 89 74 { … … 116 101 117 102 attachedToFigure_ = figure_->StartBoots(this); 118 if (attachedToFigure_)119 {120 //Starte Feuer-Animation121 }122 103 } 123 104 } -
code/branches/pickupsFS14/src/modules/jump/JumpBoots.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 27 27 */ 28 28 29 /**30 @file JumpBoots.h31 @brief Declaration of the JumpBoots class.32 @ingroup Jump33 */34 35 29 #ifndef _JumpBoots_H__ 36 30 #define _JumpBoots_H__ 37 31 38 32 #include "jump/JumpPrereqs.h" 39 40 33 #include "util/Math.h" 41 42 34 #include "worldentities/MovableEntity.h" 43 35 … … 45 37 namespace orxonox 46 38 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 39 class _JumpExport JumpBoots : public JumpItem 60 40 { -
code/branches/pickupsFS14/src/modules/jump/JumpCenterpoint.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpCenterpoint.cc 31 @brief Implementation of the JumpCenterpoint class.31 @brief The JumpCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the JumpCenterpoint. 32 32 */ 33 33 34 34 #include "JumpCenterpoint.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/XMLPort.h" 38 39 37 #include "Jump.h" 40 38 … … 43 41 RegisterClass(JumpCenterpoint); 44 42 45 /**46 @brief47 Constructor. Registers and initializes the object and checks whether the gametype is actually Jump.48 */49 43 JumpCenterpoint::JumpCenterpoint(Context* context) : StaticEntity(context) 50 44 { 51 45 RegisterObject(JumpCenterpoint); 52 46 53 // Variablen hier veraendern nuetzt nichts! Diese Variablen koennen in Level-File initialisiert werden. 54 width_ = 200; 55 height_ = 120; 56 sectionLength_ = 120; 57 platformSpeed_ = 20.0; 47 width_ = 0.0; 48 height_ = 0.0; 49 sectionLength_ = 0.0; 50 platformSpeed_ = 0.0; 58 51 59 52 checkGametype(); 60 53 } 61 54 62 /**63 @brief64 Method to create a JumpCenterpoint through XML.65 */66 55 void JumpCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 67 56 { … … 91 80 } 92 81 93 /**94 @brief95 Is called when the gametype has changed.96 */97 82 void JumpCenterpoint::changedGametype() 98 83 { 99 84 SUPER(JumpCenterpoint, changedGametype); 100 85 101 // Check, whether it's still Jump.102 86 checkGametype(); 103 87 } 104 88 105 /**106 @brief107 Checks whether the gametype is Jump and if it is, sets its centerpoint.108 */109 89 void JumpCenterpoint::checkGametype() 110 90 { 111 if ( this->getGametype() != NULL && this->getGametype()->isA(Class(Jump)))91 if (getGametype() != NULL && this->getGametype()->isA(Class(Jump))) 112 92 { 113 93 Jump* jumpGametype = orxonox_cast<Jump*>(this->getGametype().get()); -
code/branches/pickupsFS14/src/modules/jump/JumpCenterpoint.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpCenterpoint.h31 @brief Declaration of the JumpCenterpoint class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpCenterpoint_H__ … … 112 106 113 107 For a more elaborate example, have a look at the <code>jump.oxw</code> level file. 114 115 @author 116 Fabian 'x3n' Landau 117 118 @ingroup Jump 108 119 109 */ 120 110 class _JumpExport JumpCenterpoint : public StaticEntity … … 123 113 JumpCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Jump. 124 114 virtual ~JumpCenterpoint() {} 125 126 115 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a JumpCenterpoint through XML. 127 128 virtual void changedGametype(); //!< Is called when the gametype has changed. 129 130 116 virtual void changedGametype(); 131 117 void setPlatformStaticTemplate(const std::string& balltemplate) 132 118 { this->platformStaticTemplate_ = balltemplate; } 133 134 119 const std::string& getPlatformStaticTemplate() const 135 120 { return this->platformStaticTemplate_; } 136 137 121 void setPlatformHMoveTemplate(const std::string& balltemplate) 138 122 { this->platformHMoveTemplate_ = balltemplate; } 139 140 123 const std::string& getPlatformHMoveTemplate() const 141 124 { return this->platformHMoveTemplate_; } 142 143 125 void setPlatformVMoveTemplate(const std::string& balltemplate) 144 126 { this->platformVMoveTemplate_ = balltemplate; } 145 146 127 const std::string& getPlatformVMoveTemplate() const 147 128 { return this->platformVMoveTemplate_; } 148 149 129 void setPlatformDisappearTemplate(const std::string& balltemplate) 150 130 { this->platformDisappearTemplate_ = balltemplate; } 151 152 131 const std::string& getPlatformDisappearTemplate() const 153 132 { return this->platformDisappearTemplate_; } 154 155 133 void setPlatformTimerTemplate(const std::string& balltemplate) 156 134 { this->platformTimerTemplate_ = balltemplate; } 157 158 135 const std::string& getPlatformTimerTemplate() const 159 136 { return this->platformTimerTemplate_; } 160 161 137 void setPlatformFakeTemplate(const std::string& balltemplate) 162 138 { this->platformFakeTemplate_ = balltemplate; } 163 164 139 const std::string& getPlatformFakeTemplate() const 165 140 { return this->platformFakeTemplate_; } 166 167 141 void setProjectileTemplate(const std::string& newTemplate) 168 142 { this->projectileTemplate_ = newTemplate; } 169 170 143 const std::string& getProjectileTemplate() const 171 144 { return this->projectileTemplate_; } 172 173 145 void setSpringTemplate(const std::string& newTemplate) 174 146 { this->springTemplate_ = newTemplate; } 175 176 147 const std::string& getSpringTemplate() const 177 148 { return this->springTemplate_; } 178 179 149 void setRocketTemplate(const std::string& newTemplate) 180 150 { this->rocketTemplate_ = newTemplate; } 181 182 151 const std::string& getRocketTemplate() const 183 152 { return this->rocketTemplate_; } 184 185 153 void setPropellerTemplate(const std::string& newTemplate) 186 154 { this->propellerTemplate_ = newTemplate; } 187 188 155 const std::string& getPropellerTemplate() const 189 156 { return this->propellerTemplate_; } 190 191 157 void setBootsTemplate(const std::string& newTemplate) 192 158 { this->bootsTemplate_ = newTemplate; } 193 194 159 const std::string& getBootsTemplate() const 195 160 { return this->bootsTemplate_; } 196 197 161 void setShieldTemplate(const std::string& newTemplate) 198 162 { this->shieldTemplate_ = newTemplate; } 199 200 163 const std::string& getShieldTemplate() const 201 164 { return this->shieldTemplate_; } 202 203 165 void setFigureTemplate(const std::string& newTemplate) 204 166 { this->figureTemplate_ = newTemplate; } 205 206 167 const std::string& getFigureTemplate() const 207 168 { return this->figureTemplate_; } 208 209 169 void setEnemy1Template(const std::string& newTemplate) 210 170 { this->enemy1Template_ = newTemplate; } 211 212 171 const std::string& getEnemy1Template() const 213 172 { return this->enemy1Template_; } 214 215 173 void setEnemy2Template(const std::string& newTemplate) 216 174 { this->enemy2Template_ = newTemplate; } 217 218 175 const std::string& getEnemy2Template() const 219 176 { return this->enemy2Template_; } 220 221 177 void setEnemy3Template(const std::string& newTemplate) 222 178 { this->enemy3Template_ = newTemplate; } 223 224 179 const std::string& getEnemy3Template() const 225 180 { return this->enemy3Template_; } 226 227 181 void setEnemy4Template(const std::string& newTemplate) 228 182 { this->enemy4Template_ = newTemplate; } 229 230 183 const std::string& getEnemy4Template() const 231 184 { return this->enemy4Template_; } 232 233 234 /**235 @brief Set the dimensions of the playing field.236 @param dimension A vector with the width of the playing field as first component and the height as second.237 */238 185 void setFieldDimension(const Vector2& dimension) 239 186 { this->width_ = dimension.x; this->height_ = dimension.y; } 240 /**241 @brief Get the dimensions of the playing field.242 @return Returns a vector with the width of the playing field as first component and the height as second.243 */244 187 Vector2 getFieldDimension() const 245 188 { return Vector2(this->width_, this->height_); } 246 247 /**248 @brief Set the dimensions of the playing field.249 @param dimension A vector with the width of the playing field as first component and the height as second.250 */251 189 void setSectionLength(const float sectionLength) 252 190 { this->sectionLength_ = sectionLength; } 253 /**254 @brief Get the dimensions of the playing field.255 @return Returns a vector with the width of the playing field as first component and the height as second.256 */257 191 float getSectionLength() const 258 192 { return sectionLength_; } 259 260 193 void setPlatformSpeed(const float platformSpeed) 261 194 { this->platformSpeed_ = platformSpeed; } 262 263 195 float getPlatformSpeed() const 264 196 { return platformSpeed_; } 265 266 197 void setCameraOffset(const float cameraOffset) 267 198 { this->cameraOffset_ = cameraOffset; } 268 269 199 float getCameraOffset() const 270 200 { return cameraOffset_; } 271 272 273 201 private: 274 void checkGametype(); //!< Checks whether the gametype is Jump and if it is, sets its centerpoint. 275 276 std::string platformStaticTemplate_; //!< The template for the ball. 277 std::string platformHMoveTemplate_; //!< The template for the ball. 278 std::string platformVMoveTemplate_; //!< The template for the ball. 279 std::string platformDisappearTemplate_; //!< The template for the ball. 280 std::string platformTimerTemplate_; //!< The template for the ball. 281 std::string platformFakeTemplate_; //!< The template for the ball. 282 std::string projectileTemplate_; //!< The template for the ball. 283 std::string springTemplate_; //!< The template for the ball. 284 std::string rocketTemplate_; //!< The template for the ball. 285 std::string propellerTemplate_; //!< The template for the ball. 286 std::string bootsTemplate_; //!< The template for the ball. 287 std::string shieldTemplate_; //!< The template for the ball. 288 std::string figureTemplate_; //!< The template for the bats. 289 std::string enemy1Template_; //!< The template for the bats. 290 std::string enemy2Template_; //!< The template for the bats. 291 std::string enemy3Template_; //!< The template for the bats. 292 std::string enemy4Template_; //!< The template for the bats. 293 294 float width_; //!< The height of the playing field. 295 float height_; //!< The width of the playing field. 296 float sectionLength_; //!< Height of one section 297 float platformSpeed_; //!< Height of one section 298 float cameraOffset_; //!< Height of one section 202 void checkGametype(); 203 std::string platformStaticTemplate_; 204 std::string platformHMoveTemplate_; 205 std::string platformVMoveTemplate_; 206 std::string platformDisappearTemplate_; 207 std::string platformTimerTemplate_; 208 std::string platformFakeTemplate_; 209 std::string projectileTemplate_; 210 std::string springTemplate_; 211 std::string rocketTemplate_; 212 std::string propellerTemplate_; 213 std::string bootsTemplate_; 214 std::string shieldTemplate_; 215 std::string figureTemplate_; 216 std::string enemy1Template_; 217 std::string enemy2Template_; 218 std::string enemy3Template_; 219 std::string enemy4Template_; 220 float width_; 221 float height_; 222 float sectionLength_; 223 float platformSpeed_; 224 float cameraOffset_; 299 225 }; 300 226 } -
code/branches/pickupsFS14/src/modules/jump/JumpEnemy.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpEnemy.cc 31 @brief Implementation of the JumpEnemy class.31 @brief All enemies in the minigame inherit from this class. This class manages the movement of all enemies and allows enemies to touch the figure to kill it. 32 32 */ 33 33 -
code/branches/pickupsFS14/src/modules/jump/JumpEnemy.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 45 45 namespace orxonox 46 46 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 47 class _JumpExport JumpEnemy : public MovableEntity 60 48 { … … 62 50 JumpEnemy(Context* context); 63 51 virtual ~JumpEnemy(); 64 65 52 virtual void tick(float dt); 66 67 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 68 69 /**70 @brief Set the dimensions of the playing field.71 @param width The width of the playing field.72 @param height The height of the playing field.73 */74 54 void setFieldDimension(float width, float height) 75 55 { this->fieldWidth_ = width; this->fieldHeight_ = height; } 76 /**77 @brief Get the dimensions of the playing field.78 @param dimension A vector with the width as the first and height as the second component.79 */80 56 void setFieldDimension(const Vector2& dimension) 81 57 { this->setFieldDimension(dimension.x, dimension.y); } 82 /**83 @brief Get the dimensions of the playing field.84 @return Returns a vector with the width as the first and height as the second component.85 */86 58 Vector2 getFieldDimension() const 87 59 { return Vector2(this->fieldWidth_, this->fieldHeight_); } 88 89 60 void setWidth(const float width) 90 61 { this->width_ = width; } … … 97 68 98 69 virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed); 99 100 void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball. 70 void setFigure(WeakPtr<JumpFigure> bats); 101 71 virtual void touchFigure(); 102 72 bool dead_; 103 73 protected: 104 105 74 float width_; 106 75 float height_; 107 108 float fieldWidth_; //!< The width of the playing field. 109 float fieldHeight_; //!< The height of the playing field. 110 76 float fieldWidth_; 77 float fieldHeight_; 111 78 float leftBoundary_; 112 79 float rightBoundary_; 113 80 float lowerBoundary_; 114 81 float upperBoundary_; 115 116 WeakPtr<JumpFigure> figure_; //!< An array with the two bats. 82 WeakPtr<JumpFigure> figure_; 117 83 }; 118 84 } -
code/branches/pickupsFS14/src/modules/jump/JumpFigure.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpFigure.cc 31 @brief Implementation of the JumpFigure class.31 @brief This class represents your figure when you play the minigame. Here the movement of the figure, activating items, ... are handled. 32 32 */ 33 33 … … 41 41 RegisterClass(JumpFigure); 42 42 43 /**44 @brief45 Constructor. Registers and initializes the object.46 */47 43 JumpFigure::JumpFigure(Context* context) : ControllableEntity(context) 48 44 { 49 45 RegisterObject(JumpFigure); 50 46 47 // initialize variables 51 48 leftHand_ = NULL; 52 49 rightHand_ = NULL; 53 54 50 fieldHeight_ = 0; 55 51 fieldWidth_ = 0; 56 57 52 jumpSpeed_ = 0.0; 58 53 handSpeed_ = 0.0; … … 62 57 propellerPos_ = 0.0; 63 58 bootsPos_ = 0.0; 64 65 moveUpPressed = false; 66 moveDownPressed = false; 67 moveLeftPressed = false; 68 moveDownPressed = false; 69 firePressed = false; 70 fireSignal = false; 71 timeSinceLastFire = 0.0; 72 73 gravityAcceleration = 8.0; 59 moveUpPressed_ = false; 60 moveDownPressed_ = false; 61 moveLeftPressed_ = false; 62 moveDownPressed_ = false; 63 firePressed_ = false; 64 fireSignal_ = false; 65 timeSinceLastFire_ = 0.0; 66 gravityAcceleration_ = 8.0; 74 67 mouseFactor_ = 75.0; 75 maxFireRate = 0.3; 76 68 maxFireRate_ = 0.3; 77 69 handAngle_ = 0.0; 78 70 animateHands_ = false; 79 71 turnUp_ = false; 80 81 72 rocketActive_ = false; 82 73 propellerActive_ = false; … … 85 76 rocketSpeed_ = 0.0; 86 77 propellerSpeed_ = 0.0; 87 88 78 dead_ = false; 89 79 } 90 80 91 /**92 @brief93 Method to create a JumpCenterpoint through XML.94 */95 81 void JumpFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode) 96 82 { … … 110 96 } 111 97 112 /**113 @brief114 Is called each tick.115 Moves the bat.116 @param dt117 The time since last tick.118 */119 98 void JumpFigure::tick(float dt) 120 99 { 121 100 SUPER(JumpFigure, tick, dt); 122 101 123 // If the bat is controlled (but not over the network).124 102 if (hasLocalController()) 125 103 { 126 timeSinceLastFire += dt;104 timeSinceLastFire_ += dt; 127 105 128 106 // Move up/down … … 138 116 else 139 117 { 140 velocity.z -= gravityAcceleration ;118 velocity.z -= gravityAcceleration_; 141 119 } 142 120 … … 174 152 if (dead_ == false) 175 153 { 176 velocity.x = -mouseFactor_*horizontalSpeed ;154 velocity.x = -mouseFactor_*horizontalSpeed_; 177 155 } 178 156 else … … 182 160 183 161 // Cheats 184 if (moveUpPressed== true)185 { 186 velocity.z = 200.0f;187 moveUpPressed = false;162 /*if (moveUpPressed_ == true) 163 { 164 velocity.z = 400.0f; 165 moveUpPressed_ = false; 188 166 dead_ = false; 189 167 } 190 if (moveDownPressed == true)191 { 192 moveDownPressed = false;193 } 168 if (moveDownPressed_ == true) 169 { 170 moveDownPressed_ = false; 171 }*/ 194 172 195 173 setVelocity(velocity); 196 174 197 175 198 if (firePressed && timeSinceLastFire >= maxFireRate) 199 { 200 firePressed = false; 201 timeSinceLastFire = 0.0; 202 fireSignal = true; 203 //orxout() << "fired signal set" << endl; 176 if (firePressed_ && timeSinceLastFire_ >= maxFireRate_) 177 { 178 firePressed_ = false; 179 timeSinceLastFire_ = 0.0; 180 fireSignal_ = true; 204 181 } 205 182 } … … 218 195 219 196 // Reset key variables 220 moveUpPressed = false;221 moveDownPressed = false;222 moveLeftPressed = false;223 moveDownPressed = false;224 firePressed = false;197 moveUpPressed_ = false; 198 moveDownPressed_ = false; 199 moveLeftPressed_ = false; 200 moveDownPressed_ = false; 201 firePressed_ = false; 225 202 } 226 203 … … 365 342 } 366 343 367 /**368 @briefhandPosition_369 Overloaded the function to steer the bat up and down.370 @param value371 A vector whose first component is the inverse direction in which we want to steer the bat.372 */373 344 void JumpFigure::moveFrontBack(const Vector2& value) 374 345 { 375 346 if (value.x > 0) 376 347 { 377 //orxout() << "up pressed" << endl; 378 moveUpPressed = true; 379 moveDownPressed = false; 348 moveUpPressed_ = true; 349 moveDownPressed_ = false; 380 350 } 381 351 else 382 352 { 383 //orxout() << "down pressed" << endl; 384 moveUpPressed = false; 385 moveDownPressed = true; 386 } 387 } 388 389 /** 390 @brief 391 Overloaded the function to steer the bat up and down. 392 @param value 393 A vector whose first component is the direction in which we wnat to steer the bat. 394 */ 353 moveUpPressed_ = false; 354 moveDownPressed_ = true; 355 } 356 } 357 395 358 void JumpFigure::moveRightLeft(const Vector2& value) 396 359 { 397 360 if (value.x > 0) 398 361 { 399 moveLeftPressed = false;400 moveRightPressed = true;362 moveLeftPressed_ = false; 363 moveRightPressed_ = true; 401 364 } 402 365 else 403 366 { 404 moveLeftPressed = true;405 moveRightPressed = false;367 moveLeftPressed_ = true; 368 moveRightPressed_ = false; 406 369 } 407 370 } … … 409 372 void JumpFigure::rotateYaw(const Vector2& value) 410 373 { 411 horizontalSpeed = value.x;374 horizontalSpeed_ = value.x; 412 375 } 413 376 … … 426 389 void JumpFigure::fire(unsigned int firemode) 427 390 { 428 //SUPER(JumpFigure, fire, firemode); 391 429 392 } 430 393 431 394 void JumpFigure::fired(unsigned int firemode) 432 395 { 433 //SUPER(JumpFigure, fired, firemode); 434 firePressed = true; 396 firePressed_ = true; 435 397 } 436 398 } -
code/branches/pickupsFS14/src/modules/jump/JumpFigure.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpFigure.h31 @brief Declaration of the JumpFigure class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpFigure_H__ … … 42 36 namespace orxonox 43 37 { 44 45 /**46 @brief47 The JumpFigure class manages the bats for @ref orxonox::Jump "Jump", which are the elements controlled by the players.48 49 It is responsible for the movement (controlled by the players) of the bat.50 51 @author52 Fabian 'x3n' Landau53 54 @ingroup Jump55 */56 38 class _JumpExport JumpFigure : public ControllableEntity 57 39 { … … 59 41 JumpFigure(Context* context); //!< Constructor. Registers and initializes the object. 60 42 virtual ~JumpFigure() {} 61 62 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 63 64 44 virtual void tick(float dt); 65 66 45 virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down. 67 46 virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down. 68 69 47 virtual void rotateYaw(const Vector2& value); 70 48 virtual void rotatePitch(const Vector2& value); 71 49 virtual void rotateRoll(const Vector2& value); 72 73 50 void fire(unsigned int firemode); 74 51 virtual void fired(unsigned int firemode); 75 76 52 virtual void JumpFromPlatform(JumpPlatform* platform); 77 53 virtual void JumpFromSpring(JumpSpring* spring); … … 85 61 virtual bool StartShield(JumpShield* shield); 86 62 virtual void StopShield(JumpShield* shield); 87 88 63 virtual void InitializeAnimation(Context* context); 89 64 90 65 void setFieldDimension(float width, float height) 91 66 { fieldWidth_ = width; fieldHeight_ = height; } 92 93 67 void setFieldDimension(const Vector2& dimension) 94 68 { setFieldDimension(dimension.x, dimension.y); } 95 96 69 Vector2 getFieldDimension() const 97 70 { return Vector2(fieldWidth_, fieldHeight_); } 98 99 71 void setMouseFactor(const float mouseFactor) 100 72 { mouseFactor_ = mouseFactor; } 101 102 73 const float getMouseFactor() const 103 74 { return mouseFactor_; } 104 105 75 void setModelLeftHand(const std::string& modelLeftHand) 106 76 { modelLeftHand_ = modelLeftHand; } 107 108 77 const std::string& getModelLeftHand() const 109 78 { return modelLeftHand_; } 110 111 79 void setModelRightHand(const std::string& modelRightHand) 112 80 { modelRightHand_ = modelRightHand; } 113 114 81 const std::string& getModelRightHand() const 115 82 { return modelRightHand_; } 116 117 83 void setRocketPos(const float rocketPos) 118 84 { rocketPos_ = rocketPos; } 119 120 85 const float getRocketPos() const 121 86 { return rocketPos_; } 122 123 87 void setPropellerPos(const float propellerPos) 124 88 { propellerPos_ = propellerPos; } 125 126 89 const float getPropellerPos() const 127 90 { return propellerPos_; } 128 129 91 void setBootsPos(const float bootsPos) 130 92 { bootsPos_ = bootsPos; } 131 132 93 const float getBootsPos() const 133 94 { return bootsPos_; } 134 135 95 void setJumpSpeed(const float jumpSpeed) 136 96 { jumpSpeed_ = jumpSpeed; } 137 138 97 const float getJumpSpeed() const 139 98 { return jumpSpeed_; } 140 141 99 void setRocketSpeed(const float rocketSpeed) 142 100 { rocketSpeed_ = rocketSpeed; } 143 144 101 const float getRocketSpeed() const 145 102 { return rocketSpeed_; } 146 147 103 void setPropellerSpeed(const float propellerSpeed) 148 104 { propellerSpeed_ = propellerSpeed; } 149 150 105 const float getPropellerSpeed() const 151 106 { return propellerSpeed_; } 152 153 107 void setHandMinAngle(const float handMinAngle) 154 108 { handMinAngle_ = handMinAngle; } 155 156 109 const float getHandMinAngle() const 157 110 { return handMinAngle_; } 158 159 111 void setHandMaxAngle(const float handMaxAngle) 160 112 { handMaxAngle_ = handMaxAngle; } 161 162 113 const float getHandMaxAngle() const 163 114 { return handMaxAngle_; } 164 165 115 void setHandSpeed(const float handSpeed) 166 116 { handSpeed_ = handSpeed; } 167 168 117 const float getHandSpeed() const 169 118 { return handSpeed_; } 170 119 171 bool fireSignal; 120 bool fireSignal_; 121 bool rocketActive_; 122 bool propellerActive_; 172 123 bool dead_; 173 174 124 private: 175 125 std::string modelLeftHand_; 176 126 std::string modelRightHand_; 177 178 127 Model* leftHand_; 179 128 Model* rightHand_; 180 181 129 float fieldWidth_; 182 130 float fieldHeight_; 183 float timeSinceLastFire; 184 185 bool moveUpPressed; 186 bool moveDownPressed; 187 bool moveLeftPressed; 188 bool moveRightPressed; 189 bool firePressed; 190 191 float gravityAcceleration; 131 float timeSinceLastFire_; 132 bool moveUpPressed_; 133 bool moveDownPressed_; 134 bool moveLeftPressed_; 135 bool moveRightPressed_; 136 bool firePressed_; 137 float gravityAcceleration_; 192 138 float mouseFactor_; 193 194 139 float jumpSpeed_; 195 140 float handSpeed_; … … 199 144 float propellerPos_; 200 145 float bootsPos_; 201 float maxFireRate; 202 203 float horizontalSpeed; 204 146 float maxFireRate_; 147 float horizontalSpeed_; 205 148 float handAngle_; 206 149 bool animateHands_; 207 150 bool turnUp_; 208 209 bool rocketActive_;210 bool propellerActive_;211 151 bool bootsActive_; 212 152 bool shieldActive_; -
code/branches/pickupsFS14/src/modules/jump/JumpItem.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpItem.cc 31 @brief Implementation of the JumpItem class.31 @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies. 32 32 */ 33 33 … … 48 48 RegisterClass(JumpItem); 49 49 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 50 JumpItem::JumpItem(Context* context) : MovableEntity(context) 55 51 { … … 66 62 } 67 63 68 /**69 @brief70 Destructor.71 */72 64 JumpItem::~JumpItem() 73 65 { … … 75 67 } 76 68 77 //xml port for loading sounds78 69 void JumpItem::XMLPort(Element& xmlelement, XMLPort::Mode mode) 79 70 { … … 84 75 } 85 76 86 /**87 @brief88 Is called every tick.89 Handles the movement of the ball and its interaction with the boundaries and bats.90 @param dt91 The time since the last tick.92 */93 77 void JumpItem::tick(float dt) 94 78 { … … 125 109 } 126 110 127 /**128 @brief129 Set the bats for the ball.130 @param bats131 An array (of size 2) of weak pointers, to be set as the new bats.132 */133 111 void JumpItem::setFigure(WeakPtr<JumpFigure> newFigure) 134 112 { -
code/branches/pickupsFS14/src/modules/jump/JumpItem.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 45 45 namespace orxonox 46 46 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 47 class _JumpExport JumpItem : public MovableEntity 60 48 { … … 74 62 Vector2 getFieldDimension() const 75 63 { return Vector2(this->fieldWidth_, this->fieldHeight_); } 76 77 64 void setWidth(const float width) 78 65 { this->width_ = width; } … … 89 76 float fieldWidth_; //!< The width of the playing field. 90 77 float fieldHeight_; //!< The height of the playing field. 91 92 78 WeakPtr<JumpFigure> figure_; //!< An array with the two bats. 93 79 float height_; 94 80 float width_; 95 96 81 float leftBoundary_; 97 82 float rightBoundary_; -
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatform.cc 31 @brief Implementation of the JumpPlatform class.31 @brief All platforms in this minigame inherit from this class. The basic functions of a platform (interact with figure) is implemented here. Special functions are implemented in the specialized classes. 32 32 */ 33 33 … … 48 48 RegisterClass(JumpPlatform); 49 49 50 const float JumpPlatform::MAX_REL_Z_VELOCITY = 1.5;51 52 /**53 @brief54 Constructor. Registers and initializes the object.55 */56 50 JumpPlatform::JumpPlatform(Context* context) : MovableEntity(context) 57 51 { -
code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 37 37 38 38 #include "jump/JumpPrereqs.h" 39 40 39 #include "util/Math.h" 41 42 40 #include "worldentities/MovableEntity.h" 43 44 41 45 42 namespace orxonox 46 43 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 44 class _JumpExport JumpPlatform : public MovableEntity 60 45 { … … 66 51 void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball. 67 52 virtual void touchFigure(); 68 69 static const float MAX_REL_Z_VELOCITY;70 53 71 54 void setDefScoreSound(const std::string& engineSound); -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformDisappear.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformDisappear.cc 31 @brief Implementation of the JumpPlatform class.31 @brief This platform disappears after contact with the figure. 32 32 */ 33 33 … … 48 48 RegisterClass(JumpPlatformDisappear); 49 49 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 50 JumpPlatformDisappear::JumpPlatformDisappear(Context* context) : JumpPlatform(context) 55 51 { … … 59 55 } 60 56 61 /**62 @brief63 Destructor.64 */65 57 JumpPlatformDisappear::~JumpPlatformDisappear() 66 58 { … … 68 60 } 69 61 70 71 //xml port for loading sounds72 62 void JumpPlatformDisappear::XMLPort(Element& xmlelement, XMLPort::Mode mode) 73 63 { … … 75 65 } 76 66 77 /**78 @brief79 Is called every tick.80 Handles the movement of the ball and its interaction with the boundaries and bats.81 @param dt82 The time since the last tick.83 */84 67 void JumpPlatformDisappear::tick(float dt) 85 68 { -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformDisappear.h
r10050 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 37 37 38 38 #include "jump/JumpPrereqs.h" 39 40 39 #include "util/Math.h" 41 42 40 #include "worldentities/MovableEntity.h" 43 44 41 45 42 namespace orxonox 46 43 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 44 class _JumpExport JumpPlatformDisappear : public JumpPlatform 60 45 { … … 62 47 JumpPlatformDisappear(Context* context); 63 48 virtual ~JumpPlatformDisappear(); 64 65 49 virtual void tick(float dt); 66 67 50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 68 69 51 virtual void setProperties(bool active); 70 52 virtual bool isActive(); 71 53 virtual void touchFigure(); 72 73 54 74 55 protected: -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformFake.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformFake.cc 31 @brief Implementation of the JumpPlatform class.31 @brief This platform has a hole in it. You cannot jump from this platform. It has no touchFigure function. 32 32 */ 33 33 34 34 #include "JumpPlatformFake.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 39 37 #include "gametypes/Gametype.h" 40 41 38 #include "JumpFigure.h" 42 43 39 #include "sound/WorldSound.h" 44 40 #include "core/XMLPort.h" … … 48 44 RegisterClass(JumpPlatformFake); 49 45 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 46 JumpPlatformFake::JumpPlatformFake(Context* context) : JumpPlatform(context) 55 47 { … … 57 49 } 58 50 59 /**60 @brief61 Destructor.62 */63 51 JumpPlatformFake::~JumpPlatformFake() 64 52 { … … 66 54 } 67 55 68 //xml port for loading sounds69 56 void JumpPlatformFake::XMLPort(Element& xmlelement, XMLPort::Mode mode) 70 57 { … … 72 59 } 73 60 74 /**75 @brief76 Is called every tick.77 Handles the movement of the ball and its interaction with the boundaries and bats.78 @param dt79 The time since the last tick.80 */81 61 void JumpPlatformFake::tick(float dt) 82 62 { -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformFake.h
r10050 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 45 45 namespace orxonox 46 46 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 47 class _JumpExport JumpPlatformFake : public JumpPlatform 60 48 { … … 62 50 JumpPlatformFake(Context* context); 63 51 virtual ~JumpPlatformFake(); 64 65 52 virtual void tick(float dt); 66 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformHMove.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformHMove.cc 31 @brief Implementation of the JumpPlatform class.31 @brief This platform can move horizontally. 32 32 */ 33 33 34 34 #include "JumpPlatformHMove.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 39 37 #include "gametypes/Gametype.h" 40 41 38 #include "JumpFigure.h" 42 43 39 #include "sound/WorldSound.h" 44 40 #include "core/XMLPort.h" 45 46 #include "graphics/Backlight.h"47 41 48 42 namespace orxonox … … 50 44 RegisterClass(JumpPlatformHMove); 51 45 52 /**53 @brief54 Constructor. Registers and initializes the object.55 */56 46 JumpPlatformHMove::JumpPlatformHMove(Context* context) : JumpPlatform(context) 57 47 { … … 61 51 } 62 52 63 /**64 @brief65 Destructor.66 */67 53 JumpPlatformHMove::~JumpPlatformHMove() 68 54 { … … 70 56 } 71 57 72 //xml port for loading sounds73 58 void JumpPlatformHMove::XMLPort(Element& xmlelement, XMLPort::Mode mode) 74 59 { … … 76 61 } 77 62 78 /**79 @brief80 Is called every tick.81 Handles the movement of the ball and its interaction with the boundaries and bats.82 @param dt83 The time since the last tick.84 */85 63 void JumpPlatformHMove::tick(float dt) 86 64 { … … 88 66 89 67 // Get the current position, velocity and acceleration of the ball. 90 Vector3 position = this->getPosition();91 Vector3 velocity = this->getVelocity();68 Vector3 position = getPosition(); 69 Vector3 velocity = getVelocity(); 92 70 93 71 if ((position.x < leftBoundary_ && velocity.x < 0) || (position.x > rightBoundary_ && velocity.x > 0)) 94 72 95 73 { 96 //orxout() << "refelected platformHMove at " << position.x << endl;97 74 velocity.x = -velocity.x; 98 75 } 99 76 100 77 // Set the position, velocity and acceleration of the ball, if they have changed. 101 if (velocity != this->getVelocity()) 102 this->setVelocity(velocity); 78 if (velocity != getVelocity()) 79 { 80 setVelocity(velocity); 81 } 103 82 if (position != this->getPosition()) 104 this->setPosition(position); 83 { 84 setPosition(position); 85 } 105 86 } 106 87 … … 109 90 leftBoundary_ = leftBoundary; 110 91 rightBoundary_ = rightBoundary; 111 112 this->setVelocity(Vector3(speed,0,0)); 113 92 setVelocity(Vector3(speed,0,0)); 114 93 } 115 94 -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformHMove.h
r10050 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpPlatformHMove.h31 @brief Declaration of the JumpPlatform class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpPlatformHMove_H__ … … 46 40 { 47 41 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 42 class _JumpExport JumpPlatformHMove : public JumpPlatform 60 43 { … … 62 45 JumpPlatformHMove(Context* context); 63 46 virtual ~JumpPlatformHMove(); 64 65 47 virtual void tick(float dt); 66 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 67 68 49 virtual void setProperties(float leftBoundary, float rightBoundary, float speed); 69 50 virtual void touchFigure(); -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformStatic.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformStatic.cc 31 @brief Implementation of the JumpPlatformStatic class.31 @brief This is the most simple platform in this minigame. 32 32 */ 33 33 34 34 #include "JumpPlatformStatic.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 39 37 #include "gametypes/Gametype.h" 40 41 38 #include "JumpFigure.h" 42 43 39 #include "sound/WorldSound.h" 44 40 #include "core/XMLPort.h" … … 48 44 RegisterClass(JumpPlatformStatic); 49 45 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 46 JumpPlatformStatic::JumpPlatformStatic(Context* context) : JumpPlatform(context) 55 47 { … … 58 50 } 59 51 60 /**61 @brief62 Destructor.63 */64 52 JumpPlatformStatic::~JumpPlatformStatic() 65 53 { … … 73 61 } 74 62 75 /**76 @brief77 Is called every tick.78 Handles the movement of the ball and its interaction with the boundaries and bats.79 @param dt80 The time since the last tick.81 */82 63 void JumpPlatformStatic::tick(float dt) 83 64 { -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformStatic.h
r10050 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpPlatformStatic.h31 @brief Declaration of the JumpPlatformStatic class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpPlatformStatic_H__ … … 45 39 namespace orxonox 46 40 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 41 class _JumpExport JumpPlatformStatic : public JumpPlatform 60 42 { -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformTimer.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformTimer.cc 31 @brief Implementation of the JumpPlatform class.31 @brief This platform will explode if you wait for too long time. 32 32 */ 33 33 34 34 #include "JumpPlatformTimer.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 39 37 #include "gametypes/Gametype.h" 40 41 38 #include "JumpFigure.h" 42 43 39 #include "sound/WorldSound.h" 44 40 #include "core/XMLPort.h" … … 48 44 RegisterClass(JumpPlatformTimer); 49 45 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 46 JumpPlatformTimer::JumpPlatformTimer(Context* context) : JumpPlatform(context) 55 47 { 56 48 RegisterObject(JumpPlatformTimer); 57 49 58 particleSpawner = NULL;50 particleSpawner_ = NULL; 59 51 60 52 setProperties(3.0); … … 62 54 } 63 55 64 /**65 @brief66 Destructor.67 */68 56 JumpPlatformTimer::~JumpPlatformTimer() 69 57 { … … 71 59 } 72 60 73 //xml port for loading sounds74 61 void JumpPlatformTimer::XMLPort(Element& xmlelement, XMLPort::Mode mode) 75 62 { … … 80 67 } 81 68 82 /**83 @brief84 Is called every tick.85 Handles the movement of the ball and its interaction with the boundaries and bats.86 @param dt87 The time since the last tick.88 */89 69 void JumpPlatformTimer::tick(float dt) 90 70 { … … 92 72 93 73 time_ -= dt; 94 if (time_ < effectStartTime_ && particleSpawner == NULL)74 if (time_ < effectStartTime_ && particleSpawner_ == NULL) 95 75 { 96 76 97 particleSpawner = new ParticleSpawner(getContext());98 particleSpawner ->setSource(effectPath_);99 particleSpawner ->setLoop(false);100 particleSpawner ->setLOD(LODParticle::Low);101 particleSpawner ->setLifetime(effectStartTime_);77 particleSpawner_ = new ParticleSpawner(getContext()); 78 particleSpawner_->setSource(effectPath_); 79 particleSpawner_->setLoop(false); 80 particleSpawner_->setLOD(LODParticle::Low); 81 particleSpawner_->setLifetime(effectStartTime_); 102 82 103 attach(particleSpawner );83 attach(particleSpawner_); 104 84 } 105 85 } -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformTimer.h
r10050 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 46 46 namespace orxonox 47 47 { 48 49 /**50 @brief51 This class manages the ball for @ref orxonox::Jump "Jump".52 53 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.54 55 @author56 Fabian 'x3n' Landau57 58 @ingroup Jump59 */60 48 class _JumpExport JumpPlatformTimer : public JumpPlatform 61 49 { … … 63 51 JumpPlatformTimer(Context* context); 64 52 virtual ~JumpPlatformTimer(); 65 66 53 virtual void tick(float dt); 67 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 68 69 55 virtual void setProperties(float time); 70 56 virtual bool isActive(void); … … 85 71 protected: 86 72 float time_; 87 ParticleSpawner* particleSpawner ;73 ParticleSpawner* particleSpawner_; 88 74 std::string effectPath_; 89 75 float effectStartTime_; -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformVMove.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPlatformVMove.cc 31 @brief Implementation of the JumpPlatform class.31 @brief This platform can move vertically. 32 32 */ 33 33 34 34 #include "JumpPlatformVMove.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 39 37 #include "gametypes/Gametype.h" 40 41 38 #include "JumpFigure.h" 42 43 39 #include "sound/WorldSound.h" 44 40 #include "core/XMLPort.h" … … 48 44 RegisterClass(JumpPlatformVMove); 49 45 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 46 JumpPlatformVMove::JumpPlatformVMove(Context* context) : JumpPlatform(context) 55 47 { … … 59 51 } 60 52 61 /**62 @brief63 Destructor.64 */65 53 JumpPlatformVMove::~JumpPlatformVMove() 66 54 { … … 68 56 } 69 57 70 //xml port for loading sounds71 58 void JumpPlatformVMove::XMLPort(Element& xmlelement, XMLPort::Mode mode) 72 59 { … … 74 61 } 75 62 76 /**77 @brief78 Is called every tick.79 Handles the movement of the ball and its interaction with the boundaries and bats.80 @param dt81 The time since the last tick.82 */83 63 void JumpPlatformVMove::tick(float dt) 84 64 { … … 86 66 87 67 // Get the current position, velocity and acceleration of the ball. 88 Vector3 position = this->getPosition();89 Vector3 velocity = this->getVelocity();68 Vector3 position = getPosition(); 69 Vector3 velocity = getVelocity(); 90 70 91 71 if ((position.z < lowerBoundary_ && velocity.z < 0) || (position.z > upperBoundary_ && velocity.z > 0)) 92 72 { 93 //orxout() << "refelected platformVMove at " << position.z << endl;94 73 velocity.z = -velocity.z; 95 74 } 96 75 97 76 // Set the position, velocity and acceleration of the ball, if they have changed. 98 if (velocity != this->getVelocity()) 99 this->setVelocity(velocity); 100 if (position != this->getPosition()) 101 this->setPosition(position); 77 if (velocity != getVelocity()) 78 { 79 setVelocity(velocity); 80 } 81 if (position != getPosition()) 82 { 83 setPosition(position); 84 } 102 85 } 103 86 … … 107 90 upperBoundary_ = upperBoundary; 108 91 109 this->setVelocity(Vector3(0,0,speed));92 setVelocity(Vector3(0,0,speed)); 110 93 111 94 } -
code/branches/pickupsFS14/src/modules/jump/JumpPlatformVMove.h
r10050 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 27 27 */ 28 28 29 /**30 @file JumpPlatformVMove.h31 @brief Declaration of the JumpPlatform class.32 @ingroup Jump33 */34 35 29 #ifndef _JumpPlatformVMove_H__ 36 30 #define _JumpPlatformVMove_H__ 37 31 38 32 #include "jump/JumpPrereqs.h" 39 40 33 #include "util/Math.h" 41 42 34 #include "worldentities/MovableEntity.h" 43 44 35 45 36 namespace orxonox 46 37 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 38 class _JumpExport JumpPlatformVMove : public JumpPlatform 60 39 { … … 62 41 JumpPlatformVMove(Context* context); 63 42 virtual ~JumpPlatformVMove(); 64 65 43 virtual void tick(float dt); 66 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 67 68 45 virtual void setProperties(float leftBoundary, float rightBoundary, float speed); 69 46 virtual void touchFigure(); -
code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Reto Grieder23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... -
code/branches/pickupsFS14/src/modules/jump/JumpProjectile.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpProjectile.cc 31 @brief Implementation of the JumpProjectile class.31 @brief projectiles are created by the gametype if the figure shoots. All projectiles check every tick, whether they hit an enemy. 32 32 */ 33 33 34 34 #include "JumpProjectile.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 37 #include "graphics/Model.h" 39 38 #include "gametypes/Gametype.h" 40 41 39 #include "JumpFigure.h" 42 43 40 #include "sound/WorldSound.h" 44 41 #include "core/XMLPort.h" … … 48 45 RegisterClass(JumpProjectile); 49 46 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 47 JumpProjectile::JumpProjectile(Context* context) : MovableEntity(context) 55 48 { … … 57 50 58 51 figure_ = 0; 59 60 registerVariables();61 62 52 setPosition(Vector3(0,0,0)); 63 53 setVelocity(Vector3(0,0,250.0)); … … 65 55 } 66 56 67 /**68 @brief69 Destructor.70 */71 57 JumpProjectile::~JumpProjectile() 72 58 { 73 /*if (this->isInitialized())74 {75 if (this->bDeleteBats_)76 delete this->figure_;77 59 78 delete[] this->batID_;79 }*/80 60 } 81 61 82 //xml port for loading sounds83 62 void JumpProjectile::XMLPort(Element& xmlelement, XMLPort::Mode mode) 84 63 { … … 86 65 } 87 66 88 /**89 @brief90 Register variables to synchronize over the network.91 */92 void JumpProjectile::registerVariables()93 {94 registerVariable( this->fieldWidth_ );95 registerVariable( this->fieldHeight_ );96 //registerVariable( this->batID_[1], VariableDirection::ToClient, new NetworkCallback<JumpProjectile>( this, &JumpProjectile::applyBats) );97 }98 99 /**100 @brief101 Is called every tick.102 Handles the movement of the ball and its interaction with the boundaries and bats.103 @param dt104 The time since the last tick.105 */106 67 void JumpProjectile::tick(float dt) 107 68 { … … 123 84 } 124 85 125 /**126 @brief127 Set the bats for the ball.128 @param bats129 An array (of size 2) of weak pointers, to be set as the new bats.130 */131 86 void JumpProjectile::setFigure(WeakPtr<JumpFigure> figure) 132 87 { -
code/branches/pickupsFS14/src/modules/jump/JumpProjectile.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 27 27 */ 28 28 29 /**30 @file JumpProjectile.h31 @brief Declaration of the JumpProjectile class.32 @ingroup Jump33 */34 35 29 #ifndef _JumpProjectile_H__ 36 30 #define _JumpProjectile_H__ 37 31 38 32 #include "jump/JumpPrereqs.h" 39 40 33 #include "util/Math.h" 41 42 34 #include "worldentities/MovableEntity.h" 43 35 … … 45 37 namespace orxonox 46 38 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 39 class _JumpExport JumpProjectile : public MovableEntity 60 40 { … … 76 56 { return Vector2(this->fieldWidth_, this->fieldHeight_); } 77 57 78 79 58 void setFigure(WeakPtr<JumpFigure> figure); 80 59 81 60 protected: 82 void registerVariables(); 83 84 float fieldWidth_; //!< The width of the playing field. 85 float fieldHeight_; //!< The height of the playing field. 86 WeakPtr<JumpFigure> figure_; //!< An array with the two bats. 61 float fieldWidth_; 62 float fieldHeight_; 63 WeakPtr<JumpFigure> figure_; 87 64 }; 88 65 } -
code/branches/pickupsFS14/src/modules/jump/JumpPropeller.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpPropeller.cc 31 @brief I mplementation of the JumpPropeller class.31 @brief If this propeller is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure starts flying until the fuel is reduced to zero. 32 32 */ 33 33 … … 48 48 RegisterClass(JumpPropeller); 49 49 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 50 JumpPropeller::JumpPropeller(Context* context) : JumpItem(context) 55 51 { … … 57 53 58 54 fuel_ = 3.0; 55 attachedToFigure_ = false; 59 56 60 57 setPosition(Vector3(0,0,0)); … … 64 61 } 65 62 66 /**67 @brief68 Destructor.69 */70 63 JumpPropeller::~JumpPropeller() 71 64 { … … 73 66 } 74 67 75 //xml port for loading sounds76 68 void JumpPropeller::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 69 { … … 79 71 } 80 72 81 /**82 @brief83 Is called every tick.84 Handles the movement of the ball and its interaction with the boundaries and bats.85 @param dt86 The time since the last tick.87 */88 73 void JumpPropeller::tick(float dt) 89 74 { -
code/branches/pickupsFS14/src/modules/jump/JumpPropeller.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpPropeller.h31 @brief Declaration of the JumpPropeller class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpPropeller_H__ … … 45 39 namespace orxonox 46 40 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 41 class _JumpExport JumpPropeller : public JumpItem 60 42 { -
code/branches/pickupsFS14/src/modules/jump/JumpRocket.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpRocket.cc 31 @brief I mplementation of the JumpRocket class.31 @brief If this rocket is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure starts flying fast until the fuel is reduced to zero. 32 32 */ 33 33 34 34 #include "JumpRocket.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 37 #include "graphics/Model.h" 39 38 #include "gametypes/Gametype.h" 40 41 39 #include "JumpFigure.h" 42 43 40 #include "sound/WorldSound.h" 44 41 #include "core/XMLPort.h" … … 48 45 RegisterClass(JumpRocket); 49 46 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 47 JumpRocket::JumpRocket(Context* context) : JumpItem(context) 55 48 { … … 57 50 58 51 fuel_ = 3.0; 52 attachedToFigure_ = false; 59 53 60 54 setPosition(Vector3(0,0,0)); … … 64 58 } 65 59 66 /**67 @brief68 Destructor.69 */70 60 JumpRocket::~JumpRocket() 71 61 { … … 73 63 } 74 64 75 //xml port for loading sounds76 65 void JumpRocket::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 66 { … … 79 68 } 80 69 81 /**82 @brief83 Is called every tick.84 Handles the movement of the ball and its interaction with the boundaries and bats.85 @param dt86 The time since the last tick.87 */88 70 void JumpRocket::tick(float dt) 89 71 { … … 116 98 117 99 attachedToFigure_ = figure_->StartRocket(this); 118 if (attachedToFigure_)119 {120 //Starte Feuer-Animation121 }122 100 } 123 101 } -
code/branches/pickupsFS14/src/modules/jump/JumpRocket.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 27 27 */ 28 28 29 /**30 @file JumpRocket.h31 @brief Declaration of the JumpRocket class.32 @ingroup Jump33 */34 35 29 #ifndef _JumpRocket_H__ 36 30 #define _JumpRocket_H__ 37 31 38 32 #include "jump/JumpPrereqs.h" 39 40 33 #include "util/Math.h" 41 42 34 #include "worldentities/MovableEntity.h" 43 44 35 45 36 namespace orxonox 46 37 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 38 class _JumpExport JumpRocket : public JumpItem 60 39 { -
code/branches/pickupsFS14/src/modules/jump/JumpScore.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpScore.cc 31 @brief Implementation of the JumpScore class.31 @brief HUD of thejump minigame. If showScore_ is set, it displays the score. If showMessages_ is set, it displays the game over message. 32 32 */ 33 33 34 34 #include "JumpScore.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/XMLPort.h" 38 37 #include "util/Convert.h" 39 40 38 #include "infos/PlayerInfo.h" 41 42 39 #include "Jump.h" 43 #include "sound/WorldSound.h" /////////////////////////////40 #include "sound/WorldSound.h" 44 41 45 42 namespace orxonox … … 47 44 RegisterClass(JumpScore); 48 45 49 /**50 @brief51 Constructor. Registers and initializes the object.52 */53 46 JumpScore::JumpScore(Context* context) : OverlayText(context) 54 47 { … … 60 53 } 61 54 62 /**63 @brief64 Destructor.65 */66 55 JumpScore::~JumpScore() 67 56 { … … 69 58 } 70 59 71 /**72 @brief73 Method to create a JumpScore through XML.74 */75 60 void JumpScore::XMLPort(Element& xmlelement, XMLPort::Mode mode) 76 61 { … … 82 67 } 83 68 84 /**85 @brief86 Is called each tick.87 Creates and sets the caption to be displayed by the JumpScore.88 @param dt89 The time that has elapsed since the last tick.90 */91 69 void JumpScore::tick(float dt) 92 70 { 93 71 SUPER(JumpScore, tick, dt); 94 72 95 // If the owner is set. The owner being a Jump game. 96 97 if (this->owner_ != NULL) 73 if (owner_ != NULL) 98 74 { 99 75 if (!owner_->hasEnded()) … … 120 96 } 121 97 122 /**123 @brief124 Is called when the owner changes.125 Sets the owner to NULL, if it is not a pointer to a Jump game.126 */127 98 void JumpScore::changedOwner() 128 99 { -
code/branches/pickupsFS14/src/modules/jump/JumpScore.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpScore.h31 @brief Declaration of the JumpScore class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpScore_H__ … … 44 38 namespace orxonox 45 39 { 46 47 /**48 @brief49 The JumpScore class displays the score for a game of @ref orxonox::Jump "Jump".50 51 @author52 Fabian 'x3n' Landau53 54 @ingroup Jump55 */56 40 class _JumpExport JumpScore : public OverlayText, public Tickable 57 41 { … … 60 44 virtual ~JumpScore(); 61 45 62 virtual void tick(float dt); //!< Creates and sets the caption to be displayed by the JumpScore.46 virtual void tick(float dt); 63 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 64 virtual void changedOwner(); //!< Is called when the owner changes.48 virtual void changedOwner(); 65 49 66 50 void setShowScore(const bool showScore) … … 83 67 84 68 private: 85 Jump* owner_; //!< The Jump game that owns this JumpScore.86 WeakPtr<PlayerInfo> player_; //!< Store information about left player permanently.69 Jump* owner_; 70 WeakPtr<PlayerInfo> player_; 87 71 WorldSound* scoreSound_; 88 72 bool showScore_; 89 73 bool showMessages_; 90 74 std::string gameOverText_; 91 92 75 }; 93 76 } -
code/branches/pickupsFS14/src/modules/jump/JumpShield.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpShield.cc 31 @brief I mplementation of the JumpShield class.31 @brief If this shield is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure is protected until the fuel is reduced to zero. 32 32 */ 33 33 … … 48 48 RegisterClass(JumpShield); 49 49 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 50 JumpShield::JumpShield(Context* context) : JumpItem(context) 55 51 { … … 57 53 58 54 fuel_ = 7.0; 55 attachedToFigure_ = false; 59 56 60 57 setPosition(Vector3(0,0,0)); … … 64 61 } 65 62 66 /**67 @brief68 Destructor.69 */70 63 JumpShield::~JumpShield() 71 64 { … … 73 66 } 74 67 75 //xml port for loading sounds76 68 void JumpShield::XMLPort(Element& xmlelement, XMLPort::Mode mode) 77 69 { … … 79 71 } 80 72 81 /**82 @brief83 Is called every tick.84 Handles the movement of the ball and its interaction with the boundaries and bats.85 @param dt86 The time since the last tick.87 */88 73 void JumpShield::tick(float dt) 89 74 { … … 116 101 117 102 attachedToFigure_ = figure_->StartShield(this); 118 if (attachedToFigure_)119 {120 //Starte Feuer-Animation121 }122 103 } 123 104 } -
code/branches/pickupsFS14/src/modules/jump/JumpShield.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpShield.h31 @brief Declaration of the JumpShield class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpShield_H__ … … 45 39 namespace orxonox 46 40 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 41 class _JumpExport JumpShield : public JumpItem 60 42 { -
code/branches/pickupsFS14/src/modules/jump/JumpSpring.cc
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 29 29 /** 30 30 @file JumpSpring.cc 31 @brief I mplementation of the JumpSpring class.31 @brief If this spring is touched by the figure, it jumps higher then from a platform. 32 32 */ 33 33 34 34 #include "JumpSpring.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/GameMode.h" 38 37 #include "graphics/Model.h" 39 38 #include "gametypes/Gametype.h" 40 41 39 #include "JumpFigure.h" 42 43 40 #include "sound/WorldSound.h" 44 41 #include "core/XMLPort.h" … … 48 45 RegisterClass(JumpSpring); 49 46 50 /**51 @brief52 Constructor. Registers and initializes the object.53 */54 47 JumpSpring::JumpSpring(Context* context) : JumpItem(context) 55 48 { … … 65 58 } 66 59 67 /**68 @brief69 Destructor.70 */71 60 JumpSpring::~JumpSpring() 72 61 { … … 74 63 } 75 64 76 //xml port for loading sounds77 65 void JumpSpring::XMLPort(Element& xmlelement, XMLPort::Mode mode) 78 66 { … … 80 68 } 81 69 82 /**83 @brief84 Is called every tick.85 Handles the movement of the ball and its interaction with the boundaries and bats.86 @param dt87 The time since the last tick.88 */89 70 void JumpSpring::tick(float dt) 90 71 { -
code/branches/pickupsFS14/src/modules/jump/JumpSpring.h
r10074 r10111 21 21 * 22 22 * Author: 23 * Fabi an 'x3n' Landau23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... 26 26 * 27 27 */ 28 29 /**30 @file JumpSpring.h31 @brief Declaration of the JumpSpring class.32 @ingroup Jump33 */34 28 35 29 #ifndef _JumpSpring_H__ … … 45 39 namespace orxonox 46 40 { 47 48 /**49 @brief50 This class manages the ball for @ref orxonox::Jump "Jump".51 52 It is responsible for both the movement of the ball in the x,z-plane as well as its interaction with the boundaries of the playing field (defined by the @ref orxonox::JumpCenterpoint "JumpCenterpoint") and the @ref orxonox::JumpFigure "JumpFigures". Or more precisely, it makes the ball bounce off then upper and lower delimiters of the playing field, it makes the ball bounce off the bats and also detects when a player scores and takes appropriate measures.53 54 @author55 Fabian 'x3n' Landau56 57 @ingroup Jump58 */59 41 class _JumpExport JumpSpring : public JumpItem 60 42 {
Note: See TracChangeset
for help on using the changeset viewer.