Level = {}
Level["doscenegraph"] = 1
Level["file"] = "l1"
Level["loadscreen"] = "loadscreen1"
Level["scenegraph"] = {}
Level["scenegraph"]["checkpoints"] = {}
Level["scenegraph"]["checkpoints"][1] = {}
Level["scenegraph"]["checkpoints"][1][1] = "Room 1"
Level["scenegraph"]["checkpoints"][1][2] = {}
Level["scenegraph"]["checkpoints"][1][2][1] = 0
Level["scenegraph"]["checkpoints"][1][2][2] = 124
Level["scenegraph"]["checkpoints"][1][2][3] = 0.2
Level["scenegraph"]["checkpoints"][1][3] = "sectionA"
Level["scenegraph"]["checkpoints"][1][4] = 0
Level["scenegraph"]["checkpoints"][10] = {}
Level["scenegraph"]["checkpoints"][10][1] = "End Movie"
Level["scenegraph"]["checkpoints"][10][2] = {}
Level["scenegraph"]["checkpoints"][10][2][1] = 917.1
Level["scenegraph"]["checkpoints"][10][2][2] = 213.1
Level["scenegraph"]["checkpoints"][10][2][3] = 1105.4
Level["scenegraph"]["checkpoints"][10][3] = "sectionE"
Level["scenegraph"]["checkpoints"][10][4] = 1.5708
Level["scenegraph"]["checkpoints"][11] = {}
Level["scenegraph"]["checkpoints"][11][1] = "Room 1"
Level["scenegraph"]["checkpoints"][11][2] = {}
Level["scenegraph"]["checkpoints"][11][2][1] = 0
Level["scenegraph"]["checkpoints"][11][2][2] = 124
Level["scenegraph"]["checkpoints"][11][2][3] = 0.2
Level["scenegraph"]["checkpoints"][11][3] = "sectionA"
Level["scenegraph"]["checkpoints"][11][4] = 0
Level["scenegraph"]["checkpoints"][12] = {}
Level["scenegraph"]["checkpoints"][12][1] = "Intro Movie B"
Level["scenegraph"]["checkpoints"][12][2] = {}
Level["scenegraph"]["checkpoints"][12][2][1] = 0
Level["scenegraph"]["checkpoints"][12][2][2] = 124
Level["scenegraph"]["checkpoints"][12][2][3] = 0.2
Level["scenegraph"]["checkpoints"][12][3] = "sectionF"
Level["scenegraph"]["checkpoints"][12][4] = 0
Level["scenegraph"]["checkpoints"][13] = {}
Level["scenegraph"]["checkpoints"][13][1] = "Room 5"
Level["scenegraph"]["checkpoints"][13][2] = {}
Level["scenegraph"]["checkpoints"][13][2][1] = 271
Level["scenegraph"]["checkpoints"][13][2][2] = -69
Level["scenegraph"]["checkpoints"][13][2][3] = -163
Level["scenegraph"]["checkpoints"][13][3] = "sectionB"
Level["scenegraph"]["checkpoints"][13][4] = 3.14159
Level["scenegraph"]["checkpoints"][14] = {}
Level["scenegraph"]["checkpoints"][14][1] = "Room 3"
Level["scenegraph"]["checkpoints"][14][2] = {}
Level["scenegraph"]["checkpoints"][14][2][1] = 133
Level["scenegraph"]["checkpoints"][14][2][2] = 46
Level["scenegraph"]["checkpoints"][14][2][3] = -40
Level["scenegraph"]["checkpoints"][14][2][4] = -1.5
Level["scenegraph"]["checkpoints"][14][3] = "sectionA"
Level["scenegraph"]["checkpoints"][14][4] = 4.71239
Level["scenegraph"]["checkpoints"][2] = {}
Level["scenegraph"]["checkpoints"][2][1] = "Room 2"
Level["scenegraph"]["checkpoints"][2][2] = {}
Level["scenegraph"]["checkpoints"][2][2][1] = 80
Level["scenegraph"]["checkpoints"][2][2][2] = 186
Level["scenegraph"]["checkpoints"][2][2][3] = -28
Level["scenegraph"]["checkpoints"][2][3] = "sectionA"
Level["scenegraph"]["checkpoints"][2][4] = 3.14159
Level["scenegraph"]["checkpoints"][3] = {}
Level["scenegraph"]["checkpoints"][3][1] = "Room 3"
Level["scenegraph"]["checkpoints"][3][2] = {}
Level["scenegraph"]["checkpoints"][3][2][1] = 133
Level["scenegraph"]["checkpoints"][3][2][2] = 46
Level["scenegraph"]["checkpoints"][3][2][3] = -40
Level["scenegraph"]["checkpoints"][3][2][4] = -1.5
Level["scenegraph"]["checkpoints"][3][3] = "sectionA"
Level["scenegraph"]["checkpoints"][3][4] = 4.71239
Level["scenegraph"]["checkpoints"][4] = {}
Level["scenegraph"]["checkpoints"][4][1] = "Room 4"
Level["scenegraph"]["checkpoints"][4][2] = {}
Level["scenegraph"]["checkpoints"][4][2][1] = 144.8
Level["scenegraph"]["checkpoints"][4][2][2] = -28.7
Level["scenegraph"]["checkpoints"][4][2][3] = -128
Level["scenegraph"]["checkpoints"][4][3] = "sectionB"
Level["scenegraph"]["checkpoints"][4][4] = -1.64
Level["scenegraph"]["checkpoints"][5] = {}
Level["scenegraph"]["checkpoints"][5][1] = "Room 5"
Level["scenegraph"]["checkpoints"][5][2] = {}
Level["scenegraph"]["checkpoints"][5][2][1] = 271
Level["scenegraph"]["checkpoints"][5][2][2] = -69
Level["scenegraph"]["checkpoints"][5][2][3] = -163
Level["scenegraph"]["checkpoints"][5][3] = "sectionB"
Level["scenegraph"]["checkpoints"][5][4] = 3.14159
Level["scenegraph"]["checkpoints"][6] = {}
Level["scenegraph"]["checkpoints"][6][1] = "Room 6"
Level["scenegraph"]["checkpoints"][6][2] = {}
Level["scenegraph"]["checkpoints"][6][2][1] = 404.5
Level["scenegraph"]["checkpoints"][6][2][2] = 28.7
Level["scenegraph"]["checkpoints"][6][2][3] = -189
Level["scenegraph"]["checkpoints"][6][3] = "sectionB"
Level["scenegraph"]["checkpoints"][6][4] = -1.5708
Level["scenegraph"]["checkpoints"][7] = {}
Level["scenegraph"]["checkpoints"][7][1] = "Room 7"
Level["scenegraph"]["checkpoints"][7][2] = {}
Level["scenegraph"]["checkpoints"][7][2][1] = 432.9
Level["scenegraph"]["checkpoints"][7][2][2] = 23.7
Level["scenegraph"]["checkpoints"][7][2][3] = 559
Level["scenegraph"]["checkpoints"][7][3] = "sectionC"
Level["scenegraph"]["checkpoints"][7][4] = -1
Level["scenegraph"]["checkpoints"][8] = {}
Level["scenegraph"]["checkpoints"][8][1] = "Room 8"
Level["scenegraph"]["checkpoints"][8][2] = {}
Level["scenegraph"]["checkpoints"][8][2][1] = 917.1
Level["scenegraph"]["checkpoints"][8][2][2] = 213.1
Level["scenegraph"]["checkpoints"][8][2][3] = 1105.4
Level["scenegraph"]["checkpoints"][8][3] = "sectionC"
Level["scenegraph"]["checkpoints"][8][4] = 1.63
Level["scenegraph"]["checkpoints"][9] = {}
Level["scenegraph"]["checkpoints"][9][1] = "Intro Movie A"
Level["scenegraph"]["checkpoints"][9][2] = {}
Level["scenegraph"]["checkpoints"][9][2][1] = 0
Level["scenegraph"]["checkpoints"][9][2][2] = -1000
Level["scenegraph"]["checkpoints"][9][2][3] = 3
Level["scenegraph"]["checkpoints"][9][3] = "sectionD"
Level["scenegraph"]["checkpoints"][9][4] = 0
Level["scenegraph"]["l1_con2a00"] = {}
Level["scenegraph"]["l1_con2a00"]["env"] = 12
Level["scenegraph"]["l1_con2a00"]["visible"] = {}
Level["scenegraph"]["l1_con2a00"]["visible"][1] = "l1_con2a01"
Level["scenegraph"]["l1_con2a00"]["visible"][2] = "l1_con2a02"
Level["scenegraph"]["l1_con2a00"]["visible"][3] = "l1_levellight"
Level["scenegraph"]["l1_con2a00"]["visible"][4] = "l1_r6"
Level["scenegraph"]["l1_con2a00"]["visible"][5] = "l1_r6sky"
Level["scenegraph"]["l1_con2a01"] = {}
Level["scenegraph"]["l1_con2a01"]["ambient"] = {}
Level["scenegraph"]["l1_con2a01"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a01"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a01"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a01"]["visible"] = {}
Level["scenegraph"]["l1_con2a01"]["visible"][1] = "l1_con2a00"
Level["scenegraph"]["l1_con2a01"]["visible"][2] = "l1_con2a02"
Level["scenegraph"]["l1_con2a01"]["visible"][3] = "l1_con2a03"
Level["scenegraph"]["l1_con2a01"]["visible"][4] = "l1_con2a04"
Level["scenegraph"]["l1_con2a01"]["visible"][5] = "l1_con2a05"
Level["scenegraph"]["l1_con2a01"]["visible"][6] = "l1_con2a06"
Level["scenegraph"]["l1_con2a01"]["visible"][7] = "l1_levellight"
Level["scenegraph"]["l1_con2a02"] = {}
Level["scenegraph"]["l1_con2a02"]["ambient"] = {}
Level["scenegraph"]["l1_con2a02"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a02"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a02"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a02"]["load"] = "sectionC"
Level["scenegraph"]["l1_con2a02"]["music"] = 18
Level["scenegraph"]["l1_con2a02"]["visible"] = {}
Level["scenegraph"]["l1_con2a02"]["visible"][1] = "l1_con2a00"
Level["scenegraph"]["l1_con2a02"]["visible"][2] = "l1_con2a01"
Level["scenegraph"]["l1_con2a02"]["visible"][3] = "l1_con2a03"
Level["scenegraph"]["l1_con2a02"]["visible"][4] = "l1_con2a04"
Level["scenegraph"]["l1_con2a02"]["visible"][5] = "l1_con2a05"
Level["scenegraph"]["l1_con2a02"]["visible"][6] = "l1_con2a06"
Level["scenegraph"]["l1_con2a02"]["visible"][7] = "l1_con2a07"
Level["scenegraph"]["l1_con2a02"]["visible"][8] = "l1_levellight"
Level["scenegraph"]["l1_con2a03"] = {}
Level["scenegraph"]["l1_con2a03"]["ambient"] = {}
Level["scenegraph"]["l1_con2a03"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a03"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a03"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a03"]["visible"] = {}
Level["scenegraph"]["l1_con2a03"]["visible"][1] = "l1_con2a01"
Level["scenegraph"]["l1_con2a03"]["visible"][2] = "l1_con2a02"
Level["scenegraph"]["l1_con2a03"]["visible"][3] = "l1_con2a04"
Level["scenegraph"]["l1_con2a03"]["visible"][4] = "l1_con2a05"
Level["scenegraph"]["l1_con2a03"]["visible"][5] = "l1_con2a06"
Level["scenegraph"]["l1_con2a03"]["visible"][6] = "l1_con2a07"
Level["scenegraph"]["l1_con2a03"]["visible"][7] = "l1_con2a08"
Level["scenegraph"]["l1_con2a03"]["visible"][8] = "l1_levellight"
Level["scenegraph"]["l1_con2a04"] = {}
Level["scenegraph"]["l1_con2a04"]["ambient"] = {}
Level["scenegraph"]["l1_con2a04"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a04"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a04"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a04"]["visible"] = {}
Level["scenegraph"]["l1_con2a04"]["visible"][1] = "l1_con2a01"
Level["scenegraph"]["l1_con2a04"]["visible"][2] = "l1_con2a02"
Level["scenegraph"]["l1_con2a04"]["visible"][3] = "l1_con2a03"
Level["scenegraph"]["l1_con2a04"]["visible"][4] = "l1_con2a05"
Level["scenegraph"]["l1_con2a04"]["visible"][5] = "l1_con2a06"
Level["scenegraph"]["l1_con2a04"]["visible"][6] = "l1_con2a07"
Level["scenegraph"]["l1_con2a04"]["visible"][7] = "l1_con2a08"
Level["scenegraph"]["l1_con2a04"]["visible"][8] = "l1_levellight"
Level["scenegraph"]["l1_con2a05"] = {}
Level["scenegraph"]["l1_con2a05"]["ambient"] = {}
Level["scenegraph"]["l1_con2a05"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a05"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a05"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a05"]["visible"] = {}
Level["scenegraph"]["l1_con2a05"]["visible"][1] = "l1_con2a01"
Level["scenegraph"]["l1_con2a05"]["visible"][2] = "l1_con2a02"
Level["scenegraph"]["l1_con2a05"]["visible"][3] = "l1_con2a03"
Level["scenegraph"]["l1_con2a05"]["visible"][4] = "l1_con2a04"
Level["scenegraph"]["l1_con2a05"]["visible"][5] = "l1_con2a06"
Level["scenegraph"]["l1_con2a05"]["visible"][6] = "l1_con2a07"
Level["scenegraph"]["l1_con2a05"]["visible"][7] = "l1_con2a08"
Level["scenegraph"]["l1_con2a05"]["visible"][8] = "l1_levellight"
Level["scenegraph"]["l1_con2a06"] = {}
Level["scenegraph"]["l1_con2a06"]["ambient"] = {}
Level["scenegraph"]["l1_con2a06"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a06"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a06"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a06"]["visible"] = {}
Level["scenegraph"]["l1_con2a06"]["visible"][1] = "l1_con2a02"
Level["scenegraph"]["l1_con2a06"]["visible"][2] = "l1_con2a03"
Level["scenegraph"]["l1_con2a06"]["visible"][3] = "l1_con2a04"
Level["scenegraph"]["l1_con2a06"]["visible"][4] = "l1_con2a05"
Level["scenegraph"]["l1_con2a06"]["visible"][5] = "l1_con2a07"
Level["scenegraph"]["l1_con2a06"]["visible"][6] = "l1_con2a08"
Level["scenegraph"]["l1_con2a06"]["visible"][7] = "l1_levellight"
Level["scenegraph"]["l1_con2a07"] = {}
Level["scenegraph"]["l1_con2a07"]["ambient"] = {}
Level["scenegraph"]["l1_con2a07"]["ambient"][1] = 0
Level["scenegraph"]["l1_con2a07"]["ambient"][2] = 0
Level["scenegraph"]["l1_con2a07"]["ambient"][3] = 0
Level["scenegraph"]["l1_con2a07"]["visible"] = {}
Level["scenegraph"]["l1_con2a07"]["visible"][1] = "l1_con2a03"
Level["scenegraph"]["l1_con2a07"]["visible"][2] = "l1_con2a04"
Level["scenegraph"]["l1_con2a07"]["visible"][3] = "l1_con2a05"
Level["scenegraph"]["l1_con2a07"]["visible"][4] = "l1_con2a06"
Level["scenegraph"]["l1_con2a07"]["visible"][5] = "l1_con2a08"
Level["scenegraph"]["l1_con2a07"]["visible"][6] = "l1_levellight"
Level["scenegraph"]["l1_con2a08"] = {}
Level["scenegraph"]["l1_con2a08"]["visible"] = {}
Level["scenegraph"]["l1_con2a08"]["visible"][1] = "l1_con2a04"
Level["scenegraph"]["l1_con2a08"]["visible"][2] = "l1_con2a05"
Level["scenegraph"]["l1_con2a08"]["visible"][3] = "l1_con2a06"
Level["scenegraph"]["l1_con2a08"]["visible"][4] = "l1_con2a07"
Level["scenegraph"]["l1_con2a08"]["visible"][5] = "l1_levellight"
Level["scenegraph"]["l1_con2a08"]["visible"][6] = "l1_r7"
Level["scenegraph"]["l1_con2a08"]["visible"][7] = "l1_r7sky"
Level["scenegraph"]["l1_con2b01"] = {}
Level["scenegraph"]["l1_con2b01"]["env"] = 12
Level["scenegraph"]["l1_con2b01"]["visible"] = {}
Level["scenegraph"]["l1_con2b01"]["visible"][1] = "l1_con2b02"
Level["scenegraph"]["l1_con2b01"]["visible"][2] = "l1_con2b03"
Level["scenegraph"]["l1_con2b01"]["visible"][3] = "l1_con2b04"
Level["scenegraph"]["l1_con2b01"]["visible"][4] = "l1_con2b05"
Level["scenegraph"]["l1_con2b01"]["visible"][5] = "l1_levellight"
Level["scenegraph"]["l1_con2b01"]["visible"][6] = "l1_r7"
Level["scenegraph"]["l1_con2b01"]["visible"][7] = "l1_r7sky"
Level["scenegraph"]["l1_con2b02"] = {}
Level["scenegraph"]["l1_con2b02"]["visible"] = {}
Level["scenegraph"]["l1_con2b02"]["visible"][1] = "l1_con2b01"
Level["scenegraph"]["l1_con2b02"]["visible"][2] = "l1_con2b03"
Level["scenegraph"]["l1_con2b02"]["visible"][3] = "l1_con2b04"
Level["scenegraph"]["l1_con2b02"]["visible"][4] = "l1_con2b05"
Level["scenegraph"]["l1_con2b02"]["visible"][5] = "l1_levellight"
Level["scenegraph"]["l1_con2b02"]["visible"][6] = "l1_r8"
Level["scenegraph"]["l1_con2b02"]["visible"][7] = "l1_r8sky"
Level["scenegraph"]["l1_con2b03"] = {}
Level["scenegraph"]["l1_con2b03"]["visible"] = {}
Level["scenegraph"]["l1_con2b03"]["visible"][1] = "l1_con2b01"
Level["scenegraph"]["l1_con2b03"]["visible"][2] = "l1_con2b02"
Level["scenegraph"]["l1_con2b03"]["visible"][3] = "l1_con2b04"
Level["scenegraph"]["l1_con2b03"]["visible"][4] = "l1_con2b05"
Level["scenegraph"]["l1_con2b03"]["visible"][5] = "l1_levellight"
Level["scenegraph"]["l1_con2b03"]["visible"][6] = "l1_r8"
Level["scenegraph"]["l1_con2b03"]["visible"][7] = "l1_r8sky"
Level["scenegraph"]["l1_con2b04"] = {}
Level["scenegraph"]["l1_con2b04"]["visible"] = {}
Level["scenegraph"]["l1_con2b04"]["visible"][1] = "l1_con2b01"
Level["scenegraph"]["l1_con2b04"]["visible"][2] = "l1_con2b02"
Level["scenegraph"]["l1_con2b04"]["visible"][3] = "l1_con2b03"
Level["scenegraph"]["l1_con2b04"]["visible"][4] = "l1_con2b05"
Level["scenegraph"]["l1_con2b04"]["visible"][5] = "l1_levellight"
Level["scenegraph"]["l1_con2b04"]["visible"][6] = "l1_r8"
Level["scenegraph"]["l1_con2b04"]["visible"][7] = "l1_r8sky"
Level["scenegraph"]["l1_con2b05"] = {}
Level["scenegraph"]["l1_con2b05"]["music"] = 14
Level["scenegraph"]["l1_con2b05"]["visible"] = {}
Level["scenegraph"]["l1_con2b05"]["visible"][1] = "l1_con2b01"
Level["scenegraph"]["l1_con2b05"]["visible"][2] = "l1_con2b02"
Level["scenegraph"]["l1_con2b05"]["visible"][3] = "l1_con2b03"
Level["scenegraph"]["l1_con2b05"]["visible"][4] = "l1_con2b04"
Level["scenegraph"]["l1_con2b05"]["visible"][5] = "l1_levellight"
Level["scenegraph"]["l1_con2b05"]["visible"][6] = "l1_r8"
Level["scenegraph"]["l1_con2b05"]["visible"][7] = "l1_r8sky"
Level["scenegraph"]["l1_levellight"] = {}
Level["scenegraph"]["l1_r1"] = {}
Level["scenegraph"]["l1_r1"]["ambient"] = {}
Level["scenegraph"]["l1_r1"]["ambient"][1] = 0
Level["scenegraph"]["l1_r1"]["ambient"][2] = 0
Level["scenegraph"]["l1_r1"]["ambient"][3] = 0
Level["scenegraph"]["l1_r1"]["env"] = 20
Level["scenegraph"]["l1_r1"]["visible"] = {}
Level["scenegraph"]["l1_r1"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r1"]["visible"][2] = "l1_sky01"
Level["scenegraph"]["l1_r1"]["visible"][3] = "l1_tun01crv"
Level["scenegraph"]["l1_r1"]["visible"][4] = "l1_tun02swt"
Level["scenegraph"]["l1_r2"] = {}
Level["scenegraph"]["l1_r2"]["ambient"] = {}
Level["scenegraph"]["l1_r2"]["ambient"][1] = 0
Level["scenegraph"]["l1_r2"]["ambient"][2] = 0
Level["scenegraph"]["l1_r2"]["ambient"][3] = 0
Level["scenegraph"]["l1_r2"]["ambient"][4] = 0
Level["scenegraph"]["l1_r2"]["env"] = 5
Level["scenegraph"]["l1_r2"]["visible"] = {}
Level["scenegraph"]["l1_r2"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r2"]["visible"][2] = "l1_r2sky"
Level["scenegraph"]["l1_r2"]["visible"][3] = "l1_tun04swb"
Level["scenegraph"]["l1_r2"]["visible"][4] = "l1_tun05crv"
Level["scenegraph"]["l1_r2"]["visible"][5] = "l1_tun06str"
Level["scenegraph"]["l1_r2"]["visible"][6] = "l1_tun07swt"
Level["scenegraph"]["l1_r2sky"] = {}
Level["scenegraph"]["l1_r2sky"]["bmax"] = {}
Level["scenegraph"]["l1_r2sky"]["bmax"][1] = 80
Level["scenegraph"]["l1_r2sky"]["bmax"][2] = 80
Level["scenegraph"]["l1_r2sky"]["bmax"][3] = 170
Level["scenegraph"]["l1_r2sky"]["bmin"] = {}
Level["scenegraph"]["l1_r2sky"]["bmin"][1] = 80
Level["scenegraph"]["l1_r2sky"]["bmin"][2] = 170
Level["scenegraph"]["l1_r2sky"]["bmin"][3] = -20
Level["scenegraph"]["l1_r3"] = {}
Level["scenegraph"]["l1_r3"]["ambient"] = {}
Level["scenegraph"]["l1_r3"]["ambient"][1] = 0
Level["scenegraph"]["l1_r3"]["ambient"][2] = 0
Level["scenegraph"]["l1_r3"]["ambient"][3] = 0
Level["scenegraph"]["l1_r3"]["env"] = 5
Level["scenegraph"]["l1_r3"]["visible"] = {}
Level["scenegraph"]["l1_r3"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r3"]["visible"][2] = "l1_r3secret"
Level["scenegraph"]["l1_r3"]["visible"][3] = "l1_tun09crv"
Level["scenegraph"]["l1_r3"]["visible"][4] = "l1_tun10str"
Level["scenegraph"]["l1_r3"]["visible"][5] = "l1_tun11smal"
Level["scenegraph"]["l1_r3"]["visible"][6] = "l1_tun12smal"
Level["scenegraph"]["l1_r3"]["visible"][7] = "l1_tun13swt"
Level["scenegraph"]["l1_r3secret"] = {}
Level["scenegraph"]["l1_r3secret"]["ambient"] = {}
Level["scenegraph"]["l1_r3secret"]["ambient"][1] = 0
Level["scenegraph"]["l1_r3secret"]["ambient"][2] = 0
Level["scenegraph"]["l1_r3secret"]["ambient"][3] = 0
Level["scenegraph"]["l1_r3secret"]["visible"] = {}
Level["scenegraph"]["l1_r3secret"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r3secret"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_r4"] = {}
Level["scenegraph"]["l1_r4"]["ambient"] = {}
Level["scenegraph"]["l1_r4"]["ambient"][1] = 0
Level["scenegraph"]["l1_r4"]["ambient"][2] = 0
Level["scenegraph"]["l1_r4"]["ambient"][3] = 0
Level["scenegraph"]["l1_r4"]["env"] = 8
Level["scenegraph"]["l1_r4"]["music"] = 3
Level["scenegraph"]["l1_r4"]["visible"] = {}
Level["scenegraph"]["l1_r4"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r4"]["visible"][2] = "l1_r4sky"
Level["scenegraph"]["l1_r4"]["visible"][3] = "l1_tun19swb"
Level["scenegraph"]["l1_r4"]["visible"][4] = "l1_tun20swt"
Level["scenegraph"]["l1_r4"]["visible"][5] = "l1_tun21swb"
Level["scenegraph"]["l1_r4sky"] = {}
Level["scenegraph"]["l1_r4sky"]["bmax"] = {}
Level["scenegraph"]["l1_r4sky"]["bmax"][1] = 167
Level["scenegraph"]["l1_r4sky"]["bmax"][2] = -29
Level["scenegraph"]["l1_r4sky"]["bmax"][3] = -120
Level["scenegraph"]["l1_r4sky"]["bmin"] = {}
Level["scenegraph"]["l1_r4sky"]["bmin"][1] = 167
Level["scenegraph"]["l1_r4sky"]["bmin"][2] = -29
Level["scenegraph"]["l1_r4sky"]["bmin"][3] = -120
Level["scenegraph"]["l1_r5"] = {}
Level["scenegraph"]["l1_r5"]["ambient"] = {}
Level["scenegraph"]["l1_r5"]["ambient"][1] = 0
Level["scenegraph"]["l1_r5"]["ambient"][2] = 0
Level["scenegraph"]["l1_r5"]["ambient"][3] = 0
Level["scenegraph"]["l1_r5"]["env"] = 8
Level["scenegraph"]["l1_r5"]["music"] = 13
Level["scenegraph"]["l1_r5"]["visible"] = {}
Level["scenegraph"]["l1_r5"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r5"]["visible"][2] = "l1_tun23swt"
Level["scenegraph"]["l1_r5"]["visible"][3] = "l1_tun24swt"
Level["scenegraph"]["l1_r5"]["visible"][4] = "l1_tun25swb"
Level["scenegraph"]["l1_r6"] = {}
Level["scenegraph"]["l1_r6"]["ambient"] = {}
Level["scenegraph"]["l1_r6"]["ambient"][1] = 0
Level["scenegraph"]["l1_r6"]["ambient"][2] = 0
Level["scenegraph"]["l1_r6"]["ambient"][3] = 0
Level["scenegraph"]["l1_r6"]["env"] = 8
Level["scenegraph"]["l1_r6"]["visible"] = {}
Level["scenegraph"]["l1_r6"]["visible"][1] = "l1_con2a00"
Level["scenegraph"]["l1_r6"]["visible"][2] = "l1_con2a01"
Level["scenegraph"]["l1_r6"]["visible"][3] = "l1_con2a02"
Level["scenegraph"]["l1_r6"]["visible"][4] = "l1_levellight"
Level["scenegraph"]["l1_r6"]["visible"][5] = "l1_r6sky"
Level["scenegraph"]["l1_r6"]["visible"][6] = "l1_tun25swb2"
Level["scenegraph"]["l1_r6"]["visible"][7] = "l1_tun26crv"
Level["scenegraph"]["l1_r6"]["visible"][8] = "l1_tun27smal"
Level["scenegraph"]["l1_r6sky"] = {}
Level["scenegraph"]["l1_r6sky"]["ambient"] = {}
Level["scenegraph"]["l1_r6sky"]["ambient"][1] = 0
Level["scenegraph"]["l1_r6sky"]["ambient"][2] = 0
Level["scenegraph"]["l1_r6sky"]["ambient"][3] = 0
Level["scenegraph"]["l1_r6sky"]["bmax"] = {}
Level["scenegraph"]["l1_r6sky"]["bmax"][1] = 399
Level["scenegraph"]["l1_r6sky"]["bmax"][2] = -28
Level["scenegraph"]["l1_r6sky"]["bmax"][3] = -190
Level["scenegraph"]["l1_r6sky"]["bmin"] = {}
Level["scenegraph"]["l1_r6sky"]["bmin"][1] = 399
Level["scenegraph"]["l1_r6sky"]["bmin"][2] = 28
Level["scenegraph"]["l1_r6sky"]["bmin"][3] = -190
Level["scenegraph"]["l1_r7"] = {}
Level["scenegraph"]["l1_r7"]["ambient"] = {}
Level["scenegraph"]["l1_r7"]["ambient"][1] = 0
Level["scenegraph"]["l1_r7"]["ambient"][2] = 0
Level["scenegraph"]["l1_r7"]["ambient"][3] = 0
Level["scenegraph"]["l1_r7"]["checkpoint"] = 7
Level["scenegraph"]["l1_r7"]["env"] = 20
Level["scenegraph"]["l1_r7"]["music"] = 18
Level["scenegraph"]["l1_r7"]["visible"] = {}
Level["scenegraph"]["l1_r7"]["visible"][1] = "l1_con2a08"
Level["scenegraph"]["l1_r7"]["visible"][2] = "l1_con2b01"
Level["scenegraph"]["l1_r7"]["visible"][3] = "l1_levellight"
Level["scenegraph"]["l1_r7"]["visible"][4] = "l1_r7sky"
Level["scenegraph"]["l1_r7sky"] = {}
Level["scenegraph"]["l1_r7sky"]["ambient"] = {}
Level["scenegraph"]["l1_r7sky"]["ambient"][1] = 0
Level["scenegraph"]["l1_r7sky"]["ambient"][2] = 0
Level["scenegraph"]["l1_r7sky"]["ambient"][3] = 0
Level["scenegraph"]["l1_r7sky"]["bmax"] = {}
Level["scenegraph"]["l1_r7sky"]["bmax"][1] = 420
Level["scenegraph"]["l1_r7sky"]["bmax"][2] = -16
Level["scenegraph"]["l1_r7sky"]["bmax"][3] = -58
Level["scenegraph"]["l1_r7sky"]["bmin"] = {}
Level["scenegraph"]["l1_r7sky"]["bmin"][1] = 420
Level["scenegraph"]["l1_r7sky"]["bmin"][2] = -16
Level["scenegraph"]["l1_r7sky"]["bmin"][3] = -58
Level["scenegraph"]["l1_r8"] = {}
Level["scenegraph"]["l1_r8"]["ambient"] = {}
Level["scenegraph"]["l1_r8"]["ambient"][1] = 0
Level["scenegraph"]["l1_r8"]["ambient"][2] = 0
Level["scenegraph"]["l1_r8"]["ambient"][3] = 0
Level["scenegraph"]["l1_r8"]["checkpoint"] = 8
Level["scenegraph"]["l1_r8"]["env"] = 9
Level["scenegraph"]["l1_r8"]["visible"] = {}
Level["scenegraph"]["l1_r8"]["visible"][1] = "l1_con2b05"
Level["scenegraph"]["l1_r8"]["visible"][2] = "l1_levellight"
Level["scenegraph"]["l1_r8"]["visible"][3] = "l1_r8b"
Level["scenegraph"]["l1_r8"]["visible"][4] = "l1_r8sky"
Level["scenegraph"]["l1_r8b"] = {}
Level["scenegraph"]["l1_r8b"]["visible"] = {}
Level["scenegraph"]["l1_r8b"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_r8b"]["visible"][2] = "l1_r8"
Level["scenegraph"]["l1_r8b"]["visible"][3] = "l1_r8sky"
Level["scenegraph"]["l1_r8sky"] = {}
Level["scenegraph"]["l1_r8sky"]["bmax"] = {}
Level["scenegraph"]["l1_r8sky"]["bmax"][1] = 592
Level["scenegraph"]["l1_r8sky"]["bmax"][2] = 21
Level["scenegraph"]["l1_r8sky"]["bmax"][3] = 1017
Level["scenegraph"]["l1_r8sky"]["bmin"] = {}
Level["scenegraph"]["l1_r8sky"]["bmin"][1] = 592
Level["scenegraph"]["l1_r8sky"]["bmin"][2] = 21
Level["scenegraph"]["l1_r8sky"]["bmin"][3] = 1017
Level["scenegraph"]["l1_sky01"] = {}
Level["scenegraph"]["l1_sky01"]["ambient"] = {}
Level["scenegraph"]["l1_sky01"]["ambient"][1] = 0
Level["scenegraph"]["l1_sky01"]["ambient"][2] = 0
Level["scenegraph"]["l1_sky01"]["ambient"][3] = 0
Level["scenegraph"]["l1_sky01"]["bmax"] = {}
Level["scenegraph"]["l1_sky01"]["bmax"][1] = 0
Level["scenegraph"]["l1_sky01"]["bmax"][2] = 0
Level["scenegraph"]["l1_sky01"]["bmax"][3] = 0
Level["scenegraph"]["l1_sky01"]["bmin"] = {}
Level["scenegraph"]["l1_sky01"]["bmin"][1] = 0
Level["scenegraph"]["l1_sky01"]["bmin"][2] = 0
Level["scenegraph"]["l1_sky01"]["bmin"][3] = 0
Level["scenegraph"]["l1_tun01crv"] = {}
Level["scenegraph"]["l1_tun01crv"]["ambient"] = {}
Level["scenegraph"]["l1_tun01crv"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun01crv"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun01crv"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun01crv"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun01crv"]["env"] = 12
Level["scenegraph"]["l1_tun01crv"]["visible"] = {}
Level["scenegraph"]["l1_tun01crv"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun01crv"]["visible"][2] = "l1_r1"
Level["scenegraph"]["l1_tun01crv"]["visible"][3] = "l1_sky01"
Level["scenegraph"]["l1_tun01crv"]["visible"][4] = "l1_tun02swt"
Level["scenegraph"]["l1_tun01crv"]["visible"][5] = "l1_tun03str"
Level["scenegraph"]["l1_tun02swt"] = {}
Level["scenegraph"]["l1_tun02swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun02swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun02swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun02swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun02swt"]["visible"] = {}
Level["scenegraph"]["l1_tun02swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun02swt"]["visible"][2] = "l1_r1"
Level["scenegraph"]["l1_tun02swt"]["visible"][3] = "l1_tun01crv"
Level["scenegraph"]["l1_tun02swt"]["visible"][4] = "l1_tun03str"
Level["scenegraph"]["l1_tun02swt"]["visible"][5] = "l1_tun04swb"
Level["scenegraph"]["l1_tun02swt"]["visible"][6] = "l1_tun05crv"
Level["scenegraph"]["l1_tun03str"] = {}
Level["scenegraph"]["l1_tun03str"]["ambient"] = {}
Level["scenegraph"]["l1_tun03str"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun03str"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun03str"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun03str"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun03str"]["visible"] = {}
Level["scenegraph"]["l1_tun03str"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun03str"]["visible"][2] = "l1_tun01crv"
Level["scenegraph"]["l1_tun03str"]["visible"][3] = "l1_tun02swt"
Level["scenegraph"]["l1_tun03str"]["visible"][4] = "l1_tun04swb"
Level["scenegraph"]["l1_tun03str"]["visible"][5] = "l1_tun05crv"
Level["scenegraph"]["l1_tun04swb"] = {}
Level["scenegraph"]["l1_tun04swb"]["ambient"] = {}
Level["scenegraph"]["l1_tun04swb"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun04swb"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun04swb"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun04swb"]["env"] = 12
Level["scenegraph"]["l1_tun04swb"]["visible"] = {}
Level["scenegraph"]["l1_tun04swb"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun04swb"]["visible"][2] = "l1_r2"
Level["scenegraph"]["l1_tun04swb"]["visible"][3] = "l1_tun02swt"
Level["scenegraph"]["l1_tun04swb"]["visible"][4] = "l1_tun03str"
Level["scenegraph"]["l1_tun04swb"]["visible"][5] = "l1_tun05crv"
Level["scenegraph"]["l1_tun05crv"] = {}
Level["scenegraph"]["l1_tun05crv"]["ambient"] = {}
Level["scenegraph"]["l1_tun05crv"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun05crv"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun05crv"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun05crv"]["visible"] = {}
Level["scenegraph"]["l1_tun05crv"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun05crv"]["visible"][2] = "l1_r2"
Level["scenegraph"]["l1_tun05crv"]["visible"][3] = "l1_r2sky"
Level["scenegraph"]["l1_tun05crv"]["visible"][4] = "l1_tun03str"
Level["scenegraph"]["l1_tun05crv"]["visible"][5] = "l1_tun04swb"
Level["scenegraph"]["l1_tun06str"] = {}
Level["scenegraph"]["l1_tun06str"]["ambient"] = {}
Level["scenegraph"]["l1_tun06str"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun06str"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun06str"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun06str"]["env"] = 12
Level["scenegraph"]["l1_tun06str"]["visible"] = {}
Level["scenegraph"]["l1_tun06str"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun06str"]["visible"][2] = "l1_r2"
Level["scenegraph"]["l1_tun06str"]["visible"][3] = "l1_r2sky"
Level["scenegraph"]["l1_tun06str"]["visible"][4] = "l1_tun05crv"
Level["scenegraph"]["l1_tun06str"]["visible"][5] = "l1_tun07swt"
Level["scenegraph"]["l1_tun06str"]["visible"][6] = "l1_tun08swb"
Level["scenegraph"]["l1_tun07swt"] = {}
Level["scenegraph"]["l1_tun07swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun07swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun07swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun07swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun07swt"]["visible"] = {}
Level["scenegraph"]["l1_tun07swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun07swt"]["visible"][2] = "l1_r2"
Level["scenegraph"]["l1_tun07swt"]["visible"][3] = "l1_tun05crv"
Level["scenegraph"]["l1_tun07swt"]["visible"][4] = "l1_tun06str"
Level["scenegraph"]["l1_tun07swt"]["visible"][5] = "l1_tun08swb"
Level["scenegraph"]["l1_tun08swb"] = {}
Level["scenegraph"]["l1_tun08swb"]["visible"] = {}
Level["scenegraph"]["l1_tun08swb"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun08swb"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_tun08swb"]["visible"][3] = "l1_tun07swt"
Level["scenegraph"]["l1_tun08swb"]["visible"][4] = "l1_tun09crv"
Level["scenegraph"]["l1_tun08swb"]["visible"][5] = "l1_tun10str"
Level["scenegraph"]["l1_tun08swb"]["visible"][6] = "l1_tun11smal"
Level["scenegraph"]["l1_tun09crv"] = {}
Level["scenegraph"]["l1_tun09crv"]["ambient"] = {}
Level["scenegraph"]["l1_tun09crv"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun09crv"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun09crv"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun09crv"]["visible"] = {}
Level["scenegraph"]["l1_tun09crv"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun09crv"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_tun09crv"]["visible"][3] = "l1_tun07swt"
Level["scenegraph"]["l1_tun09crv"]["visible"][4] = "l1_tun08swb"
Level["scenegraph"]["l1_tun09crv"]["visible"][5] = "l1_tun10str"
Level["scenegraph"]["l1_tun09crv"]["visible"][6] = "l1_tun11smal"
Level["scenegraph"]["l1_tun10str"] = {}
Level["scenegraph"]["l1_tun10str"]["ambient"] = {}
Level["scenegraph"]["l1_tun10str"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun10str"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun10str"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun10str"]["env"] = 12
Level["scenegraph"]["l1_tun10str"]["visible"] = {}
Level["scenegraph"]["l1_tun10str"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun10str"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_tun10str"]["visible"][3] = "l1_tun08swb"
Level["scenegraph"]["l1_tun10str"]["visible"][4] = "l1_tun09crv"
Level["scenegraph"]["l1_tun10str"]["visible"][5] = "l1_tun11smal"
Level["scenegraph"]["l1_tun11smal"] = {}
Level["scenegraph"]["l1_tun11smal"]["ambient"] = {}
Level["scenegraph"]["l1_tun11smal"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun11smal"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun11smal"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun11smal"]["visible"] = {}
Level["scenegraph"]["l1_tun11smal"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun11smal"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_tun11smal"]["visible"][3] = "l1_tun08swb"
Level["scenegraph"]["l1_tun11smal"]["visible"][4] = "l1_tun09crv"
Level["scenegraph"]["l1_tun11smal"]["visible"][5] = "l1_tun10str"
Level["scenegraph"]["l1_tun12smal"] = {}
Level["scenegraph"]["l1_tun12smal"]["ambient"] = {}
Level["scenegraph"]["l1_tun12smal"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun12smal"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun12smal"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun12smal"]["visible"] = {}
Level["scenegraph"]["l1_tun12smal"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun12smal"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_tun12smal"]["visible"][3] = "l1_tun13swt"
Level["scenegraph"]["l1_tun12smal"]["visible"][4] = "l1_tun14swb"
Level["scenegraph"]["l1_tun13swt"] = {}
Level["scenegraph"]["l1_tun13swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun13swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun13swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun13swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun13swt"]["env"] = 12
Level["scenegraph"]["l1_tun13swt"]["visible"] = {}
Level["scenegraph"]["l1_tun13swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun13swt"]["visible"][2] = "l1_r3"
Level["scenegraph"]["l1_tun13swt"]["visible"][3] = "l1_tun12smal"
Level["scenegraph"]["l1_tun13swt"]["visible"][4] = "l1_tun14swb"
Level["scenegraph"]["l1_tun13swt"]["visible"][5] = "l1_tun15long"
Level["scenegraph"]["l1_tun14swb"] = {}
Level["scenegraph"]["l1_tun14swb"]["ambient"] = {}
Level["scenegraph"]["l1_tun14swb"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun14swb"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun14swb"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun14swb"]["visible"] = {}
Level["scenegraph"]["l1_tun14swb"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun14swb"]["visible"][2] = "l1_tun12smal"
Level["scenegraph"]["l1_tun14swb"]["visible"][3] = "l1_tun13swt"
Level["scenegraph"]["l1_tun14swb"]["visible"][4] = "l1_tun15long"
Level["scenegraph"]["l1_tun14swb"]["visible"][5] = "l1_tun16long"
Level["scenegraph"]["l1_tun15long"] = {}
Level["scenegraph"]["l1_tun15long"]["ambient"] = {}
Level["scenegraph"]["l1_tun15long"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun15long"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun15long"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun15long"]["load"] = "sectionB"
Level["scenegraph"]["l1_tun15long"]["music"] = 3
Level["scenegraph"]["l1_tun15long"]["visible"] = {}
Level["scenegraph"]["l1_tun15long"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun15long"]["visible"][2] = "l1_tun13swt"
Level["scenegraph"]["l1_tun15long"]["visible"][3] = "l1_tun14swb"
Level["scenegraph"]["l1_tun15long"]["visible"][4] = "l1_tun16long"
Level["scenegraph"]["l1_tun15long"]["visible"][5] = "l1_tun17inc"
Level["scenegraph"]["l1_tun15long"]["visible"][6] = "l1_tun18swt"
Level["scenegraph"]["l1_tun16long"] = {}
Level["scenegraph"]["l1_tun16long"]["ambient"] = {}
Level["scenegraph"]["l1_tun16long"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun16long"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun16long"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun16long"]["visible"] = {}
Level["scenegraph"]["l1_tun16long"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun16long"]["visible"][2] = "l1_tun14swb"
Level["scenegraph"]["l1_tun16long"]["visible"][3] = "l1_tun15long"
Level["scenegraph"]["l1_tun16long"]["visible"][4] = "l1_tun17inc"
Level["scenegraph"]["l1_tun16long"]["visible"][5] = "l1_tun18swt"
Level["scenegraph"]["l1_tun17inc"] = {}
Level["scenegraph"]["l1_tun17inc"]["ambient"] = {}
Level["scenegraph"]["l1_tun17inc"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun17inc"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun17inc"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun17inc"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun17inc"]["visible"] = {}
Level["scenegraph"]["l1_tun17inc"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun17inc"]["visible"][2] = "l1_tun15long"
Level["scenegraph"]["l1_tun17inc"]["visible"][3] = "l1_tun16long"
Level["scenegraph"]["l1_tun17inc"]["visible"][4] = "l1_tun18swt"
Level["scenegraph"]["l1_tun17inc"]["visible"][5] = "l1_tun19swb"
Level["scenegraph"]["l1_tun18swt"] = {}
Level["scenegraph"]["l1_tun18swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun18swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun18swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun18swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun18swt"]["visible"] = {}
Level["scenegraph"]["l1_tun18swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun18swt"]["visible"][2] = "l1_tun15long"
Level["scenegraph"]["l1_tun18swt"]["visible"][3] = "l1_tun16long"
Level["scenegraph"]["l1_tun18swt"]["visible"][4] = "l1_tun17inc"
Level["scenegraph"]["l1_tun18swt"]["visible"][5] = "l1_tun19swb"
Level["scenegraph"]["l1_tun19swb"] = {}
Level["scenegraph"]["l1_tun19swb"]["ambient"] = {}
Level["scenegraph"]["l1_tun19swb"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun19swb"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun19swb"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun19swb"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun19swb"]["checkpoint"] = 4
Level["scenegraph"]["l1_tun19swb"]["env"] = 12
Level["scenegraph"]["l1_tun19swb"]["visible"] = {}
Level["scenegraph"]["l1_tun19swb"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun19swb"]["visible"][2] = "l1_r4"
Level["scenegraph"]["l1_tun19swb"]["visible"][3] = "l1_r4sky"
Level["scenegraph"]["l1_tun19swb"]["visible"][4] = "l1_tun17inc"
Level["scenegraph"]["l1_tun19swb"]["visible"][5] = "l1_tun18swt"
Level["scenegraph"]["l1_tun19swb"]["visible"][6] = "l1_tun20swt"
Level["scenegraph"]["l1_tun20swt"] = {}
Level["scenegraph"]["l1_tun20swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun20swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun20swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun20swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun20swt"]["visible"] = {}
Level["scenegraph"]["l1_tun20swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun20swt"]["visible"][2] = "l1_r4"
Level["scenegraph"]["l1_tun20swt"]["visible"][3] = "l1_r4sky"
Level["scenegraph"]["l1_tun20swt"]["visible"][4] = "l1_tun19swb"
Level["scenegraph"]["l1_tun20swt"]["visible"][5] = "l1_tun21swb"
Level["scenegraph"]["l1_tun20swt"]["visible"][6] = "l1_tun22crv"
Level["scenegraph"]["l1_tun21swb"] = {}
Level["scenegraph"]["l1_tun21swb"]["ambient"] = {}
Level["scenegraph"]["l1_tun21swb"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun21swb"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun21swb"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun21swb"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun21swb"]["env"] = 12
Level["scenegraph"]["l1_tun21swb"]["visible"] = {}
Level["scenegraph"]["l1_tun21swb"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun21swb"]["visible"][2] = "l1_tun20swt"
Level["scenegraph"]["l1_tun21swb"]["visible"][3] = "l1_tun22crv"
Level["scenegraph"]["l1_tun21swb"]["visible"][4] = "l1_tun23swt"
Level["scenegraph"]["l1_tun22crv"] = {}
Level["scenegraph"]["l1_tun22crv"]["ambient"] = {}
Level["scenegraph"]["l1_tun22crv"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun22crv"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun22crv"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun22crv"]["visible"] = {}
Level["scenegraph"]["l1_tun22crv"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun22crv"]["visible"][2] = "l1_tun20swt"
Level["scenegraph"]["l1_tun22crv"]["visible"][3] = "l1_tun21swb"
Level["scenegraph"]["l1_tun22crv"]["visible"][4] = "l1_tun23swt"
Level["scenegraph"]["l1_tun23swt"] = {}
Level["scenegraph"]["l1_tun23swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun23swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun23swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun23swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun23swt"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun23swt"]["visible"] = {}
Level["scenegraph"]["l1_tun23swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun23swt"]["visible"][2] = "l1_r5"
Level["scenegraph"]["l1_tun23swt"]["visible"][3] = "l1_tun20swt"
Level["scenegraph"]["l1_tun23swt"]["visible"][4] = "l1_tun21swb"
Level["scenegraph"]["l1_tun23swt"]["visible"][5] = "l1_tun22crv"
Level["scenegraph"]["l1_tun24swt"] = {}
Level["scenegraph"]["l1_tun24swt"]["ambient"] = {}
Level["scenegraph"]["l1_tun24swt"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun24swt"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun24swt"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun24swt"]["ambient"][4] = 0
Level["scenegraph"]["l1_tun24swt"]["visible"] = {}
Level["scenegraph"]["l1_tun24swt"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun24swt"]["visible"][2] = "l1_r5"
Level["scenegraph"]["l1_tun24swt"]["visible"][3] = "l1_tun25swb"
Level["scenegraph"]["l1_tun24swt"]["visible"][4] = "l1_tun25swb2"
Level["scenegraph"]["l1_tun25swb"] = {}
Level["scenegraph"]["l1_tun25swb"]["ambient"] = {}
Level["scenegraph"]["l1_tun25swb"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun25swb"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun25swb"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun25swb"]["env"] = 12
Level["scenegraph"]["l1_tun25swb"]["visible"] = {}
Level["scenegraph"]["l1_tun25swb"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun25swb"]["visible"][2] = "l1_tun24swt"
Level["scenegraph"]["l1_tun25swb"]["visible"][3] = "l1_tun25swb2"
Level["scenegraph"]["l1_tun25swb"]["visible"][4] = "l1_tun26crv"
Level["scenegraph"]["l1_tun25swb"]["visible"][5] = "l1_tun27smal"
Level["scenegraph"]["l1_tun25swb2"] = {}
Level["scenegraph"]["l1_tun25swb2"]["visible"] = {}
Level["scenegraph"]["l1_tun25swb2"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun25swb2"]["visible"][2] = "l1_tun24swt"
Level["scenegraph"]["l1_tun25swb2"]["visible"][3] = "l1_tun25swb"
Level["scenegraph"]["l1_tun25swb2"]["visible"][4] = "l1_tun26crv"
Level["scenegraph"]["l1_tun25swb2"]["visible"][5] = "l1_tun27smal"
Level["scenegraph"]["l1_tun26crv"] = {}
Level["scenegraph"]["l1_tun26crv"]["env"] = 12
Level["scenegraph"]["l1_tun26crv"]["visible"] = {}
Level["scenegraph"]["l1_tun26crv"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun26crv"]["visible"][2] = "l1_r6"
Level["scenegraph"]["l1_tun26crv"]["visible"][3] = "l1_r6sky"
Level["scenegraph"]["l1_tun26crv"]["visible"][4] = "l1_tun25swb"
Level["scenegraph"]["l1_tun26crv"]["visible"][5] = "l1_tun25swb2"
Level["scenegraph"]["l1_tun26crv"]["visible"][6] = "l1_tun27smal"
Level["scenegraph"]["l1_tun27smal"] = {}
Level["scenegraph"]["l1_tun27smal"]["ambient"] = {}
Level["scenegraph"]["l1_tun27smal"]["ambient"][1] = 0
Level["scenegraph"]["l1_tun27smal"]["ambient"][2] = 0
Level["scenegraph"]["l1_tun27smal"]["ambient"][3] = 0
Level["scenegraph"]["l1_tun27smal"]["visible"] = {}
Level["scenegraph"]["l1_tun27smal"]["visible"][1] = "l1_levellight"
Level["scenegraph"]["l1_tun27smal"]["visible"][2] = "l1_r6"
Level["scenegraph"]["l1_tun27smal"]["visible"][3] = "l1_r6sky"
Level["scenegraph"]["l1_tun27smal"]["visible"][4] = "l1_tun25swb"
Level["scenegraph"]["l1_tun27smal"]["visible"][5] = "l1_tun25swb2"
Level["scenegraph"]["l1_tun27smal"]["visible"][6] = "l1_tun26crv"
Level["scenegraph"]["sections"] = {}
Level["scenegraph"]["sections"]["preloaded"] = {}
Level["scenegraph"]["sections"]["preloaded"]["size"] = 4142282
Level["scenegraph"]["sections"]["preloaded"][1] = "apple.mod"
Level["scenegraph"]["sections"]["preloaded"][10] = "dboy1shot.mod"
Level["scenegraph"]["sections"]["preloaded"][11] = "decoygrenade.mod"
Level["scenegraph"]["sections"]["preloaded"][12] = "doganboy.mod"
Level["scenegraph"]["sections"]["preloaded"][13] = "dr1.mod"
Level["scenegraph"]["sections"]["preloaded"][14] = "dr2.mod"
Level["scenegraph"]["sections"]["preloaded"][15] = "dr3.mod"
Level["scenegraph"]["sections"]["preloaded"][16] = "dummydecoy.mod"
Level["scenegraph"]["sections"]["preloaded"][17] = "effect00.mod"
Level["scenegraph"]["sections"]["preloaded"][18] = "effect02.mod"
Level["scenegraph"]["sections"]["preloaded"][19] = "explode0.mod"
Level["scenegraph"]["sections"]["preloaded"][2] = "biologo1.tex"
Level["scenegraph"]["sections"]["preloaded"][20] = "explode1.mod"
Level["scenegraph"]["sections"]["preloaded"][21] = "explode16.mod"
Level["scenegraph"]["sections"]["preloaded"][22] = "explode3.mod"
Level["scenegraph"]["sections"]["preloaded"][23] = "explode5.mod"
Level["scenegraph"]["sections"]["preloaded"][24] = "explode6.mod"
Level["scenegraph"]["sections"]["preloaded"][25] = "explode9.mod"
Level["scenegraph"]["sections"]["preloaded"][26] = "fan1.mod"
Level["scenegraph"]["sections"]["preloaded"][27] = "fballgun.mod"
Level["scenegraph"]["sections"]["preloaded"][28] = "fx_selectgun.mod"
Level["scenegraph"]["sections"]["preloaded"][29] = "fx_selecthth.mod"
Level["scenegraph"]["sections"]["preloaded"][3] = "blackhole.mod"
Level["scenegraph"]["sections"]["preloaded"][30] = "fx_selectitm.mod"
Level["scenegraph"]["sections"]["preloaded"][31] = "grenade.mod"
Level["scenegraph"]["sections"]["preloaded"][32] = "ham.mod"
Level["scenegraph"]["sections"]["preloaded"][33] = "hit1a.tex"
Level["scenegraph"]["sections"]["preloaded"][34] = "kurt.mod"
Level["scenegraph"]["sections"]["preloaded"][35] = "turshot01.mod"
Level["scenegraph"]["sections"]["preloaded"][36] = "kurthealth.mod"
Level["scenegraph"]["sections"]["preloaded"][37] = "kurtinv_active.mod"
Level["scenegraph"]["sections"]["preloaded"][38] = "kurtinventory.mod"
Level["scenegraph"]["sections"]["preloaded"][39] = "kurtsnipe.mod"
Level["scenegraph"]["sections"]["preloaded"][4] = "breath.mod"
Level["scenegraph"]["sections"]["preloaded"][40] = "kurtsnipeinv.mod"
Level["scenegraph"]["sections"]["preloaded"][41] = "l1_levellight.mod"
Level["scenegraph"]["sections"]["preloaded"][42] = "lightflare02.tex"
Level["scenegraph"]["sections"]["preloaded"][43] = "lightflare04.tex"
Level["scenegraph"]["sections"]["preloaded"][44] = "mdk2.str"
Level["scenegraph"]["sections"]["preloaded"][45] = "optionbox1.tex"
Level["scenegraph"]["sections"]["preloaded"][46] = "ricochet.mod"
Level["scenegraph"]["sections"]["preloaded"][47] = "schaingun.mod"
Level["scenegraph"]["sections"]["preloaded"][48] = "sniperbullet.mod"
Level["scenegraph"]["sections"]["preloaded"][49] = "snipergrenade.mod"
Level["scenegraph"]["sections"]["preloaded"][5] = "chaingun.mod"
Level["scenegraph"]["sections"]["preloaded"][50] = "sniperhoming.mod"
Level["scenegraph"]["sections"]["preloaded"][51] = "sniperlock.mod"
Level["scenegraph"]["sections"]["preloaded"][52] = "snipermortar.mod"
Level["scenegraph"]["sections"]["preloaded"][53] = "sod.mod"
Level["scenegraph"]["sections"]["preloaded"][54] = "textbox1.tex"
Level["scenegraph"]["sections"]["preloaded"][55] = "textbox2.tex"
Level["scenegraph"]["sections"]["preloaded"][6] = "checkpoint.mod"
Level["scenegraph"]["sections"]["preloaded"][7] = "chute.mod"
Level["scenegraph"]["sections"]["preloaded"][8] = "cloak.mod"
Level["scenegraph"]["sections"]["preloaded"][9] = "dbgrenade.mod"
Level["scenegraph"]["sections"]["sectionA"] = {}
Level["scenegraph"]["sections"]["sectionA"]["size"] = 5163186
Level["scenegraph"]["sections"]["sectionA"][1] = "dialogtop.mod"
Level["scenegraph"]["sections"]["sectionA"][10] = "l1_r1arwgob03.mod"
Level["scenegraph"]["sections"]["sectionA"][11] = "l1_r1arwgob04.mod"
Level["scenegraph"]["sections"]["sectionA"][12] = "l1_r1arwgob05.mod"
Level["scenegraph"]["sections"]["sectionA"][13] = "l1_r1arwgob06.mod"
Level["scenegraph"]["sections"]["sectionA"][14] = "l1_r1arwgob07.mod"
Level["scenegraph"]["sections"]["sectionA"][15] = "l1_r1arwgob08.mod"
Level["scenegraph"]["sections"]["sectionA"][16] = "l1_r1arwgob09.mod"
Level["scenegraph"]["sections"]["sectionA"][17] = "l1_r1arwgob10.mod"
Level["scenegraph"]["sections"]["sectionA"][18] = "l1_r1extra1.mod"
Level["scenegraph"]["sections"]["sectionA"][19] = "l1_r1extra2.mod"
Level["scenegraph"]["sections"]["sectionA"][2] = "dochead.mod"
Level["scenegraph"]["sections"]["sectionA"][20] = "l1_r1extra3.mod"
Level["scenegraph"]["sections"]["sectionA"][21] = "l1_r1fancover.mod"
Level["scenegraph"]["sections"]["sectionA"][22] = "l1_r1platbig.mod"
Level["scenegraph"]["sections"]["sectionA"][23] = "l1_r1plats.mod"
Level["scenegraph"]["sections"]["sectionA"][24] = "l1_r2.mod"
Level["scenegraph"]["sections"]["sectionA"][25] = "l1_r2bases.mod"
Level["scenegraph"]["sections"]["sectionA"][26] = "l1_r2glassrim.mod"
Level["scenegraph"]["sections"]["sectionA"][27] = "l1_r2pillars.mod"
Level["scenegraph"]["sections"]["sectionA"][28] = "l1_r2plate.mod"
Level["scenegraph"]["sections"]["sectionA"][29] = "l1_r2sky.mod"
Level["scenegraph"]["sections"]["sectionA"][3] = "explode13.mod"
Level["scenegraph"]["sections"]["sectionA"][30] = "l1_r3.mod"
Level["scenegraph"]["sections"]["sectionA"][31] = "l1_r3balls.mod"
Level["scenegraph"]["sections"]["sectionA"][32] = "l1_r3secret.mod"
Level["scenegraph"]["sections"]["sectionA"][33] = "l1_r3spinners.mod"
Level["scenegraph"]["sections"]["sectionA"][34] = "l1_sky01.mod"
Level["scenegraph"]["sections"]["sectionA"][35] = "l1_tun01crv.mod"
Level["scenegraph"]["sections"]["sectionA"][36] = "l1_tun02swt.mod"
Level["scenegraph"]["sections"]["sectionA"][37] = "l1_tun03str.mod"
Level["scenegraph"]["sections"]["sectionA"][38] = "l1_tun04swb.mod"
Level["scenegraph"]["sections"]["sectionA"][39] = "l1_tun05crv.mod"
Level["scenegraph"]["sections"]["sectionA"][4] = "generator.mod"
Level["scenegraph"]["sections"]["sectionA"][40] = "l1_tun06str.mod"
Level["scenegraph"]["sections"]["sectionA"][41] = "l1_tun07swt.mod"
Level["scenegraph"]["sections"]["sectionA"][42] = "l1_tun08swb.mod"
Level["scenegraph"]["sections"]["sectionA"][43] = "l1_tun09crv.mod"
Level["scenegraph"]["sections"]["sectionA"][44] = "l1_tun10str.mod"
Level["scenegraph"]["sections"]["sectionA"][45] = "l1_tun11smal.mod"
Level["scenegraph"]["sections"]["sectionA"][46] = "l1_tun12smal.mod"
Level["scenegraph"]["sections"]["sectionA"][47] = "l1_tun13swt.mod"
Level["scenegraph"]["sections"]["sectionA"][48] = "l1_tun14swb.mod"
Level["scenegraph"]["sections"]["sectionA"][49] = "l1_tun15long.mod"
Level["scenegraph"]["sections"]["sectionA"][5] = "l1_plats.mod"
Level["scenegraph"]["sections"]["sectionA"][50] = "l1_tun16long.mod"
Level["scenegraph"]["sections"]["sectionA"][51] = "l1_tun17inc.mod"
Level["scenegraph"]["sections"]["sectionA"][52] = "l1_tun18swt.mod"
Level["scenegraph"]["sections"]["sectionA"][53] = "l1_tun19swb.mod"
Level["scenegraph"]["sections"]["sectionA"][54] = "l1_tut1.wav"
Level["scenegraph"]["sections"]["sectionA"][55] = "l1r3_tube.mod"
Level["scenegraph"]["sections"]["sectionA"][56] = "l1r3_wall.mod"
Level["scenegraph"]["sections"]["sectionA"][57] = "pdboy1shot.mod"
Level["scenegraph"]["sections"]["sectionA"][58] = "plat01.mod"
Level["scenegraph"]["sections"]["sectionA"][59] = "poopsy.mod"
Level["scenegraph"]["sections"]["sectionA"][6] = "l1_r1.mod"
Level["scenegraph"]["sections"]["sectionA"][60] = "propbox.mod"
Level["scenegraph"]["sections"]["sectionA"][61] = "target01.mod"
Level["scenegraph"]["sections"]["sectionA"][62] = "target03.mod"
Level["scenegraph"]["sections"]["sectionA"][63] = "target04.mod"
Level["scenegraph"]["sections"]["sectionA"][7] = "l1_r1arwgob00.mod"
Level["scenegraph"]["sections"]["sectionA"][8] = "l1_r1arwgob01.mod"
Level["scenegraph"]["sections"]["sectionA"][9] = "l1_r1arwgob02.mod"
Level["scenegraph"]["sections"]["sectionB"] = {}
Level["scenegraph"]["sections"]["sectionB"]["size"] = 4736333
Level["scenegraph"]["sections"]["sectionB"][1] = "bif.mod"
Level["scenegraph"]["sections"]["sectionB"][10] = "l1_con2a03.mod"
Level["scenegraph"]["sections"]["sectionB"][11] = "l1_con2a04.mod"
Level["scenegraph"]["sections"]["sectionB"][12] = "l1_con2a05.mod"
Level["scenegraph"]["sections"]["sectionB"][13] = "l1_con2a06.mod"
Level["scenegraph"]["sections"]["sectionB"][14] = "l1_con2a07.mod"
Level["scenegraph"]["sections"]["sectionB"][15] = "l1_con2a08.mod"
Level["scenegraph"]["sections"]["sectionB"][16] = "l1_r4.mod"
Level["scenegraph"]["sections"]["sectionB"][17] = "l1_r4sky.mod"
Level["scenegraph"]["sections"]["sectionB"][18] = "l1_r5.mod"
Level["scenegraph"]["sections"]["sectionB"][19] = "l1_r5_tubes.mod"
Level["scenegraph"]["sections"]["sectionB"][2] = "bifshot.mod"
Level["scenegraph"]["sections"]["sectionB"][20] = "l1_r5rings.mod"
Level["scenegraph"]["sections"]["sectionB"][21] = "l1_r6.mod"
Level["scenegraph"]["sections"]["sectionB"][22] = "l1_r6ball.mod"
Level["scenegraph"]["sections"]["sectionB"][23] = "l1_r6sky.mod"
Level["scenegraph"]["sections"]["sectionB"][24] = "l1_tun12smal.mod"
Level["scenegraph"]["sections"]["sectionB"][25] = "l1_tun13swt.mod"
Level["scenegraph"]["sections"]["sectionB"][26] = "l1_tun14swb.mod"
Level["scenegraph"]["sections"]["sectionB"][27] = "l1_tun15long.mod"
Level["scenegraph"]["sections"]["sectionB"][28] = "l1_tun16long.mod"
Level["scenegraph"]["sections"]["sectionB"][29] = "l1_tun17inc.mod"
Level["scenegraph"]["sections"]["sectionB"][3] = "explode12.mod"
Level["scenegraph"]["sections"]["sectionB"][30] = "l1_tun18swt.mod"
Level["scenegraph"]["sections"]["sectionB"][31] = "l1_tun19swb.mod"
Level["scenegraph"]["sections"]["sectionB"][32] = "l1_tun20swt.mod"
Level["scenegraph"]["sections"]["sectionB"][33] = "l1_tun21swb.mod"
Level["scenegraph"]["sections"]["sectionB"][34] = "l1_tun22crv.mod"
Level["scenegraph"]["sections"]["sectionB"][35] = "l1_tun23swt.mod"
Level["scenegraph"]["sections"]["sectionB"][36] = "l1_tun24swt.mod"
Level["scenegraph"]["sections"]["sectionB"][37] = "l1_tun25swb.mod"
Level["scenegraph"]["sections"]["sectionB"][38] = "l1_tun25swb2.mod"
Level["scenegraph"]["sections"]["sectionB"][39] = "l1_tun26crv.mod"
Level["scenegraph"]["sections"]["sectionB"][4] = "explode5.mod"
Level["scenegraph"]["sections"]["sectionB"][40] = "l1_tun27smal.mod"
Level["scenegraph"]["sections"]["sectionB"][41] = "turret04.mod"
Level["scenegraph"]["sections"]["sectionB"][42] = "turshot03.mod"
Level["scenegraph"]["sections"]["sectionB"][5] = "fan2.mod"
Level["scenegraph"]["sections"]["sectionB"][6] = "fancam.mod"
Level["scenegraph"]["sections"]["sectionB"][7] = "l1_con2a00.mod"
Level["scenegraph"]["sections"]["sectionB"][8] = "l1_con2a01.mod"
Level["scenegraph"]["sections"]["sectionB"][9] = "l1_con2a02.mod"
Level["scenegraph"]["sections"]["sectionC"] = {}
Level["scenegraph"]["sections"]["sectionC"]["size"] = 4478448
Level["scenegraph"]["sections"]["sectionC"][1] = "domeshatter.mod"
Level["scenegraph"]["sections"]["sectionC"][10] = "hansdie.mod"
Level["scenegraph"]["sections"]["sectionC"][11] = "hanspilot.mod"
Level["scenegraph"]["sections"]["sectionC"][12] = "hansshot.mod"
Level["scenegraph"]["sections"]["sectionC"][13] = "hdcam01.mod"
Level["scenegraph"]["sections"]["sectionC"][14] = "hdcam02.mod"
Level["scenegraph"]["sections"]["sectionC"][15] = "l1_con2a00.mod"
Level["scenegraph"]["sections"]["sectionC"][16] = "l1_con2a01.mod"
Level["scenegraph"]["sections"]["sectionC"][17] = "l1_con2a02.mod"
Level["scenegraph"]["sections"]["sectionC"][18] = "l1_con2a03.mod"
Level["scenegraph"]["sections"]["sectionC"][19] = "l1_con2a04.mod"
Level["scenegraph"]["sections"]["sectionC"][2] = "explode11.mod"
Level["scenegraph"]["sections"]["sectionC"][20] = "l1_con2a05.mod"
Level["scenegraph"]["sections"]["sectionC"][21] = "l1_con2a06.mod"
Level["scenegraph"]["sections"]["sectionC"][22] = "l1_con2a07.mod"
Level["scenegraph"]["sections"]["sectionC"][23] = "l1_con2a08.mod"
Level["scenegraph"]["sections"]["sectionC"][24] = "l1_con2b01.mod"
Level["scenegraph"]["sections"]["sectionC"][25] = "l1_con2b02.mod"
Level["scenegraph"]["sections"]["sectionC"][26] = "l1_con2b03.mod"
Level["scenegraph"]["sections"]["sectionC"][27] = "l1_con2b04.mod"
Level["scenegraph"]["sections"]["sectionC"][28] = "l1_con2b05.mod"
Level["scenegraph"]["sections"]["sectionC"][29] = "l1_hansdie.mod"
Level["scenegraph"]["sections"]["sectionC"][3] = "explode12.mod"
Level["scenegraph"]["sections"]["sectionC"][30] = "l1_r7.mod"
Level["scenegraph"]["sections"]["sectionC"][31] = "l1_r7cloudspin.mod"
Level["scenegraph"]["sections"]["sectionC"][32] = "l1_r7domes.mod"
Level["scenegraph"]["sections"]["sectionC"][33] = "l1_r7plat1.mod"
Level["scenegraph"]["sections"]["sectionC"][34] = "l1_r7plat2.mod"
Level["scenegraph"]["sections"]["sectionC"][35] = "l1_r7plat3.mod"
Level["scenegraph"]["sections"]["sectionC"][36] = "l1_r7plat4.mod"
Level["scenegraph"]["sections"]["sectionC"][37] = "l1_r7plat5.mod"
Level["scenegraph"]["sections"]["sectionC"][38] = "l1_r7ribs.mod"
Level["scenegraph"]["sections"]["sectionC"][39] = "l1_r7sky.mod"
Level["scenegraph"]["sections"]["sectionC"][4] = "explode17.mod"
Level["scenegraph"]["sections"]["sectionC"][40] = "l1_r7spike06.mod"
Level["scenegraph"]["sections"]["sectionC"][41] = "l1_r7spike07.mod"
Level["scenegraph"]["sections"]["sectionC"][42] = "l1_r7spike08.mod"
Level["scenegraph"]["sections"]["sectionC"][43] = "l1_r7spike09.mod"
Level["scenegraph"]["sections"]["sectionC"][44] = "l1_r7spike1.mod"
Level["scenegraph"]["sections"]["sectionC"][45] = "l1_r7spike2.mod"
Level["scenegraph"]["sections"]["sectionC"][46] = "l1_r7spike3.mod"
Level["scenegraph"]["sections"]["sectionC"][47] = "l1_r7spike4.mod"
Level["scenegraph"]["sections"]["sectionC"][48] = "l1_r7spike5.mod"
Level["scenegraph"]["sections"]["sectionC"][49] = "l1_r7tube.mod"
Level["scenegraph"]["sections"]["sectionC"][5] = "explode7.mod"
Level["scenegraph"]["sections"]["sectionC"][50] = "l1_r7tubes.mod"
Level["scenegraph"]["sections"]["sectionC"][51] = "l1_r8.mod"
Level["scenegraph"]["sections"]["sectionC"][52] = "l1_r8b.mod"
Level["scenegraph"]["sections"]["sectionC"][53] = "l1_r8canopy.mod"
Level["scenegraph"]["sections"]["sectionC"][54] = "l1_r8cloudspin.mod"
Level["scenegraph"]["sections"]["sectionC"][55] = "l1_r8innerguns.mod"
Level["scenegraph"]["sections"]["sectionC"][56] = "l1_r8outerguns.mod"
Level["scenegraph"]["sections"]["sectionC"][57] = "l1_r8plats.mod"
Level["scenegraph"]["sections"]["sectionC"][58] = "l1_r8shield.mod"
Level["scenegraph"]["sections"]["sectionC"][59] = "l1_r8sky.mod"
Level["scenegraph"]["sections"]["sectionC"][6] = "fan2.mod"
Level["scenegraph"]["sections"]["sectionC"][60] = "l1_r8tub.mod"
Level["scenegraph"]["sections"]["sectionC"][61] = "l1bosscam.mod"
Level["scenegraph"]["sections"]["sectionC"][62] = "manta.mod"
Level["scenegraph"]["sections"]["sectionC"][63] = "platportal1.mod"
Level["scenegraph"]["sections"]["sectionC"][64] = "platportal2.mod"
Level["scenegraph"]["sections"]["sectionC"][65] = "platportal3.mod"
Level["scenegraph"]["sections"]["sectionC"][66] = "poopsy.mod"
Level["scenegraph"]["sections"]["sectionC"][67] = "r7_lava.mod"
Level["scenegraph"]["sections"]["sectionC"][68] = "r7_lava2.mod"
Level["scenegraph"]["sections"]["sectionC"][69] = "turret01.mod"
Level["scenegraph"]["sections"]["sectionC"][7] = "flyers.mod"
Level["scenegraph"]["sections"]["sectionC"][70] = "turret02.mod"
Level["scenegraph"]["sections"]["sectionC"][71] = "turret04.mod"
Level["scenegraph"]["sections"]["sectionC"][72] = "turshot02.mod"
Level["scenegraph"]["sections"]["sectionC"][73] = "turshot03.mod"
Level["scenegraph"]["sections"]["sectionC"][74] = "turshot04.mod"
Level["scenegraph"]["sections"]["sectionC"][8] = "generator2.mod"
Level["scenegraph"]["sections"]["sectionC"][9] = "hans.mod"
Level["scenegraph"]["sections"]["sectionD"] = {}
Level["scenegraph"]["sections"]["sectionD"]["size"] = 5870368
Level["scenegraph"]["sections"]["sectionD"][1] = "dialog.mod"
Level["scenegraph"]["sections"]["sectionD"][10] = "l0a_animgob.mod"
Level["scenegraph"]["sections"]["sectionD"][11] = "ml0a_1.wav"
Level["scenegraph"]["sections"]["sectionD"][12] = "ml0a_2.wav"
Level["scenegraph"]["sections"]["sectionD"][13] = "ml0a_3.wav"
Level["scenegraph"]["sections"]["sectionD"][14] = "ml0a_4.wav"
Level["scenegraph"]["sections"]["sectionD"][15] = "ml0a_5.wav"
Level["scenegraph"]["sections"]["sectionD"][16] = "ml0a_6.wav"
Level["scenegraph"]["sections"]["sectionD"][17] = "ml0a_7.wav"
Level["scenegraph"]["sections"]["sectionD"][18] = "ml0a_8.wav"
Level["scenegraph"]["sections"]["sectionD"][19] = "ml0a_9.wav"
Level["scenegraph"]["sections"]["sectionD"][2] = "dialogtop.mod"
Level["scenegraph"]["sections"]["sectionD"][20] = "ml1_stuntdr.mod"
Level["scenegraph"]["sections"]["sectionD"][21] = "ml1_stuntkurt.mod"
Level["scenegraph"]["sections"]["sectionD"][22] = "ml1_stuntmax.mod"
Level["scenegraph"]["sections"]["sectionD"][23] = "ml1a_camera.mod"
Level["scenegraph"]["sections"]["sectionD"][24] = "ml1a_drmovegob.mod"
Level["scenegraph"]["sections"]["sectionD"][25] = "ml1a_kurmovegob.mod"
Level["scenegraph"]["sections"]["sectionD"][26] = "ml1a_lounge.mod"
Level["scenegraph"]["sections"]["sectionD"][27] = "ml1a_maxmovegob.mod"
Level["scenegraph"]["sections"]["sectionD"][3] = "dochead.mod"
Level["scenegraph"]["sections"]["sectionD"][4] = "jd_doors00.mod"
Level["scenegraph"]["sections"]["sectionD"][5] = "jd_fartmachine.mod"
Level["scenegraph"]["sections"]["sectionD"][6] = "jd_fridge.mod"
Level["scenegraph"]["sections"]["sectionD"][7] = "jimbhead.mod"
Level["scenegraph"]["sections"]["sectionD"][8] = "kurthead.mod"
Level["scenegraph"]["sections"]["sectionD"][9] = "l0a.mod"
Level["scenegraph"]["sections"]["sectionE"] = {}
Level["scenegraph"]["sections"]["sectionE"]["size"] = 2836399
Level["scenegraph"]["sections"]["sectionE"][1] = "dialog.mod"
Level["scenegraph"]["sections"]["sectionE"][10] = "l1_r8canopy.mod"
Level["scenegraph"]["sections"]["sectionE"][11] = "l1_r8cloudspin.mod"
Level["scenegraph"]["sections"]["sectionE"][12] = "l1_r8innerguns.mod"
Level["scenegraph"]["sections"]["sectionE"][13] = "l1_r8outerguns.mod"
Level["scenegraph"]["sections"]["sectionE"][14] = "l1_r8plats.mod"
Level["scenegraph"]["sections"]["sectionE"][15] = "l1_r8shield.mod"
Level["scenegraph"]["sections"]["sectionE"][16] = "l1_r8sky.mod"
Level["scenegraph"]["sections"]["sectionE"][17] = "l1_r8tub.mod"
Level["scenegraph"]["sections"]["sectionE"][18] = "ml1_stuntkurt.mod"
Level["scenegraph"]["sections"]["sectionE"][19] = "ml1z_camera.mod"
Level["scenegraph"]["sections"]["sectionE"][2] = "dialogtop.mod"
Level["scenegraph"]["sections"]["sectionE"][20] = "ml1z_kurmovegob.mod"
Level["scenegraph"]["sections"]["sectionE"][21] = "ml1z_shwang.mod"
Level["scenegraph"]["sections"]["sectionE"][22] = "schwhead.mod"
Level["scenegraph"]["sections"]["sectionE"][23] = "turret01.mod"
Level["scenegraph"]["sections"]["sectionE"][24] = "turret02.mod"
Level["scenegraph"]["sections"]["sectionE"][25] = "l1_r8b.mod"
Level["scenegraph"]["sections"]["sectionE"][3] = "dochead.mod"
Level["scenegraph"]["sections"]["sectionE"][4] = "fan2.mod"
Level["scenegraph"]["sections"]["sectionE"][5] = "generator2.mod"
Level["scenegraph"]["sections"]["sectionE"][6] = "hanspilot.mod"
Level["scenegraph"]["sections"]["sectionE"][7] = "kurthead.mod"
Level["scenegraph"]["sections"]["sectionE"][8] = "l1_con2b05.mod"
Level["scenegraph"]["sections"]["sectionE"][9] = "l1_r8.mod"
Level["scenegraph"]["sections"]["sectionF"] = {}
Level["scenegraph"]["sections"]["sectionF"]["size"] = 4933676
Level["scenegraph"]["sections"]["sectionF"][1] = "earthb1.mod"
Level["scenegraph"]["sections"]["sectionF"][10] = "l1_r1.mod"
Level["scenegraph"]["sections"]["sectionF"][11] = "l1_r1extra1.mod"
Level["scenegraph"]["sections"]["sectionF"][12] = "l1_r1extra2.mod"
Level["scenegraph"]["sections"]["sectionF"][13] = "l1_r1extra3.mod"
Level["scenegraph"]["sections"]["sectionF"][14] = "l1_r1fancover.mod"
Level["scenegraph"]["sections"]["sectionF"][15] = "l1_r1plats.mod"
Level["scenegraph"]["sections"]["sectionF"][16] = "l1_sky01.mod"
Level["scenegraph"]["sections"]["sectionF"][17] = "l1_tun01crv.mod"
Level["scenegraph"]["sections"]["sectionF"][18] = "l1_tun02swt.mod"
Level["scenegraph"]["sections"]["sectionF"][19] = "ml1_stuntkurt.mod"
Level["scenegraph"]["sections"]["sectionF"][2] = "explode12.mod"
Level["scenegraph"]["sections"]["sectionF"][20] = "ml1b_camera.mod"
Level["scenegraph"]["sections"]["sectionF"][21] = "ml1b_static.mod"
Level["scenegraph"]["sections"]["sectionF"][3] = "grmissl.mod"
Level["scenegraph"]["sections"]["sectionF"][4] = "ktgame_grndhit1.mod"
Level["scenegraph"]["sections"]["sectionF"][5] = "ktgame_helmet.mod"
Level["scenegraph"]["sections"]["sectionF"][6] = "ktgame_laser0.mod"
Level["scenegraph"]["sections"]["sectionF"][7] = "ktgame_missl0.mod"
Level["scenegraph"]["sections"]["sectionF"][8] = "ktgame_timer.mod"
Level["scenegraph"]["sections"]["sectionF"][9] = "kurtgame.mod"
Level["sounds"] = {}
Level["sounds"]["amb_alien1.wav"] = 0
Level["sounds"]["amb_alien2.wav"] = 0
Level["sounds"]["amb_alien3.wav"] = 0
Level["sounds"]["amb_comp4.wav"] = 1
Level["sounds"]["bullet_bounce.wav"] = 0
Level["sounds"]["checkpoint.wav"] = 0
Level["sounds"]["cloak_disable.wav"] = 0
Level["sounds"]["cloak_use.wav"] = 0
Level["sounds"]["death_fall.wav"] = 0
Level["sounds"]["dogan_bounce.wav"] = 0
Level["sounds"]["dogan_grenade.wav"] = 0
Level["sounds"]["glass_break.wav"] = 0
Level["sounds"]["grenade_bounce.wav"] = 0
Level["sounds"]["hans_scream.wav"] = 0
Level["sounds"]["hans_taunt.wav"] = 0
Level["sounds"]["kurt_gun.wav"] = 1
Level["sounds"]["kurt_laser.wav"] = 1
Level["sounds"]["kurt_sgun.wav"] = 1
Level["sounds"]["mortar_bounce.wav"] = 0
Level["sounds"]["option_bar.wav"] = 0
Level["sounds"]["option_button.wav"] = 0
Level["sounds"]["option_select.wav"] = 0
Level["sounds"]["rumble1.wav"] = 0
Level["sounds"]["rumble2.wav"] = 0
Level["sounds"]["shatter1.wav"] = 0

if PreInitLevel()==1 then Level=nil return end

-- FUNCTIONS



Level.BobOnShotExploded = function(gob)
    -- check if the shot exploded in one of the domes --
    Level.ShotHitDome(platportal1)
    Level.ShotHitDome(platportal2)
    Level.ShotHitDome(platportal3)
end
----------------------------------------------------

Level.GetPlatformGuard = function(gob)
    -- returns the guard associated with the given platform --
    if (gob == platportal1) then
        return l1_r7dogan1
    elseif (gob == platportal2) then
        return l1_r7dogan2
    else
        return nil
    end
end
----------------------------------------------------

Level.GuardTaunt = function(gob)
    -- face the player and occasionally taunt him --
    if (mdkWalkerHeadToGob(gob, bob) == 1) then
        if (random(100) == 1) then
            mdkWalkerPlayAnim(gob, ANIM_TAUNT0)
        end
    end
end
----------------------------------------------------

Level.HansPilotSetState = function(gob, state)
    gob.state = state
end

hanspilot.OnDamage = function(gob, from, damage, damagetype, part)

    if (l1_r8.BossFlag==0) then	return end

    if (hanspilot.state==1) then
        --print('HIT ONCE')
        StartGlobalScript(l1_r8, {    
            { omAnimPlay, { hanspilot, ANIM_DAMAGE0,0 } },
            { WaitForAnim, { hanspilot, ANIM_DAMAGE0,0 } },
            { omAnimPlay, { hanspilot,ANIM_ENABLED,0 } },
            { Level.HansPilotSetState, { hanspilot, 2 } },
        })    
    elseif (hanspilot.state==2) then
        --print('HIT TWICE')
        StartGlobalScript(l1_r8, {    
            { omAnimPlay, { hanspilot, ANIM_DAMAGE2,0 } },
            { WaitForAnim, { hanspilot, ANIM_DAMAGE2,0 } },
            { omAnimPlay, { hanspilot,ANIM_ENABLED,0 } },
            { Level.HansPilotSetState, { hanspilot, 3 } },
        })    

    elseif (hanspilot.state==3) then
        --print('DEAD')
        hanspilot.state=4
        StartGlobalScript(l1_r8, {    
            { omAnimPlay, { hanspilot, ANIM_DAMAGE1,0 } },
            { Wait, { bob, .4 } },
            { omGobEnterStasis, { hanspilot } },
            { Wait, { bob, 4 } },
            { omAnimPlay, { l1_r8outerguns,ANIM_CLOSE,0 } },
            { omAnimPlay, { l1_r8innerguns,ANIM_ACTION01,0 } },
            { omAnimPlay, { l1_r8shield,ANIM_ACTION01,0 } },
            { omAnimPlay, { turret01_01,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_02,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_03,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_04,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_05,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_06,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_07,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_08,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_01,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_02,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_03,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_04,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_05,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_06,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_07,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret02_08,ANIM_ENABLED,0 } },
        })    


        hans = mdkCreateObjectLua("hans", OBJ_HANS, scene, l1_r8, nil, 0,0,0, 1,0,0,0, "l1_r8lowcenter",60,0.2,0,0)
        mdkGobSetBoss(hans, 1)
        mdkGobSetPosition(hans, "l1_r8hansspawn")
        mdkWalkerJumpToPoint(hans, "l1_r8lowcenter", 100)
        mdkWalkerAlert(hans,0)

        StartScript(hans, {
            { Wait, { 2.4 } },
            { Level.r8HansScream },
            { mdkWalkerIsReady },
            { omAnimPlay, { ANIM_VICTORY, ANIMFLAG_OVERLAY } },
            { omAnimJustLooped, { ANIM_VICTORY } },
            { Level.r8HansAttack },
        })

        hans.OnDie = Level.r8HansOnDie
        hans.OnTimer = Level.r8HansOnTimer
        hans.OnCustomKey = Level.r8HansOnCustomKey
        omGobSetTimer(hans, 10)
        
        l1_r8.state = 2
        omGobSetTimer(l1_r8, 4)
    end

end

Level.r8HansAttack = function(gob)
    if(not l1_r8.bossstarted) then return end

    local player = mdkGetPlayerGob()
    local dist = mdkGobDistance(gob, player)
    local cloaked = (mdkGetAITargetGob() == nil)
    if (mdkWalkerIsReady(gob) == 1 and gob.poundnow) then
        if (dist < 45) then
            mdkWalkerPlayAnim(gob, ANIM_MELEE)
            gob.poundnow = nil
            if (cloaked) then
                omGobSetTimer(gob, 4)
            else
                omGobSetTimer(gob, 10)
            end
        elseif (dist > 70 or cloaked) then
            if (hans.high) then
                mdkWalkerJumpToPoint(gob, "l1_r8lowcenter", 50)
                mdkWalkerSetPen(gob, "l1_r8lowcenter", 60)
                hans.high = nil
            else
                mdkWalkerJumpToPoint(gob, "l1_r8highcenter", 50)
                mdkWalkerSetPen(gob, "l1_r8highcenter", 15)
                hans.high = 1
            end
            gob.poundnow = nil
            if (cloaked) then
                omGobSetTimer(gob, 1)
            else
                omGobSetTimer(gob, 10)
            end
        end
    end
    mdkDoganboyAttack(gob)
    return 0
end

Level.r8HansOnTimer = function(gob)
    gob.poundnow = 1    
end

Level.r8HansScream = function(gob)
    omGobGSPlay(l1_r8.screamsound, 0,1,0,0)
end

Level.r8HansTaunt = function(gob)
    omGobGSPlay(l1_r8.tauntsound, 0,1,0,0)
end

l1_r8.OnCreate = function(gob)
    if (not l1_r8.screamsound) then
        l1_r8.screamsound = omGobAddSound(l1_r8, "hans_scream", 0)
    end
    if (not l1_r8.tauntsound) then
        l1_r8.tauntsound = omGobAddSound(l1_r8, "hans_taunt", 0)
    end
    mdkGobSetSeekable(hanspilot, 1)
    mdkGobSetBullseye(hanspilot, 3.5)
    l1_r8.BossFlag = 0
end

l1_r8.SnipeLock = function(lock)

    if ((l1_r8esnipe01.LockOn==1) and
        (l1_r8esnipe02.LockOn==1) and
        (l1_r8esnipe03.LockOn==1) and 
        (l1_r8esnipe04.LockOn==1)) then

-- INITIATE BOSS SEQUENCE PHASE 2

        --print('BOSS SEQUENCE PHASE 2')
	
        omGobDelete(l1_r8esnipe01)
        omGobDelete(l1_r8esnipe02)
        omGobDelete(l1_r8esnipe03)
        omGobDelete(l1_r8esnipe04)
        StartGlobalScript(l1_r8, {    
            { omAnimPlay, { turret01_01,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_02,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_03,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_04,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_05,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_06,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_07,ANIM_ENABLED,0 } },
            { omAnimPlay, { turret01_08,ANIM_ENABLED,0 } },

            { omAnimPlay, { l1_r8esnipe05,ANIM_LOCK,0} },

            { omAnimPlay, { l1_r8outerguns,ANIM_CLOSE,0 } },
            { omAnimJustLooped, { l1_r8outerguns, ANIM_CLOSE} },
            { omAnimPlay, { l1_r8outerguns,ANIM_OPEN,0 } },
            { omAnimJustLooped, { l1_r8outerguns, ANIM_OPEN } },
            { omAnimPlay, { l1_r8outerguns,ANIM_ENABLED,0 } },
            { omAnimJustLooped, { l1_r8outerguns, ANIM_ENABLED } },
            { omAnimPlay, { l1_r8innerguns,ANIM_OPEN,0 } },	



            { omAnimPlay, { turret01_01,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_02,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_03,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_04,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_05,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_06,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_07,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret01_08,ANIM_SHOOTING,0 } },

            { WaitForAnim, { l1_r8innerguns, ANIM_OPEN, 0 } },
            { omAnimPlay, { l1_r8innerguns,ANIM_SPIN,0 } },
            { omAnimPlay, { l1_r8outerguns,ANIM_SPIN,0 } },

            { omAnimSetDelta, { turret01_01,ANIM_SHOOTING,0.00 } },
            { omAnimSetDelta, { turret01_02,ANIM_SHOOTING,0.04 } },
            { omAnimSetDelta, { turret01_03,ANIM_SHOOTING,0.08 } },
            { omAnimSetDelta, { turret01_04,ANIM_SHOOTING,0.12 } },
            { omAnimSetDelta, { turret01_05,ANIM_SHOOTING,0.16 } },
            { omAnimSetDelta, { turret01_06,ANIM_SHOOTING,0.20 } },
            { omAnimSetDelta, { turret01_07,ANIM_SHOOTING,0.24 } },
            { omAnimSetDelta, { turret01_08,ANIM_SHOOTING,0.28 } },

            { omAnimSetDelta, { turret02_01,ANIM_SHOOTING,0.00 } },
            { omAnimSetDelta, { turret02_02,ANIM_SHOOTING,0.04 } },
            { omAnimSetDelta, { turret02_03,ANIM_SHOOTING,0.08 } },
            { omAnimSetDelta, { turret02_04,ANIM_SHOOTING,0.12 } },
            { omAnimSetDelta, { turret02_05,ANIM_SHOOTING,0.16 } },
            { omAnimSetDelta, { turret02_06,ANIM_SHOOTING,0.20 } },
            { omAnimSetDelta, { turret02_07,ANIM_SHOOTING,0.24 } },
            { omAnimSetDelta, { turret02_08,ANIM_SHOOTING,0.28 } },

            { omAnimPlay, { turret02_01,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret02_05,ANIM_SHOOTING,0 } },
            { Wait, { bob, .1 } },
            { omAnimPlay, { turret02_02,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret02_06,ANIM_SHOOTING,0 } },
            { Wait, { bob, .1 } },
            { omAnimPlay, { turret02_03,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret02_07,ANIM_SHOOTING,0 } },
            { Wait, { bob, .1 } },
            { omAnimPlay, { turret02_04,ANIM_SHOOTING,0 } },
            { omAnimPlay, { turret02_08,ANIM_SHOOTING,0 } },


	        { omAnimPlay, { l1_r8esnipe05,ANIM_ENABLED,0} },

            { Level.r8SetLocksDone },

        })    

    end
end

Level.r8SetLocksDone = function()
    l1_r8.locksdone = 1
end

----------------------------------------------------

Level.Init = function(cp)

    -- display KURT icon animation
    chControlAnimateImage(KURT_ICON_ANIM, 4)

    -- do checkpoint-specific initialization --
    if (cp >= 0) then
        CreateKurt()

        mdkProxDoorLock(dr1_02, 1)

        --bob.OnShotExploded = Level.BobOnShotExploded
        Level.InitPlatform(platportal1, "l1_r7domeglas1", "l1_r7domeglas06", "l1_r7domering1", domeshatter1, fan1_09, domespawner1, "domepen1" )
        Level.InitPlatform(platportal2, "l1_r7domeglas2", "l1_r7domeglas04", "l1_r7domering2", domeshatter2, fan1_11, domespawner3, "domepen3" )
        Level.InitPlatform(platportal3, "l1_r7domeglas3", "l1_r7domeglas05", "l1_r7domering3", domeshatter3, nil,     nil,          nil )

        mdkGobSetSeekable(l1_r8snipe1,1)
        mdkGobSetSeekable(l1_r8snipe2,1)
    
        l1_r1.PutTutorialInStasis()

        -- tutorial --
        if (cp == 1) then
            --chSndSwitchMusic(-1)
            Level.StartTheTutorialNOW()
    
        -- room 1, no tutorial --
        elseif (cp == 11) then
            l1_r1.tutinit = 1
            chSndSwitchMusic(16)

        elseif (cp == 4) then
            chSndSwitchMusic(3)

        elseif (cp == 14) then
            chSndSwitchMusic(3)

            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 148,43,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 148,45,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 148,47,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 148,49,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 148,51,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 148,53,-95, 1,0,0,0, nil,100,0,0,0),0)

            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 172,17,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 174,17,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 176,17,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 178,17,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 180,17,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 182,17,-95, 1,0,0,0, nil,100,0,0,0),0)

            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 209,49,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 209,51,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 209,53,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 209,55,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 209,57,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 209,59,-95, 1,0,0,0, nil,100,0,0,0),0)

            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 164,71,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 166,71,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 168,71,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 170,71,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 172,71,-95, 1,0,0,0, nil,100,0,0,0),0)
            mdkWalkerAlert(mdkCreateObjectLua("", OBJ_DOGANBOY, mdkGetScene(), l1_r3, nil, 174,71,-95, 1,0,0,0, nil,100,0,0,0),0)

            mdkSetDifficulty(1)

        -- 1-8 checkpoint -- 
        elseif (cp == 8) then 
            l1_r8.state = 1
            omGobSetTimer(l1_r8, 2)
            chSndSwitchMusic(14)
            hanspilot.state = 1
	        l1_r8.BossFlag = 0
            omAnimPlay(l1_r8proxent, ANIM_READY0, 0)
            mdkProxDoorLock(l1_r8proxent, 1)
            l1_r8.entered = 1

        -- intro movie --
        elseif (cp == 9) then
            dofile('ml1a_movie')
            dofile('l0a')
            Level.PlayIntroMovieA()
            mdkSetAutoSave(1,9)

        -- intro movie --
        elseif (cp == 12) then
            dofile('ml1b_movie')
            Level.PlayIntroMovieB()

        -- end movie --
        elseif (cp == 10) then
            dofile('ml1z_movie')
            mdkAdvanceCheckpoint(8,0)   --
            Level.PlayEndMovie()
            l1_r8.entered = 1

        elseif (cp == 13) then
            mdkCreateObjectLua("dumbif1", OBJ_BIF, mdkGetScene(), l1_r5, nil, 250,-102,-169, 1,0,0,0, "l1_r5wp2",100,0,0,0)
            mdkCreateObjectLua("dumbif2", OBJ_BIF, mdkGetScene(), l1_r5, nil, 260,-126,-169, 1,0,0,0, "l1_r5wp2",100,0,0,0)
            mdkCreateObjectLua("dumbif3", OBJ_BIF, mdkGetScene(), l1_r5, nil, 304,-127,-169, 1,0,0,0, "l1_r5wp2",100,0,0,0)
            mdkCreateObjectLua("dumbif4", OBJ_BIF, mdkGetScene(), l1_r5, nil, 383,-121,-169, 1,0,0,0, "l1_r5wp2",100,0,0,0)
            mdkCreateObjectLua("dumbif5", OBJ_BIF, mdkGetScene(), l1_r5, nil, 328,-102,-162, 1,0,0,0, "l1_r5wp2",100,0,0,0)
            mdkWalkerSetTurret(dumbif5, 1)
        end
    end
end
----------------------------------------------------

Level.InitPlatform = function(gob, slotnameglass, slotnameshield, slotnamering, anim, fan, spawner, pencentre)
    local guard

    gob.OnCollision = Level.PlatformOnCollision
    gob.bulletgob = nil
    gob.shattered = nil
    gob.slotnameglass = slotnameglass
    gob.slotnameshield = slotnameshield
    gob.slotnamering = slotnamering
    gob.anim = anim
    gob.fan = fan
    gob.spawner = spawner
    gob.pencentre = pencentre

    -- initially the platform guard only taunts the player --
    guard = Level.GetPlatformGuard(gob)
    if (guard ~= nil) then
        StartScript(guard, {
            { Level.GuardTaunt },
            { LoopScript }
        })
    end

    -- initially the platform fan is switched off --
    if (fan ~= nil) then
        mdkBlowerDisable(fan)
    end

    if (spawner ~= nil) then
        spawner.platform = gob
        spawner.OnSpawn = Level.SpawnerOnSpawn
        spawner.OnTimer = Level.SpawnerOnTimer
        mdkSpawnerSetSpawnedObject(spawner, OBJ_DOGANBOY, pencentre, 5, 0, 0, 0, 0, l2_r7)
    end

end

----------------------------------------------------

Level.IntroBStuntKurtOnCustomKey = function(gob)
    if (gob.chuteopen) then
        omAnimPlay(ml1b_chute, ANIM_CLOSE, ANIMFLAG_NOTRANS)
    else
        omAnimPlay(ml1b_chute, ANIM_OPEN, ANIMFLAG_NOTRANS)
        gob.chuteopen = 1
    end
end

Level.PlayIntroMovieB = function()

    if (ml1b_camera == nil) then return end

    mdkCreateObjectLua("ml1b_chute", OBJ_SCENERY, scene, ml1b_stuntkurt, "ML1SK_TORSO", 0,0,0, 1,0,0,0, "chute",0,0,0,0)
    omAnimPlay(ml1b_chute, ANIM_CLOSE, ANIMFLAG_NOTRANS)
    mdkSetLuaEvent(ml1b_stuntkurt, "OnCustomKey", Level.IntroBStuntKurtOnCustomKey)

    omGobExitStasis(ml1b_camera)

    StartMovie(ml1b_camera, {

        { chDoWideScreen,   { 0,2 } },

        { chSndSwitchMusic, { 14 } },
        { PlayerEnterStasis },
        { mdkDisableDefaultCamera, {} },
        { mdkDisableGui,    {} },

        { omGobExitStasis,  { ml1b_camera } },
        { omGobExitStasis,  { ml1b_stuntkurt } },
        { omGobExitStasis,  { ml1b_static } },
        { omGobExitStasis,  { ml1b_stars } },


        -- cut 1 Kurt prepares to jump --

        { omAnimPlay,       { ml1b_camera, ANIM_ACTION00, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1b_stuntkurt, ANIM_ACTION16, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { ml1b_camera, ANIM_ACTION00 } },

        -- cut 2 Kurt fall --

        { omAnimPlay,       { ml1b_camera, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1b_stuntkurt, ANIM_ACTION17, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { ml1b_camera, ANIM_ACTION01 } },

        -- cut 3 Kurt diving --

        { omAnimPlay,       { ml1b_camera, ANIM_ACTION03, ANIMFLAG_NOTRANS+ANIMFLAG_INTERRUPT } },
        { omAnimPlay,       { ml1b_stuntkurt, ANIM_ACTION19, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { ml1b_camera, ANIM_ACTION03 } },

        -- minigame --

        { MiniGameStart },
        { Level.StartMinigame },
        { Level.GetMinigameResult },
        { MiniGameEnd },

        -- cut 4 Kurt lands on Minecrawler --

        { omAnimPlay,       { ml1b_camera, ANIM_ACTION02, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1b_stuntkurt, ANIM_ACTION18, ANIMFLAG_NOTRANS } },
        { omGobEnterStasis, { ml1b_static } },
        { omAnimJustLooped, { ml1b_stuntkurt, ANIM_ACTION18 } },
        { omSceneFade, { mdkGetScene() , 0, 0, 0, 1, 1, 1, 0 } },
        { Wait,             { ml1b_camera, 1.1 } };

        Done = Level.IntroMovieBDone
    })

end

Level.IntroMovieBDone = function()
    HideNextLoadingScreen(strings.l1chk1)
    mdkNewGame(1, 1)
end

----------------------------------------------------

Level.IntroFade = function()
    omGobGMSetTransparency(ml1a_lounge, l0a.t)
    omGobGMSetTransparency(ml1a_stuntkurt, l0a.t)
    omGobGMSetTransparency(ml1a_stuntmax, l0a.t)
    omGobGMSetTransparency(ml1a_stuntdr, l0a.t)
    omGobGMSetTransparency(l0a, 1.0 - l0a.t)
    chDoWideScreen(l0a.t,1)


    l0a.t = l0a.t + chGetDeltaT()

    if (l0a.t >= 1.0) then
        omGobGMSetTransparency(ml1a_lounge, 1)
        omGobGMSetTransparency(ml1a_stuntkurt, 1)
        omGobGMSetTransparency(ml1a_stuntmax, 1)
        omGobGMSetTransparency(ml1a_stuntdr, 1)
        chDoWideScreen(0,2)
        omGobEnterStasis(l0a)
        return 1
    else
        return 0
    end
end
----------------------------------------------------

Level.IntroStartFade = function()
    l0a.t = 0
    omGobGMSetTransparency( ml1a_lounge, 0 )
    omGobGMSetTransparency( ml1a_stuntkurt, 0 )
    omGobGMSetTransparency( ml1a_stuntmax, 0 )
    omGobGMSetTransparency( ml1a_stuntdr, 0 )
    chDoWideScreen(0,1)
end
----------------------------------------------------

Level.KurtGameReady = function()
    kurtgame.ready = 1
end

Level.StartMinigame = function()

    if (inmovieplayer or pcdemo) then
        return 2
    end


    kurtgame.ready = nil
        
    StartGlobalScript( kurtgame, {
        { mdkZoomMessage,   { strings.ready } },
        { Wait,             { kurtgame, 1.5 } },
        { mdkZoomMessage,   { strings.go } },
        { Level.KurtGameReady },
    })


    kurtgame.centerx = -281.0
    kurtgame.centery = -256.1
    kurtgame.maxx = 2.5
    kurtgame.maxy = 1.7

    kurtgame.top = kurtgame.centery - kurtgame.maxy
    kurtgame.bottom = kurtgame.centery + kurtgame.maxy
    kurtgame.right = kurtgame.centerx - kurtgame.maxx
    kurtgame.left = kurtgame.centerx + kurtgame.maxx

    kurtgame.missilespeed = 50
    kurtgame.kurtheight = 28.9
    kurtgame.result = 0

    kurtgame.shotcount = 0
    kurtgame.lastmis = nil

    omGobEnterStasis( ml1b_camera )
    omGobEnterStasis( ml1b_stuntkurt )
    omGobEnterStasis( ml1b_static )
    omGobEnterStasis( ml1b_stars )
    omGobExitStasis( kurtgame )
    
    ktgame_kurt.dead = nil
    ktgame_kurt.x = kurtgame.centerx
    ktgame_kurt.vx = 0
    ktgame_kurt.y = kurtgame.centery
    ktgame_kurt.vy = 0
    ktgame_kurt.z = kurtgame.kurtheight
    points.ml1a_kurtpos = {}

    if (ktgame_kurt.fallsound == nil) then
        ktgame_kurt.fallsound = omGobAddSound(ktgame_kurt, "death_fall", 0)
    end

    mdkSetAITargetGob(ktgame_kurt)

    omAnimPlay(ktgame_timer, ANIM_ACTION00, ANIMFLAG_NOTRANS)

    --omGobAttach(mdkGetScene(), ktgame_kurt, ktgame_helmet, omGobGMGetSltIndexByName(ktgame_kurt, "KT_HEAD"))
    --omGobGMSetSltVisible(ktgame_kurt, omGobGMGetSltIndexByName(ktgame_kurt, "KT_HELMET1"), 0)
    --omGobGMSetSltVisible(ktgame_kurt, omGobGMGetSltIndexByName(ktgame_kurt, "KT_HELMET2"), 0)
    --omGobGMSetSltVisible(ktgame_kurt, omGobGMGetSltIndexByName(ktgame_kurt, "KT_HELMET3"), 0)

    omGobSetTimer(kurtgame, 2)
    
end

ktgame_kurt.OnUpdate = function(gob)

    local dt = chGetDeltaT()
    local anims = { ANIM_CHUTE, ANIM_CHUTER, ANIM_CHUTEL, ANIM_CHUTEF, ANIM_CHUTEFR, ANIM_CHUTEFL, ANIM_CHUTEB, ANIM_CHUTEBR, ANIM_CHUTEBL }

    if (not Level.microphoneset) then
        mdkGobSetMicrophone( kurtgame, 1 )
        Level.microphoneset = 1
    end

    if (gob.dead == 1) then

        local groundx, groundy, groundz = mdkGetSlotPositionLua(ktgame_timer, "KTGAME_GNDSLOT")

        gob.z = gob.z - 35*dt
        gob.x = gob.x + gob.vx*dt
        gob.y = gob.y + gob.vy*dt

        if (gob.z < groundz) then
            gob.dead = 2
            omAnimPlay(ktgame_grndhit1, ANIM_ACTION00, ANIMFLAG_NOTRANS)
            --omAnimStop(ktgame_timer, ANIM_ACTION00, ANIMFLAG_NOTRANS)
            mdkGobSetPositionXYZ(ktgame_grndhit1, gob.x, gob.y, groundz)
            gob.z = groundz - 100
            omGobSetTimer(kurtgame, 1.75)
            kurtgame.result = -5
        end

        omAnimPlay(gob, ANIM_ACTION23, 0)

    elseif (gob.dead == 2) then

    elseif (gob.dead == 3 or gob.dead == 4) then

        --local groundx, groundy, groundz = mdkGetSlotPositionLua(ktgame_timer, "KTGAME_SPH01")

        gob.z = gob.z - 35*dt
        gob.x = gob.x + gob.vx*dt
        gob.y = gob.y + gob.vy*dt

        --if (gob.z < groundz) then
            --gob.dead = 2
            --gob.z = groundz - 100
        --end

    else

        if (features and omGetCommandValue(COM_SHOOT)>0) then
            kurtgame.result = 1
            gob.dead = 3
            omGobSetTimer(kurtgame, 0.01)
            return 
        end

        local accel = 10*dt

        local mousey = omGetAxisValue(AXIS_LOOKUPDOWN)
        if (mousey ~= 0) then
            gob.vy = gob.vy - mousey*4

        elseif (omGetCommandValue(COM_MINIUP)>0 or omGetCommandValue(COM_MINIUP2)>0 ) then

            gob.vy = gob.vy - accel
            if (gob.vy < -5) then gob.vy = -5 end

        elseif (omGetCommandValue(COM_MINIDOWN)>0 or omGetCommandValue(COM_MINIDOWN2)>0 ) then

            gob.vy = gob.vy + accel
            if (gob.vy > 5) then gob.vy = 5 end

        else
            if (gob.vy > 0) then
                gob.vy = gob.vy - accel
                if (gob.vy < 0) then gob.vy = 0 end
            elseif (gob.vy < 0) then
                gob.vy = gob.vy + accel
                if (gob.vy > 0) then gob.vy = 0 end
            end
        end

        gob.y = gob.y + gob.vy*dt

        if (gob.y > kurtgame.bottom) then
            gob.y = kurtgame.bottom
            gob.vy = 0
        elseif (gob.y < kurtgame.top) then
            gob.y = kurtgame.top
            gob.vy = 0
        end


        local mousex = omGetAxisValue(AXIS_MOUSELEFTRIGHT)
        if (mousex ~= 0) then
            gob.vx = gob.vx + mousex*4

        elseif (omGetCommandValue(COM_MINIRIGHT)>0 or omGetCommandValue(COM_MINIRIGHT2)>0 ) then
        
            gob.vx = gob.vx - accel
            if (gob.vx < -5) then gob.vx = -5 end

        elseif (omGetCommandValue(COM_MINILEFT)>0 or omGetCommandValue(COM_MINILEFT2)>0 ) then

            gob.vx = gob.vx + accel
            if (gob.vx > 5) then gob.vx = 5 end

        else
            if (gob.vx > 0) then
                gob.vx = gob.vx - accel
                if (gob.vx < 0) then gob.vx = 0 end
            elseif (gob.vx < 0) then
                gob.vx = gob.vx + accel
                if (gob.vx > 0) then gob.vx = 0 end
            end
        end

        gob.x = gob.x + gob.vx*dt

        if (gob.x > kurtgame.left) then
            gob.x = kurtgame.left
            gob.vx = 0
        elseif (gob.x < kurtgame.right) then
            gob.x = kurtgame.right
            gob.vx = 0
        end

        --omAnimPlay(gob, anims[anim+1], 0)
        --omAnimSetStyle(gob, anims[anim+1], ANIMSTYLE_LOOP)
        omAnimPlay(gob, ANIM_ACTION19, 0)

    end

    mdkGobSetPositionXYZ(gob, gob.x, gob.y, gob.z)
    points.ml1a_kurtpos.x = gob.x
    points.ml1a_kurtpos.y = gob.y
    points.ml1a_kurtpos.z = gob.z

    if (kurtgame.lastmis) then
        Level.MissileOnUpdate(kurtgame.lastmis)
    end

end

ktgame_timer.OnCustomKey = function(gob, part, key)
    if (key == CUSTKEY_USER1 and not ktgame_kurt.dead) then
        ktgame_kurt.dead = 3

        local groundx, groundy, groundz = mdkGetSlotPositionLua(ktgame_timer, "KTGAME_SPH01")
        ktgame_kurt.vx = -35*(ktgame_kurt.x-groundx)/(ktgame_kurt.z-groundz)
        ktgame_kurt.vy = -35*(ktgame_kurt.y-groundy)/(ktgame_kurt.z-groundz)

        kurtgame.result = 1
        omGobSetTimer(kurtgame, 1)
    end
end

kurtgame.OnTimer = function(gob)

    if (ktgame_kurt.dead == 2) then

        omAnimPlay(ktgame_timer, ANIM_READY0, ANIMFLAG_NOTRANS)
        omGobSetTimer(kurtgame, 1.5)
        omSceneFade(mdkGetScene(), 0, 0, 0, 1, 1.5, 1, 0)
        ktgame_kurt.dead = 4

    elseif (ktgame_kurt.dead == 3) then

        ktgame_kurt.dead = 4
        omGobSetTimer(kurtgame, 0.5)

    elseif (ktgame_kurt.dead == 4) then

        omGobExitStasis( ml1b_camera )
        omGobExitStasis( ml1b_stuntkurt )
        omGobExitStasis( ml1b_static )
        omGobExitStasis( ml1b_stars )
        omGobEnterStasis( kurtgame )

    else

        local mis

        if (kurtgame.shotcount < 4) then

            mis = mdkCreateObjectLua( "", OBJ_SCENERY, mdkGetScene(), ktgame_timer, nil, 0,0,0, 1,0,0,0, "ktgame_laser0",0,0,0,0 )

            mis.x, mis.y, mis.z = mdkGetSlotPositionLua(ktgame_timer, "KTGAME_SHOTSLT2")
            --mis.x = kurtgame.centerx
            --mis.y = kurtgame.centery

            local dx = kurtgame.centerx + (random()*2-1)*kurtgame.maxx - mis.x
            local dy = kurtgame.centery + (random()*2-1)*kurtgame.maxy - mis.y
            local t = (kurtgame.kurtheight - mis.z) / kurtgame.missilespeed
            mis.vx = dx/t
            mis.vy = dy/t

            mdkGobSetPositionXYZ(mis, mis.x, mis.y, mis.z)
            mdkGobPointToXYZ(mis, mis.vx, mis.vy, kurtgame.missilespeed)
    
            omAnimPlay(mis, ANIM_ACTION00, ANIMFLAG_NOTRANS)
            mdkSetLuaEvent(mis, "OnAnimLoop", Level.MissileOnAnimLoop)
            mdkSetLuaEvent(mis, "OnTimer", omGobDelete)
            mis.laser = 1
            omGobSetTimer(mis, 3)

            omGobSetTimer(kurtgame, 0.5+random())

        else

            local x,y,z
            x,y,z = mdkGetSlotPositionLua(ktgame_timer, "KTGAME_SHOTSLT2")
            --x = kurtgame.centerx
            --y = kurtgame.centery

            mdkCreateObjectLua( "", OBJ_EXPLOSION1, mdkGetScene(), ktgame_timer, nil, x,y,z, 1,0,0,0 )

            mis = mdkCreateObjectLua( "", OBJ_TURSHOT07, mdkGetScene(), ktgame_timer, nil, x,y,z, 1,0,0,0 )
            mdkShootBullet(mis, mis, ktgame_kurt)

            --mdkSetLuaEvent(mis, "OnUpdate", Level.MissileOnUpdate)
            mdkSetLuaEvent(mis, "OnTimer", omGobDelete)
            omGobSetTimer(mis, 5)

            kurtgame.lastmis = mis

            kurtgame.shotcount = 0
            omGobSetTimer(kurtgame, 0.25+random())
        end

        kurtgame.shotcount = kurtgame.shotcount + 1

    end

end

Level.MissileOnAnimLoop = function(gob)
    mdkSetLuaEvent(gob, "OnAnimLoop", nil)
    omAnimPlay(gob, ANIM_ACTION01+random(0,1), ANIMFLAG_NOTRANS)
    mdkSetLuaEvent(gob, "OnUpdate", Level.MissileOnUpdate)
end

Level.MissileOnUpdate = function(gob)

    local dt = chGetDeltaT()

    if(not kurtgame.ready) then return end
    if (not gob.exploding) then
     
        if (gob.laser) then
            gob.z = gob.z + kurtgame.missilespeed*dt
            gob.x = gob.x + gob.vx*dt
            gob.y = gob.y + gob.vy*dt
            mdkGobSetPositionXYZ(gob, gob.x, gob.y, gob.z)

            if (not ktgame_kurt.dead and not gob.checked and gob.z >= ktgame_kurt.z) then
                points.ml1a_kurtpos.z = gob.z
                if (mdkGobDistancePoint(gob, "ml1a_kurtpos") <= 0.4) then
                    omAnimPlay(gob, ANIM_ACTION00, ANIMFLAG_NOTRANS)
                    gob.exploding = 1
                    ktgame_kurt.dead = 1
                    omGobGSPlay(ktgame_kurt.fallsound, 0,1,0,0)
                    mdkSetAITargetGob(nil)
                    omGobSetTimer(kurtgame, 0)
                end
                gob.checked = 1
            end

        else

            if (not ktgame_kurt.dead and mdkGobDistance(gob, ktgame_kurt) <= 0.4) then
                --omAnimPlay(gob, ANIM_ACTION00, ANIMFLAG_NOTRANS)
                local eff = mdkCreateObjectLua( "", OBJ_EXPLOSION1, mdkGetScene(), ktgame_timer, nil )
                mdkGobAlignWith(eff, ktgame_kurt)
                omGobDelete(gob)
                gob.exploding = 1
                ktgame_kurt.dead = 1
                omGobGSPlay(ktgame_kurt.fallsound, 0,1,0,0)
                mdkSetAITargetGob(nil)
                omGobSetTimer(kurtgame, 0)
            end
        end
    end

end

Level.GetMinigameResult = function()
    if (kurtgame.result < 0) then
        Save.inminigame = nil
    end
    return kurtgame.result
end

----------------------------------------------------

l1_con2adr02.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_CLOSE) then
        --door has closed and locked, play ready animation
        omAnimPlay(gob, ANIM_READY0, 0)

    end

end
----------------------------------------------------

l1_con2adr01.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_OPEN) then
        if(not l1_con2adr02.closed) then
            omAnimPlay(l1_con2adr02, ANIM_CLOSE, 0)
            l1_con2adr02.closed=1
        end
    elseif(animid==ANIM_CLOSE) then

        omAnimPlay(gob, ANIM_READY0, 0)
        
    end


end
----------------------------------------------------

l1_con2a02.OnEnterRoom = function(gob)

    mdkProxDoorLock(l1_con2adr01, 1)

end

----------------------------------------------------

l1_con2a08dr04.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_READY0,0)
    end

end

----------------------------------------------------

l1_con2a08dr3.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_OPEN) then
        mdkProxDoorLock(l1_con2a08dr04, 1)
    elseif(animid==ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_READY0,0)
    end

end

----------------------------------------------------

l1_con2a08.OnUpdate = function(gob)

    if(l1_con2a08.locked) then return end
    
    local player=mdkGetPlayerGob()

    if(player) then

        if(mdkGobDistancePoint(player, "l1_r7enterwp") <= 10) then

            mdkProxDoorLock(l1_con2a08dr3, 1)
            l1_con2a08.locked=1

        end

    end

end

----------------------------------------------------

con2bdr01.OnAnimLoop = function(gob, animid)
    
    if(animid==ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_READY0,0)
    end
    
end

----------------------------------------------------

con2bdr02.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_OPEN) then
        mdkProxDoorLock(con2bdr01, 1)
    elseif(animid==ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_READY0, 0)
    end

end

----------------------------------------------------

con2bdr03.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_OPEN) then 
        mdkProxDoorLock(con2bdr02, 1)
    elseif(animid==ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_READY0,0)
    end

end

----------------------------------------------------

l1_r1.ConeheadOnDie = function(gob, crit)

    l1_r1.TaskInc("state 4")
        
end

----------------------------------------------------

l1_r1.InitTutorialFunctions = function(gob)

    -- the way the new tutorials will work is this:
        -- An InitState function, which sets up the new state
        -- An Update function, which will perform anything the state needs done
        -- An EndState function, which will clear everything and make ready for the next state
    
    l1_r1.tasks=0
    l1_r1.state = 0
    l1_r1.statename="state 0"
    l1_r1.TutFuncs = {}
    
    l1_r1.TutFuncs["state 0"]={}
    l1_r1.TutFuncs["state 0"].tasks = 0
    l1_r1.TutFuncs["state 0"].statetasks = 1
    l1_r1.TutFuncs["state 0"].InitState = function(gob)
        
        --l1_r1.TaskInc("state 0")
        l1_r1.timerstate = 0
        omGobSetTimer(l1_r1, strings.tooltipduration)
        
        
    end
    l1_r1.TutFuncs["state 0"].Update = function(gob)
        --no update needed
        --l1_r1.TaskInc("state 0")

    end
    l1_r1.TutFuncs["state 0"].EndState = function(gob)
        l1_r1.statename="state 1"
        
    end
    
    --=================state 1=======================--
    --state 1, play first batch of doctor text
    
    l1_r1.TutFuncs["state 1"]={}
    l1_r1.TutFuncs["state 1"].tasks = 0
    l1_r1.TutFuncs["state 1"].statetasks = 1
    l1_r1.TutFuncs["state 1"].InitState = function(gob)
        --omGobExitStasis(l1_r1fan)

        mdkSetLuaEvent(mdkGetPlayerGob(), "OnOutOfAmmo", Level.r1BobOnOutOfAmmo)
        
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut2.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr1, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { mdkPreloadRes, { "l1_tut3.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr2, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { mdkPreloadRes, { "l1_tut4.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr3, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { mdkPreloadRes, { "l1_tut6.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr4, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.scriptrunning=nil l1_r1.TaskInc("state 1") end, {} }
            })
    end
    l1_r1.TutFuncs["state 1"].Update = function(gob)
        --no update needed
    end
    l1_r1.TutFuncs["state 1"].EndState = function(gob)
        l1_r1.statename="state 2"
        
    end
    
    --=================state 2=======================--
    --state 2, show arrow, wait for player to go to the center of the room  
    
    l1_r1.TutFuncs["state 2"]={}
    l1_r1.TutFuncs["state 2"].tasks = 0
    l1_r1.TutFuncs["state 2"].statetasks = 1
    l1_r1.TutFuncs["state 2"].InitState = function(gob)
        
        omGobExitStasis(l1_r1arwgob00)
        omAnimPlay(l1_r1arwgob00, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1arwgob00.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
            
    end
    l1_r1.TutFuncs["state 2"].Update = function(gob)
        if(mdkGobDistance(l1_r1arwgob00, mdkGetPlayerGob()) < 4) then
            omAnimPlay(l1_r1arwgob00, ANIM_DIE, 0)
            l1_r1.TaskInc("state 2")
        end
    end
    l1_r1.TutFuncs["state 2"].EndState = function(gob)
        l1_r1.statename="state 3"
    end

    --=================state 3=======================--
    --state 3, play second batch of doctor dialog
    
    l1_r1.TutFuncs["state 3"]={}
    l1_r1.TutFuncs["state 3"].tasks = 0
    l1_r1.TutFuncs["state 3"].statetasks = 1
    l1_r1.TutFuncs["state 3"].InitState = function(gob)
        
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            --{ mdkPreloadRes, { "l1_tut6.wav",0 } },
            --{ mdkDialogPanel, { strings.l1tut_dr5, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { mdkPreloadRes, { "l1_tut7.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr6, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.scriptrunning=nil l1_r1.TaskInc("state 3") end, {} }
            })
    end
    l1_r1.TutFuncs["state 3"].Update = function(gob)
        --no update needed
    end
    l1_r1.TutFuncs["state 3"].EndState = function(gob)
        l1_r1.statename="state 4"
    end

    --=================state 4=======================--
    --state 4, spawn in 2 coneheads, set their death function, show arrows, don't do anything else
        
    l1_r1.TutFuncs["state 4"]={}
    l1_r1.TutFuncs["state 4"].tasks = 0
    l1_r1.TutFuncs["state 4"].statetasks = 2
    l1_r1.TutFuncs["state 4"].InitState = function(gob)
        
        
        --spawn 2 coneheads at their respective points
--        l1_r1.ch1 = mdkCreateObjectLua("ch1", OBJ_CONEHEADCIV1, mdkGetScene(), gob, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )    
--        mdkGobSetPosition(l1_r1.ch1,"l1_r1cone01")
--        l1_r1.ch1.OnDie = l1_r1.ConeheadOnDie

--        l1_r1.ch2 = mdkCreateObjectLua("ch2", OBJ_CONEHEADCIV1, mdkGetScene(), gob, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )    
--        mdkGobSetPosition(l1_r1.ch2,"l1_r1cone02")
--        l1_r1.ch2.OnDie = l1_r1.ConeheadOnDie

        mdkCreateObjectLua("dummy1", OBJ_DECOY, mdkGetScene(), l1_r1, nil, 0,0,0, 1,0,0,0, nil,0,0,0,1 )
        mdkGobSetPosition(dummy1, "l1_r1dummy1")
        dummy1.OnDamage = Level.r1DummyOnDamage
        dummy1.OnAnimLoop = Level.r1DummyOnAnimLoop
        
        mdkCreateObjectLua("dummy2", OBJ_DECOY, mdkGetScene(), l1_r1, nil, 0,0,0, 1,0,0,0, nil,0,0,0,1 )
        mdkGobSetPosition(dummy2, "l1_r1dummy2")
        dummy2.OnDamage = Level.r1DummyOnDamage
        dummy2.OnAnimLoop = Level.r1DummyOnAnimLoop

        --show the arrows
        omGobExitStasis(l1_r1arwgob06)
        l1_r1arwgob06.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
        omAnimPlay(l1_r1arwgob06, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        omGobExitStasis(l1_r1arwgob07)
        l1_r1arwgob07.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
        omAnimPlay(l1_r1arwgob07, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        
    end
    l1_r1.TutFuncs["state 4"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 4"].EndState = function(gob)
        omAnimPlay(l1_r1arwgob06, ANIM_DIE, 0)
        omAnimPlay(l1_r1arwgob07, ANIM_DIE, 0)
        l1_r1.statename = "state 5"
    end
   
    --=================state 5=======================--
   
    l1_r1.TutFuncs["state 5"]={}
    l1_r1.TutFuncs["state 5"].tasks = 0
    l1_r1.TutFuncs["state 5"].statetasks = 2
    l1_r1.TutFuncs["state 5"].InitState = function(gob)
        
        mdkSetLuaEvent(mdkGetPlayerGob(), "OnShotExploded", Level.r1BobboOnShotExploded)
        
        l1_r1.scriptrunning = 1
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut8.wav",0 } },
        { mdkDialogPanel, {strings.l1tut_dr21, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP}},
        { mdkDialogIsDone, {}},
        { function(gob) l1_r1.scriptrunning=nil, l1_r1.TaskInc("state 5") end, {} },
        })

        l1_r1.grenades = mdkCreateObjectLua("grenades", OBJ_GRENADEITEM, mdkGetScene(), gob, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )    
        l1_r1.grenades.OnPickedUp = Level.r1SGOnPickedUp
        mdkGobSetPosition(l1_r1.grenades,"l1_r1grengen")
        omGobExitStasis(l1_r1arwgob09)
        omAnimPlay(l1_r1arwgob09, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1arwgob09.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
      --  God(1)

    end 
    l1_r1.TutFuncs["state 5"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 5"].EndState = function(gob)
        l1_r1.statename = "state 6"
    end


    --=================state 6=======================--
    --state 6, kurt picked up grenades, tell him to throw em, wait for him to finish

    l1_r1.TutFuncs["state 6"]={}
    l1_r1.TutFuncs["state 6"].tasks = 0
    l1_r1.TutFuncs["state 6"].statetasks = 2
    l1_r1.TutFuncs["state 6"].InitState = function(gob)
        
        
        l1_r1.scriptrunning = 1
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut9.wav",0 } },
        { mdkDialogPanel, {strings.l1tut_dr22, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP}},
        { mdkDialogIsDone, {}},
        { function(gob) l1_r1.scriptrunning=nil, l1_r1.TaskInc("state 6") end, {} },
        })

    end 
    l1_r1.TutFuncs["state 6"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 6"].EndState = function(gob)
        l1_r1.statename = "state 7"
    end

    --=================state 7=======================--
    --state 7, doctors 3rd batch of text
        
    l1_r1.TutFuncs["state 7"]={}
    l1_r1.TutFuncs["state 7"].tasks = 0
    l1_r1.TutFuncs["state 7"].statetasks = 1
    l1_r1.TutFuncs["state 7"].InitState = function(gob)
        l1_r1.scriptrunning =1
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut10.wav",0 } },
        { mdkDialogPanel, { strings.l1tut_dr7, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
        { mdkDialogIsDone,  {} },
        { function(gob) l1_r1.TaskInc("state 7") l1_r1.scriptrunning=nil end, {} }
        })
    
    end 
    l1_r1.TutFuncs["state 7"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 7"].EndState = function(gob)
  --      God(0)
        l1_r1.statename = "state 8"
    end

    --=================state 8=======================--
    --state 8, tell kurt to jump to platform, show first platform and arrow
        
    l1_r1.TutFuncs["state 8"]={}
    l1_r1.TutFuncs["state 8"].tasks = 0
    l1_r1.TutFuncs["state 8"].statetasks = 1
    l1_r1.TutFuncs["state 8"].InitState = function(gob)
        
        l1_r1.scriptrunning =1
        
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut11.wav",0 } },
        { mdkDialogPanel, { strings.l1tut_dr8, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
        { mdkDialogIsDone,  {} },
        { function(gob) l1_r1.TaskInc("state 8") l1_r1.scriptrunning=nil end, {} }
        })
    
        l1_r1.SetPlatnArrow(l1_r1plat01,l1_r1arwgob01,"state 8")

    end 
    l1_r1.TutFuncs["state 8"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 8"].EndState = function(gob)
        --omGobSetTimer(l1_r1, 5)
        l1_r1.statename = "state 8b"
    end

    --=================state 8b=======================--
    --state 8b, wait to go to next state until player is on platform
    l1_r1.TutFuncs["state 8b"]={}
    l1_r1.TutFuncs["state 8b"].tasks = 0
    l1_r1.TutFuncs["state 8b"].statetasks = 1
    l1_r1.TutFuncs["state 8b"].InitState = function(gob)
        --no init        
    end 
    l1_r1.TutFuncs["state 8b"].Update = function(gob)
        
        if(l1_r1plat01.playeron) then
            --omGobSetTimer(l1_r1,0)
            l1_r1.TaskInc("state 8b")
        end

    end    
    l1_r1.TutFuncs["state 8b"].EndState = function(gob)
        omAnimPlay(l1_r1arwgob01, ANIM_DIE, ANIMFLAG_NOTRANS+ANIMFLAG_NOREWIND)
        l1_r1arwgob01.done=1
        l1_r1.statename = "state 9"
    end
    
    --=================state 9=======================--
        --state 9, play doc dialog, show next platform and arrow, wait
    l1_r1.TutFuncs["state 9"]={}
    l1_r1.TutFuncs["state 9"].tasks = 0
    l1_r1.TutFuncs["state 9"].statetasks = 1
    l1_r1.TutFuncs["state 9"].InitState = function(gob)
        
        l1_r1.scriptrunning =1
        
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut12.wav",0 } },
        { mdkDialogPanel, { strings.l1tut_dr9, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
        { mdkDialogIsDone,  {} },
        { function(gob) l1_r1.TaskInc("state 9") l1_r1.scriptrunning=nil end, {} }
        })
    
        l1_r1.SetPlatnArrow(l1_r1plat02,l1_r1arwgob02,"state 9")
    end 
    l1_r1.TutFuncs["state 9"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 9"].EndState = function(gob)
        --omGobSetTimer(l1_r1, 5)
        l1_r1.statename = "state 9b"
    end

    --=================state 9b=======================--
    --state 9b, wait to go to next state until player is on platform
    l1_r1.TutFuncs["state 9b"]={}
    l1_r1.TutFuncs["state 9b"].tasks = 0
    l1_r1.TutFuncs["state 9b"].statetasks = 1
    l1_r1.TutFuncs["state 9b"].InitState = function(gob)
        --no init        
    end 
    l1_r1.TutFuncs["state 9b"].Update = function(gob)
        
        if(l1_r1plat02.playeron) then
            --omGobSetTimer(l1_r1,0)
            l1_r1.TaskInc("state 9b")
        end

    end    
    l1_r1.TutFuncs["state 9b"].EndState = function(gob)
        omAnimPlay(l1_r1arwgob02, ANIM_DIE, ANIMFLAG_NOTRANS+ANIMFLAG_NOREWIND)
        l1_r1arwgob02.done=1
        l1_r1.statename = "state 10"
    end

    --=================state 10=======================--
        --state 10, play doc dialog, show next platform and arrow
    l1_r1.TutFuncs["state 10"]={}
    l1_r1.TutFuncs["state 10"].tasks = 0
    l1_r1.TutFuncs["state 10"].statetasks = 1
    l1_r1.TutFuncs["state 10"].InitState = function(gob)
        l1_r1.scriptrunning =1
        
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut13.wav",0 } },
        { mdkDialogPanel, { strings.l1tut_dr10, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
        { mdkDialogIsDone,  {} },
        { function(gob) l1_r1.TaskInc("state 10") l1_r1.scriptrunning=nil end, {} }
        })
    
        l1_r1.SetPlatnArrow(l1_r1plat03,l1_r1arwgob03,"state 10")

    end 
    l1_r1.TutFuncs["state 10"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 10"].EndState = function(gob)
        --omGobSetTimer(l1_r1, 5)
        l1_r1.statename = "state 10b"
    end

    --=================state 10b=======================--
    --state 10b, wait to go to next state until player is on platform
    l1_r1.TutFuncs["state 10b"]={}
    l1_r1.TutFuncs["state 10b"].tasks = 0
    l1_r1.TutFuncs["state 10b"].statetasks = 1
    l1_r1.TutFuncs["state 10b"].InitState = function(gob)
        --no init        
    end 
    l1_r1.TutFuncs["state 10b"].Update = function(gob)
        
        if(l1_r1plat03.playeron) then
            --omGobSetTimer(l1_r1,0)
            l1_r1.TaskInc("state 10b")
        end

    end    
    l1_r1.TutFuncs["state 10b"].EndState = function(gob)
        omAnimPlay(l1_r1arwgob03, ANIM_DIE, ANIMFLAG_NOTRANS+ANIMFLAG_NOREWIND)
        l1_r1arwgob03.done=1
        l1_r1.statename = "state 11"
    end

    --=================state 11=======================--
        --state 11, play doc dialog, show last platform and arrow
    l1_r1.TutFuncs["state 11"]={}
    l1_r1.TutFuncs["state 11"].tasks = 0
    l1_r1.TutFuncs["state 11"].statetasks = 1
    l1_r1.TutFuncs["state 11"].InitState = function(gob)
        l1_r1.scriptrunning =1
        
        StartGlobalScript(l1_r1, {
        { mdkPreloadRes, { "l1_tut14.wav",0 } },
        { mdkDialogPanel, { strings.l1tut_dr11, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
        { mdkDialogIsDone,  {} },
        { function(gob) l1_r1.TaskInc("state 11") l1_r1.scriptrunning=nil end, {} }
        })
    
        l1_r1.SetPlatnArrow(l1_r1plat04,l1_r1arwgob04,"state 11")
    end 
    l1_r1.TutFuncs["state 11"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 11"].EndState = function(gob)
        --omGobSetTimer(l1_r1, 5)
        l1_r1.statename = "state 11b"
    end

    --=================state 11b=======================--
    --state 11b, wait to go to next state until player is on platform
    l1_r1.TutFuncs["state 11b"]={}
    l1_r1.TutFuncs["state 11b"].tasks = 0
    l1_r1.TutFuncs["state 11b"].statetasks = 1
    l1_r1.TutFuncs["state 11b"].InitState = function(gob)
        --no init        
    end 
    l1_r1.TutFuncs["state 11b"].Update = function(gob)
        
        if(l1_r1plat04.playeron) then
            --omGobSetTimer(l1_r1,0)
            l1_r1.TaskInc("state 11b")
        end

    end    
    l1_r1.TutFuncs["state 11b"].EndState = function(gob)
        omAnimPlay(l1_r1arwgob04, ANIM_DIE, ANIMFLAG_NOTRANS+ANIMFLAG_NOREWIND)
        l1_r1arwgob04.done=1
        l1_r1.statename = "state 13"
        l1_r1.PlatDie(l1_r1plat01)
        l1_r1.PlatDie(l1_r1plat02)
        l1_r1.PlatDie(l1_r1plat03)
        l1_r1.PlatDie(l1_r1plat04)
    end

    --=================state 12=======================--
    --state 12, play doc dialog, wait till done, move on to next step
    l1_r1.TutFuncs["state 12"]={}
    l1_r1.TutFuncs["state 12"].tasks = 0
    l1_r1.TutFuncs["state 12"].statetasks = 1
    l1_r1.TutFuncs["state 12"].InitState = function(gob)

    end 
    l1_r1.TutFuncs["state 12"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 12"].EndState = function(gob)
    end

    --=================state 13=======================--
        --state 13, kill small platforms, show big one, turn on fan, show arrow
    l1_r1.TutFuncs["state 13"]={}
    l1_r1.TutFuncs["state 13"].tasks = 0
    l1_r1.TutFuncs["state 13"].statetasks = 1
    l1_r1.TutFuncs["state 13"].InitState = function(gob)
        
        omGobExitStasis(l1_r1fan)
        omGobExitStasis(l1_r1platbig)
        omAnimPlay(l1_r1platbig, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1platbig.OnCollision = Level.l1r1PlatOnCollision
        omAnimPlay(l1_r1fancover, ANIM_SPAWN, 0)
         
        l1_r1.snipergrenade = mdkCreateObjectLua("snipergrenade", OBJ_SNIPERGRENADEITEM, mdkGetScene(), gob, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )    
        l1_r1.snipergrenade.OnPickedUp = Level.r1SGOnPickedUp
        mdkGobSetPosition(l1_r1.snipergrenade,"l1_r1snpgrngen")

         
        l1_r1.scriptrunning =1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut16.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr12, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 13") l1_r1.scriptrunning=nil end, {} }
            })

    end 
    l1_r1.TutFuncs["state 13"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 13"].EndState = function(gob)
        l1_r1.statename = "state 14"
    end

    --=================state 14=======================--
        --state 14, wait for player to get near the fan
    l1_r1.TutFuncs["state 14"]={}
    l1_r1.TutFuncs["state 14"].tasks = 0
    l1_r1.TutFuncs["state 14"].statetasks = 1
    l1_r1.TutFuncs["state 14"].InitState = function(gob)
        l1_r1.taskdone=nil
    end 
    l1_r1.TutFuncs["state 14"].Update = function(gob)

        if(l1_r1.taskdone) then return end
        if(mdkGobDistance(l1_r1fan, mdkGetPlayerGob())<=6) then
            omGobExitStasis(l1_r1arwgob08)
            l1_r1platbig.arrow=l1_r1arwgob08
            omAnimPlay(l1_r1arwgob08, ANIM_SPAWN, ANIMFLAG_NOTRANS)
            mdkSetLuaEvent(l1_r1arwgob08, "OnAnimLoop", Level.l1r1ArrowOnAnimLoop)
            --l1_r1arwgob08.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
            mdkBlowerEnable(l1_r1fan)
            l1_r1.TaskInc("state 14")
            l1_r1.taskdone = 1
        end

    end    
    l1_r1.TutFuncs["state 14"].EndState = function(gob)
        l1_r1.statename = "state 14b"
        omGobExitStasis(l1_r1arwgob10)
        omAnimPlay(l1_r1arwgob10, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1arwgob10.OnAnimLoop = Level.l1r1ArrowOnAnimLoop

    end

    --=================state 14b=======================--
    --state 14b, wait for player to jump, getting out of radius of fan
    l1_r1.TutFuncs["state 14b"]={}
    l1_r1.TutFuncs["state 14b"].tasks = 0
    l1_r1.TutFuncs["state 14b"].statetasks = 1
    l1_r1.TutFuncs["state 14b"].InitState = function(gob)

        l1_r1.taskdone=nil

    end 
    l1_r1.TutFuncs["state 14b"].Update = function(gob)
  
        if(l1_r1.taskdone) then return end
        if(mdkGobDistance(l1_r1fan, mdkGetPlayerGob())>6) then
            l1_r1.TaskInc("state 14b")
            l1_r1.taskdone = 1
        end

    end    
    l1_r1.TutFuncs["state 14b"].EndState = function(gob)
        l1_r1.statename = "state 14c"
    end

    --=================state 14c=======================--
        --state 14c, play doc dialog, then wait for plat hit
    l1_r1.TutFuncs["state 14c"]={}
    l1_r1.TutFuncs["state 14c"].tasks = 0
    l1_r1.TutFuncs["state 14c"].statetasks = 2
    l1_r1.TutFuncs["state 14c"].InitState = function(gob)

        l1_r1.taskdone=nil
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut17.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr14, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 14c") l1_r1.scriptrunning=nil end, {} }
            })
    end 
    l1_r1.TutFuncs["state 14c"].Update = function(gob)

        if((l1_r1platbig.playeron==1) and (not l1_r1.taskdone)) then
            l1_r1.TaskInc("state 14c")
            omAnimPlay(l1_r1arwgob08, ANIM_DIE, ANIMFLAG_NOTRANS)
            l1_r1.taskdone=1
        end

    end    
    l1_r1.TutFuncs["state 14c"].EndState = function(gob)
        l1_r1.statename = "state 15"
    end

    --=================state 15=======================--
    --state 15, player is on large platform, play dialog, wait for item pickup 
    l1_r1.TutFuncs["state 15"]={}
    l1_r1.TutFuncs["state 15"].tasks = 0
    l1_r1.TutFuncs["state 15"].statetasks = 2
    l1_r1.TutFuncs["state 15"].InitState = function(gob)
        

        l1_r1.scriptrunning =1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut18.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr15, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 15") l1_r1.scriptrunning=nil end, {} }
            })

    end 
    l1_r1.TutFuncs["state 15"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 15"].EndState = function(gob)
        l1_r1.statename = "state 16"
    end

    --=================state 16=======================--
    --state 16, play 2 doc dialogs, move on
    l1_r1.TutFuncs["state 16"]={}
    l1_r1.TutFuncs["state 16"].tasks = 0
    l1_r1.TutFuncs["state 16"].statetasks = 3
    l1_r1.TutFuncs["state 16"].InitState = function(gob)
        

        l1_r1.taskdone = nil
        omGobExitStasis(l1_r1arwgob05)
        omAnimPlay(l1_r1arwgob05, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1arwgob05.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
    
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut19.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr16, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 16") l1_r1.scriptrunning=nil end, {} }
            })
    end 
    l1_r1.TutFuncs["state 16"].Update = function(gob)

        if((mdkGobDistance(l1_r1arwgob05, mdkGetPlayerGob()) < 4) and (not l1_r1.taskdone)) then
            l1_r1.TaskInc("state 16")
            l1_r1.taskdone=1
            omAnimPlay(l1_r1arwgob05, ANIM_DIE, ANIMFLAG_NOTRANS)
        
        end

    end    
    l1_r1.TutFuncs["state 16"].EndState = function(gob)
        mdkSetLuaEvent(l1_r1, "OnModeSwitch", nil)
        l1_r1.statename = "state 16b"
    end
    
    --=================state 16b=======================--
    --state 16b, play  doc dialogs, move on
    l1_r1.TutFuncs["state 16b"]={}
    l1_r1.TutFuncs["state 16b"].tasks = 0
    l1_r1.TutFuncs["state 16b"].statetasks = 1
    l1_r1.TutFuncs["state 16b"].InitState = function(gob)
        
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut20.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr17, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 16b") l1_r1.scriptrunning=nil end, {} }
            })
    end 
    l1_r1.TutFuncs["state 16b"].Update = function(gob)

    end    
    l1_r1.TutFuncs["state 16b"].EndState = function(gob)
        l1_r1.statename = "state 17"
    end
    --=================state 17=======================--
   
    l1_r1.TutFuncs["state 17"]={}
    l1_r1.TutFuncs["state 17"].tasks = 0
    l1_r1.TutFuncs["state 17"].statetasks = 1
    l1_r1.TutFuncs["state 17"].InitState = function(gob)
        
        
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut21.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr18, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 17") l1_r1.scriptrunning = nil end, {} }
            })

    end 
    l1_r1.TutFuncs["state 17"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 17"].EndState = function(gob)
        l1_r1.statename = "state 18"
    end
    
    --=================state 18=======================--
    --state 18, player must snipe both new targets after they appear
    l1_r1.TutFuncs["state 18"]={}
    l1_r1.TutFuncs["state 18"].tasks = 0
    l1_r1.TutFuncs["state 18"].statetasks = 2
    l1_r1.TutFuncs["state 18"].InitState = function(gob)
        
        omGobExitStasis(l1_r1snphit01)
        omAnimPlay(l1_r1snphit01, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1snphit01.OnDamage=l1_r1.SmallTargetOnDamage
        l1_r1snphit01.OnAnimLoop= l1_r1.TGTOnAnimLoop
        omGobExitStasis(l1_r1snphit02)
        omAnimPlay(l1_r1snphit02, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1snphit02.OnDamage=l1_r1.SmallTargetOnDamage
        l1_r1snphit02.OnAnimLoop= l1_r1.TGTOnAnimLoop

    end 
    l1_r1.TutFuncs["state 18"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 18"].EndState = function(gob)
        l1_r1.statename = "state 19"
    end

    --=================state 19=======================--
    --state 19, player must hit big target
    l1_r1.TutFuncs["state 19"]={}
    l1_r1.TutFuncs["state 19"].tasks = 0
    l1_r1.TutFuncs["state 19"].statetasks = 2
    l1_r1.TutFuncs["state 19"].InitState = function(gob)
        l1_r1.statetasks = 1
        l1_r1.scriptrunning=1
        StartGlobalScript(l1_r1, {
            { mdkPreloadRes, { "l1_tut22.wav",0 } },
            { mdkDialogPanel, { strings.l1tut_dr19, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP } },
            { mdkDialogIsDone,  {} },
            { function(gob) l1_r1.TaskInc("state 19") l1_r1.scriptrunning = nil end, {} }
            })

        omGobExitStasis(l1_r1snpghit01)
        omAnimPlay(l1_r1snpghit01, ANIM_SPAWN, ANIMFLAG_NOTRANS)
        l1_r1snpghit01.OnDamage= l1_r1.SGTargetOnDamage
        l1_r1snpghit01.OnAnimLoop= l1_r1.TGTOnAnimLoop

    end 
    l1_r1.TutFuncs["state 19"].Update = function(gob)
        --no update needed
    end    
    l1_r1.TutFuncs["state 19"].EndState = function(gob)
        l1_r1.statename = "state 20"
    end

    --=================state 20=======================--
    --state 20, play last dialog, DONE!
    l1_r1.TutFuncs["state 20"]={}
    l1_r1.TutFuncs["state 20"].tasks = 0
    l1_r1.TutFuncs["state 20"].statetasks = 1
    l1_r1.TutFuncs["state 20"].InitState = function(gob)
        
        omGobSetTimer(l1_r1, 1.5)
        l1_r1.timerstate = 20
        chSndSwitchMusic(16)
        God(0)
        Save.intutorial = nil

    end
    l1_r1.TutFuncs["state 20"].Update = function(gob)
        --this is the last state, so basically the update will not do anything, and tasks won't be updated.
    end    
    l1_r1.TutFuncs["state 20"].EndState = function(gob)
        l1_r1.statename = "state 20"
    end


end

----------------------------------------------------

l1_r1.KillTutorial = function(gob)

    if(l1_r1.state==nil or l1_r1.state==26) then return end

    Save.intutorial = nil

    mdkDumpAllTempRes()

    chSndSwitchMusic(12)
    God(0)

    if(l1_r1.state>=2) then
        if(l1_r1arwgob00) then
            omAnimPlay(l1_r1arwgob00, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
    end
    if(l1_r1.state>=4) then
        --if(ch1) then mdkSetLuaEvent(l1_r1.ch1, "OnDie", nil) end
        --if(ch2) then mdkSetLuaEvent(l1_r1.ch2, "OnDie", nil) end
        if(l1_r1arwgob06) then
            omAnimPlay(l1_r1arwgob06, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        if(l1_r1arwgob07) then
            omAnimPlay(l1_r1arwgob07, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        if(dummy1) then
            mdkDecoyDeeeeeeeeeeeestroy(dummy1)
        end
        if(dummy2) then
            mdkDecoyDeeeeeeeeeeeestroy(dummy2)
        end

    end
    if(l1_r1.state>=5) then
        
        if(grenades) then
            omGobDelete(l1_r1.grenades)
            l1_r1.grenades = nil
        end

        mdkKurtRemoveItem(mdkGetPlayerGob(),OBJ_GRENADEITEM, 1)

        omAnimPlay(l1_r1arwgob09, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
    end

    if(l1_r1.state>=8) then
        l1_r1.PlatDie(l1_r1plat01)
        mdkSetLuaEvent(l1_r1plat01, "OnCollision", nil)
        if(l1_r1arwgob01) then
            omAnimPlay(l1_r1arwgob01, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        l1_r1arwgob01.done=1
    end
    if(l1_r1.state>=10) then
        l1_r1.PlatDie(l1_r1plat02)
        mdkSetLuaEvent(l1_r1plat02, "OnCollision", nil)
        if(l1_r1arwgob02) then
            omAnimPlay(l1_r1arwgob02, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        l1_r1arwgob02.done=1
    end
    if(l1_r1.state>=12) then
        l1_r1.PlatDie(l1_r1plat03)
        mdkSetLuaEvent(l1_r1plat03, "OnCollision", nil)
        if(l1_r1arwgob03) then
            omAnimPlay(l1_r1arwgob03, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        l1_r1arwgob03.done=1
    end
    if(l1_r1.state>=14) then
        l1_r1.PlatDie(l1_r1plat04)
        mdkSetLuaEvent(l1_r1plat04, "OnCollision", nil)
        if(l1_r1arwgob04) then
            omAnimPlay(l1_r1arwgob04, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        l1_r1arwgob04.done=1
    end
    if(l1_r1.state>=17) then
        l1_r1.PlatDie(l1_r1platbig)
        --omAnimPlay(l1_r1platbig, ANIM_DIE, 0)
        mdkSetLuaEvent(l1_r1platbig, "OnCollision", nil)
        if(l1_r1arwgob08) then
            omAnimPlay(l1_r1arwgob08, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        if(l1_r1arwgob10) then
            omAnimPlay(l1_r1arwgob10, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        if(snipergrenade) then
            omGobDelete(l1_r1.snipergrenade)
            l1_r1.snipergrenade = nil
        end

    end
    if(l1_r1.state>=18) then
        mdkBlowerDisable(l1_r1fan)
    end
    if(l1_r1.state>=21) then 
        if(l1_r1arwgob05) then
            omAnimPlay(l1_r1arwgob05, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end

    end
    if(l1_r1.state>=24) then
        if(l1_r1snphit01) then
            omAnimPlay(l1_r1snphit01, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        mdkSetLuaEvent(l1_r1snphit01, "OnDamage", nil)
        if(l1_r1snphit02) then
            omAnimPlay(l1_r1snphit02, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        mdkSetLuaEvent(l1_r1snphit02, "OnDamage", nil)
    end
    if(l1_r1.state>=25) then
        if(l1_r1snpghit01) then
            omAnimPlay(l1_r1snpghit01, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
        end
        mdkSetLuaEvent(l1_r1snpghit01, "OnDamage", nil)
    end
    
    mdkSetLuaEvent(l1_r1, "OnUpdate", nil)
    mdkSetLuaEvent(mdkGetPlayerGob(), "OnOutOfAmmo", nil)

    if(l1_r1.scriptrunning) then
        StopScript(l1_r1)
    end
    l1_r1.state=25
    
end

----------------------------------------------------

l1_r1.OnEnterRoom = function(gob)


end

----------------------------------------------------

l1_r1.OnTimer = function(gob)

    
    if(l1_r1.timerstate==0) then
        l1_r1.TaskInc("state 0")
        if(l1_r1.state~=25) then
            God(1)
        end

 --   elseif(l1_r1.timerstate==1) then
--        l1_r1.holdstate=1

--        l1_r1.scriptrunning=1
--        StartGlobalScript(l1_r1, {
--        { mdkDialogPanel, { strings.l1tut_dr23, DIALOGPORTRAIT_DOCTOR, 4, DIALOGFLAG_TOP } },
--        { mdkDialogIsDone,  {} },
--        { function(gob) l1_r1.holdstate=nil l1_r1.scriptrunning = nil end, {} }
--        })
--        --omGobSetTimer(l1_r1, 14)

    elseif( l1_r1.timerstate==2) then
        l1_r1.TaskInc("state 5")
    elseif(l1_r1.timerstate == 3) then
        l1_r1.TaskInc("state 6")
    elseif(l1_r1.timerstate == 20) then
        mdkDialogPanel(strings.l1tut_dr20, DIALOGPORTRAIT_DOCTOR, 8, DIALOGFLAG_TOP)
    end

end


----------------------------------------------------

l1_r1.PlatDie = function(gob)

    if((not gob.playeron) and gob) then 
        omAnimPlay(gob, ANIM_DIE, ANIMFLAG_NOTRANS + ANIMFLAG_NOREWIND)
    else gob.die=1
    end

end

----------------------------------------------------

l1_r1.PutTutorialInStasis = function(gob)
    omGobEnterStasis(l1_r1platbig)
    omGobEnterStasis(l1_r1arwgob00)
    omGobEnterStasis(l1_r1plat01)
    omGobEnterStasis(l1_r1arwgob01)
    omGobEnterStasis(l1_r1plat02)
    omGobEnterStasis(l1_r1arwgob02)
    omGobEnterStasis(l1_r1plat03)
    omGobEnterStasis(l1_r1arwgob03)
    omGobEnterStasis(l1_r1plat04)
    omGobEnterStasis(l1_r1arwgob04)
    omGobEnterStasis(l1_r1arwgob05)
    omGobEnterStasis(l1_r1snphit01)
    omGobEnterStasis(l1_r1snphit02)
    omGobEnterStasis(l1_r1snpghit01)
    mdkBlowerDisable(l1_r1fan)
    omGobEnterStasis(l1_r1fan)
    omGobEnterStasis(l1_r1arwgob06)
    omGobEnterStasis(l1_r1arwgob07)
    omGobEnterStasis(l1_r1arwgob08)
    omGobEnterStasis(l1_r1arwgob09)
    omGobEnterStasis(l1_r1arwgob10)
end
----------------------------------------------------

l1_r1.SetPlatnArrow = function(plat, arrow, state)

    omGobExitStasis(plat)
    omAnimPlay(plat, ANIM_SPAWN, ANIMFLAG_NOTRANS)
    plat.OnCollision = Level.l1r1PlatOnCollision
    plat.OnAnimLoop = Level.l1r1PlatOnAnimLoop
    plat.statename=state
    
    omGobExitStasis(arrow)
    arrow.plat = plat
    omAnimPlay(arrow, ANIM_SPAWN, ANIMFLAG_NOTRANS)
    arrow.OnAnimLoop = Level.l1r1ArrowOnAnimLoop
    arrow.OnUpdate = Level.l1r1ArrowOnUpdate

end

----------------------------------------------------

l1_r1.SGTargetOnDamage = function(gob, shooter, damage, damagetype, part)
    
--    print(part)
--    print(damagetype)

    if (mdkIsDamageType( damagetype, DAMAGE_SNIPER ) == 1) and
       (mdkIsDamageType( damagetype, DAMAGE_AREA ) == 1) then

        omAnimPlay(gob, ANIM_DIE, 0)
        l1_r1.TaskInc("state 19")

    end


end

----------------------------------------------------

l1_r1.SmallTargetOnDamage = function(gob, shooter, damage, damagetype, part)

    --print("hit")
    --print(part)

    if (mdkIsDamageType( damagetype, DAMAGE_SNIPER ) == 1) and
       (part == "TARGET3_HIT") then

        omAnimPlay(gob, ANIM_DIE, 0)
        l1_r1.TaskInc("state 18")

    end

end

----------------------------------------------------

snipe1_01.OnDamage = function(gob, shooter, damage, damagetype, part)

    if(mdkIsDamageType(damagetype, DAMAGE_SNIPER)==1) then

        l1_r1.KillTutorial(l1_r1)
        if(dr2_01) then
            omAnimPlay(dr2_01, ANIM_OPEN, 0)
        end
        if(snipe1_01) then
            omAnimPlay(snipe1_01, ANIM_DISABLED, 0)
        end
        
    end
        
end

----------------------------------------------------

l1_r1.TaskInc = function(statename)
    
    l1_r1.TutFuncs[statename].tasks = l1_r1.TutFuncs[statename].tasks + 1
    --print(statename .. " increased to " .. l1_r1.TutFuncs[statename].tasks)
    
end

----------------------------------------------------

l1_r1.TGTOnAnimLoop = function(gob, animid)
    
    if(animid==ANIM_SPAWN) then 
        omAnimPlay(gob, ANIM_READY0,0)
    end

end

----------------------------------------------------

l1_r2.OnCreate = function(gob)

    --get sound for frame break
    if(not l1_r2.shattersound) then
        l1_r2.shattersound = omGobAddSound(l1_r2, "glass_break", 0)
    end


end

----------------------------------------------------

l1_r2.OnTimer = function(gob)

    local itemcount=0
    
    if(gob.timer==3) then
        --shatter all the pieces parented to l1_r2glassrim, 22 to be precise.
        --while (itemcount<23) do
            
        --    omGobGMShatter(l1_r2glassrim,itemcount,0,0,1,10,SHATTEROPTION_VECTOR)
        --    itemcount=itemcount+1

        --end
        --omGobGSPlay(l1_r2.shattersound, 0,0,0,0)
        omGobEnterStasis(l1_r2glassrim)
    elseif(gob.timer==2) then

        mdkKurtEnterNormalMode(mdkGetPlayerGob())
        omGobGMShatter(gob,omGobGMGetSltIndexByName(l1_r2,"l1_r2glass"), 0, 1, 0, 40, SHATTEROPTION_VECTOR, 2, 1)

        omAnimPlay(r2_dog01,ANIM_KNOCKDOWN,0)
        mdkWalkerAlert(r2_dog01, 0)
        omAnimPlay(l1_r2plate, ANIM_EXPLODE, 0)
        omGobSetTimer(l1_r2,0.5)
        gob.timer=3
        
    elseif(gob.timer==1) then   
        
        omAnimPlay(r2_dog01,ANIM_SCARED,0)
        omAnimSetStyle(r2_dog01, ANIM_SCARED, ANIMSTYLE_LOOP)
        omSceneShake(mdkGetScene(), 0.03, 3, 2, 'rumble1')
        omGobSetTimer(l1_r2,1.5)
        gob.timer=2

    end

end

----------------------------------------------------

r2_dog01.OnAnimLoop = function(gob, animid)
    -- play seductive wave animations --
    if (animid == ANIM_ACTION08 or animid == ANIM_ACTION09) then
        if (random() > 0.5) then
            omAnimPlay(gob, ANIM_ACTION08, 0)
        else
            omAnimPlay(gob, ANIM_ACTION09, 0)
        end
    elseif( animid == ANIM_KNOCKDOWN ) then

        r2_dog01.ai=1
        mdkGobSetTargetable(r2_dog01, 1)
        
            
    end
end
----------------------------------------------------

r2_dog01.OnCreate = function(gob)
    
    StopScript(gob)
    mdkGobSetTargetable(gob, 0)
    omAnimPlay(gob, ANIM_ACTION08, 0)

    local target = mdkCreateObjectLua("r2_dog01target", OBJ_SCENERY, scene, gob, "DOGGNBOY_TARGET", 0,0,0, 1,0,0,0, "target01",0,0,0,0 )

    target.OnDamage = Level.r2TargetOnDamage

    gob.ai = 0
end
----------------------------------------------------

r2_dog01.OnDamage = function(gob, shooter, damage, damagetype, part)
    if (gob.ai == 1) then
        mdkWalkerDefaultOnDamage(gob, shooter, damage, damagetype, part)
    end
end
----------------------------------------------------

r2_dog01.OnDie = function(gob)

    mdkProxDoorLock(dr1_02, 0)

end

----------------------------------------------------

r2_dog01.OnHear = function(gob, target, noise, x,y,z)
end
----------------------------------------------------

r2_dog01.OnTimer = function(gob)
end
----------------------------------------------------

r2_dog01.OnUpdate = function(gob)
    if(gob.ai==1) then
        mdkDoganboyAttack(gob)
        mdkWalkerAnimUpdate(gob)
    
    end
end
----------------------------------------------------

l1_r3spinners.OnAnimLoop = function(gob, animid)

    if(animid==ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_SPIN, 0)
    end

end

----------------------------------------------------

l1_r3spinners.OnUpdate = function(gob)

    local player = mdkGetPlayerGob()
    local dist = mdkGobDistance(gob, player)
    if(dist<=7 and (not gob.open)) then
        gob.open =1
        omAnimPlay(gob, ANIM_OPEN, 0)
    elseif((dist>7) and gob.open) then
        omAnimPlay(gob, ANIM_CLOSE, 0)
        gob.open=nil
    end

end
----------------------------------------------------

l1_r3.OnCreate = function(gob)

    omAnimPlay(l1_r3fan01, ANIM_ENABLED, 0)
    mdkSpawnerSetSpawnedObject(r3dogangen, OBJ_POOPSY, 'l1_r3centerwp', 47, 0.3, 15, 0, 0, l1_r3)

end

----------------------------------------------------

snipe1_04.OnDamage = function(gob, from, damage, damagetype, part)

    -- open the door if the lock is sniped --
    if ((mdkIsDamageType(damagetype,DAMAGE_SNIPER) == 1) and
        (omAnimIsPlaying(snipe1_04, ANIM_ENABLED) == 1)) then
        omAnimPlay(dr2_03, ANIM_OPEN, 0)
        omAnimPlay(snipe1_04, ANIM_DISABLED, 0)
    end
end
----------------------------------------------------

l1_r3secret.OnCreate = function(gob)

    --print("boxes created")
    
    l1_r3propbox01.itemspawnpoint = "l1_r3swp01"
    l1_r3propbox01.itemtype = OBJ_SNIPERGRENADEITEM
    l1_r3propbox01.OnDie = Level.r3secretBoxOnDie

    l1_r3propbox03.itemspawnpoint = "l1_r3swp03"
    l1_r3propbox03.itemtype = OBJ_CLOAK
    l1_r3propbox03.OnDie = Level.r3secretBoxOnDie

    l1_r3propbox04.itemspawnpoint = "l1_r3swp04"
    l1_r3propbox04.itemtype = OBJ_GRENADEITEM
    l1_r3propbox04.OnDie = Level.r3secretBoxOnDie

    l1_r3propbox05.itemspawnpoint = "l1_r3swp05"
    l1_r3propbox05.itemtype = OBJ_SNIPERGRENADEITEM
    l1_r3propbox05.OnDie = Level.r3secretBoxOnDie

    l1_r3propbox09.itemspawnpoint = "l1_r3swp09"
    l1_r3propbox09.itemtype = OBJ_GRENADEITEM
    l1_r3propbox09.OnDie = Level.r3secretBoxOnDie


end

----------------------------------------------------

doganboys07.OnDie = function(gob, crit)
    snipe1_02.deaddogs = snipe1_02.deaddogs + 1
    if (snipe1_02.deaddogs == 3) then
        omAnimPlay(snipe1_02, ANIM_ENABLED, 0)
    end
end
----------------------------------------------------

doganboys18.OnDie = function(gob, crit)
    snipe1_02.deaddogs = snipe1_02.deaddogs + 1
    if (snipe1_02.deaddogs == 3) then
        omAnimPlay(snipe1_02, ANIM_ENABLED, 0)
    end
end
----------------------------------------------------

l1_r4sod02.OnDie = function(gob, crit)

    snipe1_02.deaddogs = snipe1_02.deaddogs +1
    if (snipe1_02.deaddogs == 3) then
        omAnimPlay(snipe1_02, ANIM_ENABLED, 0)
    end

end

----------------------------------------------------

snipe1_02.OnCreate = function(gob)
    omAnimPlay(gob, ANIM_LOCK, 0)
    gob.deaddogs = 0
end
----------------------------------------------------

snipe1_02.OnDamage = function(gob, from, damage, damagetype, part)
    -- open the door if the lock is sniped --
    if ((mdkIsDamageType(damagetype,DAMAGE_SNIPER)==1) and
        (omAnimIsPlaying(snipe1_02, ANIM_ENABLED) == 1)) then
        omAnimPlay(dr2_02, ANIM_OPEN, 0)
        omAnimPlay(snipe1_02, ANIM_DISABLED, 0)
    end
end
----------------------------------------------------

dr1_04.OnUpdate = function(gob)
end
----------------------------------------------------

l1_r5bif01.Alert = function(gob)
    mdkWalkerAlert(gob,0)
    PauseScript(gob)
    gob.state = 1
end
----------------------------------------------------

l1_r5bif01.OnCreate = function(gob)
    mdkGobSetPosition(gob, "l1_r5wp2")
    StartScript(gob, {
        { mdkWalkerGotoPoint, { "l1_r5wp3", 0, 0, 0, 0 } },
        { mdkWalkerGotoPoint, { "l1_r5wp2", 0, 0, 0, 0 } },
        { mdkWalkerGotoPoint, { "l1_r5wp1", 0, 0, 0, 0 } },
        { mdkWalkerGotoPoint, { "l1_r5wp2", 0, 0, 0, 0 } },
        { LoopScript }
    })
    gob.state = 0
    -- 0 = patrolling
    -- 1 = attacking
end
----------------------------------------------------

l1_r5bif01.OnHear = function(gob, noise, x,y,z)
    if (l1_r5bif01 and l1_r5bif01.state == 0) then
        l1_r5bif01:Alert()
    end
    if (l1_r5bif02 and l1_r5bif02.state == 0) then
        l1_r5bif02:Alert()
    end
end
----------------------------------------------------

l1_r5bif01.OnUpdate = function(gob)
    local target = mdkGetAITargetGob()
    if (gob.state == 0) then
        if (target and mdkWalkerCanSeeGob(gob, target)==1) then
            if (l1_r5bif01 and l1_r5bif01.state == 0) then
                l1_r5bif01:Alert()
            end
            if (l1_r5bif02 and l1_r5bif02.state == 0) then
                l1_r5bif02:Alert()
            end
        end
    elseif (gob.state == 1) then
        mdkDoganboyAttack(gob)
        if (target == nil) then
            ResumeScript(gob)
            gob.state = 0
        end
    end
    mdkWalkerAnimUpdate(gob)
end
----------------------------------------------------

l1_r5bif02.Alert = function(gob)
    StopScript(gob)
    StartScript(gob, {
        { mdkWalkerGotoPoint, { "l1_r5wp5", 1, 1,0,0 } },
        { mdkWalkerGotoPoint, { "l1_r5wp6", 1, 1,0,0 } },
        { mdkWalkerGotoPoint, { "l1_r5wp7", 1, 0,0,0 } },
        { mdkWalkerStop },
        { mdkWalkerHeadToPoint, { "l1_r5wp5" } },
        { Level.r5bif02StartTurret }
    })
    gob.state = 1
end
----------------------------------------------------

l1_r5bif02.OnCreate = function(gob)
    StartScript(gob, {
        { mdkWalkerGotoPoint, { "l1_r5wp5", 0, 0, 0, 0 } },
        { mdkWalkerGotoPoint, { "l1_r5wp4", 0, 0, 0, 0 } },
        { LoopScript }
    })
    gob.state = 0
end
----------------------------------------------------

l1_r5bif02.OnHear = function(gob, noise, x,y,z)
    if (l1_r5bif01 and l1_r5bif01.state == 0) then
        l1_r5bif01:Alert()
    end
    if (l1_r5bif02 and l1_r5bif02.state == 0) then
        l1_r5bif02:Alert()
    end
end



----------------------------------------------------

l1_r5bif02.OnUpdate = function(gob)
    if (gob.state == 0) then
        local target = mdkGetAITargetGob()
        if (target and mdkWalkerCanSeeGob(gob, target)==1) then
            if (l1_r5bif01 and l1_r5bif01.state == 0) then
                l1_r5bif01:Alert()
            end
            if (l1_r5bif02 and l1_r5bif02.state == 0) then
                l1_r5bif02:Alert()
            end
        end
    elseif (gob.state == 2) then
        mdkDoganboyAttack(gob)
    elseif (gob.state == 3) then
        mdkWalkerSetTurret(gob, 1)
        mdkDoganboyAttack(gob)
    end
    mdkWalkerAnimUpdate(gob)
end
----------------------------------------------------

snipe1_03.OnDamage = function(gob, from, damage, damagetype, part)

   -- open the door if the lock is sniped --
    if ((mdkIsDamageType(damagetype,DAMAGE_SNIPER) == 1) and
        (omAnimIsPlaying(snipe1_03, ANIM_ENABLED) == 1)) then
        omAnimPlay(dr1_04, ANIM_OPEN, 0)
        omAnimPlay(snipe1_03, ANIM_DISABLED, 0)
    end

end
----------------------------------------------------

fan1_01.OnAnimLoop = function(gob, animid)

    if ((animid == ANIM_ACTIVATE)) then
        mdkBlowerEnable(fan1_01)
        omAnimPlay(fan1_01,ANIM_ENABLED,0)
    elseif (animid==ANIM_ACTION01) then
        omAnimPlay(fan1_01, ANIM_ENABLED, 0)
    elseif (animid==ANIM_ACTION00) then
        omAnimPlay(fan1_01, ANIM_ACTION01, ANIMFLAG_OVERLAY)
    end
    
end
----------------------------------------------------

fan1_01.OnCreate = function(gob)
    mdkBlowerDisable(gob)
    omAnimPlay(gob,ANIM_DISABLED,0)
    omAnimPlay(gob,ANIM_ENABLED,0)
    omAnimPlay(gob,ANIM_DISABLED,0)
    
end
----------------------------------------------------

l1_r6.OnCreate = function(gob)

    r1_r8snipe01.OnDamage=Level.r6SniperLockOnDamage
    r1_r8snipe02.OnDamage=Level.r6SniperLockOnDamage
    r1_r8snipe03.OnDamage=Level.r6SniperLockOnDamage
    r1_r8snipe04.OnDamage=Level.r6SniperLockOnDamage
    r1_r8snipe05.OnDamage=Level.r6SniperLockOnDamage
    r1_r8snipe06.OnDamage=Level.r6SniperLockOnDamage


end
----------------------------------------------------

l1_r6.OnUpdate = function(gob)

    -- start fan activation cutscene --
    if (l1_r6.lockssniped) and (not l1_r6.playing) then
        if (l1_r6.lockssniped >= 6) and (mdkIsCutSceneAllowed() == 1) then
            l1_r6.StartCutScene()
            l1_r6.playing = 1
        end
    end

end
----------------------------------------------------

l1_r7.OnCreate = function(gob)

    -- place the first mortars in the room, set stuff needed
    local player = mdkGetPlayerGob()

    if(player) then 
        mdkSetLuaEvent(player, "OnOutOfAmmo", Level.r7BobOutOfAmmo)
        mdkSetLuaEvent(player, "OnShotExploded",Level.BobOnShotExploded)
    end



    l1_r7.SpawnPoint = "l1_r7mortar01"
    
    l1_r7.SpawnMeSomeMortars(gob)

    omAnimPlay(fan1_12, ANIM_ENABLED, 0)
end

----------------------------------------------------

l1_r7.OnEnterRoom = function(gob)
    gob.hinttime = 75
end
----------------------------------------------------

l1_r7.OnTimer = function(gob)

    l1_r7.SpawnMeSomeMortars(gob)

end

----------------------------------------------------

l1_r7.OnUpdate = function(gob)
    if (gob.hinttime) then
        gob.hinttime = gob.hinttime - chGetDeltaT()
        if (gob.hinttime <= 0) then
            mdkZoomMessage(605)
            gob.hinttime = 75
        end
    end
end

----------------------------------------------------

l1_r7.SpawnMeSomeMortars = function(gob)

    if(l1_r7.domesalldead) then return end

    if(l1_r7.mortarsexist and (l1_r7.mortars.spawnedat~=l1_r7.SpawnPoint) ) then 
        --CRUSH KILL DESTROY
        omGobDelete(l1_r7.mortars)
        l1_r7.mortars = nil
        --print("killed mortars on other platform")
    elseif( l1_r7.mortarsexist ) then
        --print("mortars already exist on your platform fool")
        return 
    end

    
    --create and place mortars
    l1_r7.mortars = mdkCreateObjectLua("mortars", OBJ_SNIPERMORTARITEM, mdkGetScene(), gob, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )    
    mdkGobSetPosition(l1_r7.mortars,l1_r7.SpawnPoint)
    l1_r7.mortars.OnPickedUp = Level.l1r7MortarsOnPickedUp
    l1_r7.mortarsexist = 1
    l1_r7.mortars.spawnedat=l1_r7.SpawnPoint
    --print("mortars created on your platform")

end
----------------------------------------------------

l1_r8gen1.OnDamage = function(gob)
end

----------------------------------------------------

l1_r8gen2.OnDamage = function(gob)
end

----------------------------------------------------

l1_r8snipe1.OnDamage = function(gob, from, damage, damagetype, part)
    --omGobDelete(l1_r8snipe1)
    --omGobDelete(l1_r8gen1)
    omAnimPlay(l1_r8snipe1, ANIM_DISABLED, 0)
    mdkSpawnerShutOff(l1_r8gen1)
    gob.ttl = 1
    gob.spawner = l1_r8gen1
    mdkSetLuaEvent(gob, "OnUpdate", Level.r8GenDieOnUpdate)
end

----------------------------------------------------

l1_r8snipe2.OnDamage = function(gob, from, damage, damagetype, part)
    omAnimPlay(l1_r8snipe2, ANIM_DISABLED, 0)
    mdkSpawnerShutOff(l1_r8gen2)
    gob.ttl = 1
    gob.spawner = l1_r8gen2
    mdkSetLuaEvent(gob, "OnUpdate", Level.r8GenDieOnUpdate)
end
----------------------------------------------------

l1_r8proxent.OnAnimLoop = function(gob, animid)

    if( animid == ANIM_CLOSE) then
        omAnimPlay(gob, ANIM_READY0, 0)
    end

end

----------------------------------------------------

l1_r8.OnTimer = function(gob)

    if (gob.state == 1) then

        -- start the ship opening cutscene on the next update --
        gob.startopening = 1

    elseif (gob.state == 2) then

    elseif (gob.state == 3) then
        omGobSetTimer(l1_r8, .01)
	gob.state=4

    elseif (gob.state == 4) then
	gob.state=5
        -- play end movie --
	if (not l1_r8.playedmovie) then
	    l1_r8.playedmovie=1
            Level.PlayDeathMovie()
	end

    end
    
end

Level.PlayEndMovie = function()

    if (ml1z_camera == nil) then return end

    mdkSaveMovie(1,"z")

    StartMovie(mdkGetCameraGob(), {

        -- switch to movie mode --
        { chSndSwitchMusic, {-1} },
        { omGobExitStasis,  { ml1z_camera } },
        { omGobExitStasis,  { ml1z_kurmovegob } },
        { omGobExitStasis,  { ml1z_shwang} },
        { omGobExitStasis,  { ml1z_stuntkurt } },
        
        { omGobEnterStasis, { l1r8ham01 } },
        { omGobEnterStasis, { l1r8ham02 } },


        { PlayerEnterStasis },
        { mdkDisableDefaultCamera, {} },
        { mdkDisableGui,    {} },

        -- cut 1 --
        { mdkPreloadRes,    { "ml1z_kurt1.wav", 0} },
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION00, ANIMFLAG_NOTRANS } },
        { omSceneFade,      { mdkGetScene() , 0, 0, 0, 1, 0.5, 0, 1 } },
        { omAnimPlay,       { ml1z_kurmovegob, ANIM_ACTION00, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_ACTION03, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { ml1z_stuntkurt,   ANIM_ACTION03 } },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_READY0, 0 } },
        { omAnimJustLooped, { ml1z_camera, ANIM_ACTION00 } },

        -- cut 2--
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_kurmovegob, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_ACTION04, 0 } },
        { omAnimJustLooped, { ml1z_stuntkurt,   ANIM_ACTION04 } },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_ACTION06, 0 } },
        { mdkPreloadRes,    { "ml1z_dr1.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_kurt1, DIALOGPORTRAIT_KURT, 3, DIALOGFLAG_BOTTOM } },
        { mdkDialogIsDone,  {} },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_ACTION24, 0 } },
        { mdkPreloadRes,    { "ml1z_kurt2.wav", 0} },
        { mdkPreloadRes,    { "ml1z_dr2.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_dr1, DIALOGPORTRAIT_DOCTOR, 7.3, DIALOGFLAG_TOP } },
        { mdkDialogIsDone,  {} },

        -- cut 3 --
        { omGobEnterStasis, { l1_r8canopy } },
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION02, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_kurmovegob, ANIM_ACTION02, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_ACTION05, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_shwang, ANIM_ACTION00, 0 } },
        { mdkDialogPanel,   { strings.ml1z_kurt2, DIALOGPORTRAIT_KURT, 0.7, DIALOGFLAG_BOTTOM } },
        { mdkDialogIsDone,  {} },
        { mdkPreloadRes,    { "ml1z_kurt3.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_dr2, DIALOGPORTRAIT_DOCTOR, 7.6, DIALOGFLAG_TOP } },
        { omAnimJustLooped, { ml1z_shwang, ANIM_ACTION00 } },
        { omGobExitStasis,  { l1_r8canopy } },

        -- cut 4 --
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION03, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_kurmovegob, ANIM_ACTION03, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_stuntkurt, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1z_dr3.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_kurt3, DIALOGPORTRAIT_KURT, 1.8, DIALOGFLAG_BOTTOM } },
        { omAnimPlay,       { ml1z_shwang, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  {} },
        { omAnimPlay,       { ml1z_stuntkurt, ANIM_ACTION05, 0 } },
        { mdkPreloadRes,    { "ml1z_kurt4.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_dr3, DIALOGPORTRAIT_DOCTOR, 5.5, DIALOGFLAG_TOP } },
        { omAnimJustLooped, { ml1z_shwang, ANIM_ACTION01 } },

        -- cut 5 --
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION04, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_stuntkurt, ANIM_ACTION06, 0 } },    
        { mdkDialogIsDone,  {} },
        { mdkPreloadRes,    { "ml1z_dr4.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_kurt4, DIALOGPORTRAIT_KURT, 1.8, DIALOGFLAG_BOTTOM } },
        { Wait,             { ml1z_camera, 1 } },
        { omAnimPlay,       { ml1z_shwang, ANIM_ACTION02, 0 } },
        { mdkDialogIsDone,  {} },
        { mdkPreloadRes,    { "ml1z_kurt5.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_dr4, DIALOGPORTRAIT_DOCTOR, 2.0, DIALOGFLAG_TOP } },
        { omAnimJustLooped, { ml1z_shwang, ANIM_ACTION02 } },
        { mdkPreloadRes,    { "ml1z_shwang1.wav", 0} },
        { mdkDialogPanel,   { strings.ml1z_kurt5, DIALOGPORTRAIT_KURT, 1.1, DIALOGFLAG_HIDE } },
        { omAnimPlay,       { ml1z_shwang, ANIM_ACTION05, 0 } },
        { omAnimPlay,       { ml1z_kurmovegob, ANIM_ACTION04, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_stuntkurt,   ANIM_ACTION07, 0 } },
        { omAnimJustLooped, { ml1z_shwang, ANIM_ACTION05 } },

        -- cut 6 --
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION05, ANIMFLAG_NOTRANS } },
        { mdkDialogPanel,   { strings.ml1z_shwang1, DIALOGPORTRAIT_SCHWANG, 18, DIALOGFLAG_TOP } },
        { omAnimPlay,       { ml1z_shwang, ANIM_ACTION03, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { ml1z_stuntkurt,   ANIM_ACTION07 } },

        -- cut 7 --
        { omAnimPlay,       { ml1z_camera, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1z_shwang, ANIM_ACTION04, ANIMFLAG_NOTRANS } },
        { Wait,             { ml1z_camera, 7 } },
        { omSceneFade,      { mdkGetScene() , 0, 0, 0, 1, 2.34, 4, 0 } },
        { omAnimJustLooped, { ml1z_camera, ANIM_ACTION06 } },
        { mdkDialogIsDone,  {} };

        Done = Level.EndMovieDone

    })
end

Level.EndMovieDone = function()
    mdkNewGame(2,12)
end

----------------------------------------------------

l1_r8.OnUpdate = function(gob)

    if (not gob.entered) then
        
        -- countdown to ship opening cutscene once the trigger point is reached --
        if (mdkGobDistancePoint(mdkGetPlayerGob(), "l1_r8wp") < 5) then
            gob.entered = 1
            if (not l1_r8.bossstarted) then
                gob.state = 1
                omGobSetTimer(gob, 5)
                hanspilot.state = 1
		l1_r8.BossFlag = 0
            end
            mdkProxDoorLock(l1_r8proxent, 1)
        end

    elseif (gob.startopening) then

        -- play ship opening cutscene --
        if (mdkIsCutSceneAllowed() == 1) then
            l1_r8.StartCutSceneOpening()
            gob.startopening = nil
	    omAnimPlay ( l1_r8outerguns,ANIM_OPEN,0 )
	    omAnimPlay ( l1_r8innerguns,ANIM_OPEN,0 )
	    omAnimPlay ( l1_r8shield,ANIM_ACTION00,0 )
            omGobEnterStasis ( l1_r8esnipe01 ) 
            omGobEnterStasis ( l1_r8esnipe02 ) 
            omGobEnterStasis ( l1_r8esnipe03 ) 
            omGobEnterStasis ( l1_r8esnipe04 ) 
            omGobEnterStasis ( l1_r8esnipe05 ) 
        end

    end
end
----------------------------------------------------

l1_r8.StartCutSceneOpening = function()

    local bob = mdkGetPlayerGob()
    l1_r8.state = 2
    l1_r8.bossstarted = 1
    God(1)

    StartMovie(l1_r8, {    

        { Wait, { bob, 3 } },
        { omGobExitStasis, { l1bosscam } },

        { mdkDisableDefaultCamera, {} },
        { mdkDisablePlayerControl, {} },
        { mdkKurtEnterNormalMode, {bob} },
        { mdkDisableGui, {} },

        { omAnimPlay, { l1bosscam,ANIM_ACTION00,0 } },
        { omAnimPlay, { hanspilot,ANIM_TAUNT0,0 } },
        { Level.r8HansTaunt, {hanspilot} },

        { Wait, { bob,4 } },

        { omAnimPlay, { hanspilot,ANIM_ENABLED,0 } },

        { Wait, { bob,2 } },

        { omAnimPlay, { l1_r8outerguns,ANIM_CLOSE,0 } },
        { omAnimPlay, { l1_r8innerguns,ANIM_ACTION01,0 } },
        { omAnimPlay, { l1_r8shield, ANIM_ACTION01,0 } },
        { WaitForAnim, { l1bosscam, ANIM_ACTION00, 0 } },

        { WaitForAnim, { l1_r8outerguns, ANIM_CLOSE, 0 } },
        { omAnimPlay, { l1_r8outerguns,ANIM_OPEN,0 } },

        { omGobExitStasis, { l1_r8esnipe01 } },
        { omGobExitStasis, { l1_r8esnipe02 } },
        { omGobExitStasis, { l1_r8esnipe03 } },
        { omGobExitStasis, { l1_r8esnipe04 } },
        { omGobExitStasis, { l1_r8esnipe05 } },

        { omAnimPlay, { l1_r8esnipe01,ANIM_LOCK,0 } },
        { omAnimPlay, { l1_r8esnipe02,ANIM_LOCK,0 } },
        { omAnimPlay, { l1_r8esnipe03,ANIM_LOCK,0 } },
        { omAnimPlay, { l1_r8esnipe04,ANIM_LOCK,0 } },

        { mdkEnablePlayerControl, {} },
        { mdkEnableDefaultCamera, {} },
        { mdkEnableGui, {} },
        { omGobEnterStasis, { l1bosscam } },
        { God, { 0 } },

        { Wait, { bob,2 } },
        
        { WaitForAnim, { l1_r8outerguns, ANIM_OPEN, 0 } },
        { omAnimPlay, { l1_r8outerguns,ANIM_SPIN,0 } },

        { omAnimPlay, { turret01_01,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_02,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_03,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_04,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_05,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_06,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_07,ANIM_SHOOTING,0 } },
        { Wait, { bob, .2 } },
        { omAnimPlay, { turret01_08,ANIM_SHOOTING,0 } },

        { omAnimPlay, { l1_r8esnipe01,ANIM_ENABLED,0 } },
        { omAnimPlay, { l1_r8esnipe02,ANIM_ENABLED,0 } },
        { omAnimPlay, { l1_r8esnipe03,ANIM_ENABLED,0 } },
        { omAnimPlay, { l1_r8esnipe04,ANIM_ENABLED,0 } },

        { Level.r8QueueSpawners },

    })    

    mdkSpawnerSetSpawnedObject(l1_r8gen1, OBJ_DOGANBOY, "l1_r8lowcenter", 60, 0.7, 0, 0, 3, l1_r8)
    mdkSpawnerSetSpawnedObject(l1_r8gen2, OBJ_DOGANBOY, "l1_r8lowcenter", 60, 0.7, 0, 0, 3, l1_r8)

end

Level.r8QueueSpawners = function()
    if (l1_r8gen1) then mdkSpawnerQueue(l1_r8gen1, 1) end
    if (l1_r8gen2) then mdkSpawnerQueue(l1_r8gen2, 1) end
end

----------------------------------------------------

l1_r8esnipe01.OnDamage = function(gob, from, damage, damagetype, part)
    
    if(not l1_r8.bossstarted) then return end
    
    if(mdkIsDamageType(damagetype, DAMAGE_SNIPER)==1) then
        omAnimPlay(l1_r8esnipe01, ANIM_DISABLED, 0)
        l1_r8esnipe01.LockOn=1
        l1_r8.SnipeLock(gob)
    end
end
----------------------------------------------------

l1_r8esnipe02.OnDamage = function(gob, from, damage, damagetype, part)
    
    if(not l1_r8.bossstarted) then return end
    
    if(mdkIsDamageType(damagetype, DAMAGE_SNIPER)==1) then
        omAnimPlay(l1_r8esnipe02, ANIM_DISABLED, 0)
        l1_r8esnipe02.LockOn=1
        l1_r8.SnipeLock(gob)
    end
end
----------------------------------------------------

l1_r8esnipe03.OnDamage = function(gob, from, damage, damagetype, part)
    
    if(not l1_r8.bossstarted) then return end
    
    if(mdkIsDamageType(damagetype, DAMAGE_SNIPER)==1) then
        omAnimPlay(l1_r8esnipe03, ANIM_DISABLED, 0)
        l1_r8esnipe03.LockOn=1
        l1_r8.SnipeLock(gob)
    end
end
----------------------------------------------------

l1_r8esnipe04.OnDamage = function(gob, from, damage, damagetype, part)

    if(not l1_r8.bossstarted) then return end
    
    if(mdkIsDamageType(damagetype, DAMAGE_SNIPER)==1) then
        omAnimPlay(l1_r8esnipe04, ANIM_DISABLED, 0)
        l1_r8esnipe04.LockOn=1
        l1_r8.SnipeLock(gob)
    end
end
----------------------------------------------------

l1_r8esnipe05.OnDamage = function(gob, from, damage, damagetype, part)
    
    if(not l1_r8.bossstarted) then return end
    
    if (l1_r8.locksdone and mdkIsDamageType(damagetype, DAMAGE_SNIPER)==1) then
	l1_r8.BossFlag = 1
        omAnimPlay(l1_r8esnipe05, ANIM_DISABLED, 0)
            StartGlobalScript(l1_r8, {    
                { omAnimPlay, { l1_r8shield,ANIM_OPEN,0 } },
                { omAnimPlay, { l1_r8shield,ANIM_OPEN,0 } },
                { WaitForAnim, { l1_r8shield,ANIM_OPEN,0 } },
                { omAnimPlay, { l1_r8shield,ANIM_SPIN,0 } },
            })    
    end
end
----------------------------------------------------

l1_tun13swt.OnEnterRoom = function(gob)
$if pcdemo
    if (gob.entered == nil) then
        gob.entered = 1
        omGobSetTimer(gob, 2)
        omSceneFade(mdkGetScene() , 0, 0, 0, 1, 1.5, 10, 0)
        mdkDisableGui()
        chSndSwitchMusic(-1)
        Level.nopausefade = 1
    end
$end
end
----------------------------------------------------

l1_tun13swt.OnTimer = function(gob)
$if pcdemo
    mdkNewGame(2,1)
$end
end
----------------------------------------------------

Level.l1r1ArrowOnAnimLoop = function(gob, animid)

    --this functino just plays the ready animation when the object appears
    if(animid==ANIM_SPAWN) then
        omAnimPlay(gob, ANIM_READY0, 0)
    elseif(animid == ANIM_DIE) then
        
    end

end

----------------------------------------------------

Level.l1r1ArrowOnUpdate = function(gob)

    local dist = mdkGobDistance(mdkGetPlayerGob(), gob)
    
    if(not gob.done) then
        if((dist<5) and gob.plat.playeron and (not gob.dying)) then
            omAnimPlay(gob, ANIM_DIE, 0)
            gob.dying = 1
            gob.spawning = nil
            
        elseif((dist>5) and (not gob.plat.playeron) and (not gob.spawning)) then
            omAnimPlay(gob, ANIM_SPAWN, 0)
            gob.spawning=1
            gob.dying = nil
        end
    end

end

----------------------------------------------------

Level.l1r1KurtOnModeSwitch = function(gob, mode)

    if(mode == PLAYMODE_SNIPER) then
        l1_r1.TaskInc("state 16")
        mdkSetLuaEvent(l1_r1, "OnModeSwitch", nil)
        
    end

end

----------------------------------------------------

Level.l1r1PlatOnAnimLoop = function(gob, animid)

    --this function just plays the spin animation when the object appears
    if(animid==ANIM_SPAWN) then
        omAnimPlay(gob, ANIM_SPIN, 0)
    end

end

----------------------------------------------------

Level.l1r1PlatOnCollision = function(gob, target, part)

    if(target==nil) then 
        gob.playeron=nil 
        --print("playerisoff")
    elseif( (target == mdkGetPlayerGob()) and (part==omGobGMGetSltIndexByName(gob, "plathit_01")) ) then
        gob.playeron=1 
        --print("playerison")
    end

    if((not gob.playeron) and (gob.die)) then 
        omAnimPlay(gob, ANIM_DIE, 0)
        gob.die=nil
    end

end

----------------------------------------------------

Level.l1r7MortarsOnPickedUp = function(gob, id)

    --print("mortars picked up")
    l1_r7.mortarsexist = nil
    l1_r7.mortars = nil

end

----------------------------------------------------

Level.PlatformOnCollision = function(gob, target, part)
    -- if the platform is touched by a sniper mortar, --
    -- remember the bullet and wait for its explosion --
    if (target ~= nil) and (gob.bulletgob == nil) and
       (mdkGetGobType(target) == OBJ_SNIPERMORTAR) then
        gob.bulletgob = target
        
        l1_r7.hinttime = nil   -- cancel hint timer

    end
end
----------------------------------------------------

Level.PlayDeathMovie = function()
    God(1)
    local bob = mdkGetPlayerGob()
	
    if (hans) then omGobDelete(hans) end

	StartGlobalScript(l1_r8, { 

        { mdkDisablePlayerControl, {} },
        { mdkDisableGui, {} },
        { mdkDisableDefaultCamera, {} },
        { PlayerEnterStasis, {} },

        { omGobExitStasis, { l1_hansdie } },
        { omGobExitStasis, { hdcam01 } },
        { omAnimPlay, { hdcam01,ANIM_ACTION00,ANIMFLAG_NOTRANS } },
        { omAnimPlay, { hansdie,ANIM_ACTION00,ANIMFLAG_NOTRANS } },
        { Wait,       { hdcam01, 2.2 } },
        { mdkDilateSetFactor, { .3, .1, 0 } },
        { WaitForAnim, { hdcam01, ANIM_ACTION00, 0 } },

        { omGobEnterStasis, { hdcam01 } },
        { omGobExitStasis, { hdcam02 } },
        { omAnimPlay, { hdcam02,ANIM_ACTION00,ANIMFLAG_NOTRANS } },
        { WaitForAnim, { hdcam02, ANIM_ACTION00, 0 } },
        { mdkDilateStop, {} },

        { omSceneFade,      { mdkGetScene() , 0, 0, 0, 1, 1.0, 1, 0 } },
        { Wait,             { hdcam02, 1.1 } },

        { God, { 0 } },

        { HideNextLoadingScreen, {} },
        { mdkNewGame, {1, 10} },

	}) 
end
----------------------------------------------------

Level.PlayIntroMovie = function()
    if (ml1a_camera == nil) then return end
    omGobExitStasis(ml1a_camera)
    
    l1_r1.moviestarted=1

    StartMovie(mdkGetCameraGob(), {

        { chSndSwitchMusic, {-1} },

        { omGobExitStasis,  { ml1a_kurmovegob } },
        { omGobExitStasis,  { ml1a_maxmovegob } },
        { omGobExitStasis,  { ml1a_drmovegob } },
        { omGobExitStasis,  { ml1a_stuntdr} },
        { omGobExitStasis,  { ml1a_stuntkurt } },
        { omGobExitStasis,  { ml1a_stuntmax } },
        { omGobExitStasis,  { ml1a_lounge } },
        { omGobExitStasis,  { ml1a_door } },

        { PlayerEnterStasis },
        { mdkDisableDefaultCamera, {} },
        { mdkDisableGui,    {} },

        { Level.IntroStartFade },

        -- cut 1 --
        { mdkPreloadRes,    { "ml1a_dr1.wav", 0 } },
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION00, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION00, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION00, ANIMFLAG_NOTRANS } },

        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION00, ANIMFLAG_NOTRANS } },

        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION32, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION22, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_ACTION27, ANIMFLAG_NOTRANS } },
    
        { WaitForResourceLoad },

        { Level.IntroFade },

        { omAnimPlay,       { ml1a_stuntmax, ANIM_ACTION23, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION14, ANIMFLAG_NOTRANS } },


        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION23, 0 } },
        { mdkPreloadRes,    { "ml1a_kurt1.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_dr1, DIALOGPORTRAIT_DOCTOR, 4, DIALOGFLAG_TOP } },

        { omAnimJustLooped, { ml1a_stuntdr, ANIM_ACTION23 } },
    
        { mdkDialogIsDone,  {} },

        -- cut 2 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_dr2.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_kurt1, DIALOGPORTRAIT_KURT, 3, DIALOGFLAG_BOTTOM } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION01, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION25, ANIMFLAG_NOTRANS } },
    
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION15, ANIMFLAG_NOTRANS } },

        { mdkDialogIsDone,  {} },


        -- cut 3 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION02, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION02, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION02, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION02, ANIMFLAG_NOTRANS } },


        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION31, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_kurt2.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_dr2, DIALOGPORTRAIT_DOCTOR, 6, DIALOGFLAG_TOP } },   
        { mdkDialogIsDone,  {} },

        -- cut 4 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION03, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION03, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION15, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_dr3.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_kurt2, DIALOGPORTRAIT_KURT, 2, DIALOGFLAG_BOTTOM } },
        { mdkDialogIsDone,  {} },


        -- cut 5 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION04, ANIMFLAG_NOTRANS } },

        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION04, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION04, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION04, ANIMFLAG_NOTRANS } },


        { mdkPreloadRes,    { "ml1a_kurt3.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_dr3, DIALOGPORTRAIT_DOCTOR, 4, DIALOGFLAG_TOP } },

        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION30, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_ACTION24, ANIMFLAG_NOTRANS } },
    
   



        { mdkDialogIsDone,  {} },
        { omAnimJustLooped, { ml1a_drmovegob, ANIM_ACTION04 } },

        -- 6 WARNING SIREN --

        { omAnimPlay,       { ml1a_camera, ANIM_ACTION05, ANIMFLAG_NOTRANS } },

        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION05, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION28, 0 } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION05, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION05, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_ACTION25, ANIMFLAG_NOTRANS } },
        { mdkDialogPanel,   { strings.ml1a_kurt3, DIALOGPORTRAIT_KURT, 4.4, DIALOGFLAG_BOTTOM } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION20, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_jd1.wav", 0 } },
        { omAnimJustLooped, { ml1a_camera, ANIM_ACTION05 } },


        -- cut 7 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_dr4.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_jd1, DIALOGPORTRAIT_COMPUTER, 7, DIALOGFLAG_BOTTOM } },

        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION24, 0 } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION13, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_ACTION19, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { ml1a_camera, ANIM_ACTION06 } },


        -- cut 8 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION07, ANIMFLAG_NOTRANS } },


        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION07, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntdr, ANIM_ACTION27, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION07, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION07, ANIMFLAG_NOTRANS } },
        { mdkDialogPanel,   { strings.ml1a_dr4, DIALOGPORTRAIT_DOCTOR, 13, DIALOGFLAG_TOP } },
    
        { omAnimPlay,       { ml1a_stuntmax, ANIM_ACTION26, ANIMFLAG_NOTRANS } },   
    
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_ACTION21, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_dr5.wav", 0 } },
        { mdkDialogIsDone,  {} },
        { omAnimJustLooped, { ml1a_camera, ANIM_ACTION07 } },


        -- cut 9 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION08, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_door, ANIM_OPEN, ANIMFLAG_NOTRANS } },


        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION08, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION08, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION08, ANIMFLAG_NOTRANS } },


        { omAnimPlay,       { ml1a_stuntdr, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_kurt4.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_dr5, DIALOGPORTRAIT_DOCTOR, 4, DIALOGFLAG_TOP } },   
        { mdkDialogIsDone,  {} },

        -- cut 10 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION09, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION09, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION09, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION09, ANIMFLAG_NOTRANS } },
        { mdkPreloadRes,    { "ml1a_dr6.wav", 0 } },
        { mdkDialogPanel,   { strings.ml1a_kurt4, DIALOGPORTRAIT_KURT, 3, DIALOGFLAG_BOTTOM } },    
        { omAnimPlay,       { ml1a_stuntdr, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  {} },


        -- cut 11 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION10, ANIMFLAG_NOTRANS } },
        { mdkDialogPanel,   { strings.ml1a_dr6, DIALOGPORTRAIT_DOCTOR, 9, DIALOGFLAG_TOP } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION10, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION10, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION10, ANIMFLAG_NOTRANS } },

        { omAnimPlay,       { ml1a_stuntdr, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_RUNF, ANIMFLAG_NOTRANS } },


        { omAnimJustLooped, { ml1a_kurmovegob, ANIM_ACTION10, } },

        -- cut 12 --
        { omAnimPlay,       { ml1a_camera, ANIM_ACTION11, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_kurmovegob, ANIM_ACTION11, ANIMFLAG_NOTRANS } }, 
        { omAnimPlay,       { ml1a_maxmovegob, ANIM_ACTION11, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_drmovegob, ANIM_ACTION11, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntdr, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntmax, ANIM_RUNF, ANIMFLAG_NOTRANS } },
        { omAnimPlay,       { ml1a_stuntkurt, ANIM_RUNF, ANIMFLAG_NOTRANS } },

        { mdkDialogIsDone,  {} },
        { omSceneFade,      { mdkGetScene() , 0, 0, 0, 1, 1.5, 1, 0 } },
        { Wait,             { ml1a_camera, 1.6 } };

        Done = Level.IntroMovieDone
    })
end

Level.IntroMovieDone = function()
    HideNextLoadingScreen(strings.l1chk2)
    mdkNewGame(1,12)
end

----------------------------------------------------

Level.PlayIntroMovieA = function()

   if(l0a_animgob == nil) then return end

   omGobExitStasis(l0a)

   mdkSaveMovie(1,"a")
   mdkSaveMovie(1,"b")

   StartMovie(l0a, {
        { PlayerEnterStasis },
        { mdkDisableDefaultCamera,  {} },
        { mdkDisableGui,    {} },

	-- cut 1 Comic book opens --

--        { mdkPreloadRes,    { "ml0a_1.wav", 0 } },
        { chSndSwitchMusic, { 21 } },
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION00, ANIMFLAG_NOTRANS } },
        { omSceneFade,      { mdkGetScene() , 0, 0, 0, 1, 1.5, 0, 0 } },
        { Wait,             { l0a, 1.5 } },

	-- panel 1 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION01 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION03, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_2.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_1, DIALOGPORTRAIT_NONE, 11.3, DIALOGFLAG_HIDE } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION03 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION04, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  { } },

	-- panel 2 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION05, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_3.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_2, DIALOGPORTRAIT_NONE, 11.3, DIALOGFLAG_HIDE } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION05 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION06, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  { } },
   
	-- panel 3 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION07, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_4.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_3, DIALOGPORTRAIT_NONE, 10.6, DIALOGFLAG_HIDE } },
        { mdkDialogIsDone,  { } },

	-- panel 4 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION08, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_5.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_4, DIALOGPORTRAIT_NONE, 10.6, DIALOGFLAG_HIDE } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION08 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION09, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  { } },
        
	-- panel 5 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION10, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_6.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_5, DIALOGPORTRAIT_NONE, 15.3, DIALOGFLAG_HIDE } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION10 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION11, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION11 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION12, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION12 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION13, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION13 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION14, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  { } },
        
	-- panel 6 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION15, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_7.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_6, DIALOGPORTRAIT_NONE, 4, DIALOGFLAG_HIDE } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION15 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION16, ANIMFLAG_NOTRANS } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION16 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION17, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  { } },
                
	-- panel 7 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION18, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_8.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_7, DIALOGPORTRAIT_NONE, 11.3, DIALOGFLAG_HIDE } },
        { mdkDialogIsDone,  { } },
   
	-- panel 8 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION19, ANIMFLAG_NOTRANS } },
--        { mdkPreloadRes,    { "ml0a_9.wav", 0 } },
        { mdkDialogPanel,   { strings.ml0a_8, DIALOGPORTRAIT_NONE, 4, DIALOGFLAG_HIDE } },
        { omAnimJustLooped, { l0a_animgob, ANIM_ACTION19 } },       
        { omAnimPlay,       { l0a_animgob, ANIM_ACTION20, ANIMFLAG_NOTRANS } },
        { mdkDialogIsDone,  { } },

	-- panel 9 --

        { omAnimPlay,       { l0a_animgob, ANIM_ACTION21, ANIMFLAG_NOTRANS } },
        { mdkDialogPanel,   { strings.ml0a_9, DIALOGPORTRAIT_NONE, 4, DIALOGFLAG_HIDE } },
        { mdkDialogIsDone,  { } };
        
        Done = Level.IntroMovieADone,
        ContinueMovieHack = 1
   })

end

Level.IntroMovieADone = function()
    mdkDialogDestroy()
    Level.PlayIntroMovie()
end

----------------------------------------------------

Level.r1BobboOnShotExploded = function(gob, bulletid)

    --print("exploded")
        
    if(bulletid == OBJ_GRENADE) then
    
        mdkSetLuaEvent(mdkGetPlayerGob(), "OnShotExploded", nil)
    
        l1_r1.timerstate = 3
        omGobSetTimer(l1_r1, 1.5)

    end
        
end

----------------------------------------------------

Level.r1BobOnOutOfAmmo = function(gob, type)

    if(type==OBJ_SNIPERGRENADEITEM) then
        l1_r1.snipergrenade = mdkCreateObjectLua("snipergrenade", OBJ_SNIPERGRENADEITEM, mdkGetScene(), l1_r1, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )    
        mdkGobSetPosition(l1_r1.snipergrenade,"l1_r1snpgrngen")
        
  --  elseif(type==OBJ_GRENADEITEM) then
    --    l1_r1.state=l1_r1.state+1
      --  l1_r1.statedone=nil
    end

end
----------------------------------------------------

Level.r1DummyOnAnimLoop = function(gob, animid)

    if(animid == ANIM_DIE) then
        l1_r1.TaskInc("state 4")
    end

end

----------------------------------------------------

Level.r1DummyOnDamage = function(gob, shooter, damage, damagetype, part)

    if(gob.hitcount==nil) then
        gob.hitcount=0
    end
    
    gob.hitcount = gob.hitcount + 1

    if(gob.hitcount>= 10 and ( not gob.dead )) then 
        gob.dead=1
        mdkDecoyDeeeeeeeeeeeestroy(gob)
        
    end
    if(not gob.dead) then
        mdkDecoyDefaultOnDamage(gob, shooter, damage, damagetype)
    end

end

----------------------------------------------------

Level.r1SGOnPickedUp = function(gob,id)

    if(id==OBJ_SNIPERGRENADEITEM) then
    
        mdkSetLuaEvent(l1_r1, "OnModeSwitch", Level.l1r1KurtOnModeSwitch)
        omAnimPlay(l1_r1arwgob10, ANIM_DIE, 0)
        l1_r1.TaskInc("state 15")
        l1_r1.snipergrenade = nil

    elseif (id==OBJ_GRENADEITEM) then

        mdkKurtRemoveItem(mdkGetPlayerGob(),OBJ_GRENADEITEM, 4)
        omAnimPlay(l1_r1arwgob09, ANIM_DIE, 0)
        l1_r1.grenades = nil
        l1_r1.timerstate = 2
        omGobSetTimer(l1_r1, 1)
    end

end


----------------------------------------------------

Level.r2TargetOnDamage = function(gob, shooter, damage, damagetype, part)
    if (mdkIsDamageType(damagetype,DAMAGE_SNIPER)==1) then
        omGobDelete(r2_dog01target)
        
        l1_r2.timer=1
        
        omAnimPlay(r2_dog01,ANIM_TAUNT0,0)
        omSceneShake(mdkGetScene(), 0.01, 3, 0.9, 'rumble1')
        
        omGobSetTimer(l1_r2, 1)
    
        
        
    end
end
----------------------------------------------------

Level.r3secretBoxOnDie = function(gob, crit)

    --print("box died")
    if(gob.itemspawnpoint) then
        gob.itemspawned = mdkCreateObjectLua(gob.name.."item", gob.itemtype, mdkGetScene(), l1_r3secret, nil, 0,0,0, 1,0,0,0, nil,0,0,0,0 )
        mdkGobSetPosition(gob.itemspawned,gob.itemspawnpoint)
    
    end        

end

----------------------------------------------------

Level.r5bif02StartTurret = function(gob)
    mdkWalkerAlert(gob,0)
    mdkWalkerSetPen(gob, "l1_r5wp7", 15)
    
    --WHEN PEOPLE COMPLAIN ABOUT BIF, CHANGE THIS NUMBER TO 2 OR 3
    gob.state = 3
end
----------------------------------------------------

Level.r6SniperLockOnDamage = function(gob, from, damage, damagetype, part)

    if(gob.shot) then return end

    if (mdkIsDamageType(damagetype,DAMAGE_SNIPER)==1) then
        omAnimPlay(gob, ANIM_DISABLED, 0)
        
        gob.shot=1

        if (l1_r6.lockssniped == nil) then
            l1_r6.lockssniped = 1
        else 
            l1_r6.lockssniped = l1_r6.lockssniped + 1
        end
    end

end
----------------------------------------------------

Level.r7BobOutOfAmmo = function(gob, itemid)

    if (itemid==OBJ_SNIPERMORTARITEM) then
        --set timer so that a fired mortar has time to explode a dome,
        --thus changing the next mortar spawnpoint
        omGobSetTimer(l1_r7, 5)
    end

end

----------------------------------------------------

Level.r8Gen1SpawnOnDie = function(gob)
    l1_r8.dog1 = nil
end

l1_r8gen1.OnSpawn = function(gen, dog)
    mdkWalkerJumpToPoint(dog, "l1_r8doganland1", 50)
    mdkWalkerAlert(dog, 0)
    l1_r8.dog1 = dog
    dog.OnDie = Level.r8Gen1SpawnOnDie
end
----------------------------------------------------

Level.r8Gen2SpawnOnDie = function(gob)
    l1_r8.dog2 = nil
end

l1_r8gen2.OnSpawn = function(gen, dog)
    mdkWalkerJumpToPoint(dog, "l1_r8doganland2", 50)
    mdkWalkerAlert(dog, 0)
    l1_r8.dog2 = dog
    dog.OnDie = Level.r8Gen2SpawnOnDie
end
----------------------------------------------------

Level.r8GenDieOnUpdate = function(gob)
    -- this function will run for a bit, then kill off the gen
    gob.ttl = gob.ttl - chGetDeltaT()

    if(gob.ttl <= 0) then -- kill lock and plat
        omGobDelete(gob.spawner)
        gob.spawner = nil
        omGobDelete(gob)
        return
    end

    omGobGMSetTransparency(gob, gob.ttl)
    omGobGMSetTransparency(gob.spawner, gob.ttl)


end

----------------------------------------------------

Level.r8HansOnCustomKey = function(gob, part, key)
    if (key == CUSTKEY_USER1) then
        omSceneShake(mdkGetScene(), 0.01, 3, 3, 'rumble1')
        if (l1_r8.dog1) then
            mdkWalkerFallDown(l1_r8.dog1)
        end
        if (l1_r8.dog2) then
            mdkWalkerFallDown(l1_r8.dog2)
        end
        if (mdkKurtIsOnGround(mdkGetPlayerGob()) == 1) then
            mdkDealDamage(gob, mdkGetPlayerGob(), 20, DAMAGE_BADGUY+DAMAGE_KNOCKDOWN, -1)
        end
    end
end
----------------------------------------------------

Level.r8HansOnDie = function(gob)
    if (l1_r8.dog1) then
        mdkWalkerDie(l1_r8.dog1)
    end
    if (l1_r8.dog2) then
        --mdkWalkerJumpToPoint(l1_r8.dog2, "l1_r8hansspawn", 100)
        mdkWalkerDie(l1_r8.dog2)
    end

    if (l1_r8gen1) then
        mdkSpawnerShutOff(l1_r8gen1)
    end
    if (l1_r8gen2) then
        mdkSpawnerShutOff(l1_r8gen2)
    end

    mdkHideBossHealthBar()
    omGobSetTimer(l1_r8, .01)
    l1_r8.state = 3
    God(1)


end
----------------------------------------------------

Level.SetAITargetGobNil = function()
    mdkSetAITargetGob(nil)
end

l1_r6.StartCutScene = function()
    local bob = mdkGetPlayerGob()
    God(1)

    StartMovie(l1_r6, { 
        { Level.SetAITargetGobNil },   
        { omGobExitStasis, { fancam } },
        { mdkDisableDefaultCamera, {} },
        { mdkDisablePlayerControl, {} },
        { mdkKurtEnterNormalMode, {bob} },

        { omAnimPlay, { fancam,ANIM_ACTION00,0 } },
        { Wait, { bob,0.01 } },
        { mdkDisableGui, {} },
        { Wait, { bob,2.4 } },
        { mdkBlowerEnable, { fan1_01 } },
        { omAnimPlay, { fan1_01,ANIM_ACTION00,ANIMFLAG_OVERLAY } },
        { omAnimPlay, { l1_r6ball, ANIM_ENABLED, 0 } },
        { Wait, { bob,5.6 } },
        { omAnimPlay, { l1_con2adr02, ANIM_OPEN, 0 } }, 

        { WaitForAnim, { fancam, ANIM_ACTION00, 0 } },
        { omAnimStop, { fan1_01, ANIM_ACTION01, ANIMFLAG_NOTRANS } },
        { mdkEnablePlayerControl, {} },
        { mdkEnableDefaultCamera, {} },
        { mdkEnableGui, {} },
        { omGobEnterStasis, { fancam } },
        { mdkSetAITargetGob, { bob } },
        { God, { 0 } },
    })    
end
----------------------------------------------------

Level.ShotHitDome = function(gob)
    local guard

    if (gob.bulletgob ~= nil) and (gob.shattered == nil) then

        --added by charles for spawning mortars

        if(gob==platportal1) then
            l1_r7.SpawnPoint="l1_r7mortar02"
            l1_r7.plat1dead = 1
        end
        
        if(gob==platportal2 and l1_r7.plat1dead) then
            l1_r7.SpawnPoint="l1_r7mortar03"
        end
        

        ---------------------

        mdkKurtEnterNormalMode(mdkGetPlayerGob())

        -- shatter the platform's dome --
        omSceneShake(mdkGetScene(), 0.01, 3, 3, 'rumble1')
        omGobGMShatter(l1_r7domes, omGobGMGetSltIndexByName(l1_r7domes, gob.slotnameglass), 0,0,0, 25, SHATTEROPTION_CENTRE)
        omGobGMShatter(l1_r7domes, omGobGMGetSltIndexByName(l1_r7domes, gob.slotnameshield), 0,0,0, 25, SHATTEROPTION_CENTRE)
        omGobGMShatter(l1_r7domes, omGobGMGetSltIndexByName(l1_r7domes, gob.slotnamering), 0,0,0, 25, SHATTEROPTION_CENTRE)
        gob.bulletgob = nil
        gob.shattered = 1

        -- chunk the guard --
        guard = Level.GetPlatformGuard(gob)
        if (guard ~= nil) then
            mdkWalkerDie(guard)
        end

        -- switch on the platform fan --
        if (gob.fan ~= nil) then
            mdkBlowerEnable(gob.fan)
        end

        -- play the dome shatter animation --
        if (gob.anim ~= nil) then
            omAnimPlay(gob.anim, ANIM_ACTION00, ANIMFLAG_NOTRANS)
        end

        -- spawn two replacement guards two seconds from now --
        if (gob.spawner ~= nil) then
            omGobSetTimer(gob.spawner, 2)
        end
    end
end
----------------------------------------------------

Level.SpawnerOnSpawn = function(spawner, spawnee)
    -- when a guard spawns, jump to the platform, behave like a Bif and be alert --
    mdkWalkerJumpToPoint(spawnee, spawner.platform.pencentre, 40)
    mdkWalkerSetTurret(spawnee, 1)

    mdkWalkerAlert(spawnee, 1)
end
----------------------------------------------------

Level.SpawnerOnTimer = function(gob)
    -- spawn a couple of guards and then don't spawn any more --
    mdkSpawnerSpawnObject( gob )
    mdkSpawnerSpawnObject( gob )
    mdkSpawnerShutOff( gob )
end
----------------------------------------------------

Level.StartTheTutorialNOW = function()

    --we don't want to do this twice
    if(l1_r1.tutinit) then return end
    
    omSceneFade(mdkGetScene(), 0, 0, 0, 1, 0.5, 0, 1)
   
    --initialize all the stuff to being not visible

    l1_r1.tutinit=1
    Save.intutorial = 1

--    l1_r1.InitStateTable(l1_r1)
--    l1_r1.state=1
    l1_r1.InitTutorialFunctions(gob)

    mdkSetLuaEvent(l1_r1, "OnUpdate",Level.TutorialOnUpdate)
    l1_r1.TutFuncs["state 0"].InitState()

    mdkAdvanceCheckpoint(11,0)    -- so when you die the tutorial doesn't start again
end

----------------------------------------------------

Level.TutorialOnUpdate = function(gob)
    
    --l1_r1.StateTable[l1_r1.state](gob)
    --print(l1_r1.statename)

    if (Save.intutorial) then
        if((l1_r1.TutFuncs[l1_r1.statename].tasks >= l1_r1.TutFuncs[l1_r1.statename].statetasks) and (not l1_r1.holdstate)) then
            --print("Next state")
            l1_r1.TutFuncs[l1_r1.statename].EndState(gob)
            --call init state, endstate should have changed state name
            l1_r1.state = l1_r1.state +1
            --print(l1_r1.state)
            l1_r1.TutFuncs[l1_r1.statename].InitState(gob)
        end
        l1_r1.TutFuncs[l1_r1.statename].Update(gob)
    end
   
end

----------------------------------------------------
