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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. import bge
  2. import colors
  3. def main():
  4. import bge
  5. #import GameLogic
  6. cont = bge.logic.getCurrentController()
  7. scene = bge.logic.getCurrentScene()
  8. own = cont.owner
  9. #own = scene.objects['control_cube.002']
  10. dict = bge.logic.globalDict
  11. if dict['scene_inited'] == False:
  12. own['last_stBut'] = False
  13. level = dict['level']
  14. cam = scene.objects['Camera.003']
  15. curscene = bge.logic.getCurrentScene()
  16. dict['overlay_fadeout'] = 1
  17. scenes = bge.logic.getSceneList()
  18. own['pre_pause_linvel'] = 0.0
  19. objList = scene.objects
  20. # get object named MainCharacter
  21. parent = objList["control_cube.002"]
  22. # combine child's shape with parent's
  23. compound = True
  24. obj = scene.objects['Char4']
  25. deck_obj = scene.objects['deck_arm']
  26. dict['p1c'] = own
  27. dict['p1'] = obj
  28. dict['p1d'] = deck_obj
  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 dict['bc'] == 1:
  44. cont.activate(cam.actuators["bc"])
  45. else:
  46. cont.activate(cam.actuators["bc_off"])
  47. if dict['hdr'] == 1:
  48. cont.activate(cam.actuators["hdr"])
  49. else:
  50. cont.activate(cam.actuators["hdr_off"])
  51. if dict['ao'] == 1:
  52. cont.activate(cam.actuators["ao"])
  53. else:
  54. cont.activate(cam.actuators["ao_off"])
  55. if dict['dof_on'] == 1:
  56. cont.activate(cam.actuators["DOF"])
  57. else:
  58. cont.activate(cam.actuators["DOF_off"])
  59. if dict['bloom_on'] == 1:
  60. cont.activate(cam.actuators["Bloom"])
  61. else:
  62. cont.activate(cam.actuators["bloom_off"])
  63. # print(dict['shadow_on'], 'shadow_on')
  64. # if dict['shadow_on'] == 1:
  65. # bge.render.setGLSLMaterialSetting("shadows", 1)
  66. # else:
  67. # bge.render.setGLSLMaterialSetting("shadows", 0)
  68. if dict['music_player'] == 1:
  69. dict['music_start'] = True
  70. print('starting music')
  71. else:
  72. print('not starting music', dict['music_player'])
  73. for x in scene.objects:
  74. if 'hemi' in x:
  75. if 'down' in x:
  76. x.energy = dict['ambient_strength']
  77. else:
  78. x.energy = dict['ambient_strength'] * .7
  79. if 'sun' in x:
  80. x.energy = dict['sun_strength']
  81. #scene.world.envLightEnergy = dict['ambient_strength']
  82. scene.world.envLightEnergy = 0
  83. cam['BC_BRIGHTNESS'] = dict['BC_BRIGHTNESS']
  84. cam['BC_CONTRAST'] = dict['BC_CONTRAST']
  85. cam['bc'] = dict['bc']
  86. cam['hdr'] = dict['hdr']
  87. cam['avgL'] = dict['avgL']
  88. cam['HDRamount'] = dict['HDRamount']
  89. cam['ao'] = dict['ao']
  90. cam['onlyAO'] = dict['onlyAO']
  91. cam['aowidth'] = dict['aowidth']
  92. cam['aoradius'] = dict['aoradius']
  93. cam['ambient_strength'] = dict['ambient_strength']
  94. cam['sun_strength'] = dict['sun_strength']
  95. cam['sun_pos_x'] = dict['sun_rot_x']
  96. cam['sun_pos_y'] = dict['sun_rot_y']
  97. #cam['shadow_on'] = dict['shadow_on']
  98. cam['dof_on'] = dict['dof_on']
  99. cam['bloom_on'] = dict['bloom_on']
  100. cam['fxaa'] = dict['fxaa']
  101. cam['FXAA_SPAN_MAX'] = dict['FXAA_SPAN_MAX']
  102. own['grindnew_timer'] = 0
  103. own['last_ramp'] = 0
  104. own['requestAction'] = ''
  105. own['l_actionState'] = ''
  106. own['actionState'] = ''
  107. own['transition_timer'] = 0
  108. own['transitioning'] = 0
  109. own['driving'] = False
  110. dict['last_driving'] = False
  111. own['last_roty'] = 0.0
  112. own['walk_targ_speed'] = 2
  113. own['walk_fast_targ_speed'] = 5
  114. own['walk_speed'] = 0
  115. own['walk_inc'] = .05
  116. own['walk_jump_timer'] = 0
  117. own['no_grind_timer'] = 0
  118. own['last_jump_frame'] = 0
  119. own['grinder_rot'] = None
  120. own['inc'] = 0
  121. own['vert'] = 0
  122. own['last_vert_frame'] = 0
  123. own['ragdoll_active'] = False
  124. own['rd_to_delete'] = None
  125. own['ragdoll_out'] = 0
  126. own['lland'] = ''
  127. own['grinding'] = False
  128. own['ground_since'] = 100
  129. colors.update_shirt_tex()
  130. colors.update_truck_tex()
  131. print('scene init ran')
  132. dict['scene_inited'] = True
  133. #main()