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

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