Shuvit game release repo.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menuV3.py 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  1. import bge
  2. keyboard = bge.logic.keyboard
  3. JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
  4. #exit functions
  5. #=======
  6. def endpoint(funct, motion, dict, cont):
  7. #print('endpoint', funct,motion)
  8. scene = bge.logic.getCurrentScene()
  9. scenes = bge.logic.getSceneList()
  10. main_scene = [scene for scene in scenes if scene.name=="main"][0]
  11. main_empty = main_scene.objects['Empty']
  12. own = cont.owner
  13. import Settings
  14. load_timer = 100
  15. shirt = scene.objects["Char4:Zshirtt1"]
  16. shoeR = scene.objects['Char4:Shoes02.R']
  17. shoeL = scene.objects['Char4:Shoes02.L']
  18. deck = scene.objects["deck"]
  19. throw_deck = scene.objectsInactive["throw_deck"]
  20. cam = scene.objects['Camera.003']
  21. cam2 = scene.objects['freecam']
  22. cam3 = scene.objects['followcam']
  23. c_move = .025 #color move amount
  24. if funct == 'exit':
  25. #print("exit function", motion)
  26. bge.logic.endGame()
  27. if funct == 'restart':
  28. #print("restart function", motion)
  29. bge.logic.restartGame()
  30. if funct == 'shirt color r':
  31. s_color = shirt.color
  32. s_color_r = s_color[0]
  33. if motion == 'inc':
  34. if s_color_r < 1:
  35. s_color_r += c_move
  36. s_color_r = round(s_color_r, 2)
  37. else:
  38. s_color_r = 1
  39. if motion == 'dec':
  40. if s_color_r > c_move:
  41. s_color_r -= c_move
  42. s_color_r = round(s_color_r, 2)
  43. else:
  44. s_color_r = 0
  45. new_col = [s_color_r, s_color[1], s_color[2], s_color[3]]
  46. shirt.color = new_col
  47. dict['shirt_color_r'] = new_col[0]
  48. if funct == 'shirt color g':
  49. s_color = shirt.color
  50. s_color_g = s_color[1]
  51. if motion == 'inc':
  52. if s_color_g < 1:
  53. s_color_g += c_move
  54. s_color_g = round(s_color_g, 2)
  55. else:
  56. s_color_rg = 1
  57. if motion == 'dec':
  58. if s_color_g > c_move:
  59. s_color_g -= c_move
  60. s_color_g = round(s_color_g, 2)
  61. else:
  62. s_color_g = 0
  63. new_col = [s_color[0], s_color_g, s_color[2], s_color[3]]
  64. shirt.color = new_col
  65. dict['shirt_color_g'] = new_col[1]
  66. if funct == 'shirt color b':
  67. s_color = shirt.color
  68. s_color_b = s_color[2]
  69. if motion == 'inc':
  70. if s_color_b < 1:
  71. s_color_b += c_move
  72. s_color_b = round(s_color_b, 2)
  73. else:
  74. s_color_b = 1
  75. if motion == 'dec':
  76. if s_color_b > c_move:
  77. s_color_b -= c_move
  78. s_color_b = round(s_color_b, 2)
  79. else:
  80. s_color_b = 0
  81. new_col = [s_color[0], s_color[1], s_color_b, s_color[3]]
  82. shirt.color = new_col
  83. #print(new_col)
  84. dict['shirt_color_b'] = new_col[2]
  85. if funct == 'shoe color r':
  86. s_color = shoeL.color
  87. s_color_r = s_color[0]
  88. if motion == 'inc':
  89. if s_color_r < 1:
  90. s_color_r += c_move
  91. s_color_r = round(s_color_r, 2)
  92. else:
  93. s_color_r = 1
  94. if motion == 'dec':
  95. if s_color_r > c_move:
  96. s_color_r -= c_move
  97. s_color_r = round(s_color_r, 2)
  98. else:
  99. s_color_r = 0
  100. new_col = [s_color_r, s_color[1], s_color[2], s_color[3]]
  101. shoeL.color = new_col
  102. shoeR.color = new_col
  103. dict['shoe_color_r'] = new_col[0]
  104. if funct == 'shoe color g':
  105. s_color = shoeL.color
  106. s_color_g = s_color[1]
  107. if motion == 'inc':
  108. if s_color_g < 1:
  109. s_color_g += c_move
  110. s_color_g = round(s_color_g, 2)
  111. else:
  112. s_color_rg = 1
  113. if motion == 'dec':
  114. if s_color_g > c_move:
  115. s_color_g -= c_move
  116. s_color_g = round(s_color_g, 2)
  117. else:
  118. s_color_g = 0
  119. new_col = [s_color[0], s_color_g, s_color[2], s_color[3]]
  120. shoeL.color = new_col
  121. shoeR.color = new_col
  122. dict['shoe_color_g'] = new_col[1]
  123. if funct == 'shoe color b':
  124. s_color = shoeL.color
  125. s_color_b = s_color[2]
  126. if motion == 'inc':
  127. if s_color_b < 1:
  128. s_color_b += c_move
  129. s_color_b = round(s_color_b, 2)
  130. else:
  131. s_color_b = 1
  132. if motion == 'dec':
  133. if s_color_b > c_move:
  134. s_color_b -= c_move
  135. s_color_b = round(s_color_b, 2)
  136. else:
  137. s_color_b = 0
  138. new_col = [s_color[0], s_color[1], s_color_b, s_color[3]]
  139. shoeL.color = new_col
  140. shoeR.color = new_col
  141. #print(new_col)
  142. dict['shoe_color_b'] = new_col[2]
  143. if funct == 'deck color r':
  144. s_color = deck.color
  145. s_color_r = s_color[0]
  146. if motion == 'inc':
  147. if s_color_r < 1:
  148. s_color_r += c_move
  149. s_color_r = round(s_color_r, 2)
  150. else:
  151. s_color_r = 1
  152. if motion == 'dec':
  153. if s_color_r > c_move:
  154. s_color_r -= c_move
  155. s_color_r = round(s_color_r, 2)
  156. else:
  157. s_color_r = 0
  158. new_col = [s_color_r, s_color[1], s_color[2], s_color[3]]
  159. deck.color = new_col
  160. throw_deck.color = new_col
  161. dict['deck_color_r'] = new_col[0]
  162. if funct == 'deck color g':
  163. s_color = deck.color
  164. s_color_g = s_color[1]
  165. if motion == 'inc':
  166. if s_color_g < 1:
  167. s_color_g += c_move
  168. s_color_g = round(s_color_g, 2)
  169. else:
  170. s_color_rg = 1
  171. if motion == 'dec':
  172. if s_color_g > c_move:
  173. s_color_g -= c_move
  174. s_color_g = round(s_color_g, 2)
  175. else:
  176. s_color_g = 0
  177. new_col = [s_color[0], s_color_g, s_color[2], s_color[3]]
  178. deck.color = new_col
  179. throw_deck.color = new_col
  180. dict['deck_color_g'] = new_col[1]
  181. if funct == 'deck color b':
  182. s_color = deck.color
  183. s_color_b = s_color[2]
  184. if motion == 'inc':
  185. if s_color_b < 1:
  186. s_color_b += c_move
  187. s_color_b = round(s_color_b, 2)
  188. else:
  189. s_color_b = 1
  190. if motion == 'dec':
  191. if s_color_b > c_move:
  192. s_color_b -= c_move
  193. s_color_b = round(s_color_b, 2)
  194. else:
  195. s_color_b = 0
  196. new_col = [s_color[0], s_color[1], s_color_b, s_color[3]]
  197. deck.color = new_col
  198. throw_deck.color = new_col
  199. #print(new_col)
  200. dict['deck_color_b'] = new_col[2]
  201. if funct == 'shirt logo':
  202. logo = dict['shirt_logo']
  203. logo1 = shirt.meshes[0].materials[0].textures[6]
  204. logo2 = shirt.meshes[0].materials[0].textures[7]
  205. logo3 = shirt.meshes[0].materials[0].textures[5]
  206. if motion == 'inc':
  207. if logo == 0:
  208. logo = 1
  209. elif logo == 1:
  210. logo = 2
  211. elif logo == 2:
  212. logo = 3
  213. elif logo == 3:
  214. logo = 0
  215. if motion == 'dec':
  216. if logo == 0:
  217. logo = 3
  218. elif logo == 1:
  219. logo = 0
  220. elif logo == 2:
  221. logo = 1
  222. elif logo == 3:
  223. logo = 2
  224. if logo == 1:
  225. logo1.diffuseIntensity = 1
  226. logo2.diffuseIntensity = 0
  227. logo1.diffuseFactor = 1
  228. logo2.diffuseFactor = 0
  229. logo3.diffuseIntensity = 0
  230. logo3.diffuseFactor = 0
  231. if logo == 2:
  232. logo1.diffuseIntensity = 0
  233. logo1.diffuseFactor = 0
  234. logo2.diffuseIntensity = 1
  235. logo2.diffuseFactor = 1
  236. logo3.diffuseIntensity = 0
  237. logo3.diffuseFactor = 0
  238. if logo == 3:
  239. logo1.diffuseIntensity = 0
  240. logo1.diffuseFactor = 0
  241. logo2.diffuseIntensity = 0
  242. logo2.diffuseFactor = 0
  243. logo3.diffuseIntensity = 1
  244. logo3.diffuseFactor = 1
  245. if logo == 0:
  246. logo1.diffuseIntensity = 0
  247. logo2.diffuseIntensity = 0
  248. logo1.diffuseFactor = 0
  249. logo2.diffuseFactor = 0
  250. logo3.diffuseIntensity = 0
  251. logo3.diffuseFactor = 0
  252. dict['shirt_logo'] = logo
  253. if funct == 'brightness / contrast on':
  254. if motion == 'inc':
  255. cont.activate(cam.actuators["bc"])
  256. cam['bc'] = 1
  257. dict['bc'] = 1
  258. else:
  259. cont.activate(cam.actuators["bc_off"])
  260. cam['bc'] = 0
  261. dict['bc'] = 0
  262. if funct == 'brightness value':
  263. b = cam['BC_BRIGHTNESS']
  264. if motion == 'inc':
  265. b += .05
  266. else:
  267. b -= .05
  268. cam['BC_BRIGHTNESS'] = round(b,2)
  269. dict['BC_BRIGHTNESS'] = round(b,2)
  270. if funct == 'contrast value':
  271. b = cam['BC_CONTRAST']
  272. if motion == 'inc':
  273. b += .05
  274. else:
  275. b -= .05
  276. cam['BC_CONTRAST'] = round(b,2)
  277. dict['BC_CONTRAST'] = round(b,2)
  278. if funct == 'hdr on':
  279. if motion == 'inc':
  280. cont.activate(cam.actuators["hdr"])
  281. cam['hdr'] = 1
  282. dict['hdr'] = 1
  283. else:
  284. cont.activate(cam.actuators["hdr_off"])
  285. cam['hdr'] = 0
  286. dict['hdr'] = 0
  287. if funct == 'avgL':
  288. b = cam['avgL']
  289. if motion == 'inc':
  290. b += .05
  291. else:
  292. b -= .05
  293. cam['avgL'] = round(b,2)
  294. dict['avgL'] = round(b,2)
  295. if funct == 'hdr strength':
  296. b = cam['HDRamount']
  297. if motion == 'inc':
  298. b += .05
  299. else:
  300. b -= .05
  301. cam['HDRamount'] = round(b,2)
  302. dict['HDRamount'] = round(b,2)
  303. if funct == 'ao on':
  304. if motion == 'inc':
  305. cont.activate(cam.actuators["ao"])
  306. cam['ao'] = 1
  307. dict['ao'] = 1
  308. else:
  309. cont.activate(cam.actuators["ao_off"])
  310. cam['ao'] = 0
  311. dict['ao'] = 0
  312. if funct == 'ao width':
  313. b = cam['aowidth']
  314. if motion == 'inc':
  315. b += 1
  316. else:
  317. b -= 1
  318. cam['aowidth'] = round(b,2)
  319. dict['aowidth'] = round(b,2)
  320. if funct == 'ao radius':
  321. b = cam['aoradius']
  322. if motion == 'inc':
  323. b += 1
  324. else:
  325. b -= 1
  326. cam['aoradius'] = round(b,2)
  327. dict['aoradius'] = round(b,2)
  328. if funct == 'ao only':
  329. b = cam['onlyAO']
  330. if motion == 'inc':
  331. b = 1
  332. else:
  333. b = 0
  334. cam['onlyAO'] = b
  335. dict['onlyAO'] = b
  336. if funct == 'dof on':
  337. if motion == 'inc':
  338. cont.activate(cam.actuators["DOF"])
  339. cam['dof_on'] = 1
  340. dict['dof_on'] = 1
  341. else:
  342. cont.activate(cam.actuators["DOF_off"])
  343. cam['dof_on'] = 0
  344. dict['dof_on'] = 0
  345. if funct == 'bloom on':
  346. if motion == 'inc':
  347. cont.activate(cam.actuators["Bloom"])
  348. cam['bloom_on'] = 1
  349. dict['bloom_on'] = 1
  350. else:
  351. cont.activate(cam.actuators["bloom_off"])
  352. cam['bloom_on'] = 0
  353. dict['bloom_on'] = 0
  354. if funct == 'shadow on':
  355. if motion == 'inc':
  356. cam['shadow_on'] = 1
  357. dict['shadow_on'] = 1
  358. #bge.render.setGLSLMaterialSetting("shadows", 1)
  359. else:
  360. #cont.activate(cam.actuators["bloom_off"])
  361. cam['shadow_on'] = 0
  362. dict['shadow_on'] = 0
  363. #bge.render.setGLSLMaterialSetting("shadows", 0)
  364. if funct == 'sun strength':
  365. b = cam['sun_strength']
  366. if motion == 'inc':
  367. b += .05
  368. else:
  369. b -= .05
  370. cam['sun_strength'] = round(b,2)
  371. dict['sun_strength'] = round(b,2)
  372. if 'sun33' in scene.objects:
  373. sun = scene.objects['sun33']
  374. sun.energy = b
  375. if funct == 'ambient strength':
  376. b = cam['ambient_strength']
  377. if motion == 'inc':
  378. b += .05
  379. else:
  380. b -= .05
  381. cam['ambient_strength'] = round(b,2)
  382. dict['ambient_strength'] = round(b,2)
  383. if 'sun33' in scene.objects:
  384. scene.world.envLightEnergy = b
  385. if funct == 'sun rot x':
  386. #b = cam['sun_rot_x']
  387. b=0
  388. if motion == 'inc':
  389. b += .05
  390. else:
  391. b -= .05
  392. if 'camposEmpty' in scene.objects:
  393. em = scene.objects['camposEmpty']
  394. rot = [ b, 0.0, 0]
  395. em.applyRotation(rot,True)
  396. cam['sun_rot_x'] = round(b,2)
  397. dict['sun_rot_x'] = round(b,2)
  398. if funct == 'sun rot y':
  399. #b = cam['sun_rot_y']
  400. b=0
  401. if motion == 'inc':
  402. b += .05
  403. else:
  404. b -= .05
  405. if 'camposEmpty' in scene.objects:
  406. em = scene.objects['camposEmpty']
  407. rot = [ 0, b, 0]
  408. em.applyRotation(rot,True)
  409. cam['sun_rot_y'] = round(b,2)
  410. dict['sun_rot_y'] = round(b,2)
  411. if funct == 'cam height':
  412. b = dict['cam_height']
  413. if motion == 'inc':
  414. b += .1
  415. else:
  416. b -= .1
  417. dict['cam_height'] = round(b,2)
  418. if funct == 'focal length':
  419. b = dict['focal_length']
  420. if motion == 'inc':
  421. b += 2
  422. else:
  423. b -= 2
  424. dict['focal_length'] = b
  425. if funct == 'min dist':
  426. b = dict['cam_min']
  427. if motion == 'inc':
  428. b += .1
  429. else:
  430. b -= .1
  431. dict['cam_min'] = round(b,2)
  432. if funct == 'max dist':
  433. b = dict['cam_max']
  434. if motion == 'inc':
  435. b += .1
  436. else:
  437. b -= .1
  438. dict['cam_max'] = round(b,2)
  439. #levels
  440. if funct == 'Demo Scene':
  441. if motion == 'inc':
  442. level = "pats"
  443. main_empty["level"] = "pats"
  444. own["level"] = level
  445. Settings.writeSettings()
  446. Settings.readSettings()
  447. #cont.activate(own.actuators['restart'])
  448. #Settings.loadlevel()
  449. dict['load_timer'] = load_timer
  450. dict['reload_timer'] = 250
  451. dict['overlay_fadein'] = 1
  452. if funct == 'Slavonski Brod (WIP)':
  453. if motion == 'inc':
  454. level = "j_scene"
  455. main_empty["level"] = "j_scene"
  456. own["level"] = level
  457. Settings.writeSettings()
  458. Settings.readSettings()
  459. #cont.activate(own.actuators['restart'])
  460. #Settings.loadlevel()
  461. dict['load_timer'] = load_timer
  462. dict['reload_timer'] = 250
  463. dict['overlay_fadein'] = 1
  464. if funct == 'Empty Lot':
  465. if motion == 'inc':
  466. level = "lot"
  467. main_empty["level"] = "lot"
  468. own["level"] = level
  469. Settings.writeSettings()
  470. Settings.readSettings()
  471. #cont.activate(own.actuators['restart'])
  472. #Settings.loadlevel()
  473. dict['load_timer'] = load_timer
  474. dict['reload_timer'] = 250
  475. dict['overlay_fadein'] = 1
  476. if funct == 'Training':
  477. if motion == 'inc':
  478. level = "train"
  479. main_empty["level"] = "train"
  480. own["level"] = level
  481. Settings.writeSettings()
  482. Settings.readSettings()
  483. #cont.activate(own.actuators['restart'])
  484. #Settings.loadlevel()
  485. dict['load_timer'] = load_timer
  486. dict['reload_timer'] = 250
  487. dict['overlay_fadein'] = 1
  488. if funct == 'Spine':
  489. if motion == 'inc':
  490. level = "spine"
  491. main_empty["level"] = "spine"
  492. own["level"] = level
  493. Settings.writeSettings()
  494. Settings.readSettings()
  495. #cont.activate(own.actuators['restart'])
  496. #Settings.loadlevel()
  497. dict['load_timer'] = load_timer
  498. dict['reload_timer'] = 250
  499. dict['overlay_fadein'] = 1
  500. if funct == 'Warehouse':
  501. if motion == 'inc':
  502. level = "warehouse"
  503. main_empty["level"] = "warehouse"
  504. own["level"] = level
  505. Settings.writeSettings()
  506. Settings.readSettings()
  507. #cont.activate(own.actuators['restart'])
  508. #Settings.loadlevel()
  509. dict['load_timer'] = load_timer
  510. dict['reload_timer'] = 250
  511. dict['overlay_fadein'] = 1
  512. #'1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen'
  513. if funct == '1920x1080':
  514. #pass
  515. if motion == 'inc':
  516. dict['resx'] = 1920
  517. dict['resy'] = 1080
  518. Settings.writeSettings()
  519. bge.render.setWindowSize(1920, 1080)
  520. # if dict['fullscreen_on'] == 1:
  521. # bge.render.setFullScreen(True)
  522. # else:
  523. # bge.render.setFullScreen(False)
  524. if funct == '1280x720':
  525. if motion == 'inc':
  526. dict['resx'] = 1280
  527. dict['resy'] = 720
  528. Settings.writeSettings()
  529. bge.render.setWindowSize(1280, 720)
  530. # if dict['fullscreen_on'] == 1:
  531. # bge.render.setFullScreen(True)
  532. # else:
  533. # bge.render.setFullScreen(False)
  534. if funct == '1024x768':
  535. if motion == 'inc':
  536. dict['resx'] = 1024
  537. dict['resy'] = 768
  538. Settings.writeSettings()
  539. bge.render.setWindowSize(1024, 768)
  540. # if dict['fullscreen_on'] == 1:
  541. # bge.render.setFullScreen(True)
  542. # else:
  543. # bge.render.setFullScreen(False)
  544. if funct == '800x600':
  545. if motion == 'inc':
  546. dict['resx'] = 800
  547. dict['resy'] = 600
  548. Settings.writeSettings()
  549. bge.render.setWindowSize(800, 600)
  550. # if dict['fullscreen_on'] == 1:
  551. # bge.render.setFullScreen(True)
  552. # else:
  553. # bge.render.setFullScreen(False)
  554. if funct == 'fullscreen':
  555. if motion == 'inc':
  556. dict['fullscreen_on'] = 1
  557. bge.render.setFullScreen(True)
  558. Settings.writeSettings()
  559. else:
  560. dict['fullscreen_on'] = 0
  561. bge.render.setFullScreen(False)
  562. Settings.writeSettings()
  563. #=======
  564. #end exit functions
  565. def get_c_list(dict):
  566. #main menu
  567. if dict['mlevel'] == 0:
  568. dict['current_list'] = ['settings', 'level', 'replay', 'exit']
  569. #opt = dict['current_list'][dict['current_index']]
  570. if dict['mlevel'] == 1:
  571. if dict['lv0_opt'] == 'settings':
  572. #if opt == 'settings':
  573. dict['current_list'] = ['resolution', 'graphics', 'player', 'level', 'camera', 'physics']
  574. if dict['lv0_opt'] == 'replay':
  575. dict['current_list'] = ['enter replay', 'recorder on', 'record length']
  576. if dict['lv0_opt'] == 'level':
  577. dict['current_list'] = ['Demo Scene', 'Empty Lot', 'Training', 'Spine', 'Warehouse', 'Slavonski Brod (WIP)']
  578. if dict['mlevel'] == 2:
  579. if dict['lv1_opt'] == 'resolution':
  580. #if opt == 'settings':
  581. dict['current_list'] = ['1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen']
  582. if dict['mlevel'] == 2:
  583. if dict['lv1_opt'] == 'graphics':
  584. #if opt == 'settings':
  585. dict['current_list'] = ['brightness / contrast', 'ao', 'hdr', 'dof', 'bloom']
  586. if dict['mlevel'] == 2:
  587. if dict['lv1_opt'] == 'player':
  588. #if opt == 'settings':
  589. dict['current_list'] = ['shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo']
  590. if dict['mlevel'] == 2:
  591. if dict['lv1_opt'] == 'level':
  592. #if opt == 'settings':
  593. dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
  594. if dict['mlevel'] == 2:
  595. if dict['lv1_opt'] == 'camera':
  596. #if opt == 'settings':
  597. dict['current_list'] = ['cam height', 'focal length', 'min dist', 'max dist']
  598. if dict['mlevel'] == 3:
  599. if dict['lv2_opt'] == 'ao':
  600. dict['current_list'] = ['ao on', 'ao radius', 'ao width', 'ao only']
  601. if dict['lv2_opt'] == 'brightness / contrast':
  602. dict['current_list'] = ['brightness / contrast on', 'brightness value', 'contrast value']
  603. if dict['lv2_opt'] == 'hdr':
  604. dict['current_list'] = ['hdr on', 'avgL', 'hdr strength']
  605. if dict['lv2_opt'] == 'dof':
  606. dict['current_list'] = ['dof on']
  607. if dict['lv2_opt'] == 'bloom':
  608. dict['current_list'] = ['bloom on']
  609. def get_inputs(dict, cont):
  610. import aud
  611. obj = cont.owner
  612. #opt = dict['current_list'][dict['current_index']]
  613. #b
  614. obj['sound'] = aud.Factory(bge.logic.expandPath('//sounds/select.wav'))
  615. obj['sound_a'] = aud.Factory(bge.logic.expandPath('//sounds/a.wav'))
  616. obj['sound_b'] = aud.Factory(bge.logic.expandPath('//sounds/b.wav'))
  617. obj['sound'] = obj['sound'].pitch(.8)
  618. obj['sound_a'] = obj['sound_a'].pitch(.8)
  619. obj['sound_b'] = obj['sound_b'].pitch(.8)
  620. sound = aud.Factory(bge.logic.expandPath('//sounds/select.wav'))
  621. sound = sound.pitch(.8)
  622. if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
  623. aud.device().play(obj['sound_b'])
  624. if dict['current_index'] not in dict['menu_end_points']:
  625. #print('lkey')
  626. if dict['mlevel'] == 2:
  627. dict['mlevel'] = 1
  628. dict['current_index'] = dict['lv1_index']
  629. elif dict['mlevel'] == 1:
  630. dict['mlevel'] = 0
  631. dict['current_index'] = dict['lv0_index']
  632. elif dict['mlevel'] == 3:
  633. dict['mlevel'] = 2
  634. dict['current_index'] = dict['lv2_index']
  635. else:
  636. pass
  637. #a
  638. if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
  639. aud.device().play(obj['sound_a'])
  640. if dict['current_opt'] not in dict['menu_end_points']:
  641. if dict['mlevel'] == 0:
  642. dict['lv0_opt'] = dict['current_list'][dict['current_index']]
  643. dict['lv0_index'] = dict['current_index']
  644. dict['mlevel'] = 1
  645. dict['lv1_index'] = 0
  646. dict['current_index'] = 0
  647. elif dict['mlevel'] == 1:
  648. dict['lv1_opt'] = dict['current_list'][dict['current_index']]
  649. dict['lv1_index'] = dict['current_index']
  650. dict['mlevel'] = 2
  651. dict['lv2_index'] = 0
  652. dict['current_index'] = 0
  653. elif dict['mlevel'] == 2:
  654. dict['lv2_opt'] = dict['current_list'][dict['current_index']]
  655. dict['lv2_index'] = dict['current_index']
  656. dict['mlevel'] = 3
  657. dict['lv3_index'] = 0
  658. dict['current_index'] = 0
  659. elif dict['mlevel'] == 3:
  660. dict['lv3_opt'] = dict['current_list'][dict['current_index']]
  661. dict['lv3_index'] = dict['current_index']
  662. #dict['mlevel'] = 3
  663. #dict['lv3_index'] = 0
  664. dict['current_index'] = 0
  665. else:
  666. pass
  667. funct = dict['current_opt']
  668. motion = 'inc'
  669. endpoint(funct, motion, dict, cont)
  670. #down
  671. if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
  672. aud.device().play(obj['sound'])
  673. if dict['current_index'] < (len(dict['current_list']) - 1):
  674. dict['current_index'] += 1
  675. if dict['mlevel'] == 0:
  676. dict['lv0_index'] = dict['current_index']
  677. if dict['mlevel'] == 1:
  678. dict['lv1_index'] = dict['current_index']
  679. if dict['mlevel'] == 2:
  680. dict['lv2_index'] = dict['current_index']
  681. if dict['mlevel'] == 3:
  682. dict['lv3_index'] = dict['current_index']
  683. #up
  684. if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
  685. aud.device().play(obj['sound'])
  686. if dict['current_index'] > 0:
  687. dict['current_index'] -= 1
  688. if dict['mlevel'] == 0:
  689. dict['lv0_index'] = dict['current_index']
  690. if dict['mlevel'] == 1:
  691. dict['lv1_index'] = dict['current_index']
  692. if dict['mlevel'] == 2:
  693. dict['lv2_index'] = dict['current_index']
  694. if dict['mlevel'] == 3:
  695. dict['lv3_index'] = dict['current_index']
  696. #left
  697. if dict['ldPad'] == False and dict['last_ldPad'] == True:
  698. aud.device().play(obj['sound_a'])
  699. if dict['current_opt'] in dict['menu_end_points']:
  700. funct = dict['current_opt']
  701. motion = 'dec'
  702. endpoint(funct, motion, dict, cont)
  703. #right
  704. if dict['rdPad'] == False and dict['last_rdPad'] == True:
  705. aud.device().play(obj['sound_b'])
  706. if dict['current_opt'] in dict['menu_end_points']:
  707. funct = dict['current_opt']
  708. motion = 'inc'
  709. endpoint(funct, motion, dict, cont)
  710. def init(own, dict):
  711. #print('initing')
  712. own['inited'] = True
  713. dict['lv0_opt'] = 0
  714. dict['lv0_index'] = 0
  715. dict['lv1_opt'] = 0
  716. dict['lv1_index'] = 0
  717. dict['lv2_opt'] = 0
  718. dict['lv2_index'] = 0
  719. dict['lv3_opt'] = 0
  720. dict['lv3_index'] = 0
  721. dict['current_list'] = ['']
  722. dict['current_index'] = 0
  723. dict['mlevel'] = 0
  724. dict['current_opt'] = ''
  725. dict['pause_menu_text'] = ''
  726. dict['menu_end_points'] = ['exit', 'restart', 'shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo', 'brightness / contrast on', 'brightness value', 'contrast value', 'hdr on', 'avgL', 'hdr strength', 'ao on', 'ao radius', 'ao width', 'ao only', 'dof on', 'sun strength', 'sun rot x', 'sun rot y', 'shadow on', 'ambient strength', 'Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse', '1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen', 'bloom on', 'cam height', 'focal length', 'min dist', 'max dist', 'enter replay', 'recorder on', 'record length']
  727. def output(dict):
  728. try:
  729. opt = dict['current_list'][dict['current_index']]
  730. except:
  731. pass
  732. #print('broken!!', dict['current_list'], dict['current_index'])
  733. dict['current_opt'] = opt
  734. #print(dict['lv1_index'], 'level: ', dict['mlevel'], dict['lv0_opt'], dict['current_index'], dict['current_list'], dict['current_opt'])
  735. outp = 'menu > '
  736. if dict['mlevel'] == 0:
  737. outp = outp + dict['current_opt']
  738. if dict['mlevel'] == 1:
  739. outp = outp + dict['lv0_opt'] +' > ' + dict['current_opt']
  740. if dict['mlevel'] == 2:
  741. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['current_opt']
  742. if dict['mlevel'] == 3:
  743. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['lv2_opt'] + ' > ' + dict['current_opt']
  744. #print(outp)
  745. #print(dict['current_opt'])
  746. if dict['current_opt'] in dict['menu_end_points']:
  747. #print('adding end point value')
  748. if dict['current_opt'] == 'shirt color r':
  749. outp = outp + ': ' + str(dict['shirt_color_r'])
  750. #print(outp + ': ' + str(dict['shirt_color_r']))
  751. if dict['current_opt'] == 'shirt color g':
  752. outp = outp + ': ' + str(dict['shirt_color_g'])
  753. if dict['current_opt'] == 'shirt color b':
  754. outp = outp + ': ' + str(dict['shirt_color_b'])
  755. if dict['current_opt'] == 'shoe color r':
  756. outp = outp + ': ' + str(dict['shoe_color_r'])
  757. #print(outp + ': ' + str(dict['shoe_color_r']))
  758. if dict['current_opt'] == 'shoe color g':
  759. outp = outp + ': ' + str(dict['shoe_color_g'])
  760. if dict['current_opt'] == 'shoe color b':
  761. outp = outp + ': ' + str(dict['shoe_color_b'])
  762. if dict['current_opt'] == 'deck color r':
  763. outp = outp + ': ' + str(dict['deck_color_r'])
  764. #print(outp + ': ' + str(dict['deck_color_r']))
  765. if dict['current_opt'] == 'deck color g':
  766. outp = outp + ': ' + str(dict['deck_color_g'])
  767. if dict['current_opt'] == 'deck color b':
  768. outp = outp + ': ' + str(dict['deck_color_b'])
  769. if dict['current_opt'] == 'shirt logo':
  770. outp = outp + ': ' + str(dict['shirt_logo'])
  771. if dict['current_opt'] == 'brightness / contrast on':
  772. outp = outp + ': ' + str(dict['bc'])
  773. if dict['current_opt'] == 'brightness value':
  774. outp = outp + ': ' + str(dict['BC_BRIGHTNESS'])
  775. if dict['current_opt'] == 'contrast value':
  776. outp = outp + ': ' + str(dict['BC_CONTRAST'])
  777. if dict['current_opt'] == 'hdr on':
  778. outp = outp + ': ' + str(dict['hdr'])
  779. if dict['current_opt'] == 'avgL':
  780. outp = outp + ': ' + str(dict['avgL'])
  781. if dict['current_opt'] == 'hdr strength':
  782. outp = outp + ': ' + str(dict['HDRamount'])
  783. if dict['current_opt'] == 'ao on':
  784. outp = outp + ': ' + str(dict['ao'])
  785. if dict['current_opt'] == 'ao width':
  786. outp = outp + ': ' + str(dict['aowidth'])
  787. if dict['current_opt'] == 'ao radius':
  788. outp = outp + ': ' + str(dict['aoradius'])
  789. if dict['current_opt'] == 'ao only':
  790. outp = outp + ': ' + str(dict['onlyAO'])
  791. if dict['current_opt'] == 'dof on':
  792. outp = outp + ': ' + str(dict['dof_on'])
  793. if dict['current_opt'] == 'sun strength':
  794. outp = outp + ': ' + str(dict['sun_strength'])
  795. if dict['current_opt'] == 'sun rot x':
  796. outp = outp + ': ' + str(dict['sun_rot_x'])
  797. if dict['current_opt'] == 'sun rot y':
  798. outp = outp + ': ' + str(dict['sun_rot_y'])
  799. if dict['current_opt'] == 'shadow on':
  800. #outp = outp + ': ' + str(dict['shadow_on'])
  801. outp = outp + ': (not available)'
  802. if dict['current_opt'] == 'ambient strength':
  803. outp = outp + ': ' + str(dict['ambient_strength'])
  804. if dict['current_opt'] == 'fullscreen':
  805. outp = outp + ': ' + str(dict['fullscreen_on'])
  806. if dict['current_opt'] == 'bloom on':
  807. outp = outp + ': ' + str(dict['bloom_on'])
  808. if dict['current_opt'] == 'cam height':
  809. outp = outp + '(-0.4): ' + str(dict['cam_height'])
  810. if dict['current_opt'] == 'focal length':
  811. outp = outp + '(16): ' + str(dict['focal_length'])
  812. if dict['current_opt'] == 'min dist':
  813. outp = outp + '(1.6): ' + str(dict['cam_min'])
  814. if dict['current_opt'] == 'max dist':
  815. outp = outp + '(2.4): ' + str(dict['cam_max'])
  816. dict['pause_menu_text'] = outp
  817. def main(cont):
  818. own = cont.owner
  819. dict = bge.logic.globalDict
  820. if 'inited' not in own:
  821. init(own, dict)
  822. get_c_list(dict)
  823. get_inputs(dict, cont)
  824. get_c_list(dict)
  825. output(dict)