Working on scripts
This commit is contained in:
parent
c086fe1ef0
commit
4044acefb2
@ -175,7 +175,7 @@ set(EMSCRIPTEN_LINK_FLAGS
|
|||||||
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/loading.png@resources/loading.png"
|
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/loading.png@resources/loading.png"
|
||||||
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/shaders@resources/shaders"
|
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/shaders@resources/shaders"
|
||||||
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/start_uni_interior.lua@resources/start_uni_interior.lua"
|
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/start_uni_interior.lua@resources/start_uni_interior.lua"
|
||||||
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/start2.lua@resources/start2.lua"
|
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/start_uni_exterior.lua@resources/start_uni_exterior.lua"
|
||||||
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/start_dorm.lua@resources/start_dorm.lua"
|
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../resources/start_dorm.lua@resources/start_dorm.lua"
|
||||||
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../audio@audio"
|
"--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../audio@audio"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Plane",
|
"name": "Plane",
|
||||||
"texturePath": "resources/w/exterior/Segmented_Plane002.png",
|
"texturePath": "resources/w/exterior/Segmented_Plane002.png",
|
||||||
|
"textureDarkandsPath": "resources/w/exterior/darklands_Segmented_Plane002.png",
|
||||||
"meshPath": "resources/w/exterior/Segmented_Plane002.txt",
|
"meshPath": "resources/w/exterior/Segmented_Plane002.txt",
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
@ -16,6 +17,7 @@
|
|||||||
{
|
{
|
||||||
"name": "door",
|
"name": "door",
|
||||||
"texturePath": "resources/w/exterior/door002.png",
|
"texturePath": "resources/w/exterior/door002.png",
|
||||||
|
"textureDarkandsPath": "resources/w/exterior/darklands_door002.png",
|
||||||
"meshPath": "resources/w/exterior/ext_door001.txt",
|
"meshPath": "resources/w/exterior/ext_door001.txt",
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
@ -29,6 +31,7 @@
|
|||||||
{
|
{
|
||||||
"name": "inai",
|
"name": "inai",
|
||||||
"texturePath": "resources/w/exterior/Ext_Building004.png",
|
"texturePath": "resources/w/exterior/Ext_Building004.png",
|
||||||
|
"textureDarkandsPath": "resources/w/exterior/darklands_Ext_Building004.png",
|
||||||
"meshPath": "resources/w/exterior/ext_building001.txt",
|
"meshPath": "resources/w/exterior/ext_building001.txt",
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
|
|||||||
@ -48,18 +48,6 @@
|
|||||||
"positionZ": 0.0,
|
"positionZ": 0.0,
|
||||||
"scale": 1.0
|
"scale": 1.0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "Bed001",
|
|
||||||
"texturePath": "resources/w/dorm/ikea_bed_bake002.png",
|
|
||||||
"meshPath": "resources/w/dorm/ikea_bed001.txt",
|
|
||||||
"rotationX": 0.0,
|
|
||||||
"rotationY": 0.0,
|
|
||||||
"rotationZ": 0.0,
|
|
||||||
"positionX": 0.0,
|
|
||||||
"positionY": -0.1,
|
|
||||||
"positionZ": 0.0,
|
|
||||||
"scale": 1.0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Chair001",
|
"name": "Chair001",
|
||||||
"texturePath": "resources/w/dorm/ikea_chair_bake002.png",
|
"texturePath": "resources/w/dorm/ikea_chair_bake002.png",
|
||||||
|
|||||||
176
resources/config2/gameobjects_uni_exterior.json
Normal file
176
resources/config2/gameobjects_uni_exterior.json
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
{
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"name": "Plane",
|
||||||
|
"texturePath": "resources/w/exterior/Segmented_Plane002.png",
|
||||||
|
"textureDarkandsPath": "resources/w/exterior/darklands_Segmented_Plane002.png",
|
||||||
|
"meshPath": "resources/w/exterior/Segmented_Plane002.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 0.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 0.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "door",
|
||||||
|
"texturePath": "resources/w/exterior/door002.png",
|
||||||
|
"textureDarkandsPath": "resources/w/exterior/darklands_door002.png",
|
||||||
|
"meshPath": "resources/w/exterior/ext_door001.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 0.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 0.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inai",
|
||||||
|
"texturePath": "resources/w/exterior/Ext_Building004.png",
|
||||||
|
"textureDarkandsPath": "resources/w/exterior/darklands_Ext_Building004.png",
|
||||||
|
"meshPath": "resources/w/exterior/ext_building001.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 0.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 0.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree001",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": -1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 10.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 12.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree002",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": -12,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 19.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree003",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": -12.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 8.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree004",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": -1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": -12.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 0.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree005",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": -12.0,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -8.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree006",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 8.49915,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -2.59884,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree007",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": -1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 14.5936,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 5.3401,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree008",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 23.9295,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 9.00583,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree009",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 29.8128,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -1.45278,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tree010",
|
||||||
|
"texturePath": "resources/w/exterior/tree001.png",
|
||||||
|
"meshPath": "resources/w/exterior/tree003.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": -1.5707963267948966,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 33.1771,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 14.609,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactive": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Plane",
|
"name": "Plane",
|
||||||
"texturePath": "resources/w/exterior/Segmented_Plane002.png",
|
"texturePath": "resources/w/exterior/Segmented_Plane002.png",
|
||||||
|
"textureDarkandsPath" : "resources/w/exterior/darklands_Segmented_Plane002.png",
|
||||||
"meshPath": "resources/w/exterior/Segmented_Plane002.txt",
|
"meshPath": "resources/w/exterior/Segmented_Plane002.txt",
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
@ -15,6 +16,7 @@
|
|||||||
{
|
{
|
||||||
"name": "door",
|
"name": "door",
|
||||||
"texturePath": "resources/w/exterior/door002.png",
|
"texturePath": "resources/w/exterior/door002.png",
|
||||||
|
"textureDarkandsPath" : "resources/w/exterior/darklands_door002.png",
|
||||||
"meshPath": "resources/w/exterior/ext_door001.txt",
|
"meshPath": "resources/w/exterior/ext_door001.txt",
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
@ -76,6 +78,7 @@
|
|||||||
{
|
{
|
||||||
"name": "stairs",
|
"name": "stairs",
|
||||||
"texturePath": "resources/w/exterior/Staircase001.png",
|
"texturePath": "resources/w/exterior/Staircase001.png",
|
||||||
|
"textureDarkandsPath" : "resources/w/interior/darklands_Staircase001.png",
|
||||||
"meshPath": "resources/w/exterior/int_stairs001.txt",
|
"meshPath": "resources/w/exterior/int_stairs001.txt",
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
|
|||||||
@ -27,6 +27,20 @@
|
|||||||
"scale": 1.0,
|
"scale": 1.0,
|
||||||
"interactionRadius": 0.3,
|
"interactionRadius": 0.3,
|
||||||
"activateFunction": "on_journal_pickup"
|
"activateFunction": "on_journal_pickup"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "Bed001",
|
||||||
|
"texturePath": "resources/w/dorm/ikea_bed_bake002.png",
|
||||||
|
"meshPath": "resources/w/dorm/ikea_bed001.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 0.0,
|
||||||
|
"positionY": -0.1,
|
||||||
|
"positionZ": 0.0,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactionRadius": 1.0,
|
||||||
|
"activateFunction": "on_bed_sleep"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
18
resources/config2/interactive_objects_uni_exterior.json
Normal file
18
resources/config2/interactive_objects_uni_exterior.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"name": "Container001",
|
||||||
|
"texturePath": "resources/w/exterior/ikea_container001.png",
|
||||||
|
"meshPath": "resources/w/exterior/ikea_container001_001.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": 4.74077,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": 16.9085,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactionRadius": 0.5,
|
||||||
|
"activateFunction": "on_container_clicked"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -13,6 +13,20 @@
|
|||||||
"scale": 1.0,
|
"scale": 1.0,
|
||||||
"interactionRadius": 0.5,
|
"interactionRadius": 0.5,
|
||||||
"activateFunction": "on_bookshelf_clicked"
|
"activateFunction": "on_bookshelf_clicked"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BookshelfTeacher001",
|
||||||
|
"texturePath": "resources/w/interior/ikea_bookshelf001_tex001.png",
|
||||||
|
"meshPath": "resources/w/interior/ikea_bookshelf_teacher001_001.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": -4.94591,
|
||||||
|
"positionY": 0.96841,
|
||||||
|
"positionZ": 0.430933,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactionRadius": 0.5,
|
||||||
|
"activateFunction": "on_bookshelf_teacher_clicked"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Computer001",
|
"name": "Computer001",
|
||||||
@ -52,9 +66,23 @@
|
|||||||
"positionX": 1.97952,
|
"positionX": 1.97952,
|
||||||
"positionY": 0.95746,
|
"positionY": 0.95746,
|
||||||
"positionZ": 0.85755,
|
"positionZ": 0.85755,
|
||||||
"scale": 0.5,
|
"scale": 1.0,
|
||||||
"interactionRadius": 0.3,
|
"interactionRadius": 0.3,
|
||||||
"activateFunction": "on_book_pickup"
|
"activateFunction": "on_book_pickup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ReportCard001",
|
||||||
|
"texturePath": "resources/w/interior/report_card_tex001.png",
|
||||||
|
"meshPath": "resources/w/interior/book001.txt",
|
||||||
|
"rotationX": 0.0,
|
||||||
|
"rotationY": 0.0,
|
||||||
|
"rotationZ": 0.0,
|
||||||
|
"positionX": -5.10169,
|
||||||
|
"positionY": 0.95746,
|
||||||
|
"positionZ": 0.440886,
|
||||||
|
"scale": 1.0,
|
||||||
|
"interactionRadius": 0.3,
|
||||||
|
"activateFunction": "on_report_card_pickup"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Note001",
|
"name": "Note001",
|
||||||
|
|||||||
4
resources/config2/npcs_uni_exterior.json
Normal file
4
resources/config2/npcs_uni_exterior.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"npcs": [
|
||||||
|
]
|
||||||
|
}
|
||||||
30
resources/config2/teleports_uni_exterior.json
Normal file
30
resources/config2/teleports_uni_exterior.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"teleports": [
|
||||||
|
{
|
||||||
|
"id": "tp_loc2_to_loc1",
|
||||||
|
"positionX": 8.2,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -9.9,
|
||||||
|
"radius": 1.5,
|
||||||
|
"active": true,
|
||||||
|
"destinationLocation": "uni_interior",
|
||||||
|
"destinationPositionX": 2.64621,
|
||||||
|
"destinationPositionY": 0.0,
|
||||||
|
"destinationPositionZ": -9.37259,
|
||||||
|
"destinationRotationY": -1.5708
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tp_loc2_to_dorm",
|
||||||
|
"positionX": -21.7327,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -34.1036,
|
||||||
|
"radius": 2.5,
|
||||||
|
"active": true,
|
||||||
|
"destinationLocation": "location_dorm",
|
||||||
|
"destinationPositionX": -8.32343,
|
||||||
|
"destinationPositionY": 0.0,
|
||||||
|
"destinationPositionZ": -0.152264,
|
||||||
|
"destinationRotationY": 1.5708
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
29
resources/config2/trigger_zones_uni_exterior.json
Normal file
29
resources/config2/trigger_zones_uni_exterior.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"trigger_zones": [
|
||||||
|
{
|
||||||
|
"id": "darklands_exit001",
|
||||||
|
"positionX": 11.747,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -6.34282,
|
||||||
|
"radius": 3.0,
|
||||||
|
"hysteresis": 0.5,
|
||||||
|
"enabled": true
|
||||||
|
},{
|
||||||
|
"id": "darklands_exit002",
|
||||||
|
"positionX": 13.3522,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -10.0046,
|
||||||
|
"radius": 3.0,
|
||||||
|
"hysteresis": 0.5,
|
||||||
|
"enabled": true
|
||||||
|
},{
|
||||||
|
"id": "darklands_exit002",
|
||||||
|
"positionX": 9.92273,
|
||||||
|
"positionY": 0.0,
|
||||||
|
"positionZ": -15.5795,
|
||||||
|
"radius": 3.0,
|
||||||
|
"hysteresis": 0.5,
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -43,6 +43,24 @@
|
|||||||
"type": "End"
|
"type": "End"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dialog_no_sleep001",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
|
||||||
|
"text": "Я сейчас не хочу спать.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "dialog_phone_pickup001",
|
"id": "dialog_phone_pickup001",
|
||||||
@ -117,6 +135,42 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"cutscenes": [
|
"cutscenes": [{
|
||||||
|
"id": "sleep_cutscene001",
|
||||||
|
"background": "resources/test_cutscene001.png",
|
||||||
|
"durationMs": 5000,
|
||||||
|
"fadeOutMs": 500,
|
||||||
|
"fadeInMs": 500,
|
||||||
|
"endFadeOutMs": 500,
|
||||||
|
"endFadeInMs": 500,
|
||||||
|
"cameraTrack": [
|
||||||
|
{
|
||||||
|
"durationMs": 3000,
|
||||||
|
"from": { "focusX": 0.3, "focusY": 0.50, "zoom": 1.10, "rotationDeg": 0.0 },
|
||||||
|
"to": { "focusX": 0.7, "focusY": 0.50, "zoom": 1.00, "rotationDeg": 0.0 },
|
||||||
|
"easing": "EaseInOutSine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"durationMs": 3000,
|
||||||
|
"from": { "focusX": 0.3, "focusY": 0.50, "zoom": 1.0, "rotationDeg": 0.0 },
|
||||||
|
"to": { "focusX": 0.7, "focusY": 0.50, "zoom": 1.1, "rotationDeg": 0.0 },
|
||||||
|
"easing": "EaseInOutCubic"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lines": [
|
||||||
|
{
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/hero.png",
|
||||||
|
"text": "Я завалился спать и уснул.",
|
||||||
|
"durationMs": 3000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/hero.png",
|
||||||
|
"text": "И я проспал аж до обеда.",
|
||||||
|
"durationMs": 3000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
86
resources/dialogue/uni_exterior_dialogues.json
Normal file
86
resources/dialogue/uni_exterior_dialogues.json
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"dialogues": [
|
||||||
|
{
|
||||||
|
"id": "door_dialog001",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
|
||||||
|
"text": "Дверь закрыта на ключ.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dialog_contaier001",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
|
||||||
|
"text": "Это мусорный контейнер, я не буду в нем копаться!",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cutscenes": [
|
||||||
|
{
|
||||||
|
"id": "darklands_exit001",
|
||||||
|
"background": "resources/test_cutscene001.png",
|
||||||
|
"durationMs": 5000,
|
||||||
|
"fadeOutMs": 500,
|
||||||
|
"fadeInMs": 500,
|
||||||
|
"endFadeOutMs": 500,
|
||||||
|
"endFadeInMs": 500,
|
||||||
|
"cameraTrack": [
|
||||||
|
{
|
||||||
|
"durationMs": 3000,
|
||||||
|
"from": { "focusX": 0.3, "focusY": 0.50, "zoom": 1.10, "rotationDeg": 0.0 },
|
||||||
|
"to": { "focusX": 0.7, "focusY": 0.50, "zoom": 1.00, "rotationDeg": 0.0 },
|
||||||
|
"easing": "EaseInOutSine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"durationMs": 3000,
|
||||||
|
"from": { "focusX": 0.3, "focusY": 0.50, "zoom": 1.0, "rotationDeg": 0.0 },
|
||||||
|
"to": { "focusX": 0.7, "focusY": 0.50, "zoom": 1.1, "rotationDeg": 0.0 },
|
||||||
|
"easing": "EaseInOutCubic"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lines": [
|
||||||
|
{
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/hero.png",
|
||||||
|
"text": "Кажется, яркий свет луны разбудил меня от этого сна.",
|
||||||
|
"durationMs": 3000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/hero.png",
|
||||||
|
"text": "Жесть вообще, хочу спать.",
|
||||||
|
"durationMs": 3000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/hero.png",
|
||||||
|
"text": "Который час?",
|
||||||
|
"durationMs": 2000,
|
||||||
|
"background": "resources/test_cutscene001.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -283,6 +283,24 @@
|
|||||||
"type": "End"
|
"type": "End"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dialog_report_card001",
|
||||||
|
"start": "line_1",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "line_1",
|
||||||
|
"type": "Line",
|
||||||
|
"speaker": "Бекзат",
|
||||||
|
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
|
||||||
|
"text": "Тут лежат зачетные книжки студентов.",
|
||||||
|
"next": "end_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "end_1",
|
||||||
|
"type": "End"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"cutscenes": [
|
"cutscenes": [
|
||||||
|
|||||||
@ -59,5 +59,18 @@ game_api.set_trigger_zone_callbacks("ladder_zone001",
|
|||||||
nil
|
nil
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function on_bed_sleep()
|
||||||
|
local need_sleep = game_api.getIntValue("need_sleep")
|
||||||
|
print("Lua script need sleep =")
|
||||||
|
print(need_sleep)
|
||||||
|
if (need_sleep==0) then
|
||||||
|
game_api.start_dialogue("dialog_no_sleep001")
|
||||||
|
else
|
||||||
|
game_api.start_cutscene("sleep_cutscene001")
|
||||||
|
game_api.setIntValue("need_sleep", 0)
|
||||||
|
game_api.set_player_hp(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
print("Lua script loaded successfully--!")
|
print("Lua script loaded successfully--!")
|
||||||
54
resources/start_uni_exterior.lua
Normal file
54
resources/start_uni_exterior.lua
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
print("Lua script loaded successfully!")
|
||||||
|
|
||||||
|
game_api.set_location_callbacks(
|
||||||
|
function()
|
||||||
|
-- player just arrived here
|
||||||
|
if game_api.is_darklands() then
|
||||||
|
-- arrived while in darklands mode
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
function()
|
||||||
|
-- player is about to leave
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
function darklands_exit001_enter_callback()
|
||||||
|
if game_api.is_darklands() then
|
||||||
|
print("Lua script start_darklands_transition")
|
||||||
|
game_api.start_darklands_transition()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_container_clicked()
|
||||||
|
game_api.start_dialogue("dialog_contaier001")
|
||||||
|
end
|
||||||
|
|
||||||
|
game_api.set_darklands_callbacks(
|
||||||
|
nil,
|
||||||
|
function()
|
||||||
|
print("Lua script start_darklands_transition callback")
|
||||||
|
game_api.start_cutscene("darklands_exit001")
|
||||||
|
game_api.setIntValue("day", 1)
|
||||||
|
game_api.setIntValue("need_sleep", 1)
|
||||||
|
local need_sleep = game_api.getIntValue("need_sleep")
|
||||||
|
print("Lua script need sleep =")
|
||||||
|
print(need_sleep)
|
||||||
|
print("Lua script set need sleep 1")
|
||||||
|
game_api.set_player_hp(10)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
game_api.set_trigger_zone_callbacks("darklands_exit001",
|
||||||
|
darklands_exit001_enter_callback,
|
||||||
|
nil
|
||||||
|
)
|
||||||
|
game_api.set_trigger_zone_callbacks("darklands_exit002",
|
||||||
|
darklands_exit001_enter_callback,
|
||||||
|
nil
|
||||||
|
)
|
||||||
|
game_api.set_trigger_zone_callbacks("darklands_exit003",
|
||||||
|
darklands_exit001_enter_callback,
|
||||||
|
nil
|
||||||
|
)
|
||||||
@ -107,6 +107,9 @@ function on_npc_interact(npc_index)
|
|||||||
game_api.start_dialogue("teacher_dialog001")
|
game_api.start_dialogue("teacher_dialog001")
|
||||||
--game_api.set_trigger_zone_enabled(2, false)
|
--game_api.set_trigger_zone_enabled(2, false)
|
||||||
end
|
end
|
||||||
|
if npc_index == 2 then
|
||||||
|
game_api.start_dialogue("dialog_with_ghost001")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function teacher_zone001_enter_callback()
|
function teacher_zone001_enter_callback()
|
||||||
@ -176,7 +179,7 @@ game_api.start_dialogue("book_dialog001")
|
|||||||
game_api.switch_navigation(5)
|
game_api.switch_navigation(5)
|
||||||
end
|
end
|
||||||
if (player_in_darklands) then
|
if (player_in_darklands) then
|
||||||
game_api.start_dialogue("ghost_dialog001")
|
game_api.start_dialogue("ghost_dialog002")
|
||||||
game_api.set_trigger_zone_enabled(3, false)
|
game_api.set_trigger_zone_enabled(3, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -242,71 +245,43 @@ function on_note_pickup()
|
|||||||
game_api.start_dialogue("note_dialog001")
|
game_api.start_dialogue("note_dialog001")
|
||||||
game_api.pickup_item("note_spell")
|
game_api.pickup_item("note_spell")
|
||||||
game_api.deactivate_interactive_object("Note001")
|
game_api.deactivate_interactive_object("Note001")
|
||||||
|
|
||||||
-- After the moving to darklands:
|
|
||||||
player_in_darklands = true
|
|
||||||
darklands_fadein = 2.0
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_Corridor_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_South_1_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_South_2_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_South_3_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_North_1_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_North_1_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_North_2_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_North_3_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_Cover_Main_Hall_001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.fade_object("Room_S_0_Leaf001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_S_0_Leaf001")
|
|
||||||
end)
|
|
||||||
game_api.fade_object("Room_S_1_Leaf001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_S_1_Leaf001")
|
|
||||||
end)
|
|
||||||
game_api.fade_object("Room_S_2_Leaf001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_S_2_Leaf001")
|
|
||||||
end)
|
|
||||||
game_api.fade_object("Room_N_1_Leaf001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_N_1_Leaf001")
|
|
||||||
end)
|
|
||||||
game_api.fade_object("Room_N_2_Leaf001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Room_N_2_Leaf001")
|
|
||||||
end)
|
|
||||||
game_api.fade_object("Hall_Leaf001", 0, darklands_fadein, function()
|
|
||||||
game_api.deactivate_interactive_object("Hall_Leaf001")
|
|
||||||
end)
|
|
||||||
|
|
||||||
game_api.set_npc_enabled(2, true)
|
|
||||||
game_api.set_npc_enabled(3, true)
|
|
||||||
game_api.set_npc_enabled(4, true)
|
|
||||||
game_api.set_npc_enabled(5, true)
|
|
||||||
|
|
||||||
game_api.switch_navigation(6)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function on_report_card_pickup()
|
||||||
|
game_api.start_dialogue("dialog_report_card001")
|
||||||
|
end
|
||||||
|
function on_bookshelf_teacher_clicked()
|
||||||
|
game_api.start_dialogue("dialog_report_card001")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
game_api.set_darklands_callbacks(
|
||||||
|
function()
|
||||||
|
game_api.start_dialogue("ghost_dialog001")
|
||||||
|
game_api.set_npc_enabled(2, true)
|
||||||
|
game_api.set_npc_enabled(3, true)
|
||||||
|
game_api.set_npc_enabled(4, true)
|
||||||
|
game_api.set_npc_enabled(5, true)
|
||||||
|
|
||||||
|
game_api.switch_navigation(6)
|
||||||
|
player_in_darklands = true
|
||||||
|
|
||||||
|
end,
|
||||||
|
function()
|
||||||
|
player_in_darklands = false
|
||||||
|
game_api.start_cutscene("test_cutscene_03")
|
||||||
|
game_api.set_npc_enabled(2, false)
|
||||||
|
game_api.set_npc_enabled(2, false)
|
||||||
|
game_api.set_npc_enabled(3, false)
|
||||||
|
game_api.set_npc_enabled(4, false)
|
||||||
|
game_api.set_npc_enabled(5, false)
|
||||||
|
game_api.switch_navigation(3)
|
||||||
|
game_api.setIntValue("day", 1)
|
||||||
|
game_api.setIntValue("need_sleep", 1)
|
||||||
|
game_api.set_player_hp(10)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
game_api.set_trigger_zone_callbacks("teacher_dialog_zone001",
|
game_api.set_trigger_zone_callbacks("teacher_dialog_zone001",
|
||||||
teacher_zone001_enter_callback,
|
teacher_zone001_enter_callback,
|
||||||
|
|||||||
BIN
resources/w/exterior/darklands_Ext_Building004.png
(Stored with Git LFS)
Normal file
BIN
resources/w/exterior/darklands_Ext_Building004.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/w/exterior/darklands_Segmented_Plane002.png
(Stored with Git LFS)
Normal file
BIN
resources/w/exterior/darklands_Segmented_Plane002.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/w/exterior/darklands_door002.png
(Stored with Git LFS)
Normal file
BIN
resources/w/exterior/darklands_door002.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/w/exterior/ikea_container001.png
(Stored with Git LFS)
Normal file
BIN
resources/w/exterior/ikea_container001.png
(Stored with Git LFS)
Normal file
Binary file not shown.
68388
resources/w/exterior/ikea_container001_001.txt
Normal file
68388
resources/w/exterior/ikea_container001_001.txt
Normal file
File diff suppressed because it is too large
Load Diff
BIN
resources/w/interior/darklands_Staircase001.png
(Stored with Git LFS)
Normal file
BIN
resources/w/interior/darklands_Staircase001.png
(Stored with Git LFS)
Normal file
Binary file not shown.
37887
resources/w/interior/ikea_bookshelf_teacher001_001.txt
Normal file
37887
resources/w/interior/ikea_bookshelf_teacher001_001.txt
Normal file
File diff suppressed because it is too large
Load Diff
39
resources/w/interior/report_card001_001.txt
Normal file
39
resources/w/interior/report_card001_001.txt
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
===Vertices (Split by UV/Normal): 24
|
||||||
|
V 0: Pos(-0.05145, -0.147687, 0.028763) Norm(-0.403611, -0.709753, 0.577364) UV(0.755263, 0.547807)
|
||||||
|
V 1: Pos(-0.119724, 0.100623, -0.028762) Norm(-0.709745, 0.403636, -0.577356) UV(0.877631, 0.0)
|
||||||
|
V 2: Pos(-0.05145, -0.147687, -0.028762) Norm(-0.403639, -0.709734, -0.577368) UV(0.877631, 0.547807)
|
||||||
|
V 3: Pos(-0.119724, 0.100623, 0.028763) Norm(-0.709759, 0.403605, 0.57736) UV(0.632894, 0.925439)
|
||||||
|
V 4: Pos(0.051449, 0.147687, -0.028762) Norm(0.403639, 0.709734, -0.577368) UV(0.755263, 0.547807)
|
||||||
|
V 5: Pos(-0.119724, 0.100623, -0.028762) Norm(-0.709745, 0.403636, -0.577356) UV(0.755263, 0.925439)
|
||||||
|
V 6: Pos(0.051449, 0.147687, 0.028763) Norm(0.403611, 0.709753, 0.577364) UV(0.877631, 0.547807)
|
||||||
|
V 7: Pos(0.119723, -0.100623, -0.028762) Norm(0.709745, -0.403636, -0.577356) UV(1.0, -0.0)
|
||||||
|
V 8: Pos(0.051449, 0.147687, -0.028762) Norm(0.403639, 0.709734, -0.577368) UV(1.0, 0.547807)
|
||||||
|
V 9: Pos(0.119723, -0.100623, 0.028763) Norm(0.709759, -0.403605, 0.57736) UV(0.510526, 0.925438)
|
||||||
|
V 10: Pos(-0.05145, -0.147687, -0.028762) Norm(-0.403639, -0.709734, -0.577368) UV(0.632894, 0.547807)
|
||||||
|
V 11: Pos(0.119723, -0.100623, -0.028762) Norm(0.709745, -0.403636, -0.577356) UV(0.632894, 0.925438)
|
||||||
|
V 12: Pos(0.051449, 0.147687, -0.028762) Norm(0.403639, 0.709734, -0.577368) UV(0.0, 0.547807)
|
||||||
|
V 13: Pos(-0.05145, -0.147687, -0.028762) Norm(-0.403639, -0.709734, -0.577368) UV(0.377632, 0.0)
|
||||||
|
V 14: Pos(-0.119724, 0.100623, -0.028762) Norm(-0.709745, 0.403636, -0.577356) UV(0.377632, 0.547808)
|
||||||
|
V 15: Pos(0.051449, 0.147687, 0.028763) Norm(0.403611, 0.709753, 0.577364) UV(0.755263, 0.547807)
|
||||||
|
V 16: Pos(-0.05145, -0.147687, 0.028763) Norm(-0.403611, -0.709753, 0.577364) UV(0.377632, -0.0)
|
||||||
|
V 17: Pos(0.119723, -0.100623, 0.028763) Norm(0.709759, -0.403605, 0.57736) UV(0.755263, -0.0)
|
||||||
|
V 18: Pos(-0.119724, 0.100623, 0.028763) Norm(-0.709759, 0.403605, 0.57736) UV(0.755263, 0.0)
|
||||||
|
V 19: Pos(0.051449, 0.147687, 0.028763) Norm(0.403611, 0.709753, 0.577364) UV(0.632894, 0.547807)
|
||||||
|
V 20: Pos(0.119723, -0.100623, 0.028763) Norm(0.709759, -0.403605, 0.57736) UV(0.877631, -0.0)
|
||||||
|
V 21: Pos(-0.05145, -0.147687, 0.028763) Norm(-0.403611, -0.709753, 0.577364) UV(0.510526, 0.547807)
|
||||||
|
V 22: Pos(0.119723, -0.100623, -0.028762) Norm(0.709745, -0.403636, -0.577356) UV(0.0, 0.0)
|
||||||
|
V 23: Pos(-0.119724, 0.100623, 0.028763) Norm(-0.709759, 0.403605, 0.57736) UV(0.377632, 0.547807)
|
||||||
|
|
||||||
|
===Triangles (Indices): 12
|
||||||
|
Tri: 0 1 2
|
||||||
|
Tri: 3 4 5
|
||||||
|
Tri: 6 7 8
|
||||||
|
Tri: 9 10 11
|
||||||
|
Tri: 12 13 14
|
||||||
|
Tri: 15 16 17
|
||||||
|
Tri: 0 18 1
|
||||||
|
Tri: 3 19 4
|
||||||
|
Tri: 6 20 7
|
||||||
|
Tri: 9 21 10
|
||||||
|
Tri: 12 22 13
|
||||||
|
Tri: 15 23 16
|
||||||
BIN
resources/w/interior/report_card_tex001.png
(Stored with Git LFS)
Normal file
BIN
resources/w/interior/report_card_tex001.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -432,6 +432,17 @@ void Character::update(int64_t deltaMs) {
|
|||||||
if (currentState == AnimationState::ACTION_TO_DEATH)
|
if (currentState == AnimationState::ACTION_TO_DEATH)
|
||||||
{
|
{
|
||||||
currentState = AnimationState::DEATH_IDLE;
|
currentState = AnimationState::DEATH_IDLE;
|
||||||
|
if (onDeathAnimComplete) {
|
||||||
|
auto cb = std::move(onDeathAnimComplete);
|
||||||
|
onDeathAnimComplete = nullptr;
|
||||||
|
cb();
|
||||||
|
//TODO: need to add some delay here
|
||||||
|
currentState = AnimationState::STAND;
|
||||||
|
resetAnim = true;
|
||||||
|
showWeapon = false;
|
||||||
|
battle_state = 0;
|
||||||
|
attack = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -146,6 +146,9 @@ public:
|
|||||||
float slowMoActiveTime = 6.0f;
|
float slowMoActiveTime = 6.0f;
|
||||||
float getSpeedMultiplier(float transitionProgress) const;
|
float getSpeedMultiplier(float transitionProgress) const;
|
||||||
|
|
||||||
|
// Called once when the death animation finishes and the character enters DEATH_IDLE.
|
||||||
|
std::function<void()> onDeathAnimComplete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::map<AnimationState, BoneAnimationDataNew> animations;
|
std::map<AnimationState, BoneAnimationDataNew> animations;
|
||||||
|
|||||||
152
src/Game.cpp
152
src/Game.cpp
@ -147,6 +147,18 @@ namespace ZL
|
|||||||
renderer.shaderManager.AddShaderFromFiles("darklands_fog", "resources/shaders/darklands_fog.vertex", "resources/shaders/darklands_fog_web.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("darklands_fog", "resources/shaders/darklands_fog.vertex", "resources/shaders/darklands_fog_web.fragment", CONST_ZIP_FILE);
|
||||||
renderer.shaderManager.AddShaderFromFiles("darklands_fog_skinning", "resources/shaders/darklands_fog_skinning.vertex", "resources/shaders/darklands_fog_web.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("darklands_fog_skinning", "resources/shaders/darklands_fog_skinning.vertex", "resources/shaders/darklands_fog_web.fragment", CONST_ZIP_FILE);
|
||||||
renderer.shaderManager.AddShaderFromFiles("darklands_flash", "resources/shaders/default.vertex", "resources/shaders/darklands_flash_web.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("darklands_flash", "resources/shaders/default.vertex", "resources/shaders/darklands_flash_web.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("cutsceneFade", "resources/shaders/default.vertex", "resources/shaders/cutscene_fade_web.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("cutsceneBlack", "resources/shaders/default.vertex", "resources/shaders/cutscene_black_web.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("shadow_depth", "resources/shaders/shadow_depth.vertex", "resources/shaders/shadow_depth_web.fragment", CONST_ZIP_FILE);
|
||||||
|
std::cout << "Load resurces step 12x1" << std::endl;
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("shadow_depth_skinning", "resources/shaders/shadow_depth_skinning.vertex", "resources/shaders/shadow_depth_web.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("default_shadow", "resources/shaders/default_shadow.vertex", "resources/shaders/default_shadow_web.fragment", CONST_ZIP_FILE);
|
||||||
|
std::cout << "Load resurces step 12x3" << std::endl;
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("skinning_shadow", "resources/shaders/skinning_shadow.vertex", "resources/shaders/default_shadow_web.fragment", CONST_ZIP_FILE);
|
||||||
|
std::cout << "Load resurces step 12x4" << std::endl;
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("fog_shadow", "resources/shaders/fog_shadow.vertex", "resources/shaders/fog_shadow_web.fragment", CONST_ZIP_FILE);
|
||||||
|
std::cout << "Load resurces step 12x5" << std::endl;
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("fog_skinning_shadow", "resources/shaders/fog_skinning_shadow.vertex", "resources/shaders/fog_shadow_web.fragment", CONST_ZIP_FILE);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
renderer.shaderManager.AddShaderFromFiles("env_sky", "resources/shaders/env_sky.vertex", "resources/shaders/env_sky_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("env_sky", "resources/shaders/env_sky.vertex", "resources/shaders/env_sky_desktop.fragment", CONST_ZIP_FILE);
|
||||||
@ -161,6 +173,15 @@ namespace ZL
|
|||||||
renderer.shaderManager.AddShaderFromFiles("darklands_fog", "resources/shaders/darklands_fog.vertex", "resources/shaders/darklands_fog_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("darklands_fog", "resources/shaders/darklands_fog.vertex", "resources/shaders/darklands_fog_desktop.fragment", CONST_ZIP_FILE);
|
||||||
renderer.shaderManager.AddShaderFromFiles("darklands_fog_skinning", "resources/shaders/darklands_fog_skinning.vertex", "resources/shaders/darklands_fog_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("darklands_fog_skinning", "resources/shaders/darklands_fog_skinning.vertex", "resources/shaders/darklands_fog_desktop.fragment", CONST_ZIP_FILE);
|
||||||
renderer.shaderManager.AddShaderFromFiles("darklands_flash", "resources/shaders/default.vertex", "resources/shaders/darklands_flash_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("darklands_flash", "resources/shaders/default.vertex", "resources/shaders/darklands_flash_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("cutsceneFade", "resources/shaders/default.vertex", "resources/shaders/cutscene_fade_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("cutsceneBlack", "resources/shaders/default.vertex", "resources/shaders/cutscene_black_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("shadow_depth", "resources/shaders/shadow_depth.vertex", "resources/shaders/shadow_depth_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("shadow_depth_skinning", "resources/shaders/shadow_depth_skinning.vertex", "resources/shaders/shadow_depth_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("default_shadow", "resources/shaders/default_shadow.vertex", "resources/shaders/default_shadow_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("skinning_shadow", "resources/shaders/skinning_shadow.vertex", "resources/shaders/default_shadow_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("fog_shadow", "resources/shaders/fog_shadow.vertex", "resources/shaders/fog_shadow_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
renderer.shaderManager.AddShaderFromFiles("fog_skinning_shadow", "resources/shaders/fog_skinning_shadow.vertex", "resources/shaders/fog_shadow_desktop.fragment", CONST_ZIP_FILE);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::cout << "Load resurces step 4" << std::endl;
|
std::cout << "Load resurces step 4" << std::endl;
|
||||||
@ -201,19 +222,29 @@ namespace ZL
|
|||||||
|
|
||||||
locations["uni_interior"] = std::make_shared<Location>(renderer, inventory);
|
locations["uni_interior"] = std::make_shared<Location>(renderer, inventory);
|
||||||
locations["uni_interior"]->setup(uniInteriorParams);
|
locations["uni_interior"]->setup(uniInteriorParams);
|
||||||
|
locations["uni_interior"]->scriptEngine.setGlobalStore(&globalInts);
|
||||||
|
locations["uni_interior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||||
|
if (locations["uni_interior"]->player)
|
||||||
|
locations["uni_interior"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
|
||||||
|
|
||||||
LocationSetup uniExteriorParams = uniInteriorParams;
|
LocationSetup uniExteriorParams = uniInteriorParams;
|
||||||
uniExteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects2.json";
|
uniExteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects_uni_exterior.json";
|
||||||
uniExteriorParams.interactiveObjectsJsonPath = "";
|
uniExteriorParams.interactiveObjectsJsonPath = "resources/config2/interactive_objects_uni_exterior.json";
|
||||||
//uniExteriorParams.navigationJsonPaths = {"resources/config2/navigation2.json"};
|
//uniExteriorParams.navigationJsonPaths = {"resources/config2/navigation2.json"};
|
||||||
uniExteriorParams.navigationJsonPaths = { "resources/w/nav_uni_exterior.txt" };
|
uniExteriorParams.navigationJsonPaths = { "resources/w/nav_uni_exterior.txt" };
|
||||||
uniExteriorParams.teleportsJsonPath = "resources/config2/teleports2.json";
|
uniExteriorParams.teleportsJsonPath = "resources/config2/teleports_uni_exterior.json";
|
||||||
uniExteriorParams.triggerZonesJsonPath = "resources/config2/trigger_zones2.json";
|
uniExteriorParams.triggerZonesJsonPath = "resources/config2/trigger_zones_uni_exterior.json";
|
||||||
uniExteriorParams.scriptPath = "resources/start2.lua";
|
uniExteriorParams.scriptPath = "resources/start_uni_exterior.lua";
|
||||||
uniExteriorParams.playerPosition = Eigen::Vector3f(5, 0, -18.4);
|
uniExteriorParams.playerPosition = Eigen::Vector3f(5, 0, -18.4);
|
||||||
uniExteriorParams.npcsJsonPath = "resources/config2/npcs2.json";
|
uniExteriorParams.npcsJsonPath = "resources/config2/npcs_uni_exterior.json";
|
||||||
|
uniExteriorParams.dialoguesJsonPath = "resources/dialogue/uni_exterior_dialogues.json";
|
||||||
|
|
||||||
locations["uni_exterior"] = std::make_shared<Location>(renderer, inventory);
|
locations["uni_exterior"] = std::make_shared<Location>(renderer, inventory);
|
||||||
locations["uni_exterior"]->setup(uniExteriorParams);
|
locations["uni_exterior"]->setup(uniExteriorParams);
|
||||||
|
locations["uni_exterior"]->scriptEngine.setGlobalStore(&globalInts);
|
||||||
|
locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||||
|
if (locations["uni_exterior"]->player)
|
||||||
|
locations["uni_exterior"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
|
||||||
|
|
||||||
LocationSetup params_dorm;
|
LocationSetup params_dorm;
|
||||||
params_dorm.gameObjectsJsonPath = "resources/config2/gameobjects_dorm.json";
|
params_dorm.gameObjectsJsonPath = "resources/config2/gameobjects_dorm.json";
|
||||||
@ -230,6 +261,10 @@ namespace ZL
|
|||||||
|
|
||||||
locations["location_dorm"] = std::make_shared<Location>(renderer, inventory);
|
locations["location_dorm"] = std::make_shared<Location>(renderer, inventory);
|
||||||
locations["location_dorm"]->setup(params_dorm);
|
locations["location_dorm"]->setup(params_dorm);
|
||||||
|
locations["location_dorm"]->scriptEngine.setGlobalStore(&globalInts);
|
||||||
|
locations["location_dorm"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||||
|
if (locations["location_dorm"]->player)
|
||||||
|
locations["location_dorm"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
|
||||||
|
|
||||||
// Teleport callbacks: destination name and position come from the teleport zone data.
|
// Teleport callbacks: destination name and position come from the teleport zone data.
|
||||||
auto teleportCallback = [this](const std::string& destName, const Eigen::Vector3f& destPos, float destRotY) {
|
auto teleportCallback = [this](const std::string& destName, const Eigen::Vector3f& destPos, float destRotY) {
|
||||||
@ -239,6 +274,8 @@ namespace ZL
|
|||||||
std::cerr << "[TELEPORT] Unknown destination location: " << destName << std::endl;
|
std::cerr << "[TELEPORT] Unknown destination location: " << destName << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (currentLocation)
|
||||||
|
currentLocation->scriptEngine.callLocationExitCallback();
|
||||||
currentLocation = it->second;
|
currentLocation = it->second;
|
||||||
if (currentLocation->player) {
|
if (currentLocation->player) {
|
||||||
currentLocation->player->position = destPos;
|
currentLocation->player->position = destPos;
|
||||||
@ -247,7 +284,7 @@ namespace ZL
|
|||||||
currentLocation->player->targetFacingAngle = destRotY;
|
currentLocation->player->targetFacingAngle = destRotY;
|
||||||
}
|
}
|
||||||
currentLocation->cameraAzimuth = destRotY;
|
currentLocation->cameraAzimuth = destRotY;
|
||||||
|
currentLocation->scriptEngine.callLocationEnterCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
locations["uni_exterior"]->onTeleport = teleportCallback;
|
locations["uni_exterior"]->onTeleport = teleportCallback;
|
||||||
@ -255,9 +292,10 @@ namespace ZL
|
|||||||
locations["location_dorm"]->onTeleport = teleportCallback;
|
locations["location_dorm"]->onTeleport = teleportCallback;
|
||||||
|
|
||||||
currentLocation = locations["location_dorm"];
|
currentLocation = locations["location_dorm"];
|
||||||
|
currentLocation->scriptEngine.callLocationEnterCallback();
|
||||||
|
|
||||||
std::cout << "Load resurces step 5" << std::endl;
|
std::cout << "Load resurces step 5" << std::endl;
|
||||||
|
/*
|
||||||
std::cout << "Load resurces step 12" << std::endl;
|
std::cout << "Load resurces step 12" << std::endl;
|
||||||
|
|
||||||
// Shadow mapping shaders
|
// Shadow mapping shaders
|
||||||
@ -287,7 +325,7 @@ namespace ZL
|
|||||||
renderer.shaderManager.AddShaderFromFiles("fog_skinning_shadow", "resources/shaders/fog_skinning_shadow.vertex", "resources/shaders/fog_shadow_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("fog_skinning_shadow", "resources/shaders/fog_skinning_shadow.vertex", "resources/shaders/fog_shadow_desktop.fragment", CONST_ZIP_FILE);
|
||||||
renderer.shaderManager.AddShaderFromFiles("cutsceneFade", "resources/shaders/default.vertex", "resources/shaders/cutscene_fade_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("cutsceneFade", "resources/shaders/default.vertex", "resources/shaders/cutscene_fade_desktop.fragment", CONST_ZIP_FILE);
|
||||||
renderer.shaderManager.AddShaderFromFiles("cutsceneBlack", "resources/shaders/default.vertex", "resources/shaders/cutscene_black_desktop.fragment", CONST_ZIP_FILE);
|
renderer.shaderManager.AddShaderFromFiles("cutsceneBlack", "resources/shaders/default.vertex", "resources/shaders/cutscene_black_desktop.fragment", CONST_ZIP_FILE);
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
std::cout << "Load resurces step 13" << std::endl;
|
std::cout << "Load resurces step 13" << std::endl;
|
||||||
|
|
||||||
@ -349,7 +387,10 @@ namespace ZL
|
|||||||
{
|
{
|
||||||
if (currentLocation)
|
if (currentLocation)
|
||||||
{
|
{
|
||||||
if (currentLocation->isDarklands) {
|
// Sync global darklands flag so Location's raycast and draw functions see it.
|
||||||
|
currentLocation->isDarklands = isDarklands;
|
||||||
|
|
||||||
|
if (isDarklands) {
|
||||||
currentLocation->drawGameDarklands();
|
currentLocation->drawGameDarklands();
|
||||||
CheckGlError(__FILE__, __LINE__);
|
CheckGlError(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
@ -370,6 +411,7 @@ namespace ZL
|
|||||||
// ??? Main menu???
|
// ??? Main menu???
|
||||||
}
|
}
|
||||||
drawUI();
|
drawUI();
|
||||||
|
drawDarklandsFlash();
|
||||||
}
|
}
|
||||||
CheckGlError(__FILE__, __LINE__);
|
CheckGlError(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
@ -429,6 +471,8 @@ namespace ZL
|
|||||||
|
|
||||||
lastTickCount = newTickCount;
|
lastTickCount = newTickCount;
|
||||||
|
|
||||||
|
updateDarklandsFlash(delta);
|
||||||
|
|
||||||
if (currentLocation)
|
if (currentLocation)
|
||||||
{
|
{
|
||||||
currentLocation->update(delta);
|
currentLocation->update(delta);
|
||||||
@ -543,8 +587,7 @@ namespace ZL
|
|||||||
if (event.type == SDL_KEYDOWN && event.key.repeat == 0) {
|
if (event.type == SDL_KEYDOWN && event.key.repeat == 0) {
|
||||||
switch (event.key.keysym.sym) {
|
switch (event.key.keysym.sym) {
|
||||||
case SDLK_0:
|
case SDLK_0:
|
||||||
if (currentLocation)
|
startDarklandsTransition();
|
||||||
currentLocation->startDarklandsTransition();
|
|
||||||
break;
|
break;
|
||||||
case SDLK_1:
|
case SDLK_1:
|
||||||
//if (audioPlayer) audioPlayer->playSoundAsync("audio/background.wav");
|
//if (audioPlayer) audioPlayer->playSoundAsync("audio/background.wav");
|
||||||
@ -577,15 +620,15 @@ namespace ZL
|
|||||||
case SDLK_o:
|
case SDLK_o:
|
||||||
//y = y + 0.002;
|
//y = y + 0.002;
|
||||||
//currentLocation->player->hp = 200;
|
//currentLocation->player->hp = 200;
|
||||||
currentLocation->npcs[0]->walkSpeed += 0.01f;
|
//currentLocation->npcs[0]->walkSpeed += 0.01f;
|
||||||
std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
|
//std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_k:
|
case SDLK_k:
|
||||||
//y = y - 0.002;
|
//y = y - 0.002;
|
||||||
std::cout << "Player pos: " << currentLocation->player->position.transpose() << std::endl;
|
std::cout << "Player pos: " << currentLocation->player->position.transpose() << std::endl;
|
||||||
currentLocation->npcs[0]->walkSpeed -= 0.01f;
|
//currentLocation->npcs[0]->walkSpeed -= 0.01f;
|
||||||
std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
|
//std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_p:
|
case SDLK_p:
|
||||||
@ -865,4 +908,81 @@ namespace ZL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Game::startDarklandsTransition()
|
||||||
|
{
|
||||||
|
if (darklandsFlashActive) return false;
|
||||||
|
darklandsFlashActive = true;
|
||||||
|
darklandsFlashFadingIn = true;
|
||||||
|
darklandsFlashAlpha = 0.0f;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::updateDarklandsFlash(int64_t deltaMs)
|
||||||
|
{
|
||||||
|
if (!darklandsFlashActive) return;
|
||||||
|
static constexpr float kFadeDurationMs = 500.0f;
|
||||||
|
const float step = static_cast<float>(deltaMs) / kFadeDurationMs;
|
||||||
|
|
||||||
|
if (darklandsFlashFadingIn) {
|
||||||
|
darklandsFlashAlpha = min(darklandsFlashAlpha + step, 1.0f);
|
||||||
|
if (darklandsFlashAlpha >= 1.0f) {
|
||||||
|
isDarklands = !isDarklands;
|
||||||
|
if (currentLocation) {
|
||||||
|
if (isDarklands)
|
||||||
|
currentLocation->scriptEngine.callDarklandsEnterCallback();
|
||||||
|
else
|
||||||
|
currentLocation->scriptEngine.callDarklandsExitCallback();
|
||||||
|
}
|
||||||
|
darklandsFlashFadingIn = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
darklandsFlashAlpha = max(darklandsFlashAlpha - step, 0.0f);
|
||||||
|
if (darklandsFlashAlpha <= 0.0f) {
|
||||||
|
darklandsFlashAlpha = 0.0f;
|
||||||
|
darklandsFlashActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::drawDarklandsFlash()
|
||||||
|
{
|
||||||
|
if (darklandsFlashAlpha <= 0.001f) return;
|
||||||
|
|
||||||
|
const float W = static_cast<float>(Environment::projectionWidth);
|
||||||
|
const float H = static_cast<float>(Environment::projectionHeight);
|
||||||
|
|
||||||
|
if (darklandsFlashQuadW != W || darklandsFlashQuadH != H) {
|
||||||
|
darklandsFlashQuadW = W;
|
||||||
|
darklandsFlashQuadH = H;
|
||||||
|
VertexDataStruct data;
|
||||||
|
data.PositionData = {
|
||||||
|
{0.f, 0.f, 0.f}, {0.f, H, 0.f}, {W, H, 0.f},
|
||||||
|
{W, H, 0.f}, {W, 0.f, 0.f}, {0.f, 0.f, 0.f}
|
||||||
|
};
|
||||||
|
data.TexCoordData = {
|
||||||
|
{0.f, 0.f}, {0.f, 1.f}, {1.f, 1.f},
|
||||||
|
{1.f, 1.f}, {1.f, 0.f}, {0.f, 0.f}
|
||||||
|
};
|
||||||
|
darklandsFlashQuad.data = std::move(data);
|
||||||
|
darklandsFlashQuad.RefreshVBO();
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
renderer.shaderManager.PushShader("darklands_flash");
|
||||||
|
renderer.PushProjectionMatrix(0.0f, W, 0.0f, H, -10.0f, 10.0f);
|
||||||
|
renderer.PushMatrix();
|
||||||
|
renderer.LoadIdentity();
|
||||||
|
|
||||||
|
renderer.RenderUniform1f("uAlpha", darklandsFlashAlpha);
|
||||||
|
renderer.DrawVertexRenderStruct(darklandsFlashQuad);
|
||||||
|
|
||||||
|
renderer.PopMatrix();
|
||||||
|
renderer.PopProjectionMatrix();
|
||||||
|
renderer.shaderManager.PopShader();
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ZL
|
} // namespace ZL
|
||||||
18
src/Game.h
18
src/Game.h
@ -47,9 +47,16 @@ namespace ZL {
|
|||||||
|
|
||||||
bool navigationEditorMode = false;
|
bool navigationEditorMode = false;
|
||||||
|
|
||||||
|
// Global darklands state — persists across location transitions.
|
||||||
|
bool isDarklands = false;
|
||||||
|
// Returns false if a transition is already in progress.
|
||||||
|
bool startDarklandsTransition();
|
||||||
|
|
||||||
Inventory inventory;
|
Inventory inventory;
|
||||||
InteractiveObject* pickedUpObject = nullptr;
|
InteractiveObject* pickedUpObject = nullptr;
|
||||||
|
|
||||||
|
std::unordered_map<std::string, int> globalInts;
|
||||||
|
|
||||||
MenuManager menuManager;
|
MenuManager menuManager;
|
||||||
|
|
||||||
void activateSlowMoEffect();
|
void activateSlowMoEffect();
|
||||||
@ -105,6 +112,17 @@ namespace ZL {
|
|||||||
static void onResourcesZipError(const char* filename);
|
static void onResourcesZipError(const char* filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// White-flash transition state
|
||||||
|
float darklandsFlashAlpha = 0.0f;
|
||||||
|
bool darklandsFlashActive = false;
|
||||||
|
bool darklandsFlashFadingIn = true;
|
||||||
|
VertexRenderStruct darklandsFlashQuad;
|
||||||
|
float darklandsFlashQuadW = -1.0f;
|
||||||
|
float darklandsFlashQuadH = -1.0f;
|
||||||
|
|
||||||
|
void updateDarklandsFlash(int64_t deltaMs);
|
||||||
|
void drawDarklandsFlash();
|
||||||
|
|
||||||
int64_t newTickCount;
|
int64_t newTickCount;
|
||||||
int64_t lastTickCount;
|
int64_t lastTickCount;
|
||||||
|
|
||||||
|
|||||||
@ -270,77 +270,6 @@ namespace ZL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Location::startDarklandsTransition()
|
|
||||||
{
|
|
||||||
if (darklandsFlashActive) return false;
|
|
||||||
darklandsFlashActive = true;
|
|
||||||
darklandsFlashFadingIn = true;
|
|
||||||
darklandsFlashAlpha = 0.0f;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Location::updateDarklandsFlash(int64_t deltaMs)
|
|
||||||
{
|
|
||||||
if (!darklandsFlashActive) return;
|
|
||||||
static constexpr float kFadeDurationMs = 500.0f;
|
|
||||||
const float step = static_cast<float>(deltaMs) / kFadeDurationMs;
|
|
||||||
|
|
||||||
if (darklandsFlashFadingIn) {
|
|
||||||
darklandsFlashAlpha = min(darklandsFlashAlpha + step, 1.0f);
|
|
||||||
if (darklandsFlashAlpha >= 1.0f) {
|
|
||||||
isDarklands = !isDarklands;
|
|
||||||
darklandsFlashFadingIn = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
darklandsFlashAlpha = max(darklandsFlashAlpha - step, 0.0f);
|
|
||||||
if (darklandsFlashAlpha <= 0.0f) {
|
|
||||||
darklandsFlashAlpha = 0.0f;
|
|
||||||
darklandsFlashActive = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Location::drawDarklandsFlash()
|
|
||||||
{
|
|
||||||
if (darklandsFlashAlpha <= 0.001f) return;
|
|
||||||
|
|
||||||
const float W = static_cast<float>(Environment::projectionWidth);
|
|
||||||
const float H = static_cast<float>(Environment::projectionHeight);
|
|
||||||
|
|
||||||
if (darklandsFlashQuadW != W || darklandsFlashQuadH != H) {
|
|
||||||
darklandsFlashQuadW = W;
|
|
||||||
darklandsFlashQuadH = H;
|
|
||||||
VertexDataStruct data;
|
|
||||||
data.PositionData = {
|
|
||||||
{0.f, 0.f, 0.f}, {0.f, H, 0.f}, {W, H, 0.f},
|
|
||||||
{W, H, 0.f}, {W, 0.f, 0.f}, {0.f, 0.f, 0.f}
|
|
||||||
};
|
|
||||||
data.TexCoordData = {
|
|
||||||
{0.f, 0.f}, {0.f, 1.f}, {1.f, 1.f},
|
|
||||||
{1.f, 1.f}, {1.f, 0.f}, {0.f, 0.f}
|
|
||||||
};
|
|
||||||
darklandsFlashQuad.data = std::move(data);
|
|
||||||
darklandsFlashQuad.RefreshVBO();
|
|
||||||
}
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
renderer.shaderManager.PushShader("darklands_flash");
|
|
||||||
renderer.PushProjectionMatrix(0.0f, W, 0.0f, H, -10.0f, 10.0f);
|
|
||||||
renderer.PushMatrix();
|
|
||||||
renderer.LoadIdentity();
|
|
||||||
|
|
||||||
renderer.RenderUniform1f("uAlpha", darklandsFlashAlpha);
|
|
||||||
renderer.DrawVertexRenderStruct(darklandsFlashQuad);
|
|
||||||
|
|
||||||
renderer.PopMatrix();
|
|
||||||
renderer.PopProjectionMatrix();
|
|
||||||
renderer.shaderManager.PopShader();
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Location::setupNavigation(const std::vector<std::string>& paths)
|
void Location::setupNavigation(const std::vector<std::string>& paths)
|
||||||
{
|
{
|
||||||
navigationMapPaths = paths;
|
navigationMapPaths = paths;
|
||||||
@ -777,7 +706,6 @@ namespace ZL
|
|||||||
if (npc) npc->drawHealthBar(renderer, currentView, proj);
|
if (npc) npc->drawHealthBar(renderer, currentView, proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawDarklandsFlash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Location::drawShadowDepthPass()
|
void Location::drawShadowDepthPass()
|
||||||
@ -977,7 +905,6 @@ namespace ZL
|
|||||||
if (npc) npc->drawHealthBar(renderer, cameraViewMatrix, proj);
|
if (npc) npc->drawHealthBar(renderer, cameraViewMatrix, proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawDarklandsFlash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Location::drawGameDarklands()
|
void Location::drawGameDarklands()
|
||||||
@ -1047,7 +974,6 @@ namespace ZL
|
|||||||
if (npc) npc->drawHealthBar(renderer, currentView, proj);
|
if (npc) npc->drawHealthBar(renderer, currentView, proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawDarklandsFlash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Location::setNavigationAreaAvailable(const std::string& areaName, bool available)
|
bool Location::setNavigationAreaAvailable(const std::string& areaName, bool available)
|
||||||
@ -1208,8 +1134,6 @@ namespace ZL
|
|||||||
|
|
||||||
void Location::update(int64_t delta)
|
void Location::update(int64_t delta)
|
||||||
{
|
{
|
||||||
updateDarklandsFlash(delta);
|
|
||||||
|
|
||||||
for (auto& intObj : interactiveObjects) {
|
for (auto& intObj : interactiveObjects) {
|
||||||
intObj.update(delta);
|
intObj.update(delta);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,10 +83,13 @@ namespace ZL
|
|||||||
|
|
||||||
std::vector<TriggerZone> triggerZones;
|
std::vector<TriggerZone> triggerZones;
|
||||||
|
|
||||||
|
// Set by Game and kept in sync across location transitions.
|
||||||
|
// Read by draw functions and raycast — do not write from Location code.
|
||||||
bool isDarklands = false;
|
bool isDarklands = false;
|
||||||
|
|
||||||
// Returns false if a transition is already in progress (guards against double-press).
|
// Set by Game after setup(). Lua and onDeathAnimComplete call this to
|
||||||
bool startDarklandsTransition();
|
// request the transition without coupling Location to Game directly.
|
||||||
|
std::function<bool()> requestDarklandsTransition;
|
||||||
|
|
||||||
// Navigation editor — toggle with 'N', save with 'B', right-click to finalize polygon
|
// Navigation editor — toggle with 'N', save with 'B', right-click to finalize polygon
|
||||||
bool navigationEditorMode = false;
|
bool navigationEditorMode = false;
|
||||||
@ -143,17 +146,6 @@ namespace ZL
|
|||||||
Inventory& inventory;
|
Inventory& inventory;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// White-flash transition state for darklands toggle
|
|
||||||
float darklandsFlashAlpha = 0.0f;
|
|
||||||
bool darklandsFlashActive = false;
|
|
||||||
bool darklandsFlashFadingIn = true;
|
|
||||||
VertexRenderStruct darklandsFlashQuad;
|
|
||||||
float darklandsFlashQuadW = -1.0f;
|
|
||||||
float darklandsFlashQuadH = -1.0f;
|
|
||||||
|
|
||||||
void updateDarklandsFlash(int64_t deltaMs);
|
|
||||||
void drawDarklandsFlash();
|
|
||||||
|
|
||||||
void resolveCharacterCollisions();
|
void resolveCharacterCollisions();
|
||||||
void updateDynamicReplans(int64_t deltaMs);
|
void updateDynamicReplans(int64_t deltaMs);
|
||||||
void loadTeleportZones(const std::string& jsonPath, const char* zipFile);
|
void loadTeleportZones(const std::string& jsonPath, const char* zipFile);
|
||||||
|
|||||||
@ -16,6 +16,11 @@ namespace ZL {
|
|||||||
std::unordered_map<std::string, sol::protected_function> triggerEnterCallbacks;
|
std::unordered_map<std::string, sol::protected_function> triggerEnterCallbacks;
|
||||||
std::unordered_map<std::string, sol::protected_function> triggerExitCallbacks;
|
std::unordered_map<std::string, sol::protected_function> triggerExitCallbacks;
|
||||||
std::unordered_map<std::string, sol::protected_function> cutsceneCompleteCallbacks;
|
std::unordered_map<std::string, sol::protected_function> cutsceneCompleteCallbacks;
|
||||||
|
std::unordered_map<std::string, int>* globalInts = nullptr;
|
||||||
|
sol::protected_function locationEnterCallback;
|
||||||
|
sol::protected_function locationExitCallback;
|
||||||
|
sol::protected_function darklandsEnterCallback;
|
||||||
|
sol::protected_function darklandsExitCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
ScriptEngine::ScriptEngine() = default;
|
ScriptEngine::ScriptEngine() = default;
|
||||||
@ -163,6 +168,63 @@ namespace ZL {
|
|||||||
this_impl->triggerExitCallbacks[zoneId] = onExit.as<sol::protected_function>();
|
this_impl->triggerExitCallbacks[zoneId] = onExit.as<sol::protected_function>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// start_darklands_transition()
|
||||||
|
// Triggers the white-flash transition to toggle darklands mode.
|
||||||
|
// Does nothing if a transition is already in progress.
|
||||||
|
api.set_function("start_darklands_transition",
|
||||||
|
[game]() {
|
||||||
|
if (game->requestDarklandsTransition)
|
||||||
|
game->requestDarklandsTransition();
|
||||||
|
});
|
||||||
|
|
||||||
|
// set_location_callbacks(on_enter, on_exit)
|
||||||
|
// on_enter() called once when the player arrives at this location.
|
||||||
|
// on_exit() called once just before the player leaves this location.
|
||||||
|
api.set_function("set_location_callbacks",
|
||||||
|
[this_impl = impl.get()](sol::object onEnter, sol::object onExit) {
|
||||||
|
if (onEnter.is<sol::protected_function>())
|
||||||
|
this_impl->locationEnterCallback = onEnter.as<sol::protected_function>();
|
||||||
|
if (onExit.is<sol::protected_function>())
|
||||||
|
this_impl->locationExitCallback = onExit.as<sol::protected_function>();
|
||||||
|
});
|
||||||
|
|
||||||
|
// is_darklands() → bool
|
||||||
|
api.set_function("is_darklands",
|
||||||
|
[game]() { return game->isDarklands; });
|
||||||
|
|
||||||
|
// set_player_hp(value) — sets the player's current HP directly.
|
||||||
|
api.set_function("set_player_hp",
|
||||||
|
[game](float value) {
|
||||||
|
if (game->player)
|
||||||
|
game->player->hp = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Global integer store — shared across all location scripts.
|
||||||
|
// setIntValue(key, value) / getIntValue(key) → int (0 if not set)
|
||||||
|
api.set_function("setIntValue",
|
||||||
|
[this_impl = impl.get()](const std::string& key, int value) {
|
||||||
|
if (this_impl->globalInts)
|
||||||
|
(*this_impl->globalInts)[key] = value;
|
||||||
|
});
|
||||||
|
api.set_function("getIntValue",
|
||||||
|
[this_impl = impl.get()](const std::string& key) -> int {
|
||||||
|
if (!this_impl->globalInts) return 0;
|
||||||
|
auto it = this_impl->globalInts->find(key);
|
||||||
|
return it != this_impl->globalInts->end() ? it->second : 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// set_darklands_callbacks(on_enter, on_exit)
|
||||||
|
// on_enter() called when the player switches into Darklands mode.
|
||||||
|
// on_exit() called when the player switches back to normal mode.
|
||||||
|
// Pass nil to omit either callback.
|
||||||
|
api.set_function("set_darklands_callbacks",
|
||||||
|
[this_impl = impl.get()](sol::object onEnter, sol::object onExit) {
|
||||||
|
if (onEnter.is<sol::protected_function>())
|
||||||
|
this_impl->darklandsEnterCallback = onEnter.as<sol::protected_function>();
|
||||||
|
if (onExit.is<sol::protected_function>())
|
||||||
|
this_impl->darklandsExitCallback = onExit.as<sol::protected_function>();
|
||||||
|
});
|
||||||
|
|
||||||
api.set_function("set_trigger_zone_enabled",
|
api.set_function("set_trigger_zone_enabled",
|
||||||
[game](int index, bool value) {
|
[game](int index, bool value) {
|
||||||
auto& triggerZones = game->triggerZones;
|
auto& triggerZones = game->triggerZones;
|
||||||
@ -405,6 +467,46 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptEngine::setGlobalStore(std::unordered_map<std::string, int>* store) {
|
||||||
|
if (impl) impl->globalInts = store;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngine::callLocationEnterCallback() {
|
||||||
|
if (!impl || !impl->locationEnterCallback.valid()) return;
|
||||||
|
auto result = impl->locationEnterCallback();
|
||||||
|
if (!result.valid()) {
|
||||||
|
sol::error err = result;
|
||||||
|
std::cerr << "[SCRIPT] location enter callback error: " << err.what() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngine::callLocationExitCallback() {
|
||||||
|
if (!impl || !impl->locationExitCallback.valid()) return;
|
||||||
|
auto result = impl->locationExitCallback();
|
||||||
|
if (!result.valid()) {
|
||||||
|
sol::error err = result;
|
||||||
|
std::cerr << "[SCRIPT] location exit callback error: " << err.what() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngine::callDarklandsEnterCallback() {
|
||||||
|
if (!impl || !impl->darklandsEnterCallback.valid()) return;
|
||||||
|
auto result = impl->darklandsEnterCallback();
|
||||||
|
if (!result.valid()) {
|
||||||
|
sol::error err = result;
|
||||||
|
std::cerr << "[SCRIPT] darklands enter callback error: " << err.what() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngine::callDarklandsExitCallback() {
|
||||||
|
if (!impl || !impl->darklandsExitCallback.valid()) return;
|
||||||
|
auto result = impl->darklandsExitCallback();
|
||||||
|
if (!result.valid()) {
|
||||||
|
sol::error err = result;
|
||||||
|
std::cerr << "[SCRIPT] darklands exit callback error: " << err.what() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptEngine::callCutsceneCompleteCallback(const std::string& cutsceneId) {
|
void ScriptEngine::callCutsceneCompleteCallback(const std::string& cutsceneId) {
|
||||||
if (!impl) return;
|
if (!impl) return;
|
||||||
auto it = impl->cutsceneCompleteCallbacks.find(cutsceneId);
|
auto it = impl->cutsceneCompleteCallbacks.find(cutsceneId);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace ZL {
|
namespace ZL {
|
||||||
|
|
||||||
@ -27,6 +28,14 @@ public:
|
|||||||
void callTriggerEnterCallback(const std::string& zoneId);
|
void callTriggerEnterCallback(const std::string& zoneId);
|
||||||
void callTriggerExitCallback(const std::string& zoneId);
|
void callTriggerExitCallback(const std::string& zoneId);
|
||||||
|
|
||||||
|
void setGlobalStore(std::unordered_map<std::string, int>* store);
|
||||||
|
|
||||||
|
void callLocationEnterCallback();
|
||||||
|
void callLocationExitCallback();
|
||||||
|
|
||||||
|
void callDarklandsEnterCallback();
|
||||||
|
void callDarklandsExitCallback();
|
||||||
|
|
||||||
void callCutsceneCompleteCallback(const std::string& cutsceneId);
|
void callCutsceneCompleteCallback(const std::string& cutsceneId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -180,6 +180,7 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shaderResourceMap.find(shaderName) == shaderResourceMap.end()) {
|
if (shaderResourceMap.find(shaderName) == shaderResourceMap.end()) {
|
||||||
|
std::cout << "Shader does not exist: " << shaderName << std::endl;
|
||||||
throw std::runtime_error("Shader does not exist!");
|
throw std::runtime_error("Shader does not exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user