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

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