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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import bge
  2. import colors
  3. def main():
  4. dict = bge.logic.globalDict
  5. if dict['scene_inited'] == False:
  6. cont = bge.logic.getCurrentController()
  7. scene = bge.logic.getCurrentScene()
  8. own = cont.owner
  9. own['last_stBut'] = False
  10. level = dict['level']
  11. cam = scene.objects['Camera.003']
  12. curscene = bge.logic.getCurrentScene()
  13. dict['level_scene'] = curscene
  14. dict['overlay_fadeout'] = 1
  15. scenes = bge.logic.getSceneList()
  16. own['pre_pause_linvel'] = 0.0
  17. objList = scene.objects
  18. parent = objList["control_cube.002"]
  19. dict['cc'] = parent
  20. # combine child's shape with parent's
  21. compound = True
  22. obj = scene.objects['Char4']
  23. deck_obj = scene.objects['deck_arm']
  24. dict['p1c'] = own
  25. dict['p1'] = obj
  26. dict['p1d'] = deck_obj
  27. # child is solid
  28. ghost = False
  29. # set parent
  30. obj.setParent( parent, compound, ghost)
  31. parent.worldPosition.z += .75
  32. parent.applyRotation([0,0,3.14], True)
  33. scene.gravity = [0,0,dict['gravity']]
  34. for i in scenes:
  35. if i.name == "main":
  36. main = i
  37. for i in scenes:
  38. if i.name == "fade_out":
  39. print('ending fade_out', scenes)
  40. scene2 = i
  41. scene2.end()
  42. if dict['bc'] == 1:
  43. cont.activate(cam.actuators["bc"])
  44. else:
  45. cont.activate(cam.actuators["bc_off"])
  46. if dict['hdr'] == 1:
  47. cont.activate(cam.actuators["hdr"])
  48. else:
  49. cont.activate(cam.actuators["hdr_off"])
  50. if dict['ao'] == 1:
  51. cont.activate(cam.actuators["ao"])
  52. else:
  53. cont.activate(cam.actuators["ao_off"])
  54. if dict['dof_on'] == 1:
  55. cont.activate(cam.actuators["DOF"])
  56. else:
  57. cont.activate(cam.actuators["DOF_off"])
  58. if dict['bloom_on'] == 1:
  59. cont.activate(cam.actuators["Bloom"])
  60. else:
  61. cont.activate(cam.actuators["bloom_off"])
  62. #print(dict['shadow_on'], 'shadow_on')
  63. #if dict['shadow_on'] == 1:
  64. #bge.render.setGLSLMaterialSetting("shadows", 1)
  65. #else:
  66. #bge.render.setGLSLMaterialSetting("shadows", 0)
  67. if dict['music_player'] == 1:
  68. dict['music_start'] = True
  69. print('starting music')
  70. else:
  71. print('not starting music', dict['music_player'])
  72. dict['sun_lights'] = []
  73. dict['ambient_lights'] = []
  74. for x in scene.lights:
  75. if 'hemi' in x:
  76. if 'down' in x:
  77. x.energy = dict['ambient_strength']
  78. dict['ambient_lights'].append(x)
  79. else:
  80. x.energy = dict['ambient_strength'] * .7
  81. dict['ambient_lights'].append(x)
  82. if 'sun' in x:
  83. x.energy = dict['sun_strength']
  84. dict['sun_lights'].append(x)
  85. #scene.world.envLightEnergy = dict['ambient_strength']
  86. #scene.world.envLightEnergy = 0
  87. cam['BC_BRIGHTNESS'] = dict['BC_BRIGHTNESS']
  88. cam['BC_CONTRAST'] = dict['BC_CONTRAST']
  89. cam['bc'] = dict['bc']
  90. cam['hdr'] = dict['hdr']
  91. cam['avgL'] = dict['avgL']
  92. cam['HDRamount'] = dict['HDRamount']
  93. cam['ao'] = dict['ao']
  94. cam['onlyAO'] = dict['onlyAO']
  95. cam['aowidth'] = dict['aowidth']
  96. cam['aoradius'] = dict['aoradius']
  97. cam['ambient_strength'] = dict['ambient_strength']
  98. cam['sun_strength'] = dict['sun_strength']
  99. cam['sun_pos_x'] = dict['sun_rot_x']
  100. cam['sun_pos_y'] = dict['sun_rot_y']
  101. #cam['shadow_on'] = dict['shadow_on']
  102. cam['dof_on'] = dict['dof_on']
  103. cam['bloom_on'] = dict['bloom_on']
  104. cam['fxaa'] = dict['fxaa']
  105. cam['FXAA_SPAN_MAX'] = dict['FXAA_SPAN_MAX']
  106. own['grindnew_timer'] = 0
  107. own['last_ramp'] = 0
  108. own['requestAction'] = ''
  109. own['l_actionState'] = ''
  110. own['actionState'] = ''
  111. own['transition_timer'] = 0
  112. own['transitioning'] = 0
  113. own['driving'] = False
  114. dict['last_driving'] = False
  115. own['last_roty'] = 0.0
  116. own['walk_targ_speed'] = 2
  117. own['walk_fast_targ_speed'] = 5
  118. own['walk_speed'] = 0
  119. own['walk_inc'] = .2
  120. own['walk_jump_timer'] = 0
  121. own['no_grind_timer'] = 0
  122. own['last_jump_frame'] = 0
  123. own['grinder_rot'] = None
  124. own['inc'] = 0
  125. own['vert'] = 0
  126. own['last_vert_frame'] = 0
  127. own['ragdoll_active'] = False
  128. own['rd_to_delete'] = None
  129. own['ragdoll_out'] = 0
  130. own['lland'] = ''
  131. own['grinding'] = False
  132. own['ground_since'] = 100
  133. own['last_transition_frame'] = 0
  134. #own['aState'] = 'reg_roll'
  135. colors.update_shirt_tex()
  136. colors.update_truck_tex()
  137. print('scene init ran')
  138. dict['scene_inited'] = True
  139. material_list = []
  140. for obj in scene.objects:
  141. for mesh in obj.meshes:
  142. for material in mesh.materials:
  143. material_list.append(material.name)
  144. for obj in scene.objectsInactive:
  145. for mesh in obj.meshes:
  146. for material in mesh.materials:
  147. material_list.append(material.name)
  148. scene.objects['camposEmpty'].applyRotation([.3, .3, 0], True)
  149. material_list = set(material_list)
  150. print('number of materials:', len(material_list))