From ae8b17a347ad13429a7ec732a30ac718cea951e4 Mon Sep 17 00:00:00 2001 From: Holly Date: Tue, 11 Feb 2025 05:27:07 +0000 Subject: [PATCH] HOLY FUCK MAP LOADING WORKS!!!!!!!! --- scenes/world/DynamicMap.tscn | 8 +- scenes/world/Player.tscn | 1 - src/Constants.gd | 3 +- src/DynamicMap.gd | 275 +++++++++++++++++------------------ src/IntroVideo.gd | 3 +- src/Utils.gd | 2 + src/file_parsers/RMesh.gd | 15 +- src/stinky.gd | 4 + 8 files changed, 163 insertions(+), 148 deletions(-) create mode 100644 src/stinky.gd diff --git a/scenes/world/DynamicMap.tscn b/scenes/world/DynamicMap.tscn index 05d5819..7f1b2ea 100644 --- a/scenes/world/DynamicMap.tscn +++ b/scenes/world/DynamicMap.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=7 format=3 uid="uid://bw0tk6ml7gayq"] +[gd_scene load_steps=6 format=3 uid="uid://bw0tk6ml7gayq"] [ext_resource type="Script" path="res://src/DynamicMap.gd" id="1_mytgt"] [ext_resource type="Script" path="res://src/TempDebugCamera.gd" id="2_co6fy"] -[ext_resource type="PackedScene" uid="uid://dm33ofcbh8sht" path="res://scenes/world/Player.tscn" id="3_58gow"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tvhkv"] sky_top_color = Color(0.483795, 0.593484, 0.746094, 1) @@ -22,12 +21,9 @@ script = ExtResource("1_mytgt") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_d5g72") -[node name="Player" parent="." instance=ExtResource("3_58gow")] - [node name="CameraPivot" type="Node3D" parent="."] [node name="Camera3D" type="Camera3D" parent="CameraPivot"] -current = true script = ExtResource("2_co6fy") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] @@ -37,3 +33,5 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.97521, -1.86909, -3.06) use_collision = true size = Vector3(15.4238, 0.866943, 15.2599) + +[node name="Label3D" type="Label3D" parent="."] diff --git a/scenes/world/Player.tscn b/scenes/world/Player.tscn index 660843e..df7f0d5 100644 --- a/scenes/world/Player.tscn +++ b/scenes/world/Player.tscn @@ -26,7 +26,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.75, 0) [node name="Collision" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) shape = SubResource("CylinderShape3D_bsew3") -disabled = true [node name="MeshInstance3D" type="MeshInstance3D" parent="Collision"] visible = false diff --git a/src/Constants.gd b/src/Constants.gd index b0f576a..cf6d042 100644 --- a/src/Constants.gd +++ b/src/Constants.gd @@ -14,4 +14,5 @@ const ROOM4 = 5 const gridsz = 19 # Same size as the main map itself (better for the map creator) -const RoomScale = 0.010 +#const RoomScale = 0.010 +const RoomScale = 8.0 / 2048.0 diff --git a/src/DynamicMap.gd b/src/DynamicMap.gd index e199358..7a3fecb 100644 --- a/src/DynamicMap.gd +++ b/src/DynamicMap.gd @@ -57,21 +57,20 @@ func LoadRoomTemplates(file: String): var rt = CreateRoomTemplate(StrTemp) RoomTemplates.push_back(rt) - rt.Name = TemporaryString.to_lower() + rt.Name = templateName.to_lower() StrTemp = template["shape"].to_lower() - match StrTemp: - "room1", "1": - rt.Shape = Constants.ROOM1 - "room2", "2": - rt.Shape = Constants.ROOM2 - "room2c", "2c": - rt.Shape = Constants.ROOM2C - "room3", "3": - rt.Shape = Constants.ROOM3 - "room4", "4": - rt.Shape = Constants.ROOM4 + if StrTemp == "room1" or StrTemp == "1": + rt.Shape = Constants.ROOM1 + elif StrTemp == "room2" or StrTemp == "2": + rt.Shape = Constants.ROOM2 + elif StrTemp == "room2c" or StrTemp == "2c": + rt.Shape = Constants.ROOM2C + elif StrTemp == "room3" or StrTemp == "3": + rt.Shape = Constants.ROOM3 + elif StrTemp == "room4" or StrTemp == "4": + rt.Shape = Constants.ROOM4 for i1 in range(4): rt.zone[i1] = INI.GetInt(template, str("zone", (i1 + 1))) @@ -179,8 +178,9 @@ func CalculateRoomExtents(r: Room): print("roomextents: ", r.MinX, ", ", r.MinY, ", ", r.MinZ, ", ", r.MaxX, ", ", r.MaxY, ", ", r.MaxZ) func LoadRoomMesh(rt: RoomTemplate): + var path = Utils.GetCaseiFileName(str("res://", rt.objPath.replace("\\", "/"))).replace("res://", "") if rt.objPath.contains(".rmesh"): # file is roommesh - rt.obj = RMesh.LoadRMesh(rt.objPath, rt) + rt.obj = RMesh.LoadRMesh(path, rt) # TODO: Implement b3d maps, not pressing as newer vers use exclusively rmesh #else: #file is b3d #If rt\objPath <> "" Then rt\obj = LoadWorld(rt\objPath, rt) Else rt\obj = CreatePivot() @@ -297,7 +297,7 @@ func CreateMap(): for i1 in range(y, MapHeight): # MapHeight - 1 MapTemp[x][i1] = 1 - while y < 2: + while y > 2: width = randi_range(10, 15) if x > MapWidth * 0.6: @@ -351,7 +351,7 @@ func CreateMap(): if tempheight == height: temp = x2 x = temp - y = y - height + y -= height var ZoneAmount = 3 var Room1Amount = Utils.Init1DArray(3, 0) @@ -362,7 +362,7 @@ func CreateMap(): # count the amount of rooms #For y = 1 To MapHeight - 1 - for y1 in range(MapHeight): + for y1 in range(0, MapHeight): zone = GetZone(y1) for x1 in range(MapWidth): @@ -372,24 +372,23 @@ func CreateMap(): if MapTemp[x1][y1] < 255: MapTemp[x1][y1] = temp #print(MapTemp[x1][y1]) - match MapTemp[x1][y1]: - 1: - Room1Amount[zone] += 1 - print("R1A ", Room1Amount[zone]) - 2: - if min(MapTemp[x1 + 1][y1], 1) + min(MapTemp[x1 - 1][y1], 1) == 2: - Room2Amount[zone] += 1 - elif min(MapTemp[x1][y1 + 1], 1) + min(MapTemp[x1][y1 - 1], 1) == 2: - Room2Amount[zone] += 1 - else: - Room2CAmount[zone] += 1 - 3: - Room3Amount[zone] += 1 - 4: - Room4Amount[zone] += 1 + if MapTemp[x1][y1] == 1: + Room1Amount[zone] += 1 + print("R1A ", Room1Amount[zone]) + elif MapTemp[x1][y1] == 2: + if min(MapTemp[x1 + 1][y1], 1) + min(MapTemp[x1 - 1][y1], 1) == 2: + Room2Amount[zone] += 1 + elif min(MapTemp[x1][y1 + 1], 1) + min(MapTemp[x1][y1 - 1], 1) == 2: + Room2Amount[zone] += 1 + else: + Room2CAmount[zone] += 1 + elif MapTemp[x1][y1] == 3: + Room3Amount[zone] += 1 + elif MapTemp[x1][y1] == 4: + Room4Amount[zone] += 1 # force more room1s (if needed) - for i in range(0, 2): + for i in range(0, 3): # need more rooms if there are less than 5 of them temp = -Room1Amount[i] + 5 var y2 = 0 @@ -417,20 +416,19 @@ func CreateMap(): placed = false if MapTemp[x2][y2] > 1 and MapTemp[x2][y2] < 4: - match MapTemp[x2][y2]: - 2: - if min(MapTemp[x2 + 1][y2], 1) + min(MapTemp[x2 - 1][y2], 1) == 2: - Room2Amount[i] = Room2Amount[i] - 1 - Room3Amount[i] = Room3Amount[i] + 1 - placed = true - elif min(MapTemp[x2][y2 + 1], 1) + min(MapTemp[x2][y2 - 1], 1) == 2: - Room2Amount[i] = Room2Amount[i] - 1 - Room3Amount[i] = Room3Amount[i] + 1 - placed = true - 3: - Room3Amount[i] = Room3Amount[i] - 1 - Room4Amount[i] = Room4Amount[i] + 1 + if MapTemp[x2][y2] == 2: + if min(MapTemp[x2 + 1][y2], 1) + min(MapTemp[x2 - 1][y2], 1) == 2: + Room2Amount[i] = Room2Amount[i] - 1 + Room3Amount[i] = Room3Amount[i] + 1 placed = true + elif min(MapTemp[x2][y2 + 1], 1) + min(MapTemp[x2][y2 - 1], 1) == 2: + Room2Amount[i] = Room2Amount[i] - 1 + Room3Amount[i] = Room3Amount[i] + 1 + placed = true + elif MapTemp[x2][y2] == 3: + Room3Amount[i] = Room3Amount[i] - 1 + Room4Amount[i] = Room4Amount[i] + 1 + placed = true if placed: MapTemp[x2][y2] == MapTemp[x2][y2] + 1 @@ -444,18 +442,17 @@ func CreateMap(): break # force more room4s and room2Cs - for i in range(0, 2): + for i in range(0, 3): var temp2 = 0 - match i: - 2: - zone = 2 - temp2 = MapHeight / 3 #-1 - 1: - zone = MapHeight / 3 + 1 - temp2 = MapHeight * (2.0 / 3.0) - 1 - 0: - zone = MapHeight * (2.0 / 3.0) + 1 - temp2 = MapHeight - 2 + if i == 2: + zone = 2 + temp2 = MapHeight / 3 #-1 + elif i == 1: + zone = MapHeight / 3 + 1 + temp2 = MapHeight * (2.0 / 3.0) - 1 + elif i == 0: + zone = MapHeight * (2.0 / 3.0) + 1 + temp2 = MapHeight - 2 if Room4Amount[i] < 1: # we want at least 1 ROOM4 print(str("forcing a ROOM4 into zone ", i)) temp = 0 @@ -496,7 +493,7 @@ func CreateMap(): temp2 = temp2 - 1 for y1 in range(zone, temp2): - for x1 in range(3, MapWidth - 3): + for x1 in range(3, MapWidth - 2): if MapTemp[x1][y1] == 1: if MapTemp[x1 - 1][y1] > 0: if (MapTemp[x1][y1 - 1] + MapTemp[x1][y1 + 1] + MapTemp[x1 + 2][y1]) == 0: @@ -570,12 +567,12 @@ func CreateMap(): MaxRooms = max(MaxRooms, Room2CAmount[0] + Room2CAmount[1] + Room2CAmount[2] + 1) MaxRooms = max(MaxRooms, Room3Amount[0] + Room3Amount[1] + Room3Amount[2] + 1) MaxRooms = max(MaxRooms, Room4Amount[0] + Room4Amount[1] + Room4Amount[2] + 1) - MapRoom = Utils.Init2DArray(Constants.ROOM4 + 1, MaxRooms) + MapRoom = Utils.Init2DArray(Constants.ROOM4 + 1, MaxRooms, "") # zone 1 -------------------------------------------------------------------------------------------------- var min_pos = 1 - var max_pos = Room1Amount[0] - 1 + var max_pos = Room1Amount[0]-1 MapRoom[Constants.ROOM1][0] = "start" SetRoom("roompj", Constants.ROOM1, floor(0.1 * float(Room1Amount[0])), min_pos,max_pos) @@ -663,15 +660,15 @@ func CreateMap(): temp = 0 var r: Room var spacing = 8.0 - for y1 in range(MapHeight - 1, 1, -1): + for y1 in range(MapHeight - 1, 0, -1): zone = GetZone(y1) if y1 < MapHeight / 3 + 1: zone = 3 elif y1 < MapHeight * (2.0 / 3.0): - zone=2 + zone = 2 else: - zone=1 + zone = 1 for x1 in range(MapWidth - 2): if MapTemp[x1][y1] == 255: @@ -681,92 +678,94 @@ func CreateMap(): r = CreateRoom(zone, Constants.ROOM2, x1 * 8, 0, y1 * 8, "checkpoint2") elif MapTemp[x1][y1] > 0: temp = min(MapTemp[x1 + 1][y1], 1) + min(MapTemp[x1 - 1][y1], 1) + min(MapTemp[x1][y1 + 1], 1) + min(MapTemp[x1][y1 - 1], 1) + + # viereisiss� ruuduissa olevien huoneiden m��r� + if temp == 1: + if MapRoomID[Constants.ROOM1] < MaxRooms and MapName[x1][y1] == "": + if MapRoom[Constants.ROOM1][MapRoomID[Constants.ROOM1]] != "": + MapName[x1][y1] = MapRoom[Constants.ROOM1][MapRoomID[Constants.ROOM1]] - match temp: # viereisiss� ruuduissa olevien huoneiden m��r� - 1: - if MapRoomID[Constants.ROOM1] < MaxRooms and MapName[x1][y1] == "": - if MapRoom[Constants.ROOM1][MapRoomID[Constants.ROOM1]] != "": - MapName[x1][y1] = MapRoom[Constants.ROOM1][MapRoomID[Constants.ROOM1]] - - r = CreateRoom(zone, Constants.ROOM1, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - if MapTemp[x1][y1 + 1]: - r.angle = 180 - r.obj.rotation.y = deg_to_rad(r.angle) - elif MapTemp[x1 - 1][y1]: - r.angle = 270 - r.obj.rotation.y = deg_to_rad(r.angle) - elif MapTemp[x1 + 1][y1]: + r = CreateRoom(zone, Constants.ROOM1, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + if MapTemp[x1][y1 + 1]: + r.angle = 180 + r.obj.rotation.y = deg_to_rad(r.angle) + elif MapTemp[x1 - 1][y1]: + r.angle = 90 + r.obj.rotation.y = deg_to_rad(r.angle) + elif MapTemp[x1 + 1][y1]: + r.angle = 270 + r.obj.rotation.y = deg_to_rad(r.angle) + else: + r.angle = 0 + MapRoomID[Constants.ROOM1] = MapRoomID[Constants.ROOM1] + 1 + elif temp == 2: + if MapTemp[x1 - 1][y1] > 0 and MapTemp[x1 + 1][y1] > 0: + if MapRoomID[Constants.ROOM2] < MaxRooms and MapName[x1][y1] == "": + if MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] != "": + MapName[x1][y1] = MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] + r = CreateRoom(zone, Constants.ROOM2, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + if randi_range(1, 2) == 1: r.angle = 90 - r.obj.rotation.y = deg_to_rad(r.angle) + else: + r.angle = 270 + r.obj.rotation.y = deg_to_rad(r.angle) + MapRoomID[Constants.ROOM2] = MapRoomID[Constants.ROOM2] + 1 + elif MapTemp[x1][y1 - 1] > 0 and MapTemp[x1][y1 + 1] > 0: + if MapRoomID[Constants.ROOM2] < MaxRooms and MapName[x1][y1] == "": + if MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] != "": + MapName[x1][y1] = MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] + r = CreateRoom(zone, Constants.ROOM2, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + if randi_range(1, 2) == 1: + r.angle = 180 else: r.angle = 0 - MapRoomID[Constants.ROOM1] = MapRoomID[Constants.ROOM1] + 1 - 2: - if MapTemp[x1 - 1][y1] > 0 and MapTemp[x1 + 1][y1] > 0: - if MapRoomID[Constants.ROOM2] < MaxRooms and MapName[x1][y1] == "": - if MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] != "": - MapName[x1][y1] = MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] - r = CreateRoom(zone, Constants.ROOM2, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - if randi_range(1, 2) == 1: - r.angle = 90 - else: - r.angle = 270 - r.obj.rotation.y = deg_to_rad(r.angle) - MapRoomID[Constants.ROOM2] = MapRoomID[Constants.ROOM2] + 1 - elif MapTemp[x1][y1 - 1] > 0 and MapTemp[x1][y1 + 1] > 0: - if MapRoomID[Constants.ROOM2] < MaxRooms and MapName[x1][y1] == "": - if MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] != "": - MapName[x1][y1] = MapRoom[Constants.ROOM2][MapRoomID[Constants.ROOM2]] - r = CreateRoom(zone, Constants.ROOM2, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - if randi_range(1, 2) == 1: - r.angle = 180 - else: - r.angle = 0 - r.obj.rotation.y = deg_to_rad(r.angle) - MapRoomID[Constants.ROOM2] = MapRoomID[Constants.ROOM2] + 1 - else: - if MapRoomID[Constants.ROOM2C] < MaxRooms and MapName[x1][y1] == "": - if MapRoom[Constants.ROOM2C][MapRoomID[Constants.ROOM2C]] != "": - MapName[x1][y1] = MapRoom[Constants.ROOM2C][MapRoomID[Constants.ROOM2C]] + r.obj.rotation.y = deg_to_rad(r.angle) + MapRoomID[Constants.ROOM2] = MapRoomID[Constants.ROOM2] + 1 + else: + if MapRoomID[Constants.ROOM2C] < MaxRooms and MapName[x1][y1] == "": + if MapRoom[Constants.ROOM2C][MapRoomID[Constants.ROOM2C]] != "": + MapName[x1][y1] = MapRoom[Constants.ROOM2C][MapRoomID[Constants.ROOM2C]] - if MapTemp[x1 - 1][y1] > 0 and MapTemp[x1][y1 + 1] > 0: - r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - r.angle = 180 - r.obj.rotation.y = deg_to_rad(r.angle) - elif MapTemp[x1 + 1][y1] > 0 and MapTemp[x1][y1 + 1] > 0: - r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - r.angle = 90 - r.obj.rotation.y = deg_to_rad(r.angle) - elif MapTemp[x1 - 1][y1] > 0 and MapTemp[x1][y1 - 1] > 0: - r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - r.angle = 270 - r.obj.rotation.y = deg_to_rad(r.angle) - else: - r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - MapRoomID[Constants.ROOM2C] = MapRoomID[Constants.ROOM2C] + 1 - 3: - if MapRoomID[Constants.ROOM3] < MaxRooms and MapName[x1][y1] == "": - if MapRoom[Constants.ROOM3][MapRoomID[Constants.ROOM3]] != "": - MapName[x1][y1] = MapRoom[Constants.ROOM3][MapRoomID[Constants.ROOM3]] - - r = CreateRoom(zone, Constants.ROOM3, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - if not MapTemp[x1][y1 - 1]: - r.angle = 180 - r.obj.rotation.y = deg_to_rad(r.angle) - elif not MapTemp[x1 - 1][y1]: + if MapTemp[x1 - 1][y1] > 0 and MapTemp[x1][y1 + 1] > 0: + r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) r.angle = 90 r.obj.rotation.y = deg_to_rad(r.angle) - elif not MapTemp[x1 + 1][y1]: + elif MapTemp[x1 + 1][y1] > 0 and MapTemp[x1][y1 + 1] > 0: + r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + r.angle = 180 + r.obj.rotation.y = deg_to_rad(r.angle) + elif MapTemp[x1 - 1][y1] > 0 and MapTemp[x1][y1 - 1] > 0: + r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) r.angle = 270 r.obj.rotation.y = deg_to_rad(r.angle) - MapRoomID[Constants.ROOM3] = MapRoomID[Constants.ROOM3] + 1 - 4: - if MapRoomID[Constants.ROOM4] < MaxRooms and MapName[x1][y1] == "": - if MapRoom[Constants.ROOM4][MapRoomID[Constants.ROOM4]] != "": - MapName[x1][y1] = MapRoom[Constants.ROOM4][MapRoomID[Constants.ROOM4]] + else: + r = CreateRoom(zone, Constants.ROOM2C, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + r.angle = 270 + r.obj.rotation.y = deg_to_rad(r.angle) + MapRoomID[Constants.ROOM2C] = MapRoomID[Constants.ROOM2C] + 1 + elif temp == 3: + if MapRoomID[Constants.ROOM3] < MaxRooms and MapName[x1][y1] == "": + if MapRoom[Constants.ROOM3][MapRoomID[Constants.ROOM3]] != "": + MapName[x1][y1] = MapRoom[Constants.ROOM3][MapRoomID[Constants.ROOM3]] - r = CreateRoom(zone, Constants.ROOM4, x1 * 8, 0, y1 * 8, MapName[x1][y1]) - MapRoomID[Constants.ROOM4] = MapRoomID[Constants.ROOM4] + 1 + r = CreateRoom(zone, Constants.ROOM3, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + if not MapTemp[x1][y1 - 1]: + r.angle = 180 + r.obj.rotation.y = deg_to_rad(r.angle) + elif not MapTemp[x1 - 1][y1]: + r.angle = 270 + r.obj.rotation.y = deg_to_rad(r.angle) + elif not MapTemp[x1 + 1][y1]: + r.angle = 90 + r.obj.rotation.y = deg_to_rad(r.angle) + MapRoomID[Constants.ROOM3] = MapRoomID[Constants.ROOM3] + 1 + elif temp == 4: + if MapRoomID[Constants.ROOM4] < MaxRooms and MapName[x1][y1] == "": + if MapRoom[Constants.ROOM4][MapRoomID[Constants.ROOM4]] != "": + MapName[x1][y1] = MapRoom[Constants.ROOM4][MapRoomID[Constants.ROOM4]] + + r = CreateRoom(zone, Constants.ROOM4, x1 * 8, 0, y1 * 8, MapName[x1][y1]) + MapRoomID[Constants.ROOM4] = MapRoomID[Constants.ROOM4] + 1 r = CreateRoom(0, Constants.ROOM1, (MapWidth - 1) * 8, 500, 8, "gatea") MapRoomID[Constants.ROOM1] = MapRoomID[Constants.ROOM1] + 1 diff --git a/src/IntroVideo.gd b/src/IntroVideo.gd index 7837881..3cf942f 100644 --- a/src/IntroVideo.gd +++ b/src/IntroVideo.gd @@ -13,7 +13,8 @@ func _process(_delta: float) -> void: func _on_video_stream_player_finished() -> void: if Global.videoToPlay == "res://GFX/menu/startup_TSS.avi": - get_tree().change_scene_to_file("res://scenes/screens/MainMenu.tscn") + #get_tree().change_scene_to_file("res://scenes/screens/MainMenu.tscn") + get_tree().change_scene_to_file("res://scenes/screens/LoadingScreen.tscn") return Global.videoToPlay = "res://GFX/menu/startup_TSS.avi" diff --git a/src/Utils.gd b/src/Utils.gd index 1982b9d..fd6e122 100644 --- a/src/Utils.gd +++ b/src/Utils.gd @@ -40,6 +40,8 @@ static func GetCaseiFileName(path: String): else: loadedFileNames = Dictionary() var sillyDir = DirAccess.open(dirName) + if not sillyDir: + return null sillyDir.list_dir_begin() var dirFileName = sillyDir.get_next() while dirFileName != "": diff --git a/src/file_parsers/RMesh.gd b/src/file_parsers/RMesh.gd index 48a3174..253fe6e 100644 --- a/src/file_parsers/RMesh.gd +++ b/src/file_parsers/RMesh.gd @@ -10,7 +10,7 @@ static func StripFilename(file: String): if len(file) > 0: for i in range(len(file)): mi = file.substr(i, 1) - if mi == "\\" or mi == "//": + if mi == "\\" or mi == "/": lastSlash = i return file.substr(0, lastSlash + 1) @@ -29,12 +29,23 @@ static func LoadRMesh(file: String, rt: RoomTemplate): var header = ReadString(reader) var hasTriggerBox = header == "RoomMesh.HasTriggerBox" - if header != "RoomMesh": + if header != "RoomMesh" and header != "RoomMesh.HasTriggerBox": print(str(correctedPath, " is Not RMESH")) return var scene = Node3D.new() scene.name = str(fileName, "_", rt.Name, "_", RMESH_LOAD_COUNT) + # debug rot and name! + #var text3 = Label3D.new() + #text3.position.y = 10 + #text3.scale.x = 3 + #text3.scale.y = 3 + #text3.scale.z = 3 + #text3.billboard = BaseMaterial3D.BILLBOARD_ENABLED + #text3.name = "Egg" + #scene.add_child(text3) + #scene.set_script(load("res://src/stinky.gd")) + #scene.set_meta("rmesh", fileName) RMESH_LOAD_COUNT += 1 var count: int = 0 diff --git a/src/stinky.gd b/src/stinky.gd new file mode 100644 index 0000000..45b4d85 --- /dev/null +++ b/src/stinky.gd @@ -0,0 +1,4 @@ +extends Node3D + +func _process(delta: float): + $Egg.text = str("ROT: ", rad_to_deg(rotation.y), "\n", get_meta("rmesh"))