Added XML support for the stk_config.data file and challenges; removed the LISP support.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3910 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c1d69986b0
commit
15902af969
@ -1,17 +1,15 @@
|
|||||||
;; -*- mode: lisp -*-
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
(challenge
|
<challenge
|
||||||
(id "penguinplaygroundgp")
|
id="penguinplaygroundgp"
|
||||||
(name _("Win Penguin Playground Grand\nPrix"))
|
name="_("Win Penguin Playground Grand\nPrix")"
|
||||||
(description _("Win Penguin Playground Grand\nPrix with 3 'Racer' Level AI karts."))
|
description="_("Win Penguin Playground Grand\nPrix with 3 'Racer' Level AI karts.")"
|
||||||
(unlock-mode "followtheleader" _("Follow the Leader"))
|
unlock-mode="followtheleader _(Follow the Leader)"
|
||||||
(major "grandprix")
|
major="grandprix"
|
||||||
(minor "quickrace")
|
minor="quickrace"
|
||||||
(gp "penguinplayground")
|
gp="penguinplayground"
|
||||||
(difficulty "hard")
|
difficulty="hard"
|
||||||
(karts 4)
|
karts="4"
|
||||||
(position 1)
|
position="1"
|
||||||
)
|
/>
|
||||||
|
|
||||||
;; EOF ;;
|
|
||||||
|
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
;; -*- mode: lisp -*-
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
(challenge
|
<challenge
|
||||||
(id "worldsend")
|
id="worldsend"
|
||||||
(name _("Win the At World's End\nGrand Prix"))
|
name=_("Win the At World's End\nGrand Prix")
|
||||||
(description _("Come first in the At World's End\nGrand Prix with 3 'Racer'\nLevel AI karts."))
|
description=_("Come first in the At World's End\nGrand Prix with 3 'Racer'\nLevel AI karts.")
|
||||||
(unlock-gp "alltracks")
|
unlock-gp="alltracks"
|
||||||
(depend-on "islandfollow")
|
depend-on="islandfollow"
|
||||||
(major "grandprix")
|
major="grandprix"
|
||||||
(minor "quickrace")
|
minor="quickrace"
|
||||||
(gp "atworldsend")
|
gp="atworldsend"
|
||||||
(difficulty "hard")
|
difficulty="hard"
|
||||||
(karts 4)
|
karts="4"
|
||||||
(position 1)
|
position="1"
|
||||||
)
|
/>
|
||||||
|
|
||||||
;; EOF ;;
|
|
||||||
|
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
;; -*- mode: lisp -*-
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
(challenge
|
<challenge
|
||||||
(id "islandfollow")
|
id="islandfollow"
|
||||||
(name _("Follow the Leader on a\nDesert Island"))
|
name=_("Follow the Leader on a\nDesert Island")
|
||||||
(description _("Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island."))
|
description=_("Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island.")
|
||||||
(unlock-gp "atworldsend")
|
unlock-gp="atworldsend"
|
||||||
(depend-on "tothemoonandbackgp" "tollwayhead2head" "tollwaytime" "citytime")
|
depend-on="tothemoonandbackgp tollwayhead2head tollwaytime citytime"
|
||||||
(major "single")
|
major="single"
|
||||||
(minor "followtheleader")
|
minor="followtheleader"
|
||||||
(track "islandtrack")
|
track="islandtrack"
|
||||||
(difficulty "easy")
|
difficulty="easy"
|
||||||
(laps 3)
|
laps="3"
|
||||||
(karts 4)
|
karts="4"
|
||||||
(position 2)
|
position="2"
|
||||||
)
|
/>
|
||||||
|
|
||||||
;; EOF ;;
|
|
||||||
|
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
;; -*- mode: lisp -*-
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
(challenge
|
<challenge
|
||||||
(id "tothemoonandbackgp")
|
id="tothemoonandbackgp"
|
||||||
(name _("Win To the Moon and Back\nGrand Prix"))
|
name=_("Win To the Moon and Back\nGrand Prix")
|
||||||
(description _("Win the To the Moon and Back\nGrand Prix with 3 'Racer'\nLevel AI karts."))
|
description=_("Win the To the Moon and Back\nGrand Prix with 3 'Racer'\nLevel AI karts.")
|
||||||
(unlock-gp "snagdrive")
|
unlock-gp="snagdrive"
|
||||||
(depend-on "energyshiftingsands" "junglefollow")
|
depend-on="energyshiftingsands junglefollow"
|
||||||
(major "grandprix")
|
major="grandprix"
|
||||||
(minor "quickrace")
|
minor="quickrace"
|
||||||
(gp "tothemoonandback")
|
gp="tothemoonandback"
|
||||||
(difficulty "hard")
|
difficulty="hard"
|
||||||
(karts 4)
|
karts="4"
|
||||||
(position 1)
|
position="1"
|
||||||
)
|
/>
|
||||||
|
|
||||||
;; EOF ;;
|
|
||||||
|
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
;; -*- mode: lisp -*-
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
(challenge
|
<challenge
|
||||||
(id "energyshiftingsands")
|
id="energyshiftingsands"
|
||||||
(name _("Collect the Pharaohs Treasure"))
|
name=_("Collect the Pharaohs Treasure")
|
||||||
(description _("Finish with at least 9 nitro \npoints on 3 laps of Shifting Sands\nin under 2:20 minutes."))
|
description=_("Finish with at least 9 nitro \npoints on 3 laps of Shifting Sands\nin under 2:20 minutes.")
|
||||||
(unlock-gp "tothemoonandback")
|
unlock-gp="tothemoonandback"
|
||||||
(depend-on "energymathclass" "racetracktime")
|
depend-on="energymathclass racetracktime"
|
||||||
(major "single")
|
major="single"
|
||||||
(minor "quickrace")
|
minor="quickrace"
|
||||||
(track "sandtrack")
|
track="sandtrack"
|
||||||
(difficulty "medium")
|
difficulty="medium"
|
||||||
(karts 1)
|
karts="1"
|
||||||
(laps 3)
|
laps="3"
|
||||||
(energy 9)
|
energy="9"
|
||||||
(time 140)
|
time="140"
|
||||||
)
|
/>
|
||||||
|
|
||||||
;; EOF ;;
|
|
||||||
|
|
||||||
|
@ -1,174 +1,252 @@
|
|||||||
;; -*- mode: lisp -*-
|
|
||||||
|
|
||||||
(config
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
;; STK parameters
|
<config>
|
||||||
;; --------------
|
|
||||||
(min-kart-version 1 ) ;; Minimum and maximum .kart files supported
|
|
||||||
(max-kart-version 1 ) ;; by this binary. Older/newer files are ignored.
|
|
||||||
(min-track-version 1 ) ;; Minimum and maximum .track files supported
|
|
||||||
(max-track-version 1 ) ;; by this binary, older/newer files are ignored.
|
|
||||||
(max-karts 8 ) ;; maximum number of karts
|
|
||||||
(scores 10 8 6 5 4 3 2 1 ) ;; 10 8 6 5 4 3 2 1 0 0
|
|
||||||
(grid-order 1 ) ;; order for grand prix, 1 is most
|
|
||||||
;; points 1st, 0 is least points
|
|
||||||
;; 1st
|
|
||||||
(title-music "main_theme.music")
|
|
||||||
;; Two lists which must have the same length, containing the list of all
|
|
||||||
;; possible main menu and background images.
|
|
||||||
(mainmenu-background "st_title_screen.rgb" "st_title_screen2.rgb")
|
|
||||||
(menu-background "menu_background.rgb" "menu_background2.rgb")
|
|
||||||
|
|
||||||
(max-history 10000) ;; maximum number of history frames.
|
<!-- STK PARAMETERS
|
||||||
(max-skidmarks 100) ;; max. number of skidmarks per kart.
|
|
||||||
(skid-fadeout-time 60) ;; Time till skidm marks fade out
|
|
||||||
(slowdown-factor 10) ;; Engine reduction depending on terrain,
|
|
||||||
;; see kart for details.
|
|
||||||
(near-ground 2) ;; Distance above ground when the upright
|
|
||||||
;; constraint will be disabled to allow
|
|
||||||
;; more violent explosions.
|
|
||||||
(delay-finish-time 10) ;; delay till race results are displayed.
|
|
||||||
(music-credit-time 10) ;; time for which the music credits
|
|
||||||
;; are displayed.
|
|
||||||
(final-camera-time 1.5) ;; time for the final camera to reach
|
|
||||||
;; its destination
|
|
||||||
|
|
||||||
;; Attachment related parameters
|
min-kart-version and max-kart-version are the the minimum and maximum .kart
|
||||||
;; -----------------------------
|
files supported. Older/newer files are ignored.
|
||||||
(anvil-weight 150.0 ) ;; additional weight an anvil adds to a kart
|
|
||||||
(anvil-speed-factor 0.2 ) ;; additional slowdown caused by anvil
|
|
||||||
(parachute-friction 2.0 ) ;; friction increase when a parachute is sttached
|
|
||||||
(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-done-fraction 0.7 ) ;; fraction of speed when lost will detach parachute
|
|
||||||
(bomb-time 30.0 ) ;; time till a bomb explodes
|
|
||||||
(bomb-time-increase -5.0 ) ;; time added to timer when bomb is passed on
|
|
||||||
(leader-intervals 30 20 10) ;; Time till a kart is removed in follow leader mode
|
|
||||||
(anvil-time 2.0 ) ;; time an anvil is active
|
|
||||||
(zipper-time 3.5 ) ;; time a zipper is active
|
|
||||||
(zipper-force 250.0 ) ;; additional zipper force
|
|
||||||
(zipper-speed-gain 4.5 ) ;; one time additional speed
|
|
||||||
(zipper-max-speed-fraction 0.2 ) ;; fraction of max speed allowed past regular max speed
|
|
||||||
|
|
||||||
(shortcut-length 90 ) ;; leaving the road and coming back on it more than
|
min-track-version and max-track-version are the minimum and maximum .track
|
||||||
;; x 'meters" later is considered to be a shortcut
|
files supported, older/newer files are ignored.
|
||||||
(offroad-tolerance 0.15) ;; Widen the road 15% for shortcut detection.
|
|
||||||
(enable_networking #f ) ;; For now disable networking
|
|
||||||
(explosion-impulse 10000.0 ) ;; explosion impulse on not directly hit karts
|
|
||||||
(explosion-impulse-objects 500.0) ;; explosion impulse for physics objects (smaller
|
|
||||||
;; else a cone e.g. will be pushed way too far)
|
|
||||||
|
|
||||||
;; The following files are the defaults for karts
|
max-karts is maximum number of karts.
|
||||||
;; ----------------------------------------------
|
scores are the number of points given when the race ends.
|
||||||
(kart-defaults
|
grid-order is the grand prix order, 1 = most points 1st, 0 = least points 1st.
|
||||||
(wheel-base 1.2 )
|
title-music is umm... the title music.
|
||||||
(heightCOG 0.2 )
|
|
||||||
(time-full-steer 0.25 )
|
|
||||||
;; Time for the AI to go from neutral steering to extreme
|
|
||||||
;; left (or right). This can be used to reduce 'shaking' of
|
|
||||||
;; AI karts caused by changing steering direction too often.
|
|
||||||
;; It also helps with making it easier to push the AI karts
|
|
||||||
;; (otherwise micro-corrections make this nearly impossible).
|
|
||||||
;; A value of 1/maxFPS / 2 will guarantee that the wheel can
|
|
||||||
;; go from -1 to +1 steering in one frame, basically
|
|
||||||
;; disabling this mechanism.
|
|
||||||
(time-full-steer-ai 0.1 )
|
|
||||||
(corn-f 4 )
|
|
||||||
(corn-r 4 )
|
|
||||||
|
|
||||||
;; Shift of the chassis with regards to the center of mass. E.g. with the
|
mainmenu-background and menu-background must have the same length, containing
|
||||||
;; the value commented out below the chassis will be 30 cm higher than the
|
all the possible main menu and background images.
|
||||||
;; center of mass - or the center of mass will be 30 cm lower than the
|
|
||||||
;; middle of the chassis. So this effectively lowers the center of mass,
|
|
||||||
;; making the kart more stable and less likely to topple over.
|
|
||||||
;; Default (if nothing is defined here) is that the center of the mass is
|
|
||||||
;; at the very bottom of the chassis!
|
|
||||||
;;(gravity-center-shift 0 0 0.3)
|
|
||||||
|
|
||||||
(nitro-power-boost 3 ) ;; increase in engine power, i.e. 1=plus 100%
|
max-history is the maximum number of history frames.
|
||||||
|
|
||||||
;; Skidding related parameters:
|
max-skidmarks is the max. number o skidmarks per kart.
|
||||||
(skid-increase 1.05) ;; Multiplicative increase of skidding factor
|
skid-fadeout-time is the time till the skid marks fade out
|
||||||
;; in each frame.
|
|
||||||
(skid-decrease 0.95) ;; Multiplicative decrease of skidding factor
|
|
||||||
;; in each frame.
|
|
||||||
(skid-max 2.5 ) ;; Maximum skidding factor = maximum increase
|
|
||||||
;; of steering angle.
|
|
||||||
(time-till-max-skid 0.4 ) ;; Time till maximum skidding is reached.
|
|
||||||
(skid-visual 0.16) ;; Additional graphical rotation of kart.
|
|
||||||
|
|
||||||
(slipstream-length 5 ) ;; How far behind a kart slipstream works
|
slowdown-factor is the engine reduction depending on terrain; see kart for
|
||||||
(slipstream-time 5 ) ;; How many seconds of sstream give
|
details
|
||||||
;; maximum benefit
|
|
||||||
(slipstream-add-power 3 ) ;; Additional power due to sstreaming.
|
|
||||||
;; 1 = +100%
|
|
||||||
|
|
||||||
;; Bullet physics attributes
|
near-ground is the distance above ground when the upright constraint will be
|
||||||
(brake-factor 11.0 )
|
disabled to allow more violent explosions.
|
||||||
;; Defines the smallest turn radius at lowest speed (4.64 m at
|
|
||||||
;; speed 0) and at high speed (13.5 m at speed 12 m/s). Maximum
|
|
||||||
;; steering angles for speeds in between will be interpolated. This
|
|
||||||
;; allows for tighter turns at lower speeds. The actual steering
|
|
||||||
;; angle is dependent on the wheel base of the kart:
|
|
||||||
;; radius = wheel_base/sin(steering_angle)
|
|
||||||
;; By specifying the radius the steering behaviour can be defined
|
|
||||||
;; independent of the kart size.
|
|
||||||
(min-speed-radius 0 6.64)
|
|
||||||
(max-speed-radius 15 21.5)
|
|
||||||
;; Different engine powers for different difficulties:
|
|
||||||
;; hard, medium, low level order!
|
|
||||||
(engine-power 400 400 300 )
|
|
||||||
;; Different maximum speed for different difficulties:
|
|
||||||
;; hard, medium, low level order!
|
|
||||||
(max-speed 32.22 28 25 ) ;; = 116 101 90 km/h
|
|
||||||
(mass 225 )
|
|
||||||
(suspension-stiffness 48.0 )
|
|
||||||
(wheel-damping-relaxation 20 )
|
|
||||||
(wheel-damping-compression 4.4 )
|
|
||||||
(friction-slip 10000000 )
|
|
||||||
(roll-influence 0.03 )
|
|
||||||
(wheel-radius 0.25 )
|
|
||||||
(wheel-width 0.3 )
|
|
||||||
(chassis-linear-damping 0.2 )
|
|
||||||
(chassis-angular-damping 30.2 )
|
|
||||||
(max-speed-reverse-ratio 0.3 ) ;; percentage of max speed for reverse gear
|
|
||||||
(suspension-rest 0.2 )
|
|
||||||
(suspension-travel-cm 19 )
|
|
||||||
|
|
||||||
;; The z-axis velocity set when a jump is initiated. This will cause the
|
delay-finish-time is the delay till the race results are displayed
|
||||||
;; kart to start rising, till it is pulled back by gravity. A higher value
|
music-credit-time is the time for which the music credits are displayed
|
||||||
;; means higher Z velocity, meaning the kart will rise faster and higher,
|
final-camera-time is the time for the final camera to reach it's destination
|
||||||
;; and will be in the air longer
|
|
||||||
(jump-velocity 3.0 )
|
|
||||||
|
|
||||||
;; z-axis offset when kart is being put back on track after being rescued
|
-->
|
||||||
(z-rescue-offset 0.0 ) ;; fraction of kart height
|
|
||||||
|
|
||||||
;; The following two vectors define at what ratio of the maximum speed what
|
<stk-parameters
|
||||||
;; gear is selected, e.g. 0.25 means: if speed <=0.25*maxSpeed --> gear 1,
|
min-kart-version="1"
|
||||||
;; 0.5 means: if speed <=0.5 *maxSpeed --> gear 2
|
max-kart-version="1"
|
||||||
;; The next vector contains the increase in max power (to simulate different
|
min-track-version="1"
|
||||||
;; gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1
|
max-track-version="1"
|
||||||
;; | first | second | third |
|
max-karts="8"
|
||||||
;; The position of the physics raycast wheels relative to the center of
|
scores="10 8 6 5 4 3 2 1"
|
||||||
;; gravity. Default is to use the corners of the chassis to attach the
|
grid-order="1"
|
||||||
;; wheels to.
|
title-music="main_theme.music"
|
||||||
;;(wheel-front-right (physics-position 0.38 0.6 0))
|
mainmenu-background="st_title_screen.rgb st_title_screen2.rgb"
|
||||||
;;(wheel-front-left (physics-position -0.38 0.6 0))
|
menu-background="menu_background.rgb menu_background2.rgb"
|
||||||
;;(wheel-rear-right (physics-position 0.38 -0.6 0))
|
max-history="10000"
|
||||||
;;(wheel-rear-left (physics-position -0.38 -0.6 0))
|
max-skidmarks="100"
|
||||||
|
skid-fadeout-time="60"
|
||||||
|
slowdown-factor="10"
|
||||||
|
near-ground="2"
|
||||||
|
delay-finish-time="10"
|
||||||
|
music-credit-time="10"
|
||||||
|
final-camera-time="1.5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- ATTACHMENT PARAMETERS
|
||||||
|
|
||||||
|
anvil-weight is the additional weight an anvil adds to a kart
|
||||||
|
anvil-speed-factor is the additional slowdown caused by the anvil
|
||||||
|
parachute-friction is the friction increase when a parachute is attached
|
||||||
|
parachute-time is the time an attached parachute is active
|
||||||
|
parachute-time-other is the time a parachute attached from other kart works
|
||||||
|
parachute-done-fraction is the fraction of speed when lost will detach
|
||||||
|
parachute
|
||||||
|
|
||||||
|
bomb-time is the time till a bomb explodes
|
||||||
|
bomb-time-increase is the time added to timer when bomb is passed on
|
||||||
|
leader-intervals is the time till a kart is removed in follow leader mode
|
||||||
|
anvil-time is the time an anvil is active
|
||||||
|
zipper-time is the time a zipper is active
|
||||||
|
zipper-force is the additional zipper force
|
||||||
|
zipper-speed-gain is the one time additional speed
|
||||||
|
-->
|
||||||
|
|
||||||
|
<attachment-parameters
|
||||||
|
anvil-weight="150.0"
|
||||||
|
anvil-speed-factor="0.2"
|
||||||
|
parachute-friction="2.0"
|
||||||
|
parachute-time="4.0"
|
||||||
|
parachute-time-other="8.0"
|
||||||
|
parachute-done-fraction="0.7"
|
||||||
|
bomb-time="30.0"
|
||||||
|
bomb-time-increase="-5.0"
|
||||||
|
leader-intervals="30 20 10"
|
||||||
|
anvil-time="2.0"
|
||||||
|
zipper-time="3.5"
|
||||||
|
zipper-force="250.0"
|
||||||
|
zipper-speed-gain="4.5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- GENERAL KART DEFAULTS
|
||||||
|
|
||||||
|
time-full-steer = is the time when a player's input goes from neutral
|
||||||
|
steering to extreme left or right.
|
||||||
|
|
||||||
|
time-full-steer-ai is the time for the AI to go from neutral steering to
|
||||||
|
extreme left (or right). This can be used to reduce 'shaking' of AI karts
|
||||||
|
caused by changing steering direction too often. It also helps with making it
|
||||||
|
easier to push the AI karts (otherwise micro-corrections make this nearly
|
||||||
|
impossible). A value of 1/maxFPS / 2 will guarantee that the wheel can go from
|
||||||
|
-1 to +1 steering in one frame, basically disabling this mechanism.
|
||||||
|
|
||||||
|
gravity-center-shift is the shift of the chassis with regards to the center of
|
||||||
|
mass. E.g. with the the value commented out below the chassis will be 30 cm
|
||||||
|
higher than the center of mass - or the center of mass will be 30 cm lower
|
||||||
|
than the middle of the chassis. So this effectively lowers the center of
|
||||||
|
mass, making the kart more stable and less likely to topple over. Default (if
|
||||||
|
nothing is defined here) is that the center of the mass is at the very bottom
|
||||||
|
of the chassis!
|
||||||
|
|
||||||
|
nitro-power-boost is the increase in engine power, i.e. 1=plus 100%
|
||||||
|
|
||||||
|
skid-increase: multiplicative increase of skidding factor in each frame.
|
||||||
|
skid-decrease: multiplicative decrease of skidding factor in each frame.
|
||||||
|
skid-max: maximum skidding factor = maximum increase of steering angle.
|
||||||
|
time-till-max-skid: Time till maximum skidding is reached.
|
||||||
|
skid-visual: Additional graphical rotation of kart.
|
||||||
|
slipstrea slipstream-length: How far behind a kart slipstream works
|
||||||
|
slipstream-time: How many seconds of sstream give maximum benefit
|
||||||
|
slipstream-add-power: Additional power due to sstreaming. 1 = +100%
|
||||||
|
|
||||||
|
min-speed-radius and max-speed-radius define the smallest turn radius at
|
||||||
|
lowest speed (4.64 m at speed 0) and at high speed (13.5 m at speed 12 m/s).
|
||||||
|
Maximum steering angles for speeds in between will be interpolated. This
|
||||||
|
allows for tighter turns at lower speeds. The actual steering angle is
|
||||||
|
dependent on the wheel base of the kart:
|
||||||
|
radius = wheel_base/sin(steering_angle)
|
||||||
|
By specifying the radius the steering behaviour can be defined independent
|
||||||
|
of the kart size.
|
||||||
|
|
||||||
|
|
||||||
|
engine-power and max-speed have 3 values, one for hard, medium and low
|
||||||
|
difficulties; Max speed right now would be 116 101 90 km/h.
|
||||||
|
|
||||||
|
mass: kart's mass
|
||||||
|
suspension-stiffness: kart's suspension stiffness
|
||||||
|
|
||||||
|
max-speed-reverse-ratio is the percentage of max speed for reverse gear
|
||||||
|
|
||||||
|
jump-velocity is the z-axis velocity set when a jump is initiated. This
|
||||||
|
will cause the kart to start rising, till it is pulled back by gravity.
|
||||||
|
A higher value means higher Z velocity, meaning the kart will rise faster
|
||||||
|
and higher, and will be in the air longer
|
||||||
|
|
||||||
|
z-rescue-offset is the z-axis offset when kart is being put back on track
|
||||||
|
after being rescued, it's a fraction of kart height
|
||||||
|
|
||||||
|
gear-switch-ratio defines at what ratio of the maximum speed what gear is
|
||||||
|
selected, e.g. 0.25 means that if the speed is bigger or equal to 0.25 x
|
||||||
|
maxSpeed then use gear 1, 0.5 means if the speed is bigger or equal to 0.5 x
|
||||||
|
maxSpeed then gear 2.
|
||||||
|
|
||||||
|
gear-power-increase contains the increase in max power (to simulate
|
||||||
|
different gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1
|
||||||
|
| first | second | third | .
|
||||||
|
|
||||||
|
wheel-front-right, wheel-front-left, wheel-rear-right and wheel-rear-left
|
||||||
|
give the position of the physics raycast wheels relative to the center of
|
||||||
|
gravity. Default is to use the corners of the chassis to attach the wheels
|
||||||
|
to.
|
||||||
|
|
||||||
|
rubber-band-max-length is the maximum length of rubber band
|
||||||
|
|
||||||
|
rubber-band-force is the force a plunger/rubber band applies to the kart(s).
|
||||||
|
|
||||||
|
rubber-band-duration is the duration a rubber band acts.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<general-kart-defaults
|
||||||
|
wheel-base="1.2"
|
||||||
|
heightCOG="0.2"
|
||||||
|
time-full-steer="0.25"
|
||||||
|
time-full-steer-ai="0.1"
|
||||||
|
corn-f ="4"
|
||||||
|
corn-r="4"
|
||||||
|
gravity-center-shift="0 0 0.3"
|
||||||
|
nitro-power-boost="3"
|
||||||
|
|
||||||
|
skid-increase="1.05"
|
||||||
|
skid-decrease="0.95"
|
||||||
|
skid-max="2.5"
|
||||||
|
time-till-max-skid="0.4"
|
||||||
|
skid-visual="0.16"
|
||||||
|
slipstream-length="5"
|
||||||
|
slipstream-time="5"
|
||||||
|
slipstream-add-power="3"
|
||||||
|
|
||||||
|
brake-factor="11.0"
|
||||||
|
min-speed-radius="0 6.64"
|
||||||
|
max-speed-radius="15 21.5"
|
||||||
|
engine-power="400 400 300"
|
||||||
|
max-speed="32.22 28 25"
|
||||||
|
mass="225"
|
||||||
|
suspension-stiffness="48.0"
|
||||||
|
wheel-damping-relaxation="20"
|
||||||
|
wheel-damping-compression="4.4"
|
||||||
|
friction-slip="10000000"
|
||||||
|
roll-influence="0.03"
|
||||||
|
wheel-radius="0.25"
|
||||||
|
wheel-width="0.3"
|
||||||
|
chassis-linear-damping="0.2"
|
||||||
|
chassis-angular-damping="30.2"
|
||||||
|
max-speed-reverse-ratio="0.3"
|
||||||
|
suspension-rest="0.2"
|
||||||
|
suspension-travel-cm="19"
|
||||||
|
jump-velocity="3.0"
|
||||||
|
z-rescue-offset="0.0"
|
||||||
|
wheel-front-right="0.38 0.6 0"
|
||||||
|
wheel-front-left="-0.38 0.6 0"
|
||||||
|
wheel-rear-right="0.38 -0.6 0"
|
||||||
|
wheel-rear-left="-0.38 -0.6 0"
|
||||||
|
gear-switch-ratio="0.25 0.7 1.0"
|
||||||
|
gear-power-increase="2.2 1.7 1.3"
|
||||||
|
upright-tolerance="0.2"
|
||||||
|
upright-max-force="30"
|
||||||
|
track-connection-accel="2"
|
||||||
|
rubber-band-max-length="50"
|
||||||
|
rubber-band-force="1500"
|
||||||
|
rubber-band-duration="1"
|
||||||
|
camera-max-accel="10"
|
||||||
|
camera-max-brake="10"
|
||||||
|
camera-distance="3.0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- MISC DEFAULTS
|
||||||
|
|
||||||
|
shortcut-length is the length that when leaving the road and coming back on
|
||||||
|
it more than X 'meters"
|
||||||
|
later is considered to be a shortcut
|
||||||
|
|
||||||
|
offroad-tolerance widens the road % for shortcut detection.
|
||||||
|
|
||||||
|
enable-networking is a boolean value that enables / disables networking
|
||||||
|
explosion-impulse is the push from explosions when karts aren't hit directly
|
||||||
|
explosion-impulse-objects 500.0 is the impulse for physics objects (smaller
|
||||||
|
ones like the cone, will be pushed way too far
|
||||||
|
-->
|
||||||
|
|
||||||
|
<misc-defaults
|
||||||
|
shortcut-length="90"
|
||||||
|
offroad-tolerance="0.15"
|
||||||
|
enable-networking="f"
|
||||||
|
explosion-impulse="10000.0"
|
||||||
|
explosion-impulse-objects="500.0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</config>
|
||||||
|
|
||||||
(gear-switch-ratio 0.25 0.7 1.0)
|
|
||||||
(gear-power-increase 2.2 1.7 1.3)
|
|
||||||
(upright-tolerance 0.2)
|
|
||||||
(upright-max-force 30)
|
|
||||||
(track-connection-accel 2)
|
|
||||||
(rubber-band-max-length 50) ;; Maximum length of rubber band
|
|
||||||
(rubber-band-force 1500) ;; Force a plunger/rubber band applies to the kart(s).
|
|
||||||
(rubber-band-duration 1) ;; Duration a rubber band acts.
|
|
||||||
(camera-max-accel 10)
|
|
||||||
(camera-max-brake 10)
|
|
||||||
(camera-distance 3.0)
|
|
||||||
) ;; end kart-defaults
|
|
||||||
)
|
|
||||||
;; EOF ;;
|
|
||||||
|
@ -44,20 +44,18 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
m_gp_id = "";
|
m_gp_id = "";
|
||||||
m_energy = -1;
|
m_energy = -1;
|
||||||
|
|
||||||
lisp::Parser parser;
|
XMLNode *root = new XMLNode( filename );
|
||||||
const lisp::Lisp* const ROOT = parser.parse(filename);
|
// if(!root || root->getName()!="challenges")
|
||||||
|
if(!root || root->getName()!="challenge")
|
||||||
const lisp::Lisp* const lisp = ROOT->getLisp("challenge");
|
|
||||||
if(!lisp)
|
|
||||||
{
|
{
|
||||||
delete ROOT;
|
delete root;
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "Couldn't load challenge '" << filename << "': no challenge node.";
|
msg << "Couldn't load challenge '" << filename << "': no challenge node.";
|
||||||
throw std::runtime_error(msg.str());
|
throw std::runtime_error(msg.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mode;
|
std::string mode;
|
||||||
lisp->get("major", mode);
|
root->get("major", &mode);
|
||||||
|
|
||||||
if(mode=="grandprix")
|
if(mode=="grandprix")
|
||||||
m_major = RaceManager::MAJOR_MODE_GRAND_PRIX;
|
m_major = RaceManager::MAJOR_MODE_GRAND_PRIX;
|
||||||
@ -66,7 +64,7 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
else
|
else
|
||||||
error("major");
|
error("major");
|
||||||
|
|
||||||
lisp->get("minor", mode);
|
root->get("minor", &mode);
|
||||||
if(mode=="timetrial")
|
if(mode=="timetrial")
|
||||||
m_minor = RaceManager::MINOR_MODE_TIME_TRIAL;
|
m_minor = RaceManager::MINOR_MODE_TIME_TRIAL;
|
||||||
else if(mode=="quickrace")
|
else if(mode=="quickrace")
|
||||||
@ -75,21 +73,26 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
m_minor = RaceManager::MINOR_MODE_FOLLOW_LEADER;
|
m_minor = RaceManager::MINOR_MODE_FOLLOW_LEADER;
|
||||||
else
|
else
|
||||||
error("minor");
|
error("minor");
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
if(!lisp->get("name", s) ) error("name");
|
if(!root->get("name", &s) ) error("name");
|
||||||
setName(s);
|
setName(s);
|
||||||
if(!lisp->get("id", s) ) error("id");
|
|
||||||
|
if(!root->get("id", &s) ) error("id");
|
||||||
setId(s);
|
setId(s);
|
||||||
if(!lisp->get("description", s) ) error("description");
|
|
||||||
setChallengeDescription(s);
|
if(!root->get("description", &s) ) error("description");
|
||||||
if(!lisp->get("karts", m_num_karts) ) error("karts");
|
setChallengeDescription(s);
|
||||||
|
|
||||||
|
if(!root->get("karts", &m_num_karts) ) error("karts");
|
||||||
|
|
||||||
// Position is optional except in GP and FTL
|
// Position is optional except in GP and FTL
|
||||||
if(!lisp->get("position", m_position) &&
|
if(!root->get("position", &m_position) &&
|
||||||
//RaceManager::getWorld()->areKartsOrdered() ) // FIXME - order and optional are not the same thing
|
//RaceManager::getWorld()->areKartsOrdered() ) // FIXME - order and optional are not the same thing
|
||||||
(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
||||||
m_major==RaceManager::MAJOR_MODE_GRAND_PRIX))
|
m_major==RaceManager::MAJOR_MODE_GRAND_PRIX))
|
||||||
error("position");
|
error("position");
|
||||||
lisp->get("difficulty", s);
|
root->get("difficulty", &s);
|
||||||
if(s=="easy")
|
if(s=="easy")
|
||||||
m_difficulty = RaceManager::RD_EASY;
|
m_difficulty = RaceManager::RD_EASY;
|
||||||
else if(s=="medium")
|
else if(s=="medium")
|
||||||
@ -99,32 +102,35 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
else
|
else
|
||||||
error("difficulty");
|
error("difficulty");
|
||||||
|
|
||||||
lisp->get("time", m_time ); // one of time/position
|
root->get("time", &m_time ); // one of time/position
|
||||||
lisp->get("position", m_position ); // must be set
|
|
||||||
|
root->get("position", &m_position ); // must be set
|
||||||
if(m_time<0 && m_position<0) error("position/time");
|
if(m_time<0 && m_position<0) error("position/time");
|
||||||
lisp->get("energy", m_energy ); // This is optional
|
|
||||||
|
root->get("energy", &m_energy ); // This is optional
|
||||||
if(m_major==RaceManager::MAJOR_MODE_SINGLE)
|
if(m_major==RaceManager::MAJOR_MODE_SINGLE)
|
||||||
{
|
{
|
||||||
if(!lisp->get("track", m_track_name )) error("track");
|
if(!root->get("track", &m_track_name )) error("track");
|
||||||
if(!lisp->get("laps", m_num_laps ) &&
|
if(!root->get("laps", &m_num_laps ) &&
|
||||||
m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||||
error("laps");
|
error("laps");
|
||||||
}
|
}
|
||||||
else // GP
|
else // GP
|
||||||
{
|
{
|
||||||
if(!lisp->get("gp", m_gp_id )) error("gp");
|
if(!root->get("gp", &m_gp_id )) error("gp");
|
||||||
}
|
}
|
||||||
|
|
||||||
getUnlocks(lisp, "unlock-track", UNLOCK_TRACK);
|
getUnlocks(root, "unlock-track", UNLOCK_TRACK);
|
||||||
getUnlocks(lisp, "unlock-gp", UNLOCK_GP );
|
getUnlocks(root, "unlock-gp", UNLOCK_GP );
|
||||||
getUnlocks(lisp, "unlock-mode", UNLOCK_MODE );
|
getUnlocks(root, "unlock-mode", UNLOCK_MODE );
|
||||||
getUnlocks(lisp, "unlock-difficulty", UNLOCK_DIFFICULTY);
|
getUnlocks(root, "unlock-difficulty", UNLOCK_DIFFICULTY);
|
||||||
getUnlocks(lisp, "unlock-kart", UNLOCK_KART);
|
getUnlocks(root, "unlock-kart", UNLOCK_KART);
|
||||||
|
|
||||||
std::vector<std::string> vec;
|
std::vector< std::string > deps;
|
||||||
lisp->getVector("depend-on", vec);
|
root->get("depend-on", &deps);
|
||||||
for(unsigned int i=0; i<vec.size(); i++) addDependency(vec[i]);
|
for(unsigned int i=0; i<deps.size(); i++) addDependency(deps[i]);
|
||||||
delete ROOT;
|
|
||||||
|
delete root;
|
||||||
|
|
||||||
} // ChallengeData
|
} // ChallengeData
|
||||||
|
|
||||||
@ -167,48 +173,49 @@ void ChallengeData::check() const
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ChallengeData::getUnlocks(const XMLNode *root, const std:: string type,
|
||||||
void ChallengeData::getUnlocks(const lisp::Lisp *lisp, const char* type,
|
|
||||||
REWARD_TYPE reward)
|
REWARD_TYPE reward)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std:: string attrib;
|
||||||
v.clear();
|
root->get(type, &attrib);
|
||||||
|
if( attrib . empty() ) return;
|
||||||
|
|
||||||
lisp->getVector(type, v);
|
std:: vector< std:: string > data;
|
||||||
for(unsigned int i=0; i<v.size(); i++)
|
std:: size_t space = attrib.find_first_of(' ');
|
||||||
|
data.push_back( attrib.substr(0, space) );
|
||||||
|
if( space != std:: string:: npos )
|
||||||
{
|
{
|
||||||
switch(reward)
|
data.push_back( attrib.substr(space, std:: string:: npos) );
|
||||||
{
|
|
||||||
case UNLOCK_TRACK: addUnlockTrackReward (v[i] ); break;
|
|
||||||
case UNLOCK_GP: addUnlockGPReward (v[i] ); break;
|
|
||||||
case UNLOCK_MODE: if(i+1<v.size())
|
|
||||||
{
|
|
||||||
addUnlockModeReward (v[i], v[i+1]);
|
|
||||||
i++; break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(stderr, "Unlock mode name missing.\n");
|
|
||||||
break;
|
|
||||||
case UNLOCK_DIFFICULTY: if(i+1<v.size())
|
|
||||||
{
|
|
||||||
addUnlockDifficultyReward(v[i], v[i+1]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(stderr, "Difficult name missing.\n");
|
|
||||||
break;
|
|
||||||
case UNLOCK_KART: if(i+1<v.size())
|
|
||||||
{
|
|
||||||
addUnlockKartReward(v[i], v[i+1]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(stderr, "Kart name missing.\n");
|
|
||||||
break;
|
|
||||||
} // switch
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(reward)
|
||||||
|
{
|
||||||
|
case UNLOCK_TRACK: addUnlockTrackReward (data[0] ); break;
|
||||||
|
case UNLOCK_GP: addUnlockGPReward (data[0] ); break;
|
||||||
|
case UNLOCK_MODE: if(1<data.size())
|
||||||
|
{
|
||||||
|
addUnlockModeReward (data[0], data[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Unlock mode name missing.\n");
|
||||||
|
break;
|
||||||
|
case UNLOCK_DIFFICULTY: if(1<data.size())
|
||||||
|
{
|
||||||
|
addUnlockDifficultyReward(data[0], data[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Difficult name missing.\n");
|
||||||
|
break;
|
||||||
|
case UNLOCK_KART: if(1<data.size())
|
||||||
|
{
|
||||||
|
addUnlockKartReward(data[0], data[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Kart name missing.\n");
|
||||||
|
break;
|
||||||
|
} // switch
|
||||||
} // getUnlocks
|
} // getUnlocks
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void ChallengeData::setRace() const
|
void ChallengeData::setRace() const
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
std::vector<UnlockableFeature> m_unlock;
|
std::vector<UnlockableFeature> m_unlock;
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
|
||||||
void getUnlocks(const lisp::Lisp *lisp, const char* type, REWARD_TYPE reward);
|
void getUnlocks(const XMLNode *root, const std:: string type, REWARD_TYPE reward);
|
||||||
void error(const char *id) const;
|
void error(const char *id) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "lisp/parser.hpp"
|
//#include "lisp/parser.hpp"
|
||||||
|
#include "io/xml_node.hpp"
|
||||||
#include "audio/music_information.hpp"
|
#include "audio/music_information.hpp"
|
||||||
|
|
||||||
STKConfig* stk_config=0;
|
STKConfig* stk_config=0;
|
||||||
@ -38,22 +39,20 @@ float STKConfig::UNDEFINED = -99.9f;
|
|||||||
*/
|
*/
|
||||||
void STKConfig::load(const std::string &filename)
|
void STKConfig::load(const std::string &filename)
|
||||||
{
|
{
|
||||||
const lisp::Lisp* root = 0;
|
XMLNode *root = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lisp::Parser parser;
|
root = new XMLNode(filename);
|
||||||
root = parser.parse(filename);
|
if(!root || root->getName()!="config")
|
||||||
|
|
||||||
const lisp::Lisp* const LISP = root->getLisp("config");
|
|
||||||
if(!LISP)
|
|
||||||
{
|
{
|
||||||
|
if(root) delete root;
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg<<"No 'config' node found in '"<<filename<<"'.";
|
msg << "Couldn't load config '" << filename << "': no config node.";
|
||||||
throw std::runtime_error(msg.str());
|
throw std::runtime_error(msg.str());
|
||||||
}
|
}
|
||||||
getAllData(LISP);
|
getAllData(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(std::exception& err)
|
catch(std::exception& err)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error while parsing KartProperties '%s':\n",
|
fprintf(stderr, "Error while parsing KartProperties '%s':\n",
|
||||||
@ -119,6 +118,7 @@ void STKConfig::load(const std::string &filename)
|
|||||||
CHECK_NEG(m_near_ground, "near-ground" );
|
CHECK_NEG(m_near_ground, "near-ground" );
|
||||||
CHECK_NEG(m_delay_finish_time, "delay-finish-time" );
|
CHECK_NEG(m_delay_finish_time, "delay-finish-time" );
|
||||||
CHECK_NEG(m_music_credit_time, "music-credit-time" );
|
CHECK_NEG(m_music_credit_time, "music-credit-time" );
|
||||||
|
|
||||||
m_kart_properties.checkAllSet(filename);
|
m_kart_properties.checkAllSet(filename);
|
||||||
} // load
|
} // load
|
||||||
|
|
||||||
@ -173,54 +173,92 @@ const std::string &STKConfig::getBackgroundPicture(int n)
|
|||||||
} // getBackgroundPicture
|
} // getBackgroundPicture
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Extracts the actual information from a lisp file.
|
/** Extracts the actual information from a xml file.
|
||||||
* \param lisp Pointer to the lisp data structure.
|
* \param xml Pointer to the xml data structure.
|
||||||
*/
|
*/
|
||||||
void STKConfig::getAllData(const lisp::Lisp* lisp)
|
void STKConfig::getAllData(const XMLNode * root)
|
||||||
{
|
{
|
||||||
|
const XMLNode *node = root -> getNode("stk-parameters");
|
||||||
|
if(!node)
|
||||||
|
{
|
||||||
|
std::ostringstream msg;
|
||||||
|
msg << "Couldn't load stk-parameters: no node.";
|
||||||
|
throw std::runtime_error(msg.str());
|
||||||
|
}
|
||||||
|
|
||||||
// Get the values which are not part of the default KartProperties
|
// Get the values which are not part of the default KartProperties
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
lisp->get("anvil-weight", m_anvil_weight );
|
|
||||||
lisp->get("final-camera-time", m_final_camera_time );
|
node->get("min-kart-version", &m_min_kart_version);
|
||||||
lisp->get("anvil-speed-factor", m_anvil_speed_factor );
|
node->get("max-kart-version", &m_max_kart_version);
|
||||||
lisp->get("parachute-friction", m_parachute_friction );
|
node->get("min-track-version", &m_min_track_version);
|
||||||
lisp->get("parachute-time", m_parachute_time );
|
node->get("max-track-version", &m_max_track_version);
|
||||||
lisp->get("parachute-time-other", m_parachute_time_other );
|
node->get("max-karts", &m_max_karts);
|
||||||
lisp->get("parachute-done-fraction", m_parachute_done_fraction );
|
node->get("scores", &m_scores);
|
||||||
lisp->get("bomb-time", m_bomb_time );
|
node->get("grid-order", &m_grid_order);
|
||||||
lisp->get("bomb-time-increase", m_bomb_time_increase );
|
|
||||||
lisp->getVector("leader-intervals", m_leader_intervals );
|
|
||||||
lisp->get("anvil-time", m_anvil_time );
|
|
||||||
lisp->get("zipper-time", m_zipper_time );
|
|
||||||
lisp->get("zipper-force", m_zipper_force );
|
|
||||||
lisp->get("zipper-speed-gain", m_zipper_speed_gain );
|
|
||||||
lisp->get("zipper-max-speed-fraction", m_zipper_max_speed_fraction);
|
|
||||||
lisp->get("explosion-impulse", m_explosion_impulse );
|
|
||||||
lisp->get("explosion-impulse-objects", m_explosion_impulse_objects);
|
|
||||||
lisp->get("max-karts", m_max_karts );
|
|
||||||
lisp->get("grid-order", m_grid_order );
|
|
||||||
lisp->getVector("scores", m_scores );
|
|
||||||
lisp->get("max-history", m_max_history );
|
|
||||||
lisp->get("max-skidmarks", m_max_skidmarks );
|
|
||||||
lisp->get("min-kart-version", m_min_kart_version );
|
|
||||||
lisp->get("max-kart-version", m_max_kart_version );
|
|
||||||
lisp->get("min-track-version", m_min_track_version );
|
|
||||||
lisp->get("max-track-version", m_max_track_version );
|
|
||||||
lisp->get("skid-fadeout-time", m_skid_fadeout_time );
|
|
||||||
lisp->get("slowdown-factor", m_slowdown_factor );
|
|
||||||
lisp->get("near-ground", m_near_ground );
|
|
||||||
lisp->get("delay-finish-time", m_delay_finish_time );
|
|
||||||
lisp->get("music-credit-time", m_music_credit_time );
|
|
||||||
lisp->getVector("menu-background", m_menu_background );
|
|
||||||
lisp->getVector("mainmenu-background", m_mainmenu_background );
|
|
||||||
lisp->get("enable_networking", m_enable_networking );
|
|
||||||
std::string title_music;
|
std::string title_music;
|
||||||
lisp->get("title-music", title_music );
|
node->get("title-music", &title_music);
|
||||||
m_title_music = new MusicInformation(file_manager->getMusicFile(title_music));
|
m_title_music = new MusicInformation(file_manager->getMusicFile(title_music));
|
||||||
|
|
||||||
|
node->get("mainmenu-background", &m_mainmenu_background);
|
||||||
|
node->get("menu-background", &m_menu_background);
|
||||||
|
node->get("max-history", &m_max_history);
|
||||||
|
node->get("max-skidmarks", &m_max_skidmarks);
|
||||||
|
node->get("skid-fadeout-time", &m_skid_fadeout_time);
|
||||||
|
node->get("slowdown-factor", &m_slowdown_factor);
|
||||||
|
node->get("near-ground", &m_near_ground);
|
||||||
|
node->get("delay-finish-time", &m_delay_finish_time);
|
||||||
|
node->get("music-credit-time", &m_music_credit_time);
|
||||||
|
node->get("final-camera-time", &m_final_camera_time);
|
||||||
|
|
||||||
|
|
||||||
|
node = root -> getNode("attachment-parameters");
|
||||||
|
if(!node)
|
||||||
|
{
|
||||||
|
std::ostringstream msg;
|
||||||
|
msg << "Couldn't load attachment-parameters: no node.";
|
||||||
|
throw std::runtime_error(msg.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
node->get("anvil-weight", &m_anvil_weight);
|
||||||
|
node->get("anvil-speed-factor", &m_anvil_speed_factor);
|
||||||
|
node->get("parachute-friction", &m_parachute_friction);
|
||||||
|
node->get("parachute-time", &m_parachute_time);
|
||||||
|
node->get("parachute-time-other", &m_parachute_time_other);
|
||||||
|
node->get("parachute-done-fraction", &m_parachute_done_fraction);
|
||||||
|
node->get("bomb-time", &m_bomb_time);
|
||||||
|
node->get("bomb-time-increase", &m_bomb_time_increase);
|
||||||
|
node->get("leader-intervals", &m_leader_intervals);
|
||||||
|
node->get("anvil-time", &m_anvil_time);
|
||||||
|
node->get("zipper-time", &m_zipper_time);
|
||||||
|
node->get("zipper-force", &m_zipper_force);
|
||||||
|
node->get("zipper-speed-gain", &m_zipper_speed_gain);
|
||||||
|
node->get("zipper-max-speed-fraction", &m_zipper_max_speed_fraction);
|
||||||
|
|
||||||
|
|
||||||
|
node = root -> getNode("misc-defaults");
|
||||||
|
if(!node)
|
||||||
|
{
|
||||||
|
std::ostringstream msg;
|
||||||
|
msg << "Couldn't load misc-defaults: no node.";
|
||||||
|
throw std::runtime_error(msg.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
node->get("explosion-impulse", &m_explosion_impulse);
|
||||||
|
node->get("explosion-impulse-objects", &m_explosion_impulse_objects);
|
||||||
|
node->get("enable-networking", &m_enable_networking);
|
||||||
|
|
||||||
// Get the default KartProperties
|
// Get the default KartProperties
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
m_kart_properties.getAllData(lisp->getLisp("kart-defaults"));
|
node = root -> getNode("general-kart-defaults");
|
||||||
|
if(!node)
|
||||||
|
{
|
||||||
|
std::ostringstream msg;
|
||||||
|
msg << "Couldn't load general-kart-defaults: no node.";
|
||||||
|
throw std::runtime_error(msg.str());
|
||||||
|
}
|
||||||
|
m_kart_properties.getAllData(node);
|
||||||
|
|
||||||
} // getAllData
|
} // getAllData
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
|
|
||||||
class Lisp;
|
//class Lisp;
|
||||||
|
class XMLNode;
|
||||||
class MusicInformation;
|
class MusicInformation;
|
||||||
|
|
||||||
/** Global STK configuration information. Parameters here can be tuned without
|
/** Global STK configuration information. Parameters here can be tuned without
|
||||||
@ -98,7 +99,8 @@ public:
|
|||||||
/** Empty constructor. The actual work is done in load. */
|
/** Empty constructor. The actual work is done in load. */
|
||||||
STKConfig() {};
|
STKConfig() {};
|
||||||
void init_defaults ();
|
void init_defaults ();
|
||||||
void getAllData (const lisp::Lisp* lisp);
|
// void getAllData (const lisp::Lisp* lisp);
|
||||||
|
void getAllData (const XMLNode * root);
|
||||||
void load (const std::string &filename);
|
void load (const std::string &filename);
|
||||||
/** Returns the default kart properties for each kart. */
|
/** Returns the default kart properties for each kart. */
|
||||||
const KartProperties &
|
const KartProperties &
|
||||||
|
@ -110,12 +110,12 @@ FileManager::FileManager()
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
else if( macSetBundlePathIfRelevant( m_root_dir ) ) { /* nothing to do */ }
|
else if( macSetBundlePathIfRelevant( m_root_dir ) ) { /* nothing to do */ }
|
||||||
#endif
|
#endif
|
||||||
// else if(m_file_system->existFile("/Developer/games/supertuxkart/data/stk_config.data"))
|
// else if(m_file_system->existFile("/Developer/games/supertuxkart/data/stk_config.xml"))
|
||||||
// m_root_dir = "/Developer/games/supertuxkart" ;
|
// m_root_dir = "/Developer/games/supertuxkart" ;
|
||||||
// FIXME - existFile() fails to detect the file, even though it exists, on my computer
|
// FIXME - existFile() fails to detect the file, even though it exists, on my computer
|
||||||
else if(m_file_system->existFile("data/stk_config.data"))
|
else if(m_file_system->existFile("data/stk_config.xml"))
|
||||||
m_root_dir = "." ;
|
m_root_dir = "." ;
|
||||||
else if(m_file_system->existFile("../data/stk_config.data"))
|
else if(m_file_system->existFile("../data/stk_config.xml"))
|
||||||
m_root_dir = ".." ;
|
m_root_dir = ".." ;
|
||||||
else
|
else
|
||||||
#ifdef SUPERTUXKART_DATADIR
|
#ifdef SUPERTUXKART_DATADIR
|
||||||
|
@ -29,7 +29,7 @@ XMLNode::XMLNode(io::IXMLReader *xml)
|
|||||||
} // XMLNode
|
} // XMLNode
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Reads a XML file and convert it intoa XMLNode tree.
|
/** Reads a XML file and convert it into a XMLNode tree.
|
||||||
* \param filename Name of the XML file to read.
|
* \param filename Name of the XML file to read.
|
||||||
*/
|
*/
|
||||||
XMLNode::XMLNode(const std::string &filename)
|
XMLNode::XMLNode(const std::string &filename)
|
||||||
|
@ -21,14 +21,16 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "config/stk_config.hpp"
|
#include "config/stk_config.hpp"
|
||||||
#include "config/user_config.hpp"
|
#include "config/user_config.hpp"
|
||||||
#include "graphics/material_manager.hpp"
|
#include "graphics/material_manager.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "karts/kart_model.hpp"
|
#include "karts/kart_model.hpp"
|
||||||
#include "lisp/parser.hpp"
|
//#include "lisp/parser.hpp"
|
||||||
#include "lisp/lisp.hpp"
|
//#include "lisp/lisp.hpp"
|
||||||
|
#include "io/xml_node.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
|
|
||||||
float KartProperties::UNDEFINED = -99.9f;
|
float KartProperties::UNDEFINED = -99.9f;
|
||||||
@ -98,6 +100,24 @@ void KartProperties::load(const std::string &filename, const std::string &node,
|
|||||||
// Get the default values from STKConfig:
|
// Get the default values from STKConfig:
|
||||||
*this = stk_config->getDefaultKartProperties();
|
*this = stk_config->getDefaultKartProperties();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
const XMLNode * root = 0;
|
||||||
|
m_ident = StringUtils::basename(StringUtils::without_extension(filename));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
root = new XMLNode(filename);
|
||||||
|
if(!root || root->getName()!="kart")
|
||||||
|
{
|
||||||
|
if(root) delete root;
|
||||||
|
std::ostringstream msg;
|
||||||
|
msg << "Couldn't load kart properties '" << filename <<
|
||||||
|
"': no kart node.";
|
||||||
|
throw std::runtime_error(msg.str());
|
||||||
|
}
|
||||||
|
getAllData(root);
|
||||||
|
}
|
||||||
|
#else
|
||||||
const lisp::Lisp* root = 0;
|
const lisp::Lisp* root = 0;
|
||||||
m_ident = StringUtils::basename(StringUtils::without_extension(filename));
|
m_ident = StringUtils::basename(StringUtils::without_extension(filename));
|
||||||
|
|
||||||
@ -115,6 +135,7 @@ void KartProperties::load(const std::string &filename, const std::string &node,
|
|||||||
}
|
}
|
||||||
getAllData(LISP);
|
getAllData(LISP);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
catch(std::exception& err)
|
catch(std::exception& err)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error while parsing KartProperties '%s':\n",
|
fprintf(stderr, "Error while parsing KartProperties '%s':\n",
|
||||||
@ -183,6 +204,132 @@ void KartProperties::load(const std::string &filename, const std::string &node,
|
|||||||
} // load
|
} // load
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
void KartProperties::getAllData(const XMLNode * root)
|
||||||
|
{
|
||||||
|
root->get("version", &m_version);
|
||||||
|
root->get("name", &m_name);
|
||||||
|
root->get("icon-file", &m_icon_file);
|
||||||
|
root->get("shadow-file", &m_shadow_file);
|
||||||
|
|
||||||
|
Vec3 c;
|
||||||
|
root->get("rgb", &c);
|
||||||
|
|
||||||
|
std::string sfx_type_string;
|
||||||
|
root->get("engine-sound", &sfx_type_string);
|
||||||
|
|
||||||
|
if(sfx_type_string == "large")
|
||||||
|
{
|
||||||
|
m_engine_sfx_type = SFXManager::SOUND_ENGINE_LARGE;
|
||||||
|
}
|
||||||
|
else if(sfx_type_string == "small")
|
||||||
|
{
|
||||||
|
m_engine_sfx_type = SFXManager::SOUND_ENGINE_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
root->get("has-skidmarks", &m_has_skidmarks);
|
||||||
|
root->get("groups", &m_groups);
|
||||||
|
root->get("time-full-steer", &m_time_full_steer);
|
||||||
|
root->get("time-full-steer-ai", &m_time_full_steer_ai);
|
||||||
|
root->get("gravity-center-shift", &m_gravity_center_shift);
|
||||||
|
root->get("nitro-power-boost", &m_nitro_power_boost);
|
||||||
|
root->get("skid-increase", &m_skid_increase);
|
||||||
|
root->get("skid-decrease", &m_skid_decrease);
|
||||||
|
root->get("skid-max", &m_skid_max);
|
||||||
|
root->get("time-till-max-skid", &m_time_till_max_skid);
|
||||||
|
root->get("skid-visual", &m_skid_visual);
|
||||||
|
root->get("slipstream-length", &m_slipstream_length);
|
||||||
|
root->get("slipstream-time", &m_slipstream_time);
|
||||||
|
root->get("slipstream-add-power", &m_slipstream_add_power);
|
||||||
|
root->get("brake-factor", &m_brake_factor);
|
||||||
|
|
||||||
|
std::vector<float> v;
|
||||||
|
if(root->get("min-speed-radius", &v))
|
||||||
|
{
|
||||||
|
if(v.size()!=2)
|
||||||
|
printf("Incorrect min-speed-radius specifications for kart '%s'\n",
|
||||||
|
getIdent().c_str());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_min_speed_turn = v[0];
|
||||||
|
m_min_radius = v[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
v.clear();
|
||||||
|
if(root->get("max-speed-radius", &v))
|
||||||
|
{
|
||||||
|
if(v.size()!=2)
|
||||||
|
printf("Incorrect max-speed-radius specifications for kart '%s'\n",
|
||||||
|
getIdent().c_str());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_max_speed_turn = v[0];
|
||||||
|
m_max_radius = v[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
v.clear();
|
||||||
|
if( root->get("engine-power", &v))
|
||||||
|
{
|
||||||
|
if(v.size()!=3)
|
||||||
|
printf("Incorrect engine-power specifications for kart '%s'\n",
|
||||||
|
getIdent().c_str());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_engine_power[0] = v[0];
|
||||||
|
m_engine_power[1] = v[1];
|
||||||
|
m_engine_power[2] = v[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
v.clear();
|
||||||
|
if( root->get("max-speed", &v))
|
||||||
|
{
|
||||||
|
if(v.size()!=3)
|
||||||
|
printf("Incorrect max-speed specifications for kart '%s'\n",
|
||||||
|
getIdent().c_str());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_max_speed[0] = v[0];
|
||||||
|
m_max_speed[1] = v[1];
|
||||||
|
m_max_speed[2] = v[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
root->get("mass", &m_mass);
|
||||||
|
root->get("suspension-stiffness", &m_suspension_stiffness);
|
||||||
|
root->get("wheel-damping-relaxation", &m_wheel_damping_relaxation);
|
||||||
|
root->get("wheel-damping-compression", &m_wheel_damping_compression);
|
||||||
|
root->get("friction-slip", &m_friction_slip);
|
||||||
|
root->get("roll-influence", &m_roll_influence);
|
||||||
|
root->get("wheel-radius", &m_wheel_radius);
|
||||||
|
|
||||||
|
//TODO: wheel width is not loaded, yet is listed as an attribute in the xml file after wheel-radius?
|
||||||
|
|
||||||
|
root->get("chassis-linear-damping", &m_chassis_linear_damping);
|
||||||
|
root->get("chassis-angular-damping", &m_chassis_angular_damping);
|
||||||
|
root->get("max-speed-reverse-ratio", &m_max_speed_reverse_ratio);
|
||||||
|
root->get("suspension-rest", &m_suspension_rest);
|
||||||
|
root->get("suspension-travel-cm", &m_suspension_travel_cm);
|
||||||
|
root->get("jump-velocity", &m_jump_velocity);
|
||||||
|
root->get("z-rescue-offset", &m_z_rescue_offset);
|
||||||
|
|
||||||
|
//TODO: wheel front right and wheel front left is not loaded, yet is listed as an attribute in the xml file after wheel-radius
|
||||||
|
//TODO: same goes for their rear equivalents
|
||||||
|
|
||||||
|
root->get("gear-switch-ratio", &m_gear_switch_ratio);
|
||||||
|
root->get("gear-power-increase", &m_gear_power_increase);
|
||||||
|
root->get("upright-tolerance", &m_upright_tolerance);
|
||||||
|
root->get("upright-max-force", &m_upright_max_force);
|
||||||
|
root->get("track-connection-accel", &m_track_connection_accel);
|
||||||
|
root->get("rubber-band-max-length", &m_rubber_band_max_length);
|
||||||
|
root->get("rubber-band-force", &m_rubber_band_force);
|
||||||
|
root->get("rubber-band-duration", &m_rubber_band_duration);
|
||||||
|
root->get("camera-max-accel", &m_camera_max_accel);
|
||||||
|
root->get("camera-max-brake", &m_camera_max_brake);
|
||||||
|
root->get("camera-distance", &m_camera_distance);
|
||||||
|
}
|
||||||
|
|
||||||
void KartProperties::getAllData(const lisp::Lisp* lisp)
|
void KartProperties::getAllData(const lisp::Lisp* lisp)
|
||||||
{
|
{
|
||||||
lisp->get("version", m_version);
|
lisp->get("version", m_version);
|
||||||
|
@ -29,10 +29,12 @@ using namespace irr;
|
|||||||
#include "audio/sfx_manager.hpp"
|
#include "audio/sfx_manager.hpp"
|
||||||
#include "karts/kart_model.hpp"
|
#include "karts/kart_model.hpp"
|
||||||
#include "lisp/lisp.hpp"
|
#include "lisp/lisp.hpp"
|
||||||
|
#include "io/xml_node.hpp"
|
||||||
#include "race/race_manager.hpp"
|
#include "race/race_manager.hpp"
|
||||||
#include "utils/vec3.hpp"
|
#include "utils/vec3.hpp"
|
||||||
|
|
||||||
class Material;
|
class Material;
|
||||||
|
class XMLNode;
|
||||||
|
|
||||||
/** This class stores the properties of a kart. This includes size, name,
|
/** This class stores the properties of a kart. This includes size, name,
|
||||||
* identifier, physical properties etc. It is atm also the base class for
|
* identifier, physical properties etc. It is atm also the base class for
|
||||||
@ -166,6 +168,7 @@ public:
|
|||||||
KartProperties ();
|
KartProperties ();
|
||||||
~KartProperties ();
|
~KartProperties ();
|
||||||
void getAllData (const lisp::Lisp* lisp);
|
void getAllData (const lisp::Lisp* lisp);
|
||||||
|
void getAllData (const XMLNode * root);
|
||||||
void load (const std::string &filename,
|
void load (const std::string &filename,
|
||||||
const std::string &node="tuxkart-kart",
|
const std::string &node="tuxkart-kart",
|
||||||
bool dont_load_models=false);
|
bool dont_load_models=false);
|
||||||
|
@ -86,7 +86,7 @@ void cmdLineHelp (char* invocation)
|
|||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -N, --no-start-screen Quick race\n"
|
" -N, --no-start-screen Quick race\n"
|
||||||
" -t, --track NAME Start at track NAME (see --list-tracks)\n"
|
" -t, --track NAME Start at track NAME (see --list-tracks)\n"
|
||||||
" --stk-config FILE use ./data/FILE instead of ./data/stk_config.data\n"
|
" --stk-config FILE use ./data/FILE instead of ./data/stk_config.xml\n"
|
||||||
" -l, --list-tracks Show available tracks\n"
|
" -l, --list-tracks Show available tracks\n"
|
||||||
" -k, --numkarts NUM Number of karts on the racetrack\n"
|
" -k, --numkarts NUM Number of karts on the racetrack\n"
|
||||||
" --kart NAME Use kart number NAME (see --list-karts)\n"
|
" --kart NAME Use kart number NAME (see --list-karts)\n"
|
||||||
@ -493,7 +493,7 @@ void initRest()
|
|||||||
grand_prix_manager = new GrandPrixManager ();
|
grand_prix_manager = new GrandPrixManager ();
|
||||||
network_manager = new NetworkManager ();
|
network_manager = new NetworkManager ();
|
||||||
|
|
||||||
stk_config->load(file_manager->getConfigFile("stk_config.data"));
|
stk_config->load(file_manager->getConfigFile("stk_config.xml"));
|
||||||
track_manager->loadTrackList();
|
track_manager->loadTrackList();
|
||||||
// unlock_manager->check needs GP and track manager.
|
// unlock_manager->check needs GP and track manager.
|
||||||
unlock_manager->check();
|
unlock_manager->check();
|
||||||
|
Loading…
Reference in New Issue
Block a user