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.

scene_init.py 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. import bge
  2. import colors
  3. def main():
  4. import bge
  5. #import GameLogic
  6. cont = bge.logic.getCurrentController()
  7. own = cont.owner
  8. dict = bge.logic.globalDict
  9. #print("nnnnnnpause level", dict['level'])
  10. own['last_stBut'] = False
  11. level = dict['level']
  12. scene = bge.logic.getCurrentScene()
  13. cam = scene.objects['Camera.003']
  14. curscene = bge.logic.getCurrentScene()
  15. # scenes = bge.logic.getSceneList()
  16. # for scene in scenes :
  17. # if scene.name == 'main':
  18. # player = scene.objects['player']
  19. # main = bge.logic.getSceneList["main"]
  20. dict['overlay_fadeout'] = 1
  21. scenes = bge.logic.getSceneList()
  22. own['pre_pause_linvel'] = 0.0
  23. objList = scene.objects
  24. # get object named MainCharacter
  25. parent = objList["control_cube.002"]
  26. # combine child's shape with parent's
  27. compound = True
  28. obj = scene.objects['Char4']
  29. # child is solid
  30. ghost = False
  31. # set parent
  32. obj.setParent( parent, compound, ghost)
  33. parent.worldPosition.z += .5
  34. scene.gravity = [0,0,dict['gravity']]
  35. for i in scenes:
  36. if i.name == "main":
  37. main = i
  38. for i in scenes:
  39. if i.name == "fade_out":
  40. print('ending fade_out', scenes)
  41. scene2 = i
  42. scene2.end()
  43. if level == 'newday':
  44. brightness = 2.6
  45. cam['BC_BRIGHTNESS'] = 1.3
  46. cam['BC_CONTRAST'] = 1.5
  47. # elif level == 'lot':
  48. # brightness = 2.6
  49. # cam['BC_BRIGHTNESS'] = 1
  50. # cam['BC_CONTRAST'] = 1
  51. # #main.world.zenithColor = [1.0, .9, .975, 0]
  52. # #main.world.horizonColor = [.42, .555, .823, 0]
  53. # curscene.world.zenithColor = [1.0, .9, .975, 0]
  54. # curscene.world.horizonColor = [.42, .555, .823, 0]
  55. #print("sadfasdfsdfasdfasdfasdfasdfasdf")
  56. elif level == 'spine':
  57. brightness = 2.6
  58. cam['BC_BRIGHTNESS'] = .85
  59. cam['BC_CONTRAST'] = 1.1
  60. elif level == 'sc':
  61. print('setting color of', curscene)
  62. curscene.world.zenithColor = [.23, .23, .25, 1] #[0.1,.2,.4,.5]#[.58, .86, 1.0, 0] #[.3, 0.3, 0.3, 0]
  63. curscene.world.horizonColor = [.1, .15, .3, 1] #[0.1,0,0,1] #[.58, .86, 1.0, 1]
  64. elif level == 'garage18':
  65. print('setting color of', curscene)
  66. curscene.world.zenithColor = [0, 0.0, 0.0, 0]
  67. curscene.world.horizonColor = [0, 0, 0.0, 0]
  68. elif level == 'pats':
  69. print('setting color of', curscene)
  70. if dict['bc'] == 1:
  71. cont.activate(cam.actuators["bc"])
  72. else:
  73. cont.activate(cam.actuators["bc_off"])
  74. if dict['hdr'] == 1:
  75. cont.activate(cam.actuators["hdr"])
  76. else:
  77. cont.activate(cam.actuators["hdr_off"])
  78. if dict['ao'] == 1:
  79. cont.activate(cam.actuators["ao"])
  80. else:
  81. cont.activate(cam.actuators["ao_off"])
  82. if dict['dof_on'] == 1:
  83. cont.activate(cam.actuators["DOF"])
  84. else:
  85. cont.activate(cam.actuators["DOF_off"])
  86. if dict['bloom_on'] == 1:
  87. cont.activate(cam.actuators["Bloom"])
  88. else:
  89. cont.activate(cam.actuators["bloom_off"])
  90. # print(dict['shadow_on'], 'shadow_on')
  91. # if dict['shadow_on'] == 1:
  92. # bge.render.setGLSLMaterialSetting("shadows", 1)
  93. # else:
  94. # bge.render.setGLSLMaterialSetting("shadows", 0)
  95. if dict['music_player'] == 1:
  96. dict['music_start'] = True
  97. print('starting music')
  98. else:
  99. print('not starting music', dict['music_player'])
  100. for x in scene.objects:
  101. if 'hemi' in x:
  102. if 'down' in x:
  103. x.energy = dict['ambient_strength']
  104. else:
  105. x.energy = dict['ambient_strength'] * .7
  106. #scene.world.envLightEnergy = dict['ambient_strength']
  107. scene.world.envLightEnergy = 0
  108. cam['BC_BRIGHTNESS'] = dict['BC_BRIGHTNESS']
  109. cam['BC_CONTRAST'] = dict['BC_CONTRAST']
  110. cam['bc'] = dict['bc']
  111. cam['hdr'] = dict['hdr']
  112. cam['avgL'] = dict['avgL']
  113. cam['HDRamount'] = dict['HDRamount']
  114. cam['ao'] = dict['ao']
  115. cam['onlyAO'] = dict['onlyAO']
  116. cam['aowidth'] = dict['aowidth']
  117. cam['aoradius'] = dict['aoradius']
  118. cam['ambient_strength'] = dict['ambient_strength']
  119. cam['sun_strength'] = dict['sun_strength']
  120. cam['sun_pos_x'] = dict['sun_rot_x']
  121. cam['sun_pos_y'] = dict['sun_rot_y']
  122. #cam['shadow_on'] = dict['shadow_on']
  123. cam['dof_on'] = dict['dof_on']
  124. cam['bloom_on'] = dict['bloom_on']
  125. cam['fxaa'] = dict['fxaa']
  126. cam['FXAA_SPAN_MAX'] = dict['FXAA_SPAN_MAX']
  127. own['grindnew_timer'] = 0
  128. own['last_ramp'] = 0
  129. own['requestAction'] = ''
  130. own['l_actionState'] = ''
  131. own['actionState'] = ''
  132. own['transition_timer'] = 0
  133. own['transitioning'] = 0
  134. own['driving'] = False
  135. dict['last_driving'] = False
  136. own['last_roty'] = 0.0
  137. own['walk_targ_speed'] = 2
  138. own['walk_fast_targ_speed'] = 5
  139. own['walk_speed'] = 0
  140. own['walk_inc'] = .05
  141. own['walk_jump_timer'] = 0
  142. own['no_grind_timer'] = 0
  143. own['last_jump_frame'] = 0
  144. colors.update_shirt_tex()
  145. colors.update_truck_tex()
  146. print('scene init ran')
  147. main()