1) Fixed 'moving physics', i.e. objects on the track that

can be pushed around by karts (currently only used in
   tux tollway).
2) Removed support for magnet.
3) Some code cleanup for missiles etc.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1379 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-01-09 12:09:55 +00:00
parent d27bac1a38
commit bd3ab7926f
36 changed files with 478 additions and 593 deletions

View File

@ -14,9 +14,6 @@
(anvil-weight 150.0 ) ;; additional weight an anvil adds to a kart (anvil-weight 150.0 ) ;; additional weight an anvil adds to a kart
(anvil-speed-factor 0.2 ) ;; additional slowdown caused by anvil (anvil-speed-factor 0.2 ) ;; additional slowdown caused by anvil
(parachute-friction 2.0 ) ;; friction increase when a parachute is sttached (parachute-friction 2.0 ) ;; friction increase when a parachute is sttached
(magnet-range 30.0 ) ;; maximum range a magnet can work
(magnet-min-range 4.0 ) ;; unless this distance is reached, kart will accel.
(magnet-time 10.0 ) ;; time a magnet is active
(parachute-time 4.0 ) ;; time an attached parachute is active (parachute-time 4.0 ) ;; time an attached parachute is active
(parachute-time-other 8.0 ) ;; time a parachute attached from other kart is active (parachute-time-other 8.0 ) ;; time a parachute attached from other kart is active
(bomb-time 30.0 ) ;; time till a bomb explodes (bomb-time 30.0 ) ;; time till a bomb explodes

View File

@ -19,7 +19,7 @@
"roadblock.ac",60,-29,{},0,{},{} "roadblock.ac",60,-29,{},0,{},{}
"roadcone.ac",58,-33,{},27,{},{} "roadcone.ac",58,-33,{},27,{},{}
"roadcone.ac",56,-34,{},147,{},{} "roadcone.ac",56,-34,{},147,{},{}
"roadcone.ac",54,-35,{},47,{},{} "roadcone.ac",54,-31,{},47,{},{}
#"icecreamtruck.ac",70,-30,{},-110,{},{} #"icecreamtruck.ac",70,-30,{},-110,{},{}
#"mytruck.ac",-60,105,{},-100,{},{} #"mytruck.ac",-60,105,{},-100,{},{}
# #

View File

@ -1,368 +1,375 @@
AC3Db AC3Db
MATERIAL "ac3dmat0" rgb 0 0 0 amb 0 0 0 emis 0 0 0 spec 0 0 0 shi 0 trans 1 MATERIAL "DefaultWhite" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 0.5 0.5 0.5 shi 64 trans 0
MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0 MATERIAL "ac3dmat1" rgb 1 1 1 amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10 trans 0
MATERIAL "" rgb 1 0 0 amb 1 0 0 emis 0 0 0 spec 1 1 1 shi 51 trans 0 MATERIAL "" rgb 1 0 0 amb 0.333333 0.333333 0.333333 emis 0 0 0 spec 1 1 1 shi 51 trans 0
MATERIAL "ac3dmat0" rgb 0 0 0 amb 0 0 0 emis 0 0 0 spec 0 0 0 shi 0 trans 1
OBJECT world OBJECT world
data 20 data 20
@physics box mass=10 @physics box mass=50
kids 3 kids 3
OBJECT poly OBJECT poly
name "poly" name "poly"
loc 1.39699e-08 0.369441 -0.00958636 data 4
texture "../images/candy_stripe.rgb" Mesh
texrep 2 2 texture "candy_stripe.rgb"
texrep 1 1
crease 30.000000
numvert 36 numvert 36
-0.502033 -0.37125 0.806835 -0.502033 -0.379409 0.797249
-0.113906 0.388125 0.806835 -0.113906 0.379966 0.797249
0.113906 0.388125 0.806835 0.113906 0.379966 0.797249
0.502033 -0.388125 0.806835 0.502033 -0.396284 0.797249
0.257342 -0.388125 0.806835 0.257342 -0.396284 0.797249
-0.00421875 0.126563 0.806835 -0.004219 0.118404 0.797249
-0.240469 -0.37125 0.806835 -0.240469 -0.379409 0.797249
-0.00421877 0.126563 0.705585 -0.004219 0.118404 0.695999
0.257342 -0.388125 0.705585 0.257342 -0.396284 0.695999
0.502033 -0.388125 0.705585 0.502033 -0.396284 0.695999
0.113906 0.388125 0.705585 0.113906 0.379966 0.695999
-0.240469 -0.37125 0.705585 -0.240469 -0.379409 0.695999
-0.113906 0.388125 0.705585 -0.113906 0.379966 0.695999
-0.502033 -0.37125 0.705585 -0.502033 -0.379409 0.695999
-0.502033 -0.37125 -0.703478 -0.502033 -0.379409 -0.713064
-0.113906 0.388125 -0.703478 -0.113906 0.379966 -0.713064
0.113906 0.388125 -0.703478 0.113906 0.379966 -0.713064
0.502033 -0.388125 -0.703478 0.502033 -0.396284 -0.713064
0.257345 -0.388125 -0.703478 0.257345 -0.396284 -0.713064
-0.00421875 0.126563 -0.703478 -0.004219 0.118404 -0.713064
-0.240469 -0.37125 -0.703478 -0.240469 -0.379409 -0.713064
-0.00421875 0.126563 -0.804728 -0.004219 0.118404 -0.814314
0.257345 -0.388125 -0.804728 0.257345 -0.396284 -0.814314
0.502033 -0.388125 -0.804728 0.502033 -0.396284 -0.814314
0.113906 0.388125 -0.804728 0.113906 0.379966 -0.814314
-0.240469 -0.37125 -0.804728 -0.240469 -0.379409 -0.814314
-0.113906 0.388125 -0.804728 -0.113906 0.379966 -0.814314
-0.502033 -0.37125 -0.804728 -0.502033 -0.379409 -0.814314
-0.0379688 0.109688 -0.884883 -0.037969 0.101529 -0.894469
-0.0379688 0.379688 -0.884883 -0.037969 0.371529 -0.894469
0.0379688 0.379688 -0.884883 0.037969 0.371529 -0.894469
0.0379688 0.109688 -0.884883 0.037969 0.101529 -0.894469
-0.0379688 0.109688 0.884882 -0.037969 0.101529 0.875296
-0.0379688 0.379688 0.884882 -0.037969 0.371529 0.875296
0.0379688 0.379688 0.884882 0.037969 0.371529 0.875296
0.0379688 0.109688 0.884882 0.037969 0.101529 0.875296
numsurf 46 numsurf 46
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
2 0.613445 1 1 0.773109972477 2.0
1 0.386555 1 0 0.0 0.0434781983495
0 0 0.0217391 2 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
4 0.7563 0 4 1.51259994507 0.0
3 1 0 3 2.0 0.0
2 0.613445 1 2 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
5 0.495798 0.663044 5 0.991595983505 1.32608795166
4 0.7563 0 4 1.51259994507 0.0
2 0.613445 1 2 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
5 0.495798 0.663044 2 1.22688996792 2.0
2 0.613445 1 0 0.0 0.0434781983495
0 0 0.0217391 5 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
6 0.260505 0.0217391 5 0.991595983505 1.32608795166
5 0.495798 0.663044 0 0.0 0.0434781983495
0 0 0.0217391 6 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
9 1 0 9 2.0 0.0
8 0.7563 0 8 1.51259994507 0.0
7 0.495798 0.663044 7 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
10 0.613445 1 10 1.22688996792 2.0
9 1 0 9 2.0 0.0
7 0.495798 0.663044 7 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
10 0.613445 1 10 1.22688996792 2.0
7 0.495798 0.663044 7 0.991595983505 1.32608795166
11 0.260505 0.0217391 11 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
12 0.386555 1 12 0.773109972477 2.0
10 0.613445 1 10 1.22688996792 2.0
11 0.260505 0.0217391 11 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
13 0 0.0217391 13 0.0 0.0434781983495
12 0.386555 1 12 0.773109972477 2.0
11 0.260505 0.0217391 11 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
12 0.386555 1 13 0.0 0.0434781983495
13 0 0.0217391 0 0.0 0.0434781983495
0 0 0.0217391 12 0.773109972477 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
1 0.386555 1 12 0.773109972477 2.0
12 0.386555 1 0 0.0 0.0434781983495
0 0 0.0217391 1 0.773109972477 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
10 0.613445 1 10 1.22688996792 2.0
12 0.386555 1 12 0.773109972477 2.0
1 0.386555 1 1 0.773109972477 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
2 0.613445 1 2 1.22688996792 2.0
10 0.613445 1 10 1.22688996792 2.0
1 0.386555 1 1 0.773109972477 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
9 1 0 9 2.0 0.0
10 0.613445 1 10 1.22688996792 2.0
2 0.613445 1 2 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
3 1 0 3 2.0 0.0
9 1 0 9 2.0 0.0
2 0.613445 1 2 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
7 0.495798 0.663044 7 0.991595983505 1.32608795166
8 0.7563 0 8 1.51259994507 0.0
4 0.7563 0 4 1.51259994507 0.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
5 0.495798 0.663044 5 0.991595983505 1.32608795166
7 0.495798 0.663044 7 0.991595983505 1.32608795166
4 0.7563 0 4 1.51259994507 0.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
11 0.260505 0.0217391 11 0.521009981632 0.0434781983495
7 0.495798 0.663044 7 0.991595983505 1.32608795166
5 0.495798 0.663044 5 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
6 0.260505 0.0217391 6 0.521009981632 0.0434781983495
11 0.260505 0.0217391 11 0.521009981632 0.0434781983495
5 0.495798 0.663044 5 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
16 0.613445 1 16 1.22688996792 2.0
15 0.386555 1 15 0.773109972477 2.0
14 0 0.0217391 14 0.0 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
18 0.756303 0 18 1.51260602474 0.0
17 1 0 17 2.0 0.0
16 0.613445 1 16 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
19 0.495798 0.663044 19 0.991595983505 1.32608795166
18 0.756303 0 18 1.51260602474 0.0
16 0.613445 1 16 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
19 0.495798 0.663044 19 0.991595983505 1.32608795166
16 0.613445 1 16 1.22688996792 2.0
14 0 0.0217391 14 0.0 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
20 0.260505 0.0217391 20 0.521009981632 0.0434781983495
19 0.495798 0.663044 19 0.991595983505 1.32608795166
14 0 0.0217391 14 0.0 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
23 1 0 23 2.0 0.0
22 0.756303 0 22 1.51260602474 0.0
21 0.495798 0.663044 21 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
24 0.613445 1 24 1.22688996792 2.0
23 1 0 23 2.0 0.0
21 0.495798 0.663044 21 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
24 0.613445 1 24 1.22688996792 2.0
21 0.495798 0.663044 21 0.991595983505 1.32608795166
25 0.260505 0.0217391 25 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
26 0.386555 1 26 0.773109972477 2.0
24 0.613445 1 24 1.22688996792 2.0
25 0.260505 0.0217391 25 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
27 0 0.0217391 27 0.0 0.0434781983495
26 0.386555 1 26 0.773109972477 2.0
25 0.260505 0.0217391 25 0.521009981632 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
26 0.386555 1 26 0.773109972477 2.0
27 0 0.0217391 27 0.0 0.0434781983495
14 0 0.0217391 14 0.0 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
15 0.386555 1 15 0.773109972477 2.0
26 0.386555 1 26 0.773109972477 2.0
14 0 0.0217391 14 0.0 0.0434781983495
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
24 0.613445 1 24 1.22688996792 2.0
26 0.386555 1 26 0.773109972477 2.0
15 0.386555 1 15 0.773109972477 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
16 0.613445 1 16 1.22688996792 2.0
24 0.613445 1 24 1.22688996792 2.0
15 0.386555 1 15 0.773109972477 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
23 1 0 23 2.0 0.0
24 0.613445 1 24 1.22688996792 2.0
16 0.613445 1 16 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
17 1 0 17 2.0 0.0
23 1 0 23 2.0 0.0
16 0.613445 1 16 1.22688996792 2.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
21 0.495798 0.663044 21 0.991595983505 1.32608795166
22 0.756303 0 22 1.51260602474 0.0
18 0.756303 0 18 1.51260602474 0.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
19 0.495798 0.663044 19 0.991595983505 1.32608795166
21 0.495798 0.663044 21 0.991595983505 1.32608795166
18 0.756303 0 18 1.51260602474 0.0
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
25 0.260505 0.0217391 25 0.521009981632 0.0434781983495
21 0.495798 0.663044 21 0.991595983505 1.32608795166
19 0.495798 0.663044 19 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 1 mat 1
refs 3 refs 3
20 0.260505 0.0217391 20 0.521009981632 0.0434781983495
25 0.260505 0.0217391 25 0.521009981632 0.0434781983495
19 0.495798 0.663044 19 0.991595983505 1.32608795166
SURF 0x0 SURF 0x00
mat 2 mat 2
refs 4 refs 4
28 0.462185 0.641305 28 0.924369990826 1.28261005878
29 0.462185 0.989131 29 0.924369990826 1.97826194763
30 0.537815 0.989131 30 1.07562994957 1.97826194763
31 0.537815 0.641305 31 1.07562994957 1.28261005878
SURF 0x0 SURF 0x00
mat 2 mat 2
refs 4 refs 4
34 0.537815 0.989131 34 1.07562994957 1.97826194763
35 0.537815 0.641305 35 1.07562994957 1.28261005878
31 0.537815 0.641305 31 1.07562994957 1.28261005878
30 0.537815 0.989131 30 1.07562994957 1.97826194763
SURF 0x0 SURF 0x00
mat 2 mat 2
refs 4 refs 4
35 0.537815 0.641305 35 1.07562994957 1.28261005878
34 0.537815 0.989131 34 1.07562994957 1.97826194763
33 0.462185 0.989131 33 0.924369990826 1.97826194763
32 0.462185 0.641305 32 0.924369990826 1.28261005878
SURF 0x0 SURF 0x00
mat 2 mat 2
refs 4 refs 4
32 0.462185 0.641305 32 0.924369990826 1.28261005878
33 0.462185 0.989131 33 0.924369990826 1.97826194763
29 0.462185 0.989131 29 0.924369990826 1.97826194763
28 0.462185 0.641305 28 0.924369990826 1.28261005878
SURF 0x0 SURF 0x00
mat 2 mat 2
refs 4 refs 4
29 0.462185 0.989131 29 0.924369990826 1.97826194763
33 0.462185 0.989131 33 0.924369990826 1.97826194763
34 0.537815 0.989131 34 1.07562994957 1.97826194763
30 0.537815 0.989131 30 1.07562994957 1.97826194763
SURF 0x0 SURF 0x00
mat 2 mat 2
refs 4 refs 4
32 0.462185 0.641305 32 0.924369990826 1.28261005878
28 0.462185 0.641305 28 0.924369990826 1.28261005878
31 0.537815 0.641305 31 1.07562994957 1.28261005878
35 0.537815 0.641305 35 1.07562994957 1.28261005878
kids 0 kids 0
OBJECT poly OBJECT poly
name "rect" name "rect"
loc 0 0.363279 -0.00958684 data 8
Mesh.001
crease 30.000000
numvert 4 numvert 4
0.104756 0.391296 -0.890428 0.104756 0.376975 -0.900015
0.104756 0.391296 0.890428 0.104756 0.376975 0.880841
0.511457 -0.385133 0.890428 0.511457 -0.399454 0.880841
0.511457 -0.385133 -0.890428 0.511457 -0.399454 -0.900015
numsurf 1 numsurf 1
SURF 0x0 SURF 0x00
mat 0 mat 3
refs 4 refs 4
0 0 1 0 0.0 1.0
1 1 1 1 1.0 1.0
2 1 0 2 1.0 0.0
3 0 0 3 0.0 0.0
kids 0 kids 0
OBJECT poly OBJECT poly
name "rect" name "rect.001"
loc -0.622376 0.369441 0.113656 data 8
Mesh.002
crease 30.000000
numvert 4 numvert 4
0.511457 0.391295 -0.890428 -0.110919 0.383136 -0.776772
0.511457 0.391295 0.890428 -0.110919 0.383136 1.004084
0.104756 -0.385133 0.890428 -0.51762 -0.393292 1.004084
0.104756 -0.385133 -0.890428 -0.51762 -0.393292 -0.776772
numsurf 1 numsurf 1
SURF 0x0 SURF 0x00
mat 0 mat 3
refs 4 refs 4
3 0 0 1 1.0 1.0
2 1 0 0 0.0 1.0
1 1 1 3 0.0 0.0
0 0 1 2 1.0 0.0
kids 0 kids 0

View File

@ -1,176 +1,180 @@
AC3Db AC3Db
MATERIAL "" rgb 1 0 0 amb 1 0 0 emis 0 0 0 spec 1 1 1 shi 51 trans 0 MATERIAL "DefaultWhite" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 0.5 0.5 0.5 shi 64 trans 0
MATERIAL "" rgb 1 0 0 amb 0.333333 0.333333 0.333333 emis 0 0 0 spec 1 1 1 shi 51 trans 0
OBJECT world OBJECT world
data 20 data 21
@physics cone mass=1 @physics cone mass=10
kids 1 kids 1
OBJECT poly OBJECT poly
name "cylinder" name "cylinder"
loc 5.96046e-08 1.13906 0.118125 data 4
texture "../images/candy_stripe.rgb" Mesh
texture "candy_stripe.rgb"
texrep 1 1
crease 30.000000
numvert 25 numvert 25
-0.00344123 -0.365268 -0.114602 -0.003441 0.438147 0.003523
0.172562 -1.06558 0.0852665 0.172562 -0.262165 0.203391
0.226518 -1.06558 -0.00643399 0.226518 -0.262165 0.111691
0.091811 -1.06558 0.146538 0.091811 -0.262165 0.264663
-0.00344123 -1.06558 0.168056 -0.003441 -0.262165 0.286181
-0.0986935 -1.06558 0.146538 -0.098693 -0.262165 0.264663
-0.179444 -1.06558 0.0852665 -0.179444 -0.262165 0.203391
-0.233401 -1.06558 -0.00643399 -0.233401 -0.262165 0.111691
-0.252347 -1.06558 -0.114602 -0.252347 -0.262165 0.003523
-0.233401 -1.06558 -0.222769 -0.233401 -0.262165 -0.104644
-0.179444 -1.06558 -0.31447 -0.179444 -0.262165 -0.196345
-0.0986937 -1.06558 -0.375742 -0.098694 -0.262165 -0.257617
-0.00344126 -1.06558 -0.397259 -0.003441 -0.262165 -0.279134
0.091811 -1.06558 -0.375742 0.091811 -0.262165 -0.257617
0.172562 -1.06558 -0.31447 0.172562 -0.262165 -0.196345
0.226518 -1.06558 -0.222769 0.226518 -0.262165 -0.104644
0.245465 -1.06558 -0.114602 0.245465 -0.262165 0.003523
-0.252347 -1.04449 -0.390929 -0.252347 -0.241075 -0.272804
-0.252347 -1.04449 0.161726 -0.252347 -0.241075 0.279851
0.245465 -1.04449 0.161726 0.245465 -0.241075 0.279851
0.245465 -1.04449 -0.390929 0.245465 -0.241075 -0.272804
0.245465 -1.15417 0.161726 0.245465 -0.350755 0.279851
0.245465 -1.15417 -0.390929 0.245465 -0.350755 -0.272804
-0.252347 -1.15417 0.161726 -0.252347 -0.350755 0.279851
-0.252347 -1.15417 -0.390929 -0.252347 -0.350755 -0.272804
numsurf 22 numsurf 22
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
1 0.853553 0.146448 1 0.853552997112 0.146448001266
2 0.96194 0.30866 2 0.96193999052 0.308660000563
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
3 0.691341 0.0380637 3 0.691340982914 0.0380637012422
1 0.853553 0.146448 1 0.853552997112 0.146448001266
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
4 0.5 0 4 0.5 0.0
3 0.691341 0.0380637 3 0.691340982914 0.0380637012422
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
5 0.308658 0.0380637 5 0.308658003807 0.0380637012422
4 0.5 0 4 0.5 0.0
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
6 0.146447 0.146448 6 0.146447002888 0.146448001266
5 0.308658 0.0380637 5 0.308658003807 0.0380637012422
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
7 0.0380585 0.30866 7 0.038058500737 0.308660000563
6 0.146447 0.146448 6 0.146447002888 0.146448001266
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
8 0 0.500001 8 0.0 0.500001013279
7 0.0380585 0.30866 7 0.038058500737 0.308660000563
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
9 0.0380585 0.69134 9 0.038058500737 0.69134002924
8 0 0.500001 8 0.0 0.500001013279
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
10 0.146447 0.853552 10 0.146447002888 0.853551983833
9 0.0380585 0.69134 9 0.038058500737 0.69134002924
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
11 0.308657 0.961938 11 0.308656990528 0.961938023567
10 0.146447 0.853552 10 0.146447002888 0.853551983833
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
12 0.499999 1 12 0.499998986721 1.0
11 0.308657 0.961938 11 0.308656990528 0.961938023567
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
13 0.691341 0.961938 13 0.691340982914 0.961938023567
12 0.499999 1 12 0.499998986721 1.0
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
14 0.853553 0.853552 14 0.853552997112 0.853551983833
13 0.691341 0.961938 13 0.691340982914 0.961938023567
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
15 0.96194 0.69134 15 0.96193999052 0.69134002924
14 0.853553 0.853552 14 0.853552997112 0.853551983833
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
16 1 0.500001 16 1.0 0.500001013279
15 0.96194 0.69134 15 0.96193999052 0.69134002924
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 3 refs 3
0 0.5 0.500001 0 0.5 0.500001013279
2 0.96194 0.30866 2 0.96193999052 0.308660000563
16 1 0.500001 16 1.0 0.500001013279
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 4 refs 4
17 0 0.988803 17 0.0 0.98880302906
18 0 0.0111973 18 0.0 0.0111972996965
19 1 0.0111973 19 1.0 0.0111972996965
20 1 0.988803 20 1.0 0.98880302906
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 4 refs 4
21 1 0.0111973 21 1.0 0.0111972996965
22 1 0.988803 22 1.0 0.98880302906
20 1 0.988803 20 1.0 0.98880302906
19 1 0.0111973 19 1.0 0.0111972996965
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 4 refs 4
22 1 0.988803 22 1.0 0.98880302906
21 1 0.0111973 21 1.0 0.0111972996965
23 0 0.0111973 23 0.0 0.0111972996965
24 0 0.988803 24 0.0 0.98880302906
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 4 refs 4
24 0 0.988803 24 0.0 0.98880302906
23 0 0.0111973 23 0.0 0.0111972996965
18 0 0.0111973 18 0.0 0.0111972996965
17 0 0.988803 17 0.0 0.98880302906
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 4 refs 4
18 0 0.0111973 18 0.0 0.0111972996965
23 0 0.0111973 23 0.0 0.0111972996965
21 1 0.0111973 21 1.0 0.0111972996965
19 1 0.0111973 19 1.0 0.0111972996965
SURF 0x10 SURF 0x10
mat 0 mat 1
refs 4 refs 4
24 0 0.988803 24 0.0 0.98880302906
17 0 0.988803 17 0.0 0.98880302906
20 1 0.988803 20 1.0 0.98880302906
22 1 0.988803 22 1.0 0.98880302906
kids 0 kids 0

View File

@ -141,32 +141,6 @@ void Attachment::update(float dt)
break; break;
case ATTACH_TINYTUX: if(m_time_left<=0.0) m_kart->endRescue(); case ATTACH_TINYTUX: if(m_time_left<=0.0) m_kart->endRescue();
break; break;
#ifdef USE_MAGNET
case ATTACH_MAGNET: break;
case ATTACH_MAGNET_BZZT: float cdist; int closest;
m_kart->getClosestKart(&cdist, &closest);
// if no closest kart, set type to
// non-active magnet
if(closest==-1)
{
if ( m_type == ATTACH_MAGNET_BZZT )
set( ATTACH_MAGNET, m_time_left ) ;
return;
}
// Otherwise: set type to active magnet.
if(m_type==ATTACH_MAGNET)
{
if(m_kart->isPlayerKart() || closest==0)
{
sound_manager->playSfx(SOUND_BZZT);
}
set(ATTACH_MAGNET_BZZT,
m_time_left<4.0?4.0:m_time_left);
}
m_kart->handleMagnet(cdist, closest);
break;
#endif
} // switch } // switch
// Detach attachment if its time is up. // Detach attachment if its time is up.

View File

@ -27,9 +27,6 @@ class Kart;
// and TINYTUX being the last one. So if new elemts are added, make sure // and TINYTUX being the last one. So if new elemts are added, make sure
// to add them in between those values. // to add them in between those values.
enum attachmentType { ATTACH_PARACHUTE, enum attachmentType { ATTACH_PARACHUTE,
#ifdef USE_MAGNET
ATTACH_MAGNET, ATTACH_MAGNET_BZZT,
#endif
ATTACH_BOMB, ATTACH_BOMB,
ATTACH_ANVIL, ATTACH_TINYTUX, ATTACH_ANVIL, ATTACH_TINYTUX,
ATTACH_MAX, ATTACH_NOTHING}; ATTACH_MAX, ATTACH_NOTHING};

View File

@ -44,10 +44,6 @@ struct initAttachmentType {attachmentType attachment; const char *file;};
initAttachmentType iat[]= initAttachmentType iat[]=
{ {
{ATTACH_PARACHUTE, "parachute.ac"}, {ATTACH_PARACHUTE, "parachute.ac"},
#ifdef USE_MAGNET
{ATTACH_MAGNET, "magnet.ac"},
{ATTACH_MAGNET_BZZT, "magnetbzzt.ac"},
#endif
{ATTACH_BOMB, "bomb.ac"}, {ATTACH_BOMB, "bomb.ac"},
{ATTACH_ANVIL, "anvil.ac"}, {ATTACH_ANVIL, "anvil.ac"},
{ATTACH_TINYTUX, "tinytux_magnet.ac"}, {ATTACH_TINYTUX, "tinytux_magnet.ac"},

View File

@ -1,4 +1,3 @@
// $Id: attachment_manager.hpp 757 2006-09-11 22:27:39Z hiker $
// //
// SuperTuxKart - a fun racing game with go-kart // SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2006 Joerg Henrichs // Copyright (C) 2006 Joerg Henrichs

View File

@ -37,19 +37,50 @@ CallbackManager::~CallbackManager()
{ {
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin(); for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin();
c != m_allCallbacks[i].end(); c++) c != m_allCallbacks[i].end(); c++)
delete *c; {
m_allCallbacks[i].clear(); MovingPhysics *mp = dynamic_cast<MovingPhysics*>(*c);
if(mp)
{
ssgDeRefDelete(mp);
} }
else
{
delete *c;
}
m_allCallbacks[i].clear();
} // for c in m_allCallbacks[i]
} // for i <CB_MAX
} // ~CallbackManager } // ~CallbackManager
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CallbackManager::addCallback(Callback *c, CallbackType t)
{
m_allCallbacks[t].push_back(c);
MovingPhysics *mp = dynamic_cast<MovingPhysics*>(c);
if(mp)
{
mp->ref();
}
} // addCallback
//-----------------------------------------------------------------------------
void CallbackManager::clear(CallbackType cbType) void CallbackManager::clear(CallbackType cbType)
{ {
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[cbType].begin(); for(std::vector<Callback*>::const_iterator c = m_allCallbacks[cbType].begin();
c != m_allCallbacks[cbType].end(); c++) c != m_allCallbacks[cbType].end(); c++)
{
MovingPhysics *mp = dynamic_cast<MovingPhysics*>(*c);
if(mp)
{
ssgDeRefDelete(mp);
}
else
{ {
delete *c; delete *c;
} }
}
m_allCallbacks[cbType].clear(); m_allCallbacks[cbType].clear();
} // clear } // clear

View File

@ -42,7 +42,7 @@ public:
void update (float dt) const; void update (float dt) const;
void initAll () const; void initAll () const;
void clear (CallbackType cbType); void clear (CallbackType cbType);
void addCallback(Callback *c, CallbackType t) {m_allCallbacks[t].push_back(c);} void addCallback(Callback *c, CallbackType t);
} }
; // CallbackManager ; // CallbackManager

View File

@ -56,27 +56,9 @@ Material *Collectable::getIcon()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Collectable::use() void Collectable::use()
{ {
#ifdef USE_MAGNET
if(user_config->disableMagnet)
{
attachmentType at=owner->getAttachment();
if(at==ATTACH_MAGNET)
{
owner->setAttachmentType(ATTACH_MAGNET_BZZT);
}
else if(at==ATTACH_MAGNET_BZZT)
{
owner->setAttachmentType(ATTACH_MAGNET );
} // if MAGNET_BZZT
} // user_config->disableMagnet
#endif
m_number--; m_number--;
switch (m_type) switch (m_type)
{ {
#ifdef USE_MAGNET
case COLLECT_MAGNET: m_owner->attach(ATTACH_MAGNET_BZZT, stk_config->m_magnet_time);
break ;
#endif
case COLLECT_ZIPPER: m_owner->handleZipper(); case COLLECT_ZIPPER: m_owner->handleZipper();
break ; break ;
case COLLECT_HOMING: case COLLECT_HOMING:

View File

@ -41,9 +41,6 @@ initCollectableType;
initCollectableType ict[]= initCollectableType ict[]=
{ {
{COLLECT_ZIPPER, "zipper.collectable" }, {COLLECT_ZIPPER, "zipper.collectable" },
#ifdef USE_MAGNETS
{COLLECT_MAGNET, "magnet.collectable" },
#endif
{COLLECT_SPARK, "spark.projectile" }, {COLLECT_SPARK, "spark.projectile" },
{COLLECT_MISSILE, "missile.projectile" }, {COLLECT_MISSILE, "missile.projectile" },
{COLLECT_HOMING, "homingmissile.projectile" }, {COLLECT_HOMING, "homingmissile.projectile" },

View File

@ -36,9 +36,6 @@ enum CollectableType {COLLECT_NOTHING,
COLLECT_MISSILE, COLLECT_HOMING, COLLECT_MISSILE, COLLECT_HOMING,
COLLECT_SPARK, COLLECT_ZIPPER, COLLECT_SPARK, COLLECT_ZIPPER,
COLLECT_PARACHUTE, COLLECT_ANVIL, COLLECT_PARACHUTE, COLLECT_ANVIL,
#ifdef USE_MAGNETS
COLLECT_MAGNET,
#endif
COLLECT_MAX}; COLLECT_MAX};
class CollectableManager class CollectableManager

View File

@ -59,7 +59,8 @@ Flyable::Flyable(Kart *kart, CollectableType type) : Moveable(false)
scene->add(m); scene->add(m);
} // Flyable } // Flyable
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void Flyable::createPhysics(const btVector3& offset, const btVector3 velocity) void Flyable::createPhysics(const btVector3& offset, const btVector3 velocity,
btCollisionShape *shape)
{ {
// The actual transform is determined as follows: // The actual transform is determined as follows:
// 1) Compute the heading of the kart // 1) Compute the heading of the kart
@ -88,7 +89,7 @@ void Flyable::createPhysics(const btVector3& offset, const btVector3 velocity)
trans *= offset_transform; trans *= offset_transform;
m_shape = createShape(); // get shape m_shape = shape;
createBody(m_mass, trans, m_shape, UserPointer::UP_PROJECTILE); createBody(m_mass, trans, m_shape, UserPointer::UP_PROJECTILE);
world->getPhysics()->addBody(getBody()); world->getPhysics()->addBody(getBody());

View File

@ -53,7 +53,6 @@ protected:
void getClosestKart(const Kart **minKart, float *minDist, void getClosestKart(const Kart **minKart, float *minDist,
btVector3 *minDelta) const; btVector3 *minDelta) const;
virtual btCollisionShape *createShape()=0;
virtual void too_low (float dt) virtual void too_low (float dt)
{m_body->applyCentralForce( {m_body->applyCentralForce(
btVector3(0.0f, 0.0f, m_force_updown)); } btVector3(0.0f, 0.0f, m_force_updown)); }
@ -65,7 +64,8 @@ protected:
v.setZ(0.0f); v.setZ(0.0f);
m_body->setLinearVelocity(v); } m_body->setLinearVelocity(v); }
void createPhysics(const btVector3& offset, void createPhysics(const btVector3& offset,
const btVector3 velocity); const btVector3 velocity,
btCollisionShape *shape);
public: public:
Flyable (Kart* kart, CollectableType type); Flyable (Kart* kart, CollectableType type);

View File

@ -137,10 +137,6 @@ HelpPageTwo::HelpPageTwo()
widget_manager->showWgtText( WTOK_ITEMTXT6 ); widget_manager->showWgtText( WTOK_ITEMTXT6 );
widget_manager->breakLine(); widget_manager->breakLine();
#ifdef USE_MAGNETS
//Magnets are currently disabled.
#endif
/*Buttons at the bottom*/ /*Buttons at the bottom*/
widget_manager->addWgt(WTOK_FIRST_PAGE, 25, 7); widget_manager->addWgt(WTOK_FIRST_PAGE, 25, 7);
widget_manager->setWgtText(WTOK_FIRST_PAGE, _("Previous screen")); widget_manager->setWgtText(WTOK_FIRST_PAGE, _("Previous screen"));

View File

@ -243,6 +243,7 @@ void RaceGUI::drawFPS ()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void RaceGUI::drawTimer () void RaceGUI::drawTimer ()
{ {
return;
if(world->getPhase()!=World::RACE_PHASE && if(world->getPhase()!=World::RACE_PHASE &&
world->getPhase()!=World::DELAY_FINISH_PHASE ) return; world->getPhase()!=World::DELAY_FINISH_PHASE ) return;
char str[256]; char str[256];

View File

@ -33,7 +33,7 @@ Homing::Homing (Kart *kart) : Flyable(kart, COLLECT_HOMING)
0.3f ); 0.3f );
// The cylinder needs to be rotated by 90 degrees to face in the right direction: // The cylinder needs to be rotated by 90 degrees to face in the right direction:
m_initial_velocity = btVector3(0.0f, m_speed, 0.0f); m_initial_velocity = btVector3(0.0f, m_speed, 0.0f);
createPhysics(offset, m_initial_velocity); createPhysics(offset, m_initial_velocity, new btCylinderShape(0.5f*m_extend));
m_body->setCollisionFlags(m_body->getCollisionFlags() | m_body->setCollisionFlags(m_body->getCollisionFlags() |
btCollisionObject::CF_KINEMATIC_OBJECT ); btCollisionObject::CF_KINEMATIC_OBJECT );
m_body->setActivationState(DISABLE_DEACTIVATION); m_body->setActivationState(DISABLE_DEACTIVATION);
@ -48,11 +48,6 @@ void Homing::init(const lisp::Lisp* lisp, ssgEntity *homing)
lisp->get("max-distance", m_st_max_distance ); lisp->get("max-distance", m_st_max_distance );
lisp->get("max-turn-angle", m_st_max_turn_angle); lisp->get("max-turn-angle", m_st_max_turn_angle);
} // init } // init
// -----------------------------------------------------------------------------
btCollisionShape *Homing::createShape()
{
return new btCylinderShape(0.5f*m_extend);
} // createShape
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Homing::update(float dt) void Homing::update(float dt)

View File

@ -31,7 +31,6 @@ private:
float steerTowards(btTransform& trans, btVector3& target); float steerTowards(btTransform& trans, btVector3& target);
protected: protected:
virtual btCollisionShape *createShape();
virtual void too_low (float dt) {m_initial_velocity.setZ(m_force_updown*dt);} virtual void too_low (float dt) {m_initial_velocity.setZ(m_force_updown*dt);}
virtual void too_high(float dt) {m_initial_velocity.setZ(-m_force_updown*dt);} virtual void too_high(float dt) {m_initial_velocity.setZ(-m_force_updown*dt);}
virtual void right_height(float dt) {m_initial_velocity.setZ(0.0f); } virtual void right_height(float dt) {m_initial_velocity.setZ(0.0f); }

View File

@ -1185,53 +1185,6 @@ void Kart::placeModel ()
Moveable::placeModel(); Moveable::placeModel();
} // placeModel } // placeModel
//-----------------------------------------------------------------------------
void Kart::getClosestKart(float *cdist, int *closest)
{
*cdist = SG_MAX ;
*closest = -1 ;
for ( unsigned int i = 0; i < world->getNumKarts() ; ++i )
{
if ( world->getKart(i) == this ) continue ;
if ( world->getKart(i)->getDistanceDownTrack() < getDistanceDownTrack() )
continue ;
float d = sgDistanceSquaredVec2 ( getCoord()->xyz,
world->getKart(i)->getCoord()->xyz ) ;
if ( d < *cdist && d < stk_config->m_magnet_range_sq)
{
*cdist = d ;
*closest = i ;
}
} // for i
} // getClosestKart
//-----------------------------------------------------------------------------
void Kart::handleMagnet(float cdist, int closest)
{
sgVec3 vec ;
sgSubVec2 ( vec, world->getKart(closest)->getCoord()->xyz, getCoord()->xyz );
vec [ 2 ] = 0.0f ;
sgNormalizeVec3 ( vec ) ;
sgHPRfromVec3 ( getCoord()->hpr, vec ) ;
float tgt_velocity = world->getKart(closest)->getVelocity().getY();
//JH FIXME: that should probably be changed, e.g. by increasing the throttle
// to something larger than 1???
if (cdist > stk_config->m_magnet_min_range_sq)
{
if ( getSpeed ()< tgt_velocity )
;//FIXME m_velocity.xyz[1] = tgt_velocity * 1.4f;
}
else
;//FIXME m_velocity.xyz[1] = tgt_velocity ;
} // handleMagnet
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Kart::setFinishingState(float time) void Kart::setFinishingState(float time)
{ {

View File

@ -172,7 +172,6 @@ public:
void endRescue (); void endRescue ();
void processSkidMarks (); void processSkidMarks ();
void getClosestKart (float *cdist, int *closest); void getClosestKart (float *cdist, int *closest);
void handleMagnet (float cdist, int closest);
void updatePhysics (float dt); void updatePhysics (float dt);
float NormalizedLateralForce(float alpha, float corner) const; float NormalizedLateralForce(float alpha, float corner) const;

View File

@ -364,11 +364,9 @@ ssgBranch *Loader::createBranch(char *data) const
} }
if(strncmp("physics", data, strlen("physics")) == 0) if(strncmp("physics", data, strlen("physics")) == 0)
{ {
ssgTransform *tr = new ssgTransform(); MovingPhysics *mp = new MovingPhysics(std::string(data));
MovingPhysics *mp = new MovingPhysics(std::string(data), tr);
callback_manager->addCallback(mp, m_current_callback_type); callback_manager->addCallback(mp, m_current_callback_type);
return mp;
return tr;
} }
fprintf(stderr, "Warning: Ignoring userdata '%s'\n", data); fprintf(stderr, "Warning: Ignoring userdata '%s'\n", data);
return NULL ; return NULL ;

View File

@ -26,7 +26,8 @@ Missile::Missile(Kart *kart) : Flyable(kart, COLLECT_MISSILE)
btVector3 offset(0.0f, btVector3 offset(0.0f,
kart->getKartLength()+2.0f*m_extend.getY(), kart->getKartLength()+2.0f*m_extend.getY(),
0.3f ); 0.3f );
createPhysics(offset, btVector3(0.0f, m_speed, 0.0f)); createPhysics(offset, btVector3(0.0f, m_speed, 0.0f),
new btCylinderShape(0.5f*m_extend));
} // Missile } // Missile
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -35,12 +36,6 @@ void Missile::init(const lisp::Lisp* lisp, ssgEntity *missile)
Flyable::init(lisp, missile, COLLECT_MISSILE); Flyable::init(lisp, missile, COLLECT_MISSILE);
} // init } // init
// -----------------------------------------------------------------------------
btCollisionShape *Missile::createShape()
{
return new btCylinderShape(0.5f*m_extend);
} // createShape
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Missile::update(float dt) void Missile::update(float dt)
{ {

View File

@ -24,8 +24,6 @@
class Missile : public Flyable class Missile : public Flyable
{ {
protected:
virtual btCollisionShape *createShape();
public: public:
Missile(Kart *kart); Missile(Kart *kart);
static void init (const lisp::Lisp* lisp, ssgEntity* missile); static void init (const lisp::Lisp* lisp, ssgEntity* missile);

View File

@ -27,15 +27,14 @@
#include "scene.hpp" #include "scene.hpp"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MovingPhysics::MovingPhysics(const std::string data, ssgTransform* trans) MovingPhysics::MovingPhysics(const std::string data)
: Callback() : Callback(), ssgTransform()
{ {
m_trans = trans;
m_shape = NULL; m_shape = NULL;
m_body = NULL; m_body = NULL;
m_motion_state = NULL; m_motion_state = NULL;
m_mass = 1; m_mass = 1;
m_trans->setUserData(new ssgBase()); // prevent tree optimisations to remove this node setUserData(new ssgBase()); // prevent tree optimisations to remove this node
std::vector<std::string> parameters = StringUtils::split(data, ' '); std::vector<std::string> parameters = StringUtils::split(data, ' ');
if(parameters.size()<2) if(parameters.size()<2)
@ -60,8 +59,6 @@ MovingPhysics::MovingPhysics(const std::string data, ssgTransform* trans)
fprintf(stderr, "Invalid physics parameter string: '%s'\n",data.c_str()); fprintf(stderr, "Invalid physics parameter string: '%s'\n",data.c_str());
break; break;
} }
else
{
if(p[0]=="mass") if(p[0]=="mass")
{ {
StringUtils::from_string<float>(p[1], m_mass); StringUtils::from_string<float>(p[1], m_mass);
@ -72,7 +69,7 @@ MovingPhysics::MovingPhysics(const std::string data, ssgTransform* trans)
data.c_str()); data.c_str());
break; break;
} }
}
parameters.erase(parameters.begin()); parameters.erase(parameters.begin());
} }
} // MovingPhysics } // MovingPhysics
@ -80,11 +77,11 @@ MovingPhysics::MovingPhysics(const std::string data, ssgTransform* trans)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MovingPhysics::~MovingPhysics() MovingPhysics::~MovingPhysics()
{ {
scene->remove(m_trans);
world->getPhysics()->removeBody(m_body); world->getPhysics()->removeBody(m_body);
delete m_shape;
delete m_motion_state;
delete m_body; delete m_body;
delete m_motion_state;
delete m_shape;
scene->remove(this);
} // ~MovingPhysics } // ~MovingPhysics
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -103,15 +100,15 @@ void MovingPhysics::init()
// 1. Remove the object from the graph and attach it to the root // 1. Remove the object from the graph and attach it to the root
// ------------------------------------------------------------- // -------------------------------------------------------------
if(m_trans->getNumParents()>1) if(getNumParents()>1)
{ {
fprintf(stderr, "WARNING: physical object with more than one parent!!\n"); fprintf(stderr, "WARNING: physical object with more than one parent!!\n");
return; return;
} }
ssgBranch *parent = m_trans->getParent(0); ssgBranch *parent = getParent(0);
scene->add(m_trans); scene->add(this);
parent->removeKid(m_trans); parent->removeKid(this);
// 2. Determine the original position of the object // 2. Determine the original position of the object
// ------------------------------------------------ // ------------------------------------------------
@ -160,18 +157,18 @@ void MovingPhysics::init()
// 3. Determine size of the object // 3. Determine size of the object
// ------------------------------- // -------------------------------
float x_min, x_max, y_min, y_max, z_min, z_max, radius; float x_min, x_max, y_min, y_max, z_min, z_max, radius;
MinMax(m_trans, &x_min, &x_max, &y_min, &y_max, &z_min, &z_max); MinMax(this, &x_min, &x_max, &y_min, &y_max, &z_min, &z_max);
m_half_height = 0.5f*(z_max-z_min); m_half_height = 0.5f*(z_max-z_min);
switch (m_body_type) switch (m_body_type)
{ {
case BODY_CONE: radius = 0.5f*std::max(x_max-x_min, y_max-y_min); case BODY_CONE: radius = 0.5f*std::max(x_max-x_min, y_max-y_min);
m_shape = new btConeShape(radius, z_max-z_min); m_shape = new btConeShapeZ(radius, z_max-z_min);
m_trans->setName("cone"); setName("cone");
break; break;
case BODY_BOX: m_shape = new btBoxShape(btVector3(0.5f*(x_max-x_min), case BODY_BOX: m_shape = new btBoxShape(btVector3(0.5f*(x_max-x_min),
0.5f*(y_max-y_min), 0.5f*(y_max-y_min),
0.5f*(z_max-z_min) ) ); 0.5f*(z_max-z_min) ) );
m_trans->setName("box"); setName("box");
break; break;
case BODY_NONE: fprintf(stderr, "WARNING: Uninitialised moving shape\n"); case BODY_NONE: fprintf(stderr, "WARNING: Uninitialised moving shape\n");
break; break;
@ -181,13 +178,12 @@ void MovingPhysics::init()
// -------------------------- // --------------------------
btTransform trans; btTransform trans;
trans.setIdentity(); trans.setIdentity();
// trans.setOrigin(btVector3(0, 8, 5+rand()%10));
trans.setOrigin(btVector3(pos[3][0],pos[3][1],pos[3][2]+m_half_height)); trans.setOrigin(btVector3(pos[3][0],pos[3][1],pos[3][2]+m_half_height));
m_motion_state = new btDefaultMotionState(trans); m_motion_state = new btDefaultMotionState(trans);
float mass = 10;
btVector3 inertia; btVector3 inertia;
m_shape->calculateLocalInertia(mass, inertia); m_shape->calculateLocalInertia(m_mass, inertia);
m_body = new btRigidBody(mass, m_motion_state, m_shape, inertia); m_body = new btRigidBody(m_mass, m_motion_state, m_shape, inertia);
//m_body->setDamping(2.0f, 2.0f);
world->getPhysics()->addBody(m_body); world->getPhysics()->addBody(m_body);
} // init } // init
@ -203,7 +199,7 @@ void MovingPhysics::update(float dt)
// Transfer the new position and hpr to m_curr_pos // Transfer the new position and hpr to m_curr_pos
sgCoord m_curr_pos; sgCoord m_curr_pos;
sgSetCoord(&m_curr_pos, m); sgSetCoord(&m_curr_pos, m);
m_trans->setTransform(&m_curr_pos); setTransform(&m_curr_pos);
} // update } // update
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -25,21 +25,20 @@
#include "callback.hpp" #include "callback.hpp"
#include <string> #include <string>
class MovingPhysics : public Callback class MovingPhysics : public ssgTransform, public Callback
{ {
public: public:
enum bodyTypes {BODY_NONE, BODY_CONE, BODY_BOX}; enum bodyTypes {BODY_NONE, BODY_CONE, BODY_BOX};
protected: protected:
bodyTypes m_body_type; bodyTypes m_body_type;
ssgTransform *m_trans;
btCollisionShape *m_shape; btCollisionShape *m_shape;
btRigidBody *m_body; btRigidBody *m_body;
btDefaultMotionState *m_motion_state; btDefaultMotionState *m_motion_state;
float m_half_height; float m_half_height;
float m_mass; float m_mass;
public: public:
MovingPhysics (const std::string data, ssgTransform *trans); MovingPhysics (const std::string data);
~MovingPhysics (); ~MovingPhysics ();
void update (float dt); void update (float dt);
void init (); void init ();

View File

@ -143,7 +143,7 @@ void PlayerKart::update(float dt)
{ {
if (m_collectable.getType()==COLLECT_NOTHING) sound_manager->playSfx(SOUND_BEEP); if (m_collectable.getType()==COLLECT_NOTHING) sound_manager->playSfx(SOUND_BEEP);
// use() needs to be called even if there currently is no collecteable // use() needs to be called even if there currently is no collecteable
// since use() tests for switching a magnet on/off. // since use() can test if something needs to be switched on/off.
m_collectable.use() ; m_collectable.use() ;
m_controls.fire = false; m_controls.fire = false;
} }

View File

@ -46,11 +46,11 @@ RaceMode::exit_race()
{ {
menu_manager->switchToMainMenu(); menu_manager->switchToMainMenu();
scene->clear();
delete world; delete world;
world = 0; world = 0;
scene->clear();
race_manager->m_active_race = false; race_manager->m_active_race = false;
} }

View File

@ -344,7 +344,6 @@ void DefaultRobot::handle_items( const float DELTA, const int STEPS )
m_time_since_last_shot = 0.0f; m_time_since_last_shot = 0.0f;
} }
break; break;
/*TODO: teach AI to use the magnet*/
default: default:
m_controls.fire = true; m_controls.fire = true;
m_time_since_last_shot = 0.0f; m_time_since_last_shot = 0.0f;

View File

@ -35,7 +35,8 @@ Spark::Spark(Kart *kart) : Flyable(kart, COLLECT_SPARK)
speed = m_speed; speed = m_speed;
} }
createPhysics(offset, btVector3(0.0f, speed, 0.0f)); createPhysics(offset, btVector3(0.0f, speed, 0.0f),
new btSphereShape(0.5f*m_extend.getY()));
// unset no_contact_response flags, so that the spark // unset no_contact_response flags, so that the spark
// will bounce off the track // will bounce off the track
@ -55,13 +56,6 @@ void Spark::init(const lisp::Lisp* lisp, ssgEntity *spark)
lisp->get("force-to-target", m_st_force_to_target); lisp->get("force-to-target", m_st_force_to_target);
} // init } // init
// -----------------------------------------------------------------------------
btCollisionShape *Spark::createShape()
{
return new btSphereShape(0.5f*m_extend.getY());
} // createShape
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Spark::update(float dt) void Spark::update(float dt)
{ {

View File

@ -27,8 +27,6 @@ class Spark : public Flyable
private: private:
static float m_st_max_distance; // maximum distance for a spark to be attracted static float m_st_max_distance; // maximum distance for a spark to be attracted
static float m_st_force_to_target; static float m_st_force_to_target;
protected:
virtual btCollisionShape *createShape();
public: public:
Spark(Kart* kart); Spark(Kart* kart);

View File

@ -67,8 +67,6 @@ void STKConfig::load(const std::string filename)
CHECK_NEG(m_air_resistance, "air-resistance" ); CHECK_NEG(m_air_resistance, "air-resistance" );
CHECK_NEG(m_max_steer_angle, "max-steer-angle" ); CHECK_NEG(m_max_steer_angle, "max-steer-angle" );
CHECK_NEG(m_roll_resistance, "roll-resistance" ); CHECK_NEG(m_roll_resistance, "roll-resistance" );
CHECK_NEG(m_magnet_range_sq, "magnet-range" );
CHECK_NEG(m_magnet_time, "magnet-time" );
CHECK_NEG(m_brake_factor, "brake-factor" ); CHECK_NEG(m_brake_factor, "brake-factor" );
CHECK_NEG(m_brake_force, "brake-force" ); CHECK_NEG(m_brake_force, "brake-force" );
CHECK_NEG(m_jump_impulse, "jump-impulse" ); CHECK_NEG(m_jump_impulse, "jump-impulse" );
@ -86,7 +84,6 @@ void STKConfig::load(const std::string filename)
CHECK_NEG(m_wheelie_step, "wheelie-step" ); CHECK_NEG(m_wheelie_step, "wheelie-step" );
CHECK_NEG(m_wheelie_power_boost, "wheelie-power-boost" ); CHECK_NEG(m_wheelie_power_boost, "wheelie-power-boost" );
CHECK_NEG(m_magnet_min_range_sq, "magnet-min-range" );
CHECK_NEG(m_parachute_friction, "parachute-friction" ); CHECK_NEG(m_parachute_friction, "parachute-friction" );
CHECK_NEG(m_time_full_steer, "time-full-steer" ); CHECK_NEG(m_time_full_steer, "time-full-steer" );
@ -116,9 +113,6 @@ void STKConfig::load(const std::string filename)
CHECK_NEG(m_jump_velocity, "jump-velocity" ); CHECK_NEG(m_jump_velocity, "jump-velocity" );
CHECK_NEG(m_explosion_impulse, "explosion-impulse" ); CHECK_NEG(m_explosion_impulse, "explosion-impulse" );
// Precompute some handy values to reduce work later
m_magnet_range_sq = m_magnet_range_sq * m_magnet_range_sq;
m_magnet_min_range_sq = m_magnet_min_range_sq * m_magnet_min_range_sq;
} // load } // load
/** Init all values with invalid defaults, which are tested later. This /** Init all values with invalid defaults, which are tested later. This
@ -127,16 +121,16 @@ void STKConfig::load(const std::string filename)
*/ */
void STKConfig::init_defaults() void STKConfig::init_defaults()
{ {
m_wheel_base = m_height_cog = m_magnet_min_range_sq = m_roll_resistance = m_mass = m_wheel_base = m_height_cog = m_roll_resistance = m_mass =
m_corn_r = m_air_resistance = m_tire_grip = m_max_steer_angle = m_corn_r = m_air_resistance = m_tire_grip = m_max_steer_angle =
m_corn_f = m_inertia = m_anvil_weight = m_parachute_friction = m_corn_f = m_inertia = m_anvil_weight = m_parachute_friction =
m_engine_power = m_magnet_range_sq = m_jump_impulse = m_brake_factor = m_engine_power = m_jump_impulse = m_brake_factor =
m_anvil_speed_factor = m_time_full_steer = m_wheelie_max_pitch = m_anvil_speed_factor = m_time_full_steer = m_wheelie_max_pitch =
m_wheelie_max_speed_ratio = m_wheelie_pitch_rate = m_wheelie_restore_rate = m_wheelie_max_speed_ratio = m_wheelie_pitch_rate = m_wheelie_restore_rate =
m_wheelie_speed_boost = m_air_res_reduce[2] = m_air_res_reduce[1] = m_wheelie_speed_boost = m_air_res_reduce[2] = m_air_res_reduce[1] =
m_parachute_time = m_bomb_time = m_bomb_time_increase= m_anvil_time = m_parachute_time = m_bomb_time = m_bomb_time_increase= m_anvil_time =
m_zipper_time = m_zipper_force = m_zipper_time = m_zipper_force =
m_parachute_time_other = m_magnet_time = m_max_road_distance = m_shortcut_segments = m_parachute_time_other = m_max_road_distance = m_shortcut_segments =
//bullet physics data //bullet physics data
m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_damping_compression = m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_damping_compression =
m_friction_slip = m_roll_influence = m_wheel_radius = m_wheel_width = m_friction_slip = m_roll_influence = m_wheel_radius = m_wheel_width =
@ -161,9 +155,6 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
lisp->get("shortcut-skipped-segments", m_shortcut_segments ); lisp->get("shortcut-skipped-segments", m_shortcut_segments );
lisp->get("anvil-speed-factor", m_anvil_speed_factor ); lisp->get("anvil-speed-factor", m_anvil_speed_factor );
lisp->get("parachute-friction", m_parachute_friction ); lisp->get("parachute-friction", m_parachute_friction );
lisp->get("magnet-range", m_magnet_range_sq );
lisp->get("magnet-min-range", m_magnet_min_range_sq );
lisp->get("magnet-time", m_magnet_time );
lisp->get("jump-impulse", m_jump_impulse ); lisp->get("jump-impulse", m_jump_impulse );
lisp->get("reduce-air-resistance-racer", m_air_res_reduce[2] ); lisp->get("reduce-air-resistance-racer", m_air_res_reduce[2] );
lisp->get("reduce-air-resistance-driver", m_air_res_reduce[1] ); lisp->get("reduce-air-resistance-driver", m_air_res_reduce[1] );

View File

@ -29,9 +29,6 @@ public:
float m_anvil_weight; // Additional kart weight if anvil is attached float m_anvil_weight; // Additional kart weight if anvil is attached
float m_anvil_speed_factor; // To decrease speed once when attached float m_anvil_speed_factor; // To decrease speed once when attached
float m_parachute_friction; // Increased air friction when parachute float m_parachute_friction; // Increased air friction when parachute
float m_magnet_range_sq; // Squared range for magnets
float m_magnet_min_range_sq; // Squared minimum range for magnets
float m_magnet_time; // time a magnet is active
float m_jump_impulse; // percentage of gravity when jumping float m_jump_impulse; // percentage of gravity when jumping
float m_air_res_reduce[3]; // air resistance reduction for the three levels float m_air_res_reduce[3]; // air resistance reduction for the three levels
float m_parachute_time; // time a parachute is active float m_parachute_time; // time a parachute is active

View File

@ -124,7 +124,6 @@ void UserConfig::setDefaults()
m_display_fps = false; m_display_fps = false;
m_herring_style = "new"; m_herring_style = "new";
m_background_music = ""; m_background_music = "";
m_disable_magnet = true;
m_profile = 0; m_profile = 0;
m_use_kph = false; m_use_kph = false;
m_improved_physics = false; m_improved_physics = false;
@ -428,7 +427,6 @@ void UserConfig::loadConfig(const std::string& filename)
lisp->get("displayFPS", m_display_fps); lisp->get("displayFPS", m_display_fps);
lisp->get("herringStyle", m_herring_style); lisp->get("herringStyle", m_herring_style);
lisp->get("background-music", m_background_music); lisp->get("background-music", m_background_music);
lisp->get("disableMagnet", m_disable_magnet);
lisp->get("useKPH", m_use_kph); lisp->get("useKPH", m_use_kph);
lisp->get("improvedPhysics", m_improved_physics); lisp->get("improvedPhysics", m_improved_physics);
@ -605,8 +603,6 @@ void UserConfig::saveConfig(const std::string& filename)
writer->write("herringStyle\t", m_herring_style); writer->write("herringStyle\t", m_herring_style);
writer->writeComment("Background music file to use,"); writer->writeComment("Background music file to use,");
writer->write("background-music\t", m_background_music); writer->write("background-music\t", m_background_music);
writer->writeComment("Allow players to disable a magnet");
writer->write("disableMagnet\t", m_disable_magnet);
writer->writeComment("Use of kilometers per hours (km/h) instead of mph"); writer->writeComment("Use of kilometers per hours (km/h) instead of mph");
writer->write("useKPH\t", m_use_kph); writer->write("useKPH\t", m_use_kph);
writer->writeComment("With improved physics the gravity on a non-horizontal"); writer->writeComment("With improved physics the gravity on a non-horizontal");

View File

@ -142,7 +142,6 @@ public:
std::string m_herring_style; std::string m_herring_style;
std::string m_username; std::string m_username;
std::string m_background_music; std::string m_background_music;
bool m_disable_magnet; // true if a magnet can be dis- and enabled
bool m_replay_history; bool m_replay_history;
bool m_use_kph; bool m_use_kph;
bool m_improved_physics; bool m_improved_physics;

View File

@ -148,8 +148,8 @@ void Widget::update(const float DELTA)
if( m_track_num != -1 ) if( m_track_num != -1 )
{ {
track_manager->getTrack( m_track_num )->drawScaled2D( m_x, m_y, track_manager->getTrack( m_track_num )->drawScaled2D( (float)m_x,
m_width, m_height); (float)m_y, (float)m_width, (float)m_height);
} }
else else
{ {