- Timestamp:
- 12/10/06 18:52:40 (5 years ago)
- Files:
-
- branches/soundtest/arc/io/sound.d (modified) (1 diff)
- branches/soundtest/classes/ship.d (modified) (11 diffs)
- branches/soundtest/derelict/opengl/glu.d (modified) (1 diff)
- branches/soundtest/run-build.bat (modified) (1 diff)
- branches/soundtest/space/handler.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/soundtest/arc/io/sound.d
r125 r127 125 125 126 126 float pitch = 1.0; 127 float radius = 256; // The radius of the Sound that plays.127 float radius = 50; // The radius of the Sound that plays. 128 128 float volume = 1.0; 129 129 float gain = 1.0; branches/soundtest/classes/ship.d
r125 r127 64 64 // sound info 65 65 Sound snd; 66 public: 67 bool isThrust = false; 68 bool prevThrust = false; 69 70 private: 66 71 67 72 // AI integers … … 465 470 short myAlpha = getAlpha(); 466 471 if( myAlpha < 255 ) setAlpha(myAlpha+1); 472 467 473 // handle FU_OBJECT stuff 474 468 475 super.handle_object(); 469 476 470 if (this is PlayerShip) 471 { 472 arc.io.sound.setListenerPosition(getX, getY); 473 snd.setPosition(getX, getY); 474 475 if (arc.io.input.keyHit(SDLK_UP)) 476 { 477 snd.play(); 478 snd.setPitch(1); 479 } 480 else if (!arc.io.input.keyDown(SDLK_UP)) 481 { 482 snd.stop(); 483 } 484 485 snd.process(); 486 } 477 487 478 488 479 // handle all of my items … … 598 589 if( straferMode == 1 ) thrust(ITEM_CLASS.STRAFER, 1); 599 590 else thrust(ITEM_CLASS.STRAFER, -1); 591 } 592 else{ 593 isThrust = false; 600 594 } 601 595 } … … 763 757 // handle space storm effects 764 758 effectShip(this); 759 760 // handle sound code 761 if (this is PlayerShip) 762 { 763 // set listener to location of playership 764 arc.io.sound.setListenerPosition(getX, getY); 765 } 766 767 // set sound position to position of ship 768 snd.setPosition(getX, getY); 769 770 if (isThrust == true && prevThrust == false) 771 { 772 snd.play(); 773 snd.setPitch(.5); 774 } 775 else if (isThrust == false) 776 { 777 snd.stop(); 778 } 779 780 snd.process(); 765 781 } 766 782 // return this ship's default action … … 841 857 } 842 858 float d_angle = angDest - getRotation(); 843 if ( (d_angle < 180 && d_angle >= 0) || (d_angle < -180.) ) thrust(ITEM_CLASS.TURNER, 1); 844 else thrust(ITEM_CLASS.TURNER, -1); 859 860 if ( (d_angle < 180 && d_angle >= 0) || (d_angle < -180.) ){ 861 thrust(ITEM_CLASS.TURNER, 1); 862 return angDist; 863 } else { 864 thrust(ITEM_CLASS.TURNER, -1); 865 return angDist; 866 } 867 868 isThrust = false; 845 869 return angDist; 846 870 } … … 855 879 thrust(ITEM_CLASS.ENGINE, -1); 856 880 return targetDistance; 881 }else{ 882 isThrust = false; 857 883 } 858 884 if( angDistance > 45 ) return targetDistance; … … 861 887 if( thrust(ITEM_CLASS.CRUISER, 1) == false ) { 862 888 thrust(ITEM_CLASS.ENGINE, 1); 889 }else{ 890 isThrust = false; 863 891 } 864 892 usingCruiser = true; … … 875 903 thrust(ITEM_CLASS.AFTERBURNER, 1); 876 904 return targetDistance; 905 }else{ 906 isThrust=false; 877 907 } 878 908 } 879 909 } 910 // THRUST=FALSE? 880 911 thrust(ITEM_CLASS.ENGINE, 1); 881 912 return targetDistance; … … 921 952 setFriction(true); 922 953 int angle_offset = 0; 954 923 955 bool success = false; 956 924 957 if( itemClassUsed == ITEM_CLASS.STRAFER ) angle_offset = 90; 925 958 items.reset(); … … 934 967 super.max_speed = items.data.getVars().maximum; 935 968 super.accelerate(amount, angle_offset, false, this); 969 936 970 if( getAlpha() > 200 && rand()%2==0) { 937 971 FU_PARTICLE newParticle; 938 972 switch(itemClassUsed) { 939 973 case ITEM_CLASS.ENGINE: 974 940 975 case ITEM_CLASS.STRAFER: 941 976 newParticle = new FU_PARTICLE(this,255,150,100); … … 951 986 } 952 987 } 953 else super.turn(amount); 988 else 989 { 990 super.turn(amount); 991 } 954 992 } 955 993 } 956 994 } 957 995 } 996 997 isThrust = success; 998 958 999 return success; 959 1000 } 1001 960 1002 int getStormProtection() { return stormProtection; } 961 1003 void maxUtils() { branches/soundtest/derelict/opengl/glu.d
r124 r127 285 285 // TYPES 286 286 //============================================================================== 287 struct GLUnurbs ;288 struct GLUquadric ;289 struct GLUtesselator ;287 struct GLUnurbs{} 288 struct GLUquadric{} 289 struct GLUtesselator{} 290 290 291 291 typedef GLUnurbs GLUnurbsObj; branches/soundtest/run-build.bat
r124 r127 1 bud FreeUniverse.d - Rn -full -cleanup -debug -g -v1 | more1 bud FreeUniverse.d -d -Rn -full -cleanup -debug -g -v1 | more 2 2 PAUSE 3 3 branches/soundtest/space/handler.d
r124 r127 40 40 } 41 41 if( PlayerShip.getArmor() > 0 ) { 42 43 PlayerShip.prevThrust = PlayerShip.isThrust; 44 42 45 if( arc.io.input.keyDown(SDLK_DOWN) ) { 43 46 PlayerShip.thrust(ITEM_CLASS.ENGINE,-1); 44 47 } else if( arc.io.input.keyDown(SDLK_UP) ) { 45 48 PlayerShip.thrust(ITEM_CLASS.ENGINE,1); 46 } 49 }else{ 50 PlayerShip.isThrust=false; 51 } 52 47 53 if( arc.io.input.keyDown(SDLK_RIGHT) ) { 48 54 PlayerShip.thrust(ITEM_CLASS.TURNER,1); … … 50 56 PlayerShip.thrust(ITEM_CLASS.TURNER,-1); 51 57 } 58 52 59 if( arc.io.input.keyDown(SDLK_SPACE) ) { 53 60 PlayerShip.thrust(ITEM_CLASS.AFTERBURNER,1);
