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 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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', 'ed']
  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. #------------
  356. if funct == 'fxaa on':
  357. if motion == 'inc':
  358. cont.activate(cam.actuators["fxaa"])
  359. cam['fxaa'] = 1
  360. dict['fxaa'] = 1
  361. else:
  362. cont.activate(cam.actuators["fxaa_off"])
  363. cam['fxaa'] = 0
  364. dict['fxaa'] = 0
  365. if funct == 'fxaa span max':
  366. b = cam['FXAA_SPAN_MAX']
  367. if motion == 'inc':
  368. b += 1
  369. else:
  370. b -= 1
  371. cam['FXAA_SPAN_MAX'] = b
  372. dict['FXAA_SPAN_MAX'] = b
  373. #---------
  374. if funct == 'shadow on':
  375. if motion == 'inc':
  376. cam['shadow_on'] = 1
  377. dict['shadow_on'] = 1
  378. #bge.render.setGLSLMaterialSetting("shadows", 1)
  379. else:
  380. #cont.activate(cam.actuators["bloom_off"])
  381. cam['shadow_on'] = 0
  382. dict['shadow_on'] = 0
  383. #bge.render.setGLSLMaterialSetting("shadows", 0)
  384. if funct == 'sun strength':
  385. b = cam['sun_strength']
  386. if motion == 'inc':
  387. b += .05
  388. else:
  389. b -= .05
  390. cam['sun_strength'] = round(b,2)
  391. dict['sun_strength'] = round(b,2)
  392. if 'sun33' in scene.objects:
  393. sun = scene.objects['sun33']
  394. sun.energy = b
  395. if funct == 'ambient strength':
  396. b = cam['ambient_strength']
  397. if motion == 'inc':
  398. b += .05
  399. else:
  400. b -= .05
  401. cam['ambient_strength'] = round(b,2)
  402. dict['ambient_strength'] = round(b,2)
  403. if 'sun33' in scene.objects:
  404. scene.world.envLightEnergy = b
  405. if funct == 'sun rot x':
  406. #b = cam['sun_rot_x']
  407. b=0
  408. if motion == 'inc':
  409. b += .05
  410. else:
  411. b -= .05
  412. if 'camposEmpty' in scene.objects:
  413. em = scene.objects['camposEmpty']
  414. rot = [ b, 0.0, 0]
  415. em.applyRotation(rot,True)
  416. cam['sun_rot_x'] = round(b,2)
  417. dict['sun_rot_x'] = round(b,2)
  418. if funct == 'sun rot y':
  419. #b = cam['sun_rot_y']
  420. b=0
  421. if motion == 'inc':
  422. b += .05
  423. else:
  424. b -= .05
  425. if 'camposEmpty' in scene.objects:
  426. em = scene.objects['camposEmpty']
  427. rot = [ 0, b, 0]
  428. em.applyRotation(rot,True)
  429. cam['sun_rot_y'] = round(b,2)
  430. dict['sun_rot_y'] = round(b,2)
  431. if funct == 'cam height':
  432. b = dict['cam_height']
  433. if motion == 'inc':
  434. b += .1
  435. else:
  436. b -= .1
  437. dict['cam_height'] = round(b,2)
  438. if funct == 'focal length':
  439. b = dict['focal_length']
  440. if motion == 'inc':
  441. b += 2
  442. else:
  443. b -= 2
  444. dict['focal_length'] = b
  445. if funct == 'min dist':
  446. b = dict['cam_min']
  447. if motion == 'inc':
  448. b += .1
  449. else:
  450. b -= .1
  451. dict['cam_min'] = round(b,2)
  452. if funct == 'max dist':
  453. b = dict['cam_max']
  454. if motion == 'inc':
  455. b += .1
  456. else:
  457. b -= .1
  458. dict['cam_max'] = round(b,2)
  459. if funct == 'recorder on':
  460. if motion == 'inc':
  461. cam['recorder_on'] = 1
  462. dict['recorder_on'] = 1
  463. else:
  464. cam['recorder_on'] = 0
  465. dict['recorder_on'] = 0
  466. #levels
  467. if funct == 'Demo Scene':
  468. if motion == 'inc':
  469. level = "pats"
  470. main_empty["level"] = "pats"
  471. own["level"] = level
  472. Settings.writeSettings()
  473. Settings.readSettings()
  474. #cont.activate(own.actuators['restart'])
  475. #Settings.loadlevel()
  476. dict['load_timer'] = load_timer
  477. dict['reload_timer'] = 250
  478. dict['overlay_fadein'] = 1
  479. if funct == 'Slavonski Brod (WIP)':
  480. if motion == 'inc':
  481. level = "j_scene"
  482. main_empty["level"] = "j_scene"
  483. own["level"] = level
  484. Settings.writeSettings()
  485. Settings.readSettings()
  486. #cont.activate(own.actuators['restart'])
  487. #Settings.loadlevel()
  488. dict['load_timer'] = load_timer
  489. dict['reload_timer'] = 250
  490. dict['overlay_fadein'] = 1
  491. if funct == 'Empty Lot':
  492. if motion == 'inc':
  493. level = "lot"
  494. main_empty["level"] = "lot"
  495. own["level"] = level
  496. Settings.writeSettings()
  497. Settings.readSettings()
  498. #cont.activate(own.actuators['restart'])
  499. #Settings.loadlevel()
  500. dict['load_timer'] = load_timer
  501. dict['reload_timer'] = 250
  502. dict['overlay_fadein'] = 1
  503. if funct == 'Training':
  504. if motion == 'inc':
  505. level = "train"
  506. main_empty["level"] = "train"
  507. own["level"] = level
  508. Settings.writeSettings()
  509. Settings.readSettings()
  510. #cont.activate(own.actuators['restart'])
  511. #Settings.loadlevel()
  512. dict['load_timer'] = load_timer
  513. dict['reload_timer'] = 250
  514. dict['overlay_fadein'] = 1
  515. if funct == 'Spine':
  516. if motion == 'inc':
  517. level = "spine"
  518. main_empty["level"] = "spine"
  519. own["level"] = level
  520. Settings.writeSettings()
  521. Settings.readSettings()
  522. #cont.activate(own.actuators['restart'])
  523. #Settings.loadlevel()
  524. dict['load_timer'] = load_timer
  525. dict['reload_timer'] = 250
  526. dict['overlay_fadein'] = 1
  527. if funct == 'Warehouse':
  528. if motion == 'inc':
  529. level = "warehouse"
  530. main_empty["level"] = "warehouse"
  531. own["level"] = level
  532. Settings.writeSettings()
  533. Settings.readSettings()
  534. #cont.activate(own.actuators['restart'])
  535. #Settings.loadlevel()
  536. dict['load_timer'] = load_timer
  537. dict['reload_timer'] = 250
  538. dict['overlay_fadein'] = 1
  539. if funct == 'Shop':
  540. if motion == 'inc':
  541. level = "shop"
  542. main_empty["level"] = "shop"
  543. own["level"] = level
  544. Settings.writeSettings()
  545. Settings.readSettings()
  546. #cont.activate(own.actuators['restart'])
  547. #Settings.loadlevel()
  548. dict['load_timer'] = load_timer
  549. dict['reload_timer'] = 250
  550. dict['overlay_fadein'] = 1
  551. if funct in player_list:
  552. if motion == 'inc':
  553. dict['character'] = funct
  554. Settings.writeSettings()
  555. Settings.readSettings()
  556. dict['load_timer'] = load_timer
  557. dict['reload_timer'] = 250
  558. dict['overlay_fadein'] = 1
  559. # if funct == 'billy':
  560. # if motion == 'inc':
  561. # dict['character'] = 'billy'
  562. # Settings.writeSettings()
  563. # Settings.readSettings()
  564. # dict['load_timer'] = load_timer
  565. # dict['reload_timer'] = 250
  566. # dict['overlay_fadein'] = 1
  567. #'1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen'
  568. if funct == '1920x1080':
  569. #pass
  570. if motion == 'inc':
  571. dict['resx'] = 1920
  572. dict['resy'] = 1080
  573. Settings.writeSettings()
  574. bge.render.setWindowSize(1920, 1080)
  575. # if dict['fullscreen_on'] == 1:
  576. # bge.render.setFullScreen(True)
  577. # else:
  578. # bge.render.setFullScreen(False)
  579. if funct == '1280x720':
  580. if motion == 'inc':
  581. dict['resx'] = 1280
  582. dict['resy'] = 720
  583. Settings.writeSettings()
  584. bge.render.setWindowSize(1280, 720)
  585. # if dict['fullscreen_on'] == 1:
  586. # bge.render.setFullScreen(True)
  587. # else:
  588. # bge.render.setFullScreen(False)
  589. if funct == '1024x768':
  590. if motion == 'inc':
  591. dict['resx'] = 1024
  592. dict['resy'] = 768
  593. Settings.writeSettings()
  594. bge.render.setWindowSize(1024, 768)
  595. # if dict['fullscreen_on'] == 1:
  596. # bge.render.setFullScreen(True)
  597. # else:
  598. # bge.render.setFullScreen(False)
  599. if funct == '800x600':
  600. if motion == 'inc':
  601. dict['resx'] = 800
  602. dict['resy'] = 600
  603. Settings.writeSettings()
  604. bge.render.setWindowSize(800, 600)
  605. # if dict['fullscreen_on'] == 1:
  606. # bge.render.setFullScreen(True)
  607. # else:
  608. # bge.render.setFullScreen(False)
  609. if funct == 'fullscreen':
  610. if motion == 'inc':
  611. dict['fullscreen_on'] = 1
  612. bge.render.setFullScreen(True)
  613. Settings.writeSettings()
  614. else:
  615. dict['fullscreen_on'] = 0
  616. bge.render.setFullScreen(False)
  617. Settings.writeSettings()
  618. #=======
  619. #end exit functions
  620. def get_c_list(dict):
  621. #main menu
  622. if dict['mlevel'] == 0:
  623. dict['current_list'] = ['settings', 'level', 'replay', 'exit']
  624. #opt = dict['current_list'][dict['current_index']]
  625. if dict['mlevel'] == 1:
  626. if dict['lv0_opt'] == 'settings':
  627. #if opt == 'settings':
  628. dict['current_list'] = ['resolution', 'graphics', 'player', 'level', 'camera', 'physics']
  629. if dict['lv0_opt'] == 'replay':
  630. dict['current_list'] = ['enter replay (press back button)', 'recorder on', 'record length (n/a)']
  631. if dict['lv0_opt'] == 'level':
  632. dict['current_list'] = ['Demo Scene', 'Empty Lot', 'Training', 'Spine', 'Warehouse', 'Shop', 'Slavonski Brod (WIP)']
  633. if dict['mlevel'] == 2:
  634. if dict['lv1_opt'] == 'resolution':
  635. #if opt == 'settings':
  636. dict['current_list'] = ['fullscreen']
  637. if dict['mlevel'] == 2:
  638. if dict['lv1_opt'] == 'graphics':
  639. #if opt == 'settings':
  640. dict['current_list'] = ['brightness / contrast', 'ao', 'hdr', 'dof', 'bloom', 'fxaa']
  641. if dict['mlevel'] == 2:
  642. if dict['lv1_opt'] == 'player':
  643. #if opt == 'settings':
  644. 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']
  645. if dict['mlevel'] == 2:
  646. if dict['lv1_opt'] == 'level':
  647. #if opt == 'settings':
  648. dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
  649. if dict['mlevel'] == 2:
  650. if dict['lv1_opt'] == 'camera':
  651. #if opt == 'settings':
  652. dict['current_list'] = ['cam height', 'focal length', 'min dist', 'max dist']
  653. if dict['mlevel'] == 3:
  654. if dict['lv2_opt'] == 'ao':
  655. dict['current_list'] = ['ao on', 'ao radius', 'ao width', 'ao only']
  656. if dict['lv2_opt'] == 'brightness / contrast':
  657. dict['current_list'] = ['brightness / contrast on', 'brightness value', 'contrast value']
  658. if dict['lv2_opt'] == 'hdr':
  659. dict['current_list'] = ['hdr on', 'avgL', 'hdr strength']
  660. if dict['lv2_opt'] == 'dof':
  661. dict['current_list'] = ['dof on']
  662. if dict['lv2_opt'] == 'bloom':
  663. dict['current_list'] = ['bloom on']
  664. if dict['lv2_opt'] == 'fxaa':
  665. dict['current_list'] = ['fxaa on', 'fxaa span max']
  666. if dict['lv2_opt'] == 'character':
  667. dict['current_list'] = player_list
  668. def get_inputs(dict, cont):
  669. import aud
  670. obj = cont.owner
  671. #opt = dict['current_list'][dict['current_index']]
  672. #b
  673. obj['sound'] = aud.Factory(bge.logic.expandPath('//sounds/select.wav'))
  674. obj['sound_a'] = aud.Factory(bge.logic.expandPath('//sounds/a.wav'))
  675. obj['sound_b'] = aud.Factory(bge.logic.expandPath('//sounds/b.wav'))
  676. obj['sound'] = obj['sound'].pitch(.8)
  677. obj['sound_a'] = obj['sound_a'].pitch(.8)
  678. obj['sound_b'] = obj['sound_b'].pitch(.8)
  679. sound = aud.Factory(bge.logic.expandPath('//sounds/select.wav'))
  680. sound = sound.pitch(.8)
  681. if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
  682. aud.device().play(obj['sound_b'])
  683. if dict['current_index'] not in dict['menu_end_points']:
  684. #print('lkey')
  685. if dict['mlevel'] == 2:
  686. dict['mlevel'] = 1
  687. dict['current_index'] = dict['lv1_index']
  688. elif dict['mlevel'] == 1:
  689. dict['mlevel'] = 0
  690. dict['current_index'] = dict['lv0_index']
  691. elif dict['mlevel'] == 3:
  692. dict['mlevel'] = 2
  693. dict['current_index'] = dict['lv2_index']
  694. else:
  695. pass
  696. #a
  697. if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
  698. aud.device().play(obj['sound_a'])
  699. if dict['current_opt'] not in dict['menu_end_points']:
  700. if dict['mlevel'] == 0:
  701. dict['lv0_opt'] = dict['current_list'][dict['current_index']]
  702. dict['lv0_index'] = dict['current_index']
  703. dict['mlevel'] = 1
  704. dict['lv1_index'] = 0
  705. dict['current_index'] = 0
  706. elif dict['mlevel'] == 1:
  707. dict['lv1_opt'] = dict['current_list'][dict['current_index']]
  708. dict['lv1_index'] = dict['current_index']
  709. dict['mlevel'] = 2
  710. dict['lv2_index'] = 0
  711. dict['current_index'] = 0
  712. elif dict['mlevel'] == 2:
  713. dict['lv2_opt'] = dict['current_list'][dict['current_index']]
  714. dict['lv2_index'] = dict['current_index']
  715. dict['mlevel'] = 3
  716. dict['lv3_index'] = 0
  717. dict['current_index'] = 0
  718. elif dict['mlevel'] == 3:
  719. dict['lv3_opt'] = dict['current_list'][dict['current_index']]
  720. dict['lv3_index'] = dict['current_index']
  721. #dict['mlevel'] = 3
  722. #dict['lv3_index'] = 0
  723. dict['current_index'] = 0
  724. else:
  725. pass
  726. funct = dict['current_opt']
  727. motion = 'inc'
  728. endpoint(funct, motion, dict, cont)
  729. #down
  730. if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
  731. aud.device().play(obj['sound'])
  732. if dict['current_index'] < (len(dict['current_list']) - 1):
  733. dict['current_index'] += 1
  734. if dict['mlevel'] == 0:
  735. dict['lv0_index'] = dict['current_index']
  736. if dict['mlevel'] == 1:
  737. dict['lv1_index'] = dict['current_index']
  738. if dict['mlevel'] == 2:
  739. dict['lv2_index'] = dict['current_index']
  740. if dict['mlevel'] == 3:
  741. dict['lv3_index'] = dict['current_index']
  742. #up
  743. if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
  744. aud.device().play(obj['sound'])
  745. if dict['current_index'] > 0:
  746. dict['current_index'] -= 1
  747. if dict['mlevel'] == 0:
  748. dict['lv0_index'] = dict['current_index']
  749. if dict['mlevel'] == 1:
  750. dict['lv1_index'] = dict['current_index']
  751. if dict['mlevel'] == 2:
  752. dict['lv2_index'] = dict['current_index']
  753. if dict['mlevel'] == 3:
  754. dict['lv3_index'] = dict['current_index']
  755. #left
  756. if dict['ldPad'] == False and dict['last_ldPad'] == True:
  757. aud.device().play(obj['sound_a'])
  758. if dict['current_opt'] in dict['menu_end_points']:
  759. funct = dict['current_opt']
  760. motion = 'dec'
  761. endpoint(funct, motion, dict, cont)
  762. #right
  763. if dict['rdPad'] == False and dict['last_rdPad'] == True:
  764. aud.device().play(obj['sound_b'])
  765. if dict['current_opt'] in dict['menu_end_points']:
  766. funct = dict['current_opt']
  767. motion = 'inc'
  768. endpoint(funct, motion, dict, cont)
  769. def init(own, dict):
  770. #print('initing')
  771. own['inited'] = True
  772. dict['lv0_opt'] = 0
  773. dict['lv0_index'] = 0
  774. dict['lv1_opt'] = 0
  775. dict['lv1_index'] = 0
  776. dict['lv2_opt'] = 0
  777. dict['lv2_index'] = 0
  778. dict['lv3_opt'] = 0
  779. dict['lv3_index'] = 0
  780. dict['current_list'] = ['']
  781. dict['current_index'] = 0
  782. dict['mlevel'] = 0
  783. dict['current_opt'] = ''
  784. dict['pause_menu_text'] = ''
  785. 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', 'fxaa on', 'fxaa span max',] + player_list
  786. def output(dict):
  787. try:
  788. opt = dict['current_list'][dict['current_index']]
  789. except:
  790. pass
  791. #print('broken!!', dict['current_list'], dict['current_index'])
  792. dict['current_opt'] = opt
  793. #print(dict['lv1_index'], 'level: ', dict['mlevel'], dict['lv0_opt'], dict['current_index'], dict['current_list'], dict['current_opt'])
  794. outp = 'menu > '
  795. if dict['mlevel'] == 0:
  796. outp = outp + dict['current_opt']
  797. if dict['mlevel'] == 1:
  798. outp = outp + dict['lv0_opt'] +' > ' + dict['current_opt']
  799. if dict['mlevel'] == 2:
  800. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['current_opt']
  801. if dict['mlevel'] == 3:
  802. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['lv2_opt'] + ' > ' + dict['current_opt']
  803. #print(outp)
  804. #print(dict['current_opt'])
  805. if dict['current_opt'] in dict['menu_end_points']:
  806. #print('adding end point value')
  807. if dict['current_opt'] == 'shirt color r':
  808. outp = outp + ': ' + str(dict['shirt_color_r'])
  809. #print(outp + ': ' + str(dict['shirt_color_r']))
  810. if dict['current_opt'] == 'shirt color g':
  811. outp = outp + ': ' + str(dict['shirt_color_g'])
  812. if dict['current_opt'] == 'shirt color b':
  813. outp = outp + ': ' + str(dict['shirt_color_b'])
  814. if dict['current_opt'] == 'shoe color r':
  815. outp = outp + ': ' + str(dict['shoe_color_r'])
  816. #print(outp + ': ' + str(dict['shoe_color_r']))
  817. if dict['current_opt'] == 'shoe color g':
  818. outp = outp + ': ' + str(dict['shoe_color_g'])
  819. if dict['current_opt'] == 'shoe color b':
  820. outp = outp + ': ' + str(dict['shoe_color_b'])
  821. if dict['current_opt'] == 'deck color r':
  822. outp = outp + ': ' + str(dict['deck_color_r'])
  823. #print(outp + ': ' + str(dict['deck_color_r']))
  824. if dict['current_opt'] == 'deck color g':
  825. outp = outp + ': ' + str(dict['deck_color_g'])
  826. if dict['current_opt'] == 'deck color b':
  827. outp = outp + ': ' + str(dict['deck_color_b'])
  828. if dict['current_opt'] == 'shirt logo':
  829. outp = outp + ': ' + str(dict['shirt_logo'])
  830. if dict['current_opt'] == 'brightness / contrast on':
  831. outp = outp + ': ' + str(dict['bc'])
  832. if dict['current_opt'] == 'brightness value':
  833. outp = outp + ': ' + str(dict['BC_BRIGHTNESS'])
  834. if dict['current_opt'] == 'contrast value':
  835. outp = outp + ': ' + str(dict['BC_CONTRAST'])
  836. if dict['current_opt'] == 'hdr on':
  837. outp = outp + ': ' + str(dict['hdr'])
  838. if dict['current_opt'] == 'avgL':
  839. outp = outp + ': ' + str(dict['avgL'])
  840. if dict['current_opt'] == 'hdr strength':
  841. outp = outp + ': ' + str(dict['HDRamount'])
  842. if dict['current_opt'] == 'ao on':
  843. outp = outp + ': ' + str(dict['ao'])
  844. if dict['current_opt'] == 'ao width':
  845. outp = outp + ': ' + str(dict['aowidth'])
  846. if dict['current_opt'] == 'ao radius':
  847. outp = outp + ': ' + str(dict['aoradius'])
  848. if dict['current_opt'] == 'ao only':
  849. outp = outp + ': ' + str(dict['onlyAO'])
  850. if dict['current_opt'] == 'dof on':
  851. outp = outp + ': ' + str(dict['dof_on'])
  852. if dict['current_opt'] == 'sun strength':
  853. outp = outp + ': ' + str(dict['sun_strength'])
  854. if dict['current_opt'] == 'sun rot x':
  855. outp = outp + ': ' + str(dict['sun_rot_x'])
  856. if dict['current_opt'] == 'sun rot y':
  857. outp = outp + ': ' + str(dict['sun_rot_y'])
  858. if dict['current_opt'] == 'shadow on':
  859. #outp = outp + ': ' + str(dict['shadow_on'])
  860. outp = outp + ': (not available)'
  861. if dict['current_opt'] == 'ambient strength':
  862. outp = outp + ': ' + str(dict['ambient_strength'])
  863. if dict['current_opt'] == 'fullscreen':
  864. outp = outp + ': ' + str(dict['fullscreen_on'])
  865. if dict['current_opt'] == 'bloom on':
  866. outp = outp + ': ' + str(dict['bloom_on'])
  867. if dict['current_opt'] == 'fxaa on':
  868. outp = outp + ': ' + str(dict['fxaa'])
  869. if dict['current_opt'] == 'fxaa span max':
  870. outp = outp + ': ' + str(dict['FXAA_SPAN_MAX'])
  871. if dict['current_opt'] == 'cam height':
  872. outp = outp + '(-0.4): ' + str(dict['cam_height'])
  873. if dict['current_opt'] == 'focal length':
  874. outp = outp + '(16): ' + str(dict['focal_length'])
  875. if dict['current_opt'] == 'min dist':
  876. outp = outp + '(1.6): ' + str(dict['cam_min'])
  877. if dict['current_opt'] == 'max dist':
  878. outp = outp + '(2.4): ' + str(dict['cam_max'])
  879. if dict['current_opt'] == 'recorder on':
  880. outp = outp + ': ' + str(dict['recorder_on'])
  881. # if dict['current_opt'] == 'character':
  882. # outp = outp + ': ' + str(dict['character'])
  883. dict['pause_menu_text'] = outp
  884. def main(cont):
  885. own = cont.owner
  886. dict = bge.logic.globalDict
  887. if 'inited' not in own:
  888. init(own, dict)
  889. get_c_list(dict)
  890. get_inputs(dict, cont)
  891. get_c_list(dict)
  892. output(dict)