Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.74 KB | None | 0 0
  1. "Vehicle"
  2. {
  3. "WheelsPerAxle" "2"
  4. "Body"
  5. {
  6. "CounterTorqueFactor" "0.9"
  7. "MassCenterOverride" "0 -3 13"
  8. "MassOverride" "1467"
  9. "AddGravity" "0.7"
  10. "MaxAngularVelocity" "720"
  11. }
  12. "Engine"
  13. {
  14. "HorsePower" "301"
  15. "MaxRPM" "4200"
  16. "MaxSpeed" "95"
  17. "MaxReverseSpeed" "28"
  18. "AutobrakeSpeedGain" "1.1"
  19. "AutobrakeSpeedFactor" "3"
  20. "Autotransmission" "0"
  21. "AxleRatio" "4.56"
  22. "Gear" "3.2"
  23. "Gear" "2.4"
  24. "Gear" "1.5"
  25. "Gear" "1"
  26. "Gear" "0.84"
  27.  
  28. "ShiftUpRPM" "3800"
  29. "ShiftDownRPM" "1600"
  30. }
  31. "Steering"
  32. {
  33. "DegreesSlow" "40"
  34. "DegreesFast" "12"
  35. "DegreesBoost" "11"
  36. "FastDampen" "0"
  37. "SteeringExponent" "1.4"
  38. "SlowCarSpeed" "12"
  39. "FastCarSpeed" "60"
  40. "SlowSteeringRate" "3"
  41. "FastSteeringRate" "2"
  42. "SteeringRestRateSlow" "3"
  43. "SteeringRestRateFast" "2"
  44. "TurnThrottleReduceSlow" "0.01"
  45. "TurnThrottleReduceFast" "0.6"
  46. "BrakeSteeringRateFactor" "3"
  47. "ThrottleSteeringRestRateFactor" "2"
  48. "BoostSteeringRestRateFactor" "1.7"
  49. "BoostSteeringRateFactor" "1.7"
  50.  
  51. "PowerSlideAccel" "250"
  52.  
  53. "SkidAllowed" "1"
  54. "DustCloud" "1"
  55. }
  56. "Axle"
  57. {
  58. "Wheel"
  59. {
  60. "Radius" "15"
  61. "Mass" "270"
  62. "Inertia" "0"
  63. "Damping" "0.3"
  64. "RotDamping" "0.2"
  65. "Material" "jeeptire"
  66. "SkidMaterial" "slidingrubbertire"
  67. "BrakeMaterial" "brakingrubbertire"
  68. }
  69. "Suspension"
  70. {
  71. "SpringConstant" "90"
  72. "SpringDamping" "0.5"
  73. "StabilizerConstant" "0"
  74. "SpringDampingCompression" "7"
  75. "MaxBodyForce" "10"
  76. }
  77. "TorqueFactor" "0.95"
  78. "BrakeFactor" "0.4"
  79. }
  80. "Axle"
  81. {
  82. "Wheel"
  83. {
  84. "Radius" "15"
  85. "Mass" "230"
  86. "Inertia" "0"
  87. "Damping" "0"
  88. "RotDamping" "0"
  89. "Material" "jeeptire"
  90. "SkidMaterial" "slidingrubbertire"
  91. "BrakeMaterial" "brakingrubbertire"
  92. }
  93. "Suspension"
  94. {
  95. "SpringConstant" "70"
  96. "SpringDamping" "0.5"
  97. "StabilizerConstant" "0"
  98. "SpringDampingCompression" "7"
  99. "MaxBodyForce" "15"
  100. }
  101. "TorqueFactor" "0"
  102. "BrakeFactor" "0.6"
  103. }
  104. }
  105.  
  106. "Vehicle_Sounds"
  107. {
  108. "Gear"
  109. {
  110. "Max_Speed" "0.06"
  111. "Speed_Approach_Factor" "1"
  112. }
  113. "Gear"
  114. {
  115. "Max_Speed" "0.25"
  116. "Speed_Approach_Factor" "0.08"
  117. }
  118. "Gear"
  119. {
  120. "Max_Speed" "0.35"
  121. "Speed_Approach_Factor" "0.05"
  122. }
  123. "Gear"
  124. {
  125. "Max_Speed" "0.55"
  126. "Speed_Approach_Factor" "0.035"
  127. }
  128. "Gear"
  129. {
  130. "Max_Speed" "1"
  131. "Speed_Approach_Factor" "0.01"
  132. }
  133. "State"
  134. {
  135. "Name" "SS_SHUTDOWN_WATER"
  136. "Sound" "atv_stall_in_water"
  137. "Min_Time" "0"
  138. }
  139. "State"
  140. {
  141. "Name" "SS_GEAR_2_RESUME"
  142. "Sound" "vehiclestdmcarsfocusrsthird.wav"
  143. "Min_Time" "0.5"
  144. }
  145. "State"
  146. {
  147. "Name" "SS_START_WATER"
  148. "Sound" "atv_start_in_water"
  149. "Min_Time" "0"
  150. }
  151. "State"
  152. {
  153. "Name" "SS_GEAR_3_RESUME"
  154. "Sound" "vehiclestdmcarsfocusrsfourth_cruise.wav"
  155. "Min_Time" "0.5"
  156. }
  157. "State"
  158. {
  159. "Name" "SS_REVERSE"
  160. "Sound" "vehiclestdmcarsfocusrsrev.wav"
  161. "Min_Time" "0.5"
  162. }
  163. "State"
  164. {
  165. "Name" "SS_IDLE"
  166. "Sound" "vehiclestdmcarsfocusrsidle.wav"
  167. "Min_Time" "0"
  168. }
  169. "State"
  170. {
  171. "Name" "SS_GEAR_1_RESUME"
  172. "Sound" "vehiclestdmcarsfocusrsfirst.wav"
  173. "Min_Time" "0.5"
  174. }
  175. "State"
  176. {
  177. "Name" "SS_GEAR_4"
  178. "Sound" "vehiclestdmcarsfocusrsfourth_cruise.wav"
  179. "Min_Time" "0.5"
  180. }
  181. "State"
  182. {
  183. "Name" "SS_GEAR_1"
  184. "Sound" "vehiclestdmcarsfocusrsfirst.wav"
  185. "Min_Time" "0.5"
  186. }
  187. "State"
  188. {
  189. "Name" "SS_SLOWDOWN_HIGHSPEED"
  190. "Sound" "vehiclestdmcarsfocusrsthrottle_off.wav"
  191. "Min_Time" "0"
  192. }
  193. "State"
  194. {
  195. "Name" "SS_SHUTDOWN"
  196. "Sound" "vehiclestdmcarsslsamgengineoff.mp3"
  197. "Min_Time" "0"
  198. }
  199. "State"
  200. {
  201. "Name" "SS_START_IDLE"
  202. "Sound" "vehiclestdmcarsslsamgenginestart.mp3"
  203. "Min_Time" "0.3"
  204. }
  205. "State"
  206. {
  207. "Name" "SS_GEAR_4_RESUME"
  208. "Sound" "vehiclestdmcarsfocusrsfourth_cruise.wav"
  209. "Min_Time" "0.5"
  210. }
  211. "State"
  212. {
  213. "Name" "SS_GEAR_3"
  214. "Sound" "vehiclestdmcarsfocusrsthird.wav"
  215. "Min_Time" "0.5"
  216. }
  217. "State"
  218. {
  219. "Name" "SS_GEAR_0_RESUME"
  220. "Sound" "vehiclestdmcarsfocusrsfirst.wav"
  221. "Min_Time" "0.75"
  222. }
  223. "State"
  224. {
  225. "Name" "SS_GEAR_0"
  226. "Sound" "vehiclestdmcarsfocusrsidle.wav"
  227. "Min_Time" "0.08"
  228. }
  229. "State"
  230. {
  231. "Name" "SS_GEAR_2"
  232. "Sound" "vehiclestdmcarsfocusrssecond.wav"
  233. "Min_Time" "0.5"
  234. }
  235. "State"
  236. {
  237. "Name" "SS_SLOWDOWN"
  238. "Sound" "vehiclestdmcarsfocusrsidle.wav"
  239. "Min_Time" "0"
  240. }
  241. "CrashSound"
  242. {
  243. "Min_Speed" "350"
  244. "Min_Speed_Change" "250"
  245. "Sound" "atv_impact_medium"
  246. "Gear_Limit" "1"
  247. }
  248. "CrashSound"
  249. {
  250. "Min_Speed" "450"
  251. "Min_Speed_Change" "350"
  252. "Sound" "atv_impact_heavy"
  253. "Gear_Limit" "0"
  254. }
  255.  
  256. "Skid_LowFriction" ""
  257. "Skid_NormalFriction" ""
  258. "Skid_HighFriction" ""
  259. }
  260.  
  261. <?php
  262. // simple demo parser that will parse tokens surrounded by " from a file that
  263. // only contains whitespace in the form of spaces or newlines aside from these
  264. // tokens
  265. // For example something like this:
  266. /*
  267. "hello"
  268.  
  269. "this"
  270.  
  271. "is"
  272.  
  273. "a"
  274.  
  275.  
  276.  
  277. "Test"
  278. "10.9"
  279. */
  280.  
  281.  
  282. // parse a token from the string
  283. // assume opening " has already been encountered
  284. // note the pass by reference!
  285. function parse_token($textData, &$index, &$token) {
  286. $token = "";
  287. $length = strlen($textData);
  288. while ($index < $length) {
  289.  
  290. // get next character
  291. $char = $textData{$index};
  292.  
  293. // increment for next round
  294. // do this here because we want to increment before breaking
  295. // out of the loop
  296. $index++;
  297.  
  298. // anything that is not " is part of the token
  299. if (""" != $char) {
  300. $token .= $char;
  301. } else {
  302. break;
  303. }
  304.  
  305. }
  306. }
  307.  
  308. // main function to do the parsing
  309. // note the pass by reference!
  310. function do_parse($textData, &$index, &$output) {
  311. $output = [];
  312. $char = NULL;
  313. $length = strlen($textData);
  314. $token = NULL;
  315. while ($index < $length) {
  316.  
  317. // get next character
  318. $char = $textData{$index};
  319.  
  320. // if we encounter an opening "
  321. if (""" == $char) {
  322. // parse the rest as a token, and store it in our output array
  323. $output[] = parse_token($textData, ++$index, $token);
  324. } else if (" " == $char || "n" == $char) {
  325. // skip whitespace, go on to next char
  326. $index++;
  327. } else {
  328. throw new Exception('unexpected character ' . $char);
  329. }
  330. }
  331. }
  332.  
  333. // read file into string
  334. $data = file_get_contents ("data.txt");
  335.  
  336. // perform actual parsing
  337. $index = 0;
  338. do_parse($data, $index, $parsed);
  339.  
  340. // print result
  341. print_r($parsed);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement