Shuvit game master repo. http://shuvit.org
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 35KB

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