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

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