[Orxonox-commit 1389] r6107 - in code/branches/presentation2: . data/levels data/levels/includes data/particle src/modules/weapons/projectiles src/modules/weapons/weaponmodes src/orxonox src/orxonox/controllers src/orxonox/infos src/orxonox/weaponsystem src/orxonox/worldentities src/orxonox/worldentities/pawns
rgrieder at orxonox.net
rgrieder at orxonox.net
Fri Nov 20 17:20:12 CET 2009
Author: rgrieder
Date: 2009-11-20 17:20:11 +0100 (Fri, 20 Nov 2009)
New Revision: 6107
Added:
code/branches/presentation2/data/particle/explosion4.particle
code/branches/presentation2/data/particle/laser.particle
code/branches/presentation2/data/particle/load.particle
code/branches/presentation2/data/particle/particlecanon.particle
code/branches/presentation2/data/particle/rocketfire.particle
code/branches/presentation2/data/particle/smoke.particle
code/branches/presentation2/data/particle/tes3.particle
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h
code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.cc
code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.h
Modified:
code/branches/presentation2/
code/branches/presentation2/data/levels/empty_level.oxw
code/branches/presentation2/data/levels/includes/weaponsettings3.oxi
code/branches/presentation2/src/modules/weapons/projectiles/CMakeLists.txt
code/branches/presentation2/src/modules/weapons/weaponmodes/CMakeLists.txt
code/branches/presentation2/src/orxonox/OrxonoxPrereqs.h
code/branches/presentation2/src/orxonox/Scene.cc
code/branches/presentation2/src/orxonox/controllers/Controller.h
code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc
code/branches/presentation2/src/orxonox/infos/PlayerInfo.h
code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc
code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h
code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc
code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h
code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.cc
code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.h
Log:
Merged particles2 branch to presentation2.
Property changes on: code/branches/presentation2
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
+ /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/particles2:6050-6106
/code/branches/resource2:3372-5694
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
Modified: code/branches/presentation2/data/levels/empty_level.oxw
===================================================================
--- code/branches/presentation2/data/levels/empty_level.oxw 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/data/levels/empty_level.oxw 2009-11-20 16:20:11 UTC (rev 6107)
@@ -16,7 +16,22 @@
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
>
+
+<!--Rocket position="-10, 3.5,800" velocity="0,0,-100">
+ <attached>
+ <Model pitch=180 position="0,0,0" scale=1.5 mesh="rocket_test.mesh" >
+ <attached>
+ <ParticleEmitter pitch=0 roll=0 position="0,5,0" source="Orxonox/laser" lifetime=2.0 loop=1 startdelay=3.0/>
+ <ParticleEmitter pitch=-90 roll=0 position="0,-5,0" source="Orxonox/particlecanon" lifetime=2.0 loop=1 startdelay=3.0/>
+ <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/rocketfire" lifetime=2.0 loop=1 startdelay=3.0 />
+ <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/smoke" lifetime=2.0 loop=1 startdelay=3.0 />
+ </attached>
+ </Model>
+ </attached>
+ </Rocket-->
+
+
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
- <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshippirate />
+ <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
</Scene>
</Level>
Modified: code/branches/presentation2/data/levels/includes/weaponsettings3.oxi
===================================================================
--- code/branches/presentation2/data/levels/includes/weaponsettings3.oxi 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/data/levels/includes/weaponsettings3.oxi 2009-11-20 16:20:11 UTC (rev 6107)
@@ -1,17 +1,19 @@
<weaponslots>
<WeaponSlot position="-15.0,-1.5,0" />
<WeaponSlot position=" 15.0,-1.5,0" />
- <WeaponSlot position=" 0.0, 0.0,0" />
+ <WeaponSlot position=" 0, 0,0" />
</weaponslots>
<weaponsets>
<WeaponSet firemode=0 />
<WeaponSet firemode=1 />
+ <WeaponSet firemode=2 />
</weaponsets>
<weapons>
<WeaponPack>
<links>
<DefaultWeaponmodeLink firemode=0 weaponmode=0 />
<DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+ <DefaultWeaponmodeLink firemode=2 weaponmode=2 />
</links>
<Weapon>
<attached>
@@ -35,13 +37,16 @@
<HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.7, 1.5, -4.0" />
<LightningGun mode=1 muzzleoffset="0,0,0" />
</Weapon>
+ <Weapon>
+ <RocketFire mode=2 muzzleoffset="0,0,0" />
+ </Weapon>
</WeaponPack>
<WeaponPack>
<links>
<DefaultWeaponmodeLink firemode=1 weaponmode=0 />
</links>
- <Weapon>
- <!-- EnergyDrink mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" / -->
- </Weapon>
+ <!--Weapon>
+ <EnergyDrink mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" />
+ </Weapon-->
</WeaponPack>
</weapons>
Copied: code/branches/presentation2/data/particle/explosion4.particle (from rev 6106, code/branches/particles2/data/particle/explosion4.particle)
===================================================================
--- code/branches/presentation2/data/particle/explosion4.particle (rev 0)
+++ code/branches/presentation2/data/particle/explosion4.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,71 @@
+particle_system Orxonox/explosion4
+{
+ quota 1000
+ material PE/explosion3
+ particle_width 10
+ particle_height 10
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type vertex
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 180
+ colour 0 0 0 0
+ colour_range_start 0 0 0 0
+ colour_range_end 0 0 0 0
+ direction 0 1 0
+ emission_rate 2000
+ position 0 0 0
+ velocity 15
+ velocity_min 15
+ velocity_max 15
+ time_to_live 1
+ time_to_live_min 1
+ time_to_live_max 1.4
+ duration 0.05
+ duration_min 0.05
+ duration_max 0.05
+ repeat_delay 5
+ repeat_delay_min 5
+ repeat_delay_max 5
+ }
+
+ affector Scaler
+ {
+ rate 20
+ }
+
+ affector Rotator
+ {
+ rotation_speed_range_start 0
+ rotation_speed_range_end -7.2
+ rotation_range_start 0
+ rotation_range_end 360
+ }
+
+ affector ColourInterpolator
+ {
+ colour0 0.5 0.5 0.5 0
+ time0 0
+ colour1 0.4 0.4 0.4 0
+ time1 0.2
+ colour2 0.2 0.2 0.2 0
+ time2 0.5
+ colour3 0 0 0 0
+ time3 1
+ colour4 0.5 0.5 0.5 0
+ time4 1
+ colour5 0.5 0.5 0.5 0
+ time5 1
+ }
+}
Copied: code/branches/presentation2/data/particle/laser.particle (from rev 6106, code/branches/particles2/data/particle/laser.particle)
===================================================================
--- code/branches/presentation2/data/particle/laser.particle (rev 0)
+++ code/branches/presentation2/data/particle/laser.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,47 @@
+particle_system Orxonox/laser
+{
+ quota 200
+ material PE/point_lensflare
+ particle_width 7.08
+ particle_height 7.08
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 180
+ colour 0 1 0.275862 1
+ colour_range_start 0 1 0.275862 1
+ colour_range_end 0 1 0.275862 1
+ direction 0 1 0
+ emission_rate 80
+ position 0 0 0
+ velocity 11
+ velocity_min 11
+ velocity_max 11
+ time_to_live 0.7
+ time_to_live_min 0.7
+ time_to_live_max 1
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 1.6
+ repeat_delay_min 1.6
+ repeat_delay_max 1.6
+ }
+
+ affector Scaler
+ {
+ rate -8.8
+ }
+}
Copied: code/branches/presentation2/data/particle/load.particle (from rev 6106, code/branches/particles2/data/particle/load.particle)
===================================================================
--- code/branches/presentation2/data/particle/load.particle (rev 0)
+++ code/branches/presentation2/data/particle/load.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,141 @@
+particle_system Orxonox/load
+{
+ quota 50
+ material PE/ringflare
+ particle_width 1
+ particle_height 1.3
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 5
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 1 1 1
+ direction 0 1 0
+ emission_rate 4
+ position 0 -5 0
+ velocity 5
+ velocity_min 5
+ velocity_max 5
+ time_to_live 1
+ time_to_live_min 1
+ time_to_live_max 1
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ }
+
+ emitter Point
+ {
+ angle 5
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 1 1 1
+ direction 1 0 0
+ emission_rate 3
+ position -5 0 0
+ velocity 5
+ velocity_min 5
+ velocity_max 5
+ time_to_live 1
+ time_to_live_min 1
+ time_to_live_max 1
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ }
+
+ emitter Point
+ {
+ angle 5
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 1 1 1
+ direction -1 0 0
+ emission_rate 3
+ position 5 0 0
+ velocity 5
+ velocity_min 5
+ velocity_max 5
+ time_to_live 1
+ time_to_live_min 1
+ time_to_live_max 1
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ }
+
+ emitter Point
+ {
+ angle 5
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 1 1 1
+ direction 0 -1 0
+ emission_rate 4
+ position 0 5 0
+ velocity 5
+ velocity_min 5
+ velocity_max 5
+ time_to_live 1
+ time_to_live_min 1
+ time_to_live_max 1
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ }
+
+ affector Scaler
+ {
+ rate 14.4
+ }
+
+ affector ColourInterpolator
+ {
+ colour0 1 1 0.5 0
+ time0 1
+ colour1 0.5 0.5 0.5 0
+ time1 1
+ colour2 0.5 0.5 0.5 0
+ time2 1
+ colour3 0.5 0.5 0.5 0
+ time3 1
+ colour4 0.5 0.5 0.5 0
+ time4 1
+ colour5 0.5 0.5 0.5 0
+ time5 1
+ }
+
+ affector DirectionRandomiser
+ {
+ randomness 15
+ scope 0.8
+ keep_velocity false
+ }
+
+
+}
Copied: code/branches/presentation2/data/particle/particlecanon.particle (from rev 6106, code/branches/particles2/data/particle/particlecanon.particle)
===================================================================
--- code/branches/presentation2/data/particle/particlecanon.particle (rev 0)
+++ code/branches/presentation2/data/particle/particlecanon.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,43 @@
+particle_system Orxonox/particlecanon
+{
+ quota 1000
+ material PE/point_lensflare
+ particle_width 6
+ particle_height 6
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 1
+ colour 0.965517 0.544828 0 1
+ colour_range_start 0.965517 0.544828 0 1
+ colour_range_end 0.965517 0.544828 0 1
+ direction 0 1 0
+ emission_rate 1220
+ position 0 0 0
+ velocity 300
+ velocity_min 300
+ velocity_max 300
+ time_to_live 0.05
+ time_to_live_min 0.05
+ time_to_live_max 0.05
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ }
+
+}
Copied: code/branches/presentation2/data/particle/rocketfire.particle (from rev 6106, code/branches/particles2/data/particle/rocketfire.particle)
===================================================================
--- code/branches/presentation2/data/particle/rocketfire.particle (rev 0)
+++ code/branches/presentation2/data/particle/rocketfire.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,50 @@
+particle_system Orxonox/rocketfire
+{
+ quota 5000
+ material PE/explosion
+ particle_width 9
+ particle_height 5
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Ellipsoid
+ {
+ angle 2
+ colour 1 0.682759 1 1
+ colour_range_start 1 0.682759 1 1
+ colour_range_end 1 0.682759 1 1
+ direction 0 1 0
+ emission_rate 600
+ position 0 0 0
+ velocity 10
+ velocity_min 10
+ velocity_max 48
+ time_to_live 0.3
+ time_to_live_min 0.3
+ time_to_live_max 0.5
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ width 1.5
+ height 1.5
+ depth 0
+ }
+
+ affector Scaler
+ {
+ rate -13.2
+ }
+}
Copied: code/branches/presentation2/data/particle/smoke.particle (from rev 6106, code/branches/particles2/data/particle/smoke.particle)
===================================================================
--- code/branches/presentation2/data/particle/smoke.particle (rev 0)
+++ code/branches/presentation2/data/particle/smoke.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,45 @@
+particle_system Orxonox/smoke
+{
+ quota 300
+ material PE/explosion
+ particle_width 6.94
+ particle_height 7.93
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Ellipsoid
+ {
+ angle 13
+ colour 0.156897 0.326207 1 1
+ colour_range_start 0.156897 0.326207 1 1
+ colour_range_end 0.156897 0.326207 1 1
+ direction 0 1 0
+ emission_rate 65
+ position 0 0 0
+ velocity 25
+ velocity_min 25
+ velocity_max 25
+ time_to_live 2.2
+ time_to_live_min 2.2
+ time_to_live_max 2.2
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ width 3
+ height 3
+ depth 0
+ }
+}
Copied: code/branches/presentation2/data/particle/tes3.particle (from rev 6106, code/branches/particles2/data/particle/tes3.particle)
===================================================================
--- code/branches/presentation2/data/particle/tes3.particle (rev 0)
+++ code/branches/presentation2/data/particle/tes3.particle 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,59 @@
+particle_system Orxonox/tes3
+{
+ quota 500
+ material PE/lensflare
+ particle_width 10
+ particle_height 10
+ cull_each true
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type perpendicular_self
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Cylinder
+ {
+ angle 180
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 1 1 1
+ direction 0 -1 0
+ emission_rate 100
+ position 0 100 0
+ velocity 26
+ velocity_min 26
+ velocity_max 26
+ time_to_live 9.6
+ time_to_live_min 9.6
+ time_to_live_max 9.6
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ width 200
+ height 200
+ depth 1
+ }
+
+ affector DeflectorPlane
+ {
+ plane_point 0 0 0
+ plane_normal 0 1 0
+ bounce 2
+ }
+
+ affector DirectionRandomiser
+ {
+ randomness 7
+ scope 1
+ keep_velocity true
+ }
+}
Modified: code/branches/presentation2/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/branches/presentation2/src/modules/weapons/projectiles/CMakeLists.txt 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/modules/weapons/projectiles/CMakeLists.txt 2009-11-20 16:20:11 UTC (rev 6107)
@@ -3,4 +3,5 @@
ParticleProjectile.cc
Projectile.cc
LightningGunProjectile.cc
+ Rocket.cc
)
Copied: code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc (from rev 6106, code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc)
===================================================================
--- code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc (rev 0)
+++ code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,256 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Rocket.h"
+
+#include "core/XMLPort.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+#include "worldentities/pawns/Pawn.h"
+#include "graphics/ParticleSpawner.h"
+#include "graphics/Model.h"
+#include "objects/collisionshapes/ConeCollisionShape.h"
+#include "infos/PlayerInfo.h"
+#include "controllers/Controller.h"
+#include "worldentities/CameraPosition.h"
+
+namespace orxonox
+{
+ CreateFactory(Rocket);
+ // create the factory for the Rocket
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ */
+ Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
+ {
+ RegisterObject(Rocket);// - register the Rocket class to the core
+
+ this->localAngularVelocity_ = 0;
+
+ if (GameMode::isMaster())
+ {
+ this->setCollisionType(WorldEntity::Kinematic);
+ this->setVelocity(0,0,-100);
+ this->lifetime_ = 100;
+ this->bDestroy_ = false;
+
+ this->model_ = new Model(this);
+ this->model_->setMeshSource("rocket.mesh");
+ this->attach(this->model_);
+ ParticleSpawner* fire = new ParticleSpawner(this);
+ this->attach(fire);
+ fire->setOrientation(this->getOrientation());
+ fire->setSource("Orxonox/rocketfire");
+
+ this->enableCollisionCallback();
+ this->setCollisionResponse(false);
+ this->setCollisionType(Kinematic);
+
+ this->collisionShape_ = new ConeCollisionShape(this);
+ this->collisionShape_->setRadius(3);
+ this->collisionShape_->setHeight(500);
+ this->attachCollisionShape(this->collisionShape_);
+
+ this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this)));
+
+
+ }
+
+ this->camPosition_ = new CameraPosition(this);
+ this->camPosition_->setPosition(0,10,40);
+ this->camPosition_->setSyncMode(0x0);
+ this->attach( this->camPosition_ );
+ this->addCameraPosition( this->camPosition_ );
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ Rocket::~Rocket()
+ {
+ if(this->isInitialized())
+ {
+
+ if (GameMode::isMaster() && this->player_.get())
+ {
+ this->model_->destroy();
+ this->collisionShape_->destroy();
+ this->player_->stopTemporaryControl();
+ }
+ this->camPosition_->destroy();
+ }
+ }
+
+ /**
+ @brief
+ Method for creating a Rocket through XML.
+ */
+ void Rocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ // this calls the XMLPort function of the parent class
+ SUPER(Rocket, XMLPort, xmlelement, mode);
+ }
+
+ void Rocket::setOwner(Pawn* owner)
+ {
+ this->owner_ = owner;
+ this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
+ this->player_ = this->owner_->getPlayer();
+ this->owner_->getPlayer()->startTemporaryControl(this);
+ }
+
+ /**
+ @brief
+ Defines which actions the Rocket has to take in each tick.
+ @param dt
+ The length of the tick.
+ */
+ void Rocket::tick(float dt)
+ {
+ SUPER(Rocket, tick, dt);
+
+ if( this->hasLocalController() )
+ {
+ this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
+ this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
+ this->localAngularVelocity_ = 0;
+
+ if( this->bDestroy_ )
+ this->destroy();
+ }
+ }
+
+ bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ {
+ if (!this->bDestroy_ && GameMode::isMaster())
+ {
+ if (otherObject == this->owner_)
+ return false;
+
+ this->bDestroy_ = true;
+
+ if (this->owner_)
+ {
+ {
+ ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+ effect->setPosition(this->getPosition());
+ effect->setOrientation(this->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/explosion4");
+ effect->setLifetime(2.0f);
+ }
+
+ {
+ ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+ effect->setPosition(this->getPosition());
+ effect->setOrientation(this->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/smoke4");
+ effect->setLifetime(3.0f);
+ }
+ }
+
+ float dmg = this->damage_;
+ if (this->owner_)
+ dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
+
+ Pawn* victim = orxonox_cast<Pawn*>(otherObject);
+ if (victim)
+ victim->damage(dmg, this->owner_);
+// this->destroy();
+ }
+ return false;
+ }
+
+ void Rocket::destroyObject()
+ {
+ if (GameMode::isMaster())
+ this->destroy();
+ }
+
+ void Rocket::fired(unsigned int firemode)
+ {
+ if (this->owner_)
+ {
+ {
+ ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+ effect->setPosition(this->getPosition());
+ effect->setOrientation(this->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/explosion4");
+ effect->setLifetime(2.0f);
+ }
+
+ {
+ ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+ effect->setPosition(this->getPosition());
+ effect->setOrientation(this->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/smoke4");
+ effect->setLifetime(3.0f);
+ }
+ this->destroy();
+ }
+ }
+
+ /**
+ @brief
+ Rotates the Rocket around the y-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void Rocket::rotateYaw(const Vector2& value)
+ {
+ this->localAngularVelocity_.y += value.x;
+ }
+
+ /**
+ @brief
+ Rotates the Rocket around the x-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void Rocket::rotatePitch(const Vector2& value)
+ {
+ this->localAngularVelocity_.x += value.x;
+ }
+
+ /**
+ @brief
+ Rotates the Rocket around the z-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void Rocket::rotateRoll(const Vector2& value)
+ {
+ this->localAngularVelocity_.z += value.x;
+ }
+
+}
Copied: code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h (from rev 6106, code/branches/particles2/src/modules/weapons/projectiles/Rocket.h)
===================================================================
--- code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h (rev 0)
+++ code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,131 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Rocket_H__
+#define _Rocket_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+ class ConeCollisionShape;
+
+ /**
+ @brief
+ Rocket, that is made to move upon a specified pattern.
+ This class was constructed for the PPS tutorial.
+ @author
+ Oli Scheuss
+ */
+ class _WeaponsExport Rocket : public ControllableEntity
+ {
+ public:
+ Rocket(BaseObject* creator);
+ virtual ~Rocket();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.
+ virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
+
+ virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ void destroyObject();
+
+ virtual void moveFrontBack(const Vector2& value){}
+ virtual void moveRightLeft(const Vector2& value){}
+ virtual void moveUpDown(const Vector2& value){}
+
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotatePitch(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+
+ /**
+ @brief Moves the Rocket in the Front/Back-direction by the specifed amount.
+ @param value The amount by which the Rocket is to be moved.
+ */
+ inline void moveFrontBack(float value)
+ { this->moveFrontBack(Vector2(value, 0)); }
+ /**
+ @brief Moves the Rocket in the Right/Left-direction by the specifed amount.
+ @param value The amount by which the Rocket is to be moved.
+ */
+ inline void moveRightLeft(float value)
+ { this->moveRightLeft(Vector2(value, 0)); }
+ /**
+ @brief Moves the Rocket in the Up/Down-direction by the specifed amount.
+ @param value The amount by which the Rocket is to be moved.
+ */
+ inline void moveUpDown(float value)
+ { this->moveUpDown(Vector2(value, 0)); }
+
+ /**
+ @brief Rotates the Rocket around the y-axis by the specifed amount.
+ @param value The amount by which the Rocket is to be rotated.
+ */
+ inline void rotateYaw(float value)
+ { this->rotateYaw(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Rocket around the x-axis by the specifed amount.
+ @param value The amount by which the Rocket is to be rotated.
+ */
+ inline void rotatePitch(float value)
+ { this->rotatePitch(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Rocket around the z-axis by the specifed amount.
+ @param value The amount by which the Rocket is to be rotated.
+ */
+ inline void rotateRoll(float value)
+ { this->rotateRoll(Vector2(value, 0)); }
+
+ void setOwner(Pawn* owner);
+ inline Pawn* getOwner() const
+ { return this->owner_; }
+
+ inline void setDamage(float damage)
+ { this->damage_ = damage; }
+ inline float getDamage() const
+ { return this->damage_; }
+ virtual void fired(unsigned int firemode);
+
+ private:
+ WeakPtr<Pawn> owner_;
+ Vector3 localAngularVelocity_;
+ float damage_;
+ bool bDestroy_;
+ ControllableEntity* originalControllableEntity_;
+
+ Model* model_;
+ CameraPosition* camPosition_;
+ ConeCollisionShape* collisionShape_;
+ WeakPtr<PlayerInfo> player_;
+ Timer destroyTimer_;
+ float lifetime_;
+ };
+
+}
+
+#endif /* _Rocket_H__ */
Modified: code/branches/presentation2/src/modules/weapons/weaponmodes/CMakeLists.txt
===================================================================
--- code/branches/presentation2/src/modules/weapons/weaponmodes/CMakeLists.txt 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/modules/weapons/weaponmodes/CMakeLists.txt 2009-11-20 16:20:11 UTC (rev 6107)
@@ -4,4 +4,5 @@
LaserFire.cc
HsW01.cc
LightningGun.cc
+ RocketFire.cc
)
Copied: code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.cc (from rev 6106, code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.cc)
===================================================================
--- code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.cc (rev 0)
+++ code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,67 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "RocketFire.h"
+
+#include "util/Math.h"
+#include "core/CoreIncludes.h"
+#include "weapons/projectiles/Rocket.h"
+
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(RocketFire);
+
+ RocketFire::RocketFire(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(RocketFire);
+
+ this->reloadTime_ = 0.20;
+ this->bParallelReload_ = false;
+ this->damage_ = 100;
+ this->speed_ = 500;
+
+ this->setMunitionName("RocketMunition");
+ }
+
+ void RocketFire::fire()
+ {
+ Rocket* rocket = new Rocket(this);
+
+ rocket->setOrientation(this->getMuzzleOrientation());
+ rocket->setPosition(this->getMuzzlePosition());
+ rocket->setVelocity(this->getMuzzleDirection() * this->speed_);
+ rocket->scale(2);
+
+ rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ rocket->setDamage(this->getDamage());
+ }
+}
Copied: code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.h (from rev 6106, code/branches/particles2/src/modules/weapons/weaponmodes/RocketFire.h)
===================================================================
--- code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.h (rev 0)
+++ code/branches/presentation2/src/modules/weapons/weaponmodes/RocketFire.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -0,0 +1,50 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oliver Scheuss
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _RocketFire_H__
+#define _RocketFire_H__
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+ class _WeaponsExport RocketFire : public WeaponMode
+ {
+ public:
+ RocketFire(BaseObject* creator);
+ virtual ~RocketFire() {}
+
+ virtual void fire();
+
+ private:
+ float speed_;
+ };
+}
+
+#endif /* _RocketFire_H__ */
Modified: code/branches/presentation2/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/presentation2/src/orxonox/OrxonoxPrereqs.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/OrxonoxPrereqs.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -175,6 +175,7 @@
class StaticEntity;
class TeamSpawnPoint;
class WorldEntity;
+ class Rocket;
// worldentities, pawns
class Destroyer;
class Pawn;
Modified: code/branches/presentation2/src/orxonox/Scene.cc
===================================================================
--- code/branches/presentation2/src/orxonox/Scene.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/Scene.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -333,10 +333,8 @@
int index0, const btCollisionObject* colObj1, int partId1, int index1)
{
// get the WorldEntity pointers
- WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
- assert(orxonox_cast<WorldEntity*>(object0));
- WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
- assert(orxonox_cast<WorldEntity*>(object1));
+ SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
+ SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
// false means that bullet will assume we didn't modify the contact
bool modified = false;
Modified: code/branches/presentation2/src/orxonox/controllers/Controller.h
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/Controller.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/controllers/Controller.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -36,6 +36,10 @@
{
class _OrxonoxExport Controller : public BaseObject
{
+ // set friend classes to access setControllableEntity
+ friend class PlayerInfo;
+ friend class ControllableEntity;
+
public:
Controller(BaseObject* creator);
virtual ~Controller();
@@ -45,6 +49,12 @@
inline PlayerInfo* getPlayer() const
{ return this->player_; }
+ inline ControllableEntity* getControllableEntity() const
+ { return this->controllableEntity_; }
+ virtual void changedControllableEntity() {}
+
+ protected:
+ // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do)
inline void setControllableEntity(ControllableEntity* entity)
{
if (entity != this->controllableEntity_)
@@ -53,11 +63,7 @@
this->changedControllableEntity();
}
}
- inline ControllableEntity* getControllableEntity() const
- { return this->controllableEntity_; }
- virtual void changedControllableEntity() {}
- protected:
PlayerInfo* player_;
ControllableEntity* controllableEntity_;
};
Modified: code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -49,7 +49,8 @@
this->bSetUnreadyAfterSpawn_ = true;
this->controller_ = 0;
this->controllableEntity_ = 0;
- this->controllableEntityID_ = CLIENTID_UNKNOWN;
+ this->controllableEntityID_ = OBJECTID_UNKNOWN;
+ this->oldControllableEntity_ = 0;
this->gtinfo_ = 0;
this->gtinfoID_ = OBJECTID_UNKNOWN;
@@ -79,7 +80,6 @@
{
registerVariable(this->name_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
registerVariable(this->controllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
- registerVariable(this->bReadyToSpawn_, VariableDirection::ToServer);
registerVariable(this->gtinfoID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID));
}
@@ -147,6 +147,8 @@
if (!entity || entity == this->controllableEntity_)
return;
+ if (this->oldControllableEntity_)
+ this->stopTemporaryControl();
if (this->controllableEntity_)
this->stopControl();
@@ -162,9 +164,31 @@
this->changedControllableEntity();
}
+
+ void PlayerInfo::startTemporaryControl(ControllableEntity* entity)
+ {
+ if (!entity)
+ return;
+
+// assert( this->temporaryControllableEntity_==0 );
+ this->oldControllableEntity_ = this->controllableEntity_;
+ this->controllableEntity_ = entity;
+ this->controllableEntityID_ = entity->getObjectID();
+
+ entity->setPlayer(this);
+
+ if (this->controller_)
+ this->controller_->setControllableEntity(entity);
+
+ this->changedControllableEntity();
+ }
+
void PlayerInfo::stopControl()
{
+ if ( this->oldControllableEntity_ )
+ this->stopTemporaryControl();
+
ControllableEntity* entity = this->controllableEntity_;
if (!entity)
@@ -176,11 +200,32 @@
if (this->controller_)
this->controller_->setControllableEntity(0);
- entity->removePlayer();
+ if ( GameMode::isMaster() )
+ entity->removePlayer();
this->changedControllableEntity();
}
+
+ void PlayerInfo::stopTemporaryControl()
+ {
+ ControllableEntity* entity = this->controllableEntity_;
+ if (!entity || !this->oldControllableEntity_)
+ return;
+
+ this->controllableEntity_ = this->oldControllableEntity_;
+ this->controllableEntityID_ = this->controllableEntity_->getObjectID();
+ this->oldControllableEntity_ = 0;
+
+ if ( this->controllableEntity_ && this->controller_)
+ this->controller_->setControllableEntity(this->controllableEntity_);
+
+ if ( GameMode::isMaster() )
+ entity->removePlayer();
+
+ this->changedControllableEntity();
+ }
+
void PlayerInfo::networkcallback_changedcontrollableentityID()
{
if (this->controllableEntityID_ != OBJECTID_UNKNOWN)
@@ -195,6 +240,7 @@
}
}
+
void PlayerInfo::networkcallback_changedgtinfoID()
{
if (this->gtinfoID_ != OBJECTID_UNKNOWN)
Modified: code/branches/presentation2/src/orxonox/infos/PlayerInfo.h
===================================================================
--- code/branches/presentation2/src/orxonox/infos/PlayerInfo.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/infos/PlayerInfo.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -68,6 +68,8 @@
void startControl(ControllableEntity* entity);
void stopControl();
+ void startTemporaryControl(ControllableEntity* entity);
+ void stopTemporaryControl();
inline ControllableEntity* getControllableEntity() const
{ return this->controllableEntity_; }
@@ -95,6 +97,7 @@
bool bReadyToSpawn_;
Controller* controller_;
ControllableEntity* controllableEntity_;
+ ControllableEntity* oldControllableEntity_;
unsigned int controllableEntityID_;
const GametypeInfo* gtinfo_;
Modified: code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc
===================================================================
--- code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -48,9 +48,10 @@
WeaponPack::~WeaponPack()
{
- if (this->isInitialized() && this->weaponSystem_)
+ if (this->isInitialized())
{
- this->weaponSystem_->removeWeaponPack(this);
+ if( this->weaponSystem_ )
+ this->weaponSystem_->removeWeaponPack(this);
while (!this->weapons_.empty())
(*this->weapons_.begin())->destroy();
@@ -70,13 +71,13 @@
void WeaponPack::fire(unsigned int weaponmode)
{
- for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
(*it)->fire(weaponmode);
}
void WeaponPack::reload()
{
- for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
(*it)->reload();
}
@@ -85,7 +86,7 @@
if (!weapon)
return;
- this->weapons_.insert(weapon);
+ this->weapons_.push_back(weapon);
weapon->setWeaponPack(this);
}
@@ -94,7 +95,9 @@
if (!weapon)
return;
- this->weapons_.erase(weapon);
+ std::vector<Weapon*>::iterator it = std::find(this->weapons_.begin(), this->weapons_.end(), weapon);
+ assert(it != this->weapons_.end());
+ this->weapons_.erase(it);
weapon->setWeaponPack(0);
}
@@ -102,7 +105,7 @@
{
unsigned int i = 0;
- for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
{
if (i == index)
return (*it);
@@ -141,7 +144,7 @@
void WeaponPack::notifyWeapons()
{
- for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
(*it)->setWeaponPack(this);
}
}
Modified: code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h
===================================================================
--- code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -68,7 +68,7 @@
private:
void notifyWeapons();
- std::set<Weapon *> weapons_;
+ std::vector<Weapon *> weapons_;
std::set<DefaultWeaponmodeLink *> links_;
WeaponSystem * weaponSystem_;
};
Modified: code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -201,7 +201,7 @@
it->second->setWeaponmodeLink(wPack, weaponmode);
}
- this->weaponPacks_.insert(wPack);
+ this->weaponPacks_.push_back(wPack);
wPack->setWeaponSystem(this);
return true;
@@ -220,13 +220,15 @@
it->second->removeWeaponmodeLink(wPack);
// Remove the WeaponPack from the WeaponSystem
- this->weaponPacks_.erase(wPack);
+ std::vector<WeaponPack*>::iterator it = std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(), wPack);
+ assert(it !=this->weaponPacks_.end());
+ this->weaponPacks_.erase(it);
}
WeaponPack * WeaponSystem::getWeaponPack(unsigned int index) const
{
unsigned int i = 0;
- for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
+ for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
{
++i;
if (i > index)
@@ -257,7 +259,7 @@
return;
// Check if the WeaponPack belongs to this WeaponSystem
- std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
+ std::vector<WeaponPack *>::iterator it1 = std::find( this->weaponPacks_.begin(), this->weaponPacks_.end(), wPack );
if (it1 == this->weaponPacks_.end())
return;
Modified: code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h
===================================================================
--- code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -91,7 +91,7 @@
private:
std::map<unsigned int, WeaponSet *> weaponSets_;
std::vector<WeaponSlot *> weaponSlots_;
- std::set<WeaponPack *> weaponPacks_;
+ std::vector<WeaponPack *> weaponPacks_;
std::map<Identifier *, Munition *> munitions_;
Pawn * pawn_;
};
Modified: code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -35,6 +35,7 @@
#include "core/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
#include "Scene.h"
#include "infos/PlayerInfo.h"
@@ -47,6 +48,8 @@
{
CreateFactory(ControllableEntity);
+ registerMemberNetworkFunction( ControllableEntity, fire );
+
ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
{
RegisterObject(ControllableEntity);
@@ -216,6 +219,18 @@
if (this->bMouseLook_)
this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
}
+
+ void ControllableEntity::fire(unsigned int firemode)
+ {
+ if(GameMode::isMaster())
+ {
+ this->fired(firemode);
+ }
+ else
+ {
+ callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
+ }
+ }
void ControllableEntity::setPlayer(PlayerInfo* player)
{
Modified: code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -83,7 +83,8 @@
inline void rotateRoll(float value)
{ this->rotateRoll(Vector2(value, 0)); }
- virtual void fire(unsigned int firemode) {}
+ void fire(unsigned int firemode);
+ virtual void fired(unsigned int firemode) {}
virtual void reload() {}
virtual void boost() {}
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -51,8 +51,6 @@
{
CreateFactory(Pawn);
- registerMemberNetworkFunction( Pawn, doFire );
-
Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
{
RegisterObject(Pawn);
@@ -109,7 +107,7 @@
XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
- XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
+ XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
}
void Pawn::registerVariables()
@@ -262,26 +260,12 @@
}
}
- void Pawn::fire(unsigned int firemode)
+ void Pawn::fired(unsigned int firemode)
{
- this->doFire(firemode);
+ if (this->weaponSystem_)
+ this->weaponSystem_->fire(firemode);
}
- void Pawn::doFire(uint8_t firemode)
- {
- if(GameMode::isMaster())
- {
- if (this->weaponSystem_)
- this->weaponSystem_->fire(firemode);
- }
- else
- {
- callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, firemode);
- if (this->weaponSystem_)
- this->weaponSystem_->fire(firemode);
- }
- }
-
void Pawn::reload()
{
this->bReload_ = true;
@@ -340,6 +324,13 @@
this->weaponSystem_->addWeaponPack(wPack);
}
+ void Pawn::addWeaponPackXML(WeaponPack * wPack)
+ {
+ if (this->weaponSystem_)
+ if (!this->weaponSystem_->addWeaponPack(wPack))
+ wPack->destroy();
+ }
+
WeaponPack * Pawn::getWeaponPack(unsigned int index) const
{
if (this->weaponSystem_)
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -78,9 +78,8 @@
virtual void hit(Pawn* originator, const Vector3& force, float damage);
virtual void kill();
- virtual void fire(unsigned int firemode);
+ virtual void fired(unsigned int firemode);
virtual void reload();
- virtual void doFire(uint8_t firemode);
virtual void postSpawn();
void addWeaponSlot(WeaponSlot * wSlot);
@@ -88,6 +87,7 @@
void addWeaponSet(WeaponSet * wSet);
WeaponSet * getWeaponSet(unsigned int index) const;
void addWeaponPack(WeaponPack * wPack);
+ void addWeaponPackXML(WeaponPack * wPack);
WeaponPack * getWeaponPack(unsigned int index) const;
inline const WorldEntity* getWorldEntity() const
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.cc 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.cc 2009-11-20 16:20:11 UTC (rev 6107)
@@ -188,7 +188,7 @@
ControllableEntity::rotateRoll(value);
}
- void Spectator::fire(unsigned int firemode)
+ void Spectator::fired(unsigned int firemode)
{
if (this->getPlayer())
this->getPlayer()->setReadyToSpawn(true);
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.h
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.h 2009-11-20 16:13:48 UTC (rev 6106)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/Spectator.h 2009-11-20 16:20:11 UTC (rev 6107)
@@ -54,7 +54,7 @@
virtual void rotatePitch(const Vector2& value);
virtual void rotateRoll(const Vector2& value);
- virtual void fire(unsigned int firemode);
+ virtual void fired(unsigned int firemode);
virtual void greet();
protected:
More information about the Orxonox-commit
mailing list