diff --git a/UIRoot.gd b/UIRoot.gd new file mode 100644 index 0000000..62d7bad --- /dev/null +++ b/UIRoot.gd @@ -0,0 +1,36 @@ +extends Control + +@onready var map = get_parent() + +func _process(delta): + queue_redraw() + +func _draw(): + if map.MsgTimer > 0: + var temp = false + if (not map.InvOpen): + if map.SelectedItem != null: + if map.SelectedItem.itemtemplate.tempname == "paper" or map.SelectedItem.itemtemplate.tempname == "oldpaper": + temp = true + + if (not temp): + map.MsgColor = map.MsgColor.from_rgba8(0, 0, 0, min(map.MsgTimer / 2, 255)) + Utils.DrawTextRaw(self, map.Msg, (size.x / 2)+1, (size.y / 2) + 201, Utils.COUR_FONT, 19, true, map.MsgColor) + map.MsgColor = map.MsgColor.from_rgba8(255, 255, 255, min(map.MsgTimer / 2, 255)) + #If Left(Msg,14)="Blitz3D Error!" Then + #Color 255,0,0 + #EndIf + Utils.DrawTextRaw(self, map.Msg, (size.x / 2), (size.y / 2) + 200, Utils.COUR_FONT, 19, true, map.MsgColor) + else: + map.MsgColor = map.MsgColor.from_rgba8(0, 0, 0, min(map.MsgTimer / 2, 255)) + Utils.DrawTextRaw(self, map.Msg, (size.x / 2)+1, (size.y * 0.94) + 1, Utils.COUR_FONT, 19, true, map.MsgColor) + map.MsgColor = map.MsgColor.from_rgba8(255, 255, 255, min(map.MsgTimer / 2, 255)) + #If Left(Msg,14)="Blitz3D Error!" Then + #Color 255,0,0 + #EndIf + Utils.DrawTextRaw(self, map.Msg, (size.x / 2), (size.y * 0.94), Utils.COUR_FONT, 19, true, map.MsgColor) + map.MsgTimer = map.MsgTimer - Global.FPSfactor2 + + map.MsgColor = map.MsgColor.from_rgba8(255, 255, 255) + if map.ShowFPS: + Utils.DrawTextRaw(self, "FPS: " + str(Engine.get_frames_per_second()), 20, 20, Utils.COUR_FONT, 20, false, map.MsgColor) diff --git a/UIRoot.gd.uid b/UIRoot.gd.uid new file mode 100644 index 0000000..0ea4959 --- /dev/null +++ b/UIRoot.gd.uid @@ -0,0 +1 @@ +uid://c7bo5yefn1pbv diff --git a/fonts/Blitz.ttf b/fonts/Blitz.ttf new file mode 100755 index 0000000..10be593 Binary files /dev/null and b/fonts/Blitz.ttf differ diff --git a/fonts/Blitz.ttf.import b/fonts/Blitz.ttf.import new file mode 100644 index 0000000..f2f0be7 --- /dev/null +++ b/fonts/Blitz.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://cmo5qwo134bln" +path="res://.godot/imported/Blitz.ttf-3ed9c748e1ee18fbf1b6b1cc96ceaa0b.fontdata" + +[deps] + +source_file="res://fonts/Blitz.ttf" +dest_files=["res://.godot/imported/Blitz.ttf-3ed9c748e1ee18fbf1b6b1cc96ceaa0b.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/scenes/world/DynamicMap.tscn b/scenes/world/DynamicMap.tscn index 14bb9a3..58b2f07 100644 --- a/scenes/world/DynamicMap.tscn +++ b/scenes/world/DynamicMap.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=3 uid="uid://bc46lc1tdvrio"] +[gd_scene load_steps=5 format=3 uid="uid://bc46lc1tdvrio"] [ext_resource type="Script" uid="uid://b08xfsygxqj6a" path="res://src/DynamicMap.gd" id="1_mytgt"] [ext_resource type="Script" uid="uid://pga6iqmmq4w0" path="res://src/EventSystem.gd" id="2_vb526"] +[ext_resource type="Script" uid="uid://c7bo5yefn1pbv" path="res://UIRoot.gd" id="2_y4qlq"] [sub_resource type="Environment" id="Environment_d5g72"] background_mode = 1 @@ -16,8 +17,14 @@ fog_depth_begin = 1.0 [node name="DynamicMap" type="Node3D"] script = ExtResource("1_mytgt") -[node name="UILayer" type="CanvasLayer" parent="."] -layer = 64 +[node name="UIRoot" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("2_y4qlq") [node name="EventSystem" type="Node" parent="."] script = ExtResource("2_vb526") diff --git a/src/DynamicMap.gd b/src/DynamicMap.gd index 3050912..7730c62 100644 --- a/src/DynamicMap.gd +++ b/src/DynamicMap.gd @@ -29,7 +29,10 @@ func EntityParent(obj: Node, parent: Node): if obj.get_parent() == null: parent.add_child(obj) else: - obj.reparent(parent, true) + if parent: + obj.reparent(parent, true) + else: + obj.reparent(self, true) func EntityDistance(ent1: Node3D, ent2: Node3D): return ent1.global_position.distance_to(ent2.global_position) @@ -423,12 +426,20 @@ var UpdateDoorsTimer: float = 0.0 var QuickLoadPercent: int = -1 var RemoteDoorOn: bool = false var TempLightVolume: float +var SelectedItem = null + +var Msg: String = "" +var MsgTimer = 0 +var MsgTimerPrev = 0 +var ShowFPS: bool = true +var MsgColor: Color = Color(0, 0, 0) @onready var Brightness: int = INI.GetInt(Global.options["options"], "brightness") @onready var CameraFogNear: float = INI.GetFloat(Global.options["options"], "camera fog near") @onready var CameraFogFar: float = INI.GetFloat(Global.options["options"], "camera fog far") @onready var worldEnvironment: WorldEnvironment = $WorldEnvironment @onready var env: Environment = worldEnvironment.environment +@onready var uiRoot: Control = $UIRoot func _process(delta: float) -> void: @@ -476,7 +487,7 @@ func _process(delta: float) -> void: #UpdateScreens() #UpdateRoomLights(Camera) #Else - UpdateDoors() + #UpdateDoors() TODO: PUT BACK if QuickLoadPercent == -1 or QuickLoadPercent == 100: eventSystem.UpdateEvents() #UpdateScreens() @@ -491,6 +502,16 @@ func _process(delta: float) -> void: UpdateParticles() #Use427() #UpdateMonitorSaving() + + if PlayerRoom != null: + if PlayerRoom.RoomTemplate.Name == "173": + for e: Event in eventSystem.events: + if e.EventName == "173": + if e.EventState3 >= 4 and e.EventState3 < 50: + if InvOpen: + Msg = "Double click on the document to view it." + MsgTimer = 70 * 7 + e.EventState3 = 50 var SelectedMap = "" var PlayerZone = 0 diff --git a/src/EventSystem.gd b/src/EventSystem.gd index 814dfb0..a42bd04 100644 --- a/src/EventSystem.gd +++ b/src/EventSystem.gd @@ -699,93 +699,86 @@ func UpdateEvents(): #user_camera_pitch = 0 #RotateEntity Global.player, 0, EntityYaw(Camera), 0 # - #ElseIf e\EventState3 < 40 - #If Inventory(0)<>Null Then - #Msg = "Press "+KeyName(KEY_INV)+" to open the inventory." - #MsgTimer=70*7 - #e\EventState3 = 40 - #Exit - #EndIf - #EndIf - # - #If SelectedItem <> Null Then - #e\EventState3 = e\EventState3+FPSfactor/5.0 - #EndIf - # - #ElseIf e\EventState3 => 150.0 And e\EventState3 < 700 - #If e\room\NPC[3]\State = 7 Then - #If e\room\NPC[3]\Sound2 = 0 - #e\room\NPC[3]\Sound2 = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\BeforeDoorOpen.ogg") - #e\room\NPC[3]\SoundChn2 = PlaySound2(e\room\NPC[3]\Sound2,Camera,e\room\NPC[3]\Collider) - #DebugLog "Playing guard sound before cell opening" - #EndIf - # - #UpdateSoundOrigin(e\room\NPC[3]\SoundChn2,Camera,e\room\NPC[3]\Collider) - # - #If (Not ChannelPlaying(e\room\NPC[3]\SoundChn2)) - #;BlinkTimer = -10 - # - #e\room\NPC[3]\Sound = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\ExitCell.ogg") - #e\room\NPC[3]\SoundChn = PlaySound2(e\room\NPC[3]\Sound, Camera, e\room\NPC[3]\Collider) - # - #;e\room\NPC[3]\State = 7 - #;e\room\NPC[4]\State = 7 - #;e\room\NPC[5]\State = 7 - #e\room\NPC[3]\State = 9 - #e\room\NPC[4]\State = 9 - #e\room\NPC[5]\State = 9 - # - #e\room\RoomDoors[6]\locked = False - #UseDoor(e\room\RoomDoors[6], False) - #e\room\RoomDoors[6]\locked = True - #EndIf - #Else - #FreeSound_Strict e\room\NPC[3]\Sound2 - # - #;PointEntity e\room\NPC[3]\obj, Collider - #;RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\obj), 0 - # - #;PointEntity e\room\NPC[4]\obj, Collider - #;RotateEntity e\room\NPC[4]\Collider, 0, EntityYaw(e\room\NPC[4]\obj), 0 - # - #e\EventState3 = Min(e\EventState3+FPSfactor/4,699) - # - #;outside the cell - #If Distance(EntityX(Collider),EntityZ(Collider),PlayerRoom\x-(3072+1024)*RoomScale, PlayerRoom\z+192.0*RoomScale)>1.5 Then - #;e\room\NPC[3]\State = 5 - #;e\room\NPC[3]\EnemyX = EntityX(Collider) - #;e\room\NPC[3]\EnemyY = EntityY(Collider) - #;e\room\NPC[3]\EnemyZ = EntityZ(Collider) - # - #If e\EventState3 > 250 Then - #If e\room\NPC[3]\SoundChn<>0 Then - #If ChannelPlaying(e\room\NPC[3]\SoundChn) Then StopChannel e\room\NPC[3]\SoundChn - #EndIf - #FreeSound_Strict e\room\NPC[3]\Sound - #e\room\NPC[3]\Sound = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\Escort"+Rand(1,2)+".ogg") - #e\room\NPC[3]\SoundChn = PlaySound2(e\room\NPC[3]\Sound, Camera, e\room\NPC[3]\Collider) - # - #;e\room\NPC[3]\PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale) - #;e\room\NPC[4]\PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale) - #e\room\NPC[3]\PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale) - #e\room\NPC[4]\PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale) - # - #e\EventState3 = 710 - #EndIf - #Else ;inside the cell - #e\room\NPC[3]\State = 9 - #;PointEntity e\room\NPC[3]\Collider, Collider - #;RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\Collider), 0 - # - #If e\EventState3-(FPSfactor/4) < 350 And e\EventState3=>350 Then - #FreeSound_Strict e\room\NPC[3]\Sound - #e\room\NPC[3]\Sound = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\ExitCellRefuse"+Rand(1,2)+".ogg") - #e\room\NPC[3]\SoundChn = PlaySound2(e\room\NPC[3]\Sound, Camera, e\room\NPC[3]\Collider) - #ElseIf e\EventState3-(FPSfactor/4) < 550 And e\EventState3=>550 - #FreeSound_Strict e\room\NPC[3]\Sound - #e\room\NPC[3]\Sound = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\CellGas"+Rand(1,2)+".ogg") - #e\room\NPC[3]\SoundChn = PlaySound2(e\room\NPC[3]\Sound, Camera, e\room\NPC[3]\Collider) - #ElseIf e\EventState3>630 + elif e.EventState3 < 40: + if map.Inventory[0] != null: + #map.Msg = "Press "+KeyName(KEY_INV)+" to open the inventory." + map.Msg = "Press TAB to open the inventory." # TODO: Make pull from setting. + map.MsgTimer=70*7 + e.EventState3 = 40 + break + if map.SelectedItem != null: + e.EventState3 = e.EventState3 + Global.FPSfactor / 5.0 + elif e.EventState3 >= 150.0 and e.EventState3 < 700: + if e.room.NPC[3].State == 7: + if e.room.NPC[3].Sound2 == null: + e.room.NPC[3].Sound2 = Global.LoadSound("SFX\\Room\\Intro\\Guard\\Ulgrin\\BeforeDoorOpen.ogg") + e.room.NPC[3].SoundChn2 = Global.PlaySound2(e.room.NPC[3].Sound2, Global.player.camera, e.room.NPC[3].Collider) + print("Playing guard sound before cell opening") + + Global.UpdateSoundOrigin(e.room.NPC[3].SoundChn2, Global.player.camera, e.room.NPC[3].Collider) + + if (not Global.ChannelPlaying(e.room.NPC[3].SoundChn2)): + #BlinkTimer = -10 + + e.room.NPC[3].Sound = Global.LoadSound("SFX\\Room\\Intro\\Guard\\Ulgrin\\ExitCell.ogg") + e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider) + + #e\room\NPC[3]\State = 7 + #e\room\NPC[4]\State = 7 + #e\room\NPC[5]\State = 7 + e.room.NPC[3].State = 9 + e.room.NPC[4].State = 9 + e.room.NPC[5].State = 9 + + e.room.RoomDoors[6].locked = false + map.UseDoor(e.room.RoomDoors[6], false) + e.room.RoomDoors[6].locked = true + else: + e.room.NPC[3].Sound2.queue_free() + + #PointEntity e\room\NPC[3]\obj, Collider + #RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\obj), 0 + + #PointEntity e\room\NPC[4]\obj, Collider + #RotateEntity e\room\NPC[4]\Collider, 0, EntityYaw(e\room\NPC[4]\obj), 0 + + e.EventState3 = min(e.EventState3 + Global.FPSfactor / 4, 699) + + #outside the cell + if map.Distance(map.EntityX(Global.player), map.EntityZ(Global.player), map.PlayerRoom.x - (3072+1024) * Constants.RoomScale, map.PlayerRoom.z + 192.0 * Constants.RoomScale) > 1.5: + e.room.NPC[3].State = 5 + e.room.NPC[3].EnemyX = map.EntityX(Global.player) + e.room.NPC[3].EnemyY = map.EntityY(Global.player) + e.room.NPC[3].EnemyZ = map.EntityZ(Global.player) + + if e.EventState3 > 250: + if e.room.NPC[3].SoundChn != null: + if Global.ChannelPlaying(e.room.NPC[3].SoundChn): + Global.StopChannel(e.room.NPC[3].SoundChn) + e.room.NPC[3].Sound.queue_free() + e.room.NPC[3].Sound = Global.LoadSound("SFX\\Room\\Intro\\Guard\\Ulgrin\\Escort" + str(randi_range(1, 2)) + ".ogg") + e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider) + + #e\room\NPC[3]\PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale) + #e\room\NPC[4]\PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale) + #e.room.NPC[3].PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale) + #e.room.NPC[4].PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale) + + e.EventState3 = 710 + else: #inside the cell + e.room.NPC[3].State = 9 + #PointEntity e\room\NPC[3]\Collider, Collider + #RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\Collider), 0 + + if e.EventState3 - (Global.FPSfactor / 4) < 350 and e.EventState3 >= 350: + e.room.NPC[3].Sound.queue_free() + e.room.NPC[3].Sound = Global.LoadAudio("SFX\\Room\\Intro\\Guard\\Ulgrin\\ExitCellRefuse" + str(randi_range(1, 2)) + ".ogg") + e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider) + elif e.EventState3 - (Global.FPSfactor / 4) < 550 and e.EventState3 >= 550: + e.room.NPC[3].Sound.queue_free() + e.room.NPC[3].Sound = Global.LoadAudio("SFX\\Room\\Intro\\Guard\\Ulgrin\\CellGas" + str(randi_range(1, 2)) + ".ogg") + e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider) + #elif e.EventState3 > 630: #PositionEntity Collider, EntityX(Collider), EntityY(Collider), Min(EntityZ(Collider), EntityZ(e\room\obj,True)+490*RoomScale) #If e\room\RoomDoors[6]\open = True Then #e\room\RoomDoors[6]\locked = False diff --git a/src/LoadWorld.gd b/src/LoadWorld.gd index 3e68821..64076eb 100644 --- a/src/LoadWorld.gd +++ b/src/LoadWorld.gd @@ -20,6 +20,9 @@ var frameDelay = 1 func _process(delta: float) -> void: if loadStage == 0 and frameDelay == 0: + Global.player = load("res://scenes/world/Player.tscn").instantiate() + map.add_child(Global.player) + LoadEntities.Go(map) LoadAllSounds.Go(map) @@ -162,8 +165,7 @@ func _process(delta: float) -> void: Global.PlayTempSound(map.StepSFX[0][0][0]) - Global.player = load("res://scenes/world/Player.tscn").instantiate() - map.add_child(Global.player) + # NOTE: ORIGINAL PLAYER LOAD POS Global.player.BlinkTimer = -10 #Global.player.BlurTimer = 100 diff --git a/src/LoadingScreen.gd b/src/LoadingScreen.gd index 964bfea..d7968e8 100644 --- a/src/LoadingScreen.gd +++ b/src/LoadingScreen.gd @@ -30,17 +30,6 @@ var bgImage: CompressedTexture2D const COUR_FONT = preload("res://GFX/font/cour/Courier New.ttf") -var textPos = Vector2(0, 0) -func DrawText(text: String, x: int, y: int, font, fontSize: float, shadowed: bool = false, center: bool = false): - textPos.x = x - textPos.y = y - if center: - var textSize = COUR_FONT.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale) - textPos.x -= textSize.x / 2 - if shadowed: - draw_string(font, textPos + Vector2.ONE, text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale, Color.BLACK) - draw_string(font, textPos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale) - func generateTextRows(string = "", mw = 0): var arrayIndex = 0; var strings = [""]; @@ -65,7 +54,7 @@ func generateTextRows(string = "", mw = 0): func renderTextRows(rows: Array, x: int, y: int): for i in range(rows.size()): var textSize = COUR_FONT.get_string_size(rows[i], HORIZONTAL_ALIGNMENT_LEFT, -1, 19 * Global.menuScale) - DrawText(rows[i], x, y + (textSize.y * i), COUR_FONT, 19, true, true) + Utils.DrawText(self, rows[i], x, y + (textSize.y * i), COUR_FONT, 19, true, true) var loadProgressIndex: int = 0 var loadingText: Array = [] @@ -141,10 +130,10 @@ func _draw(): if selectedLoadingScreen.title == "CWM": pass # TODO! else: - DrawText(selectedLoadingScreen.title, size.x / 2 + 1, size.y / 2 + 80 + 1, COUR_FONT, 58, true, true) + Utils.DrawText(self, selectedLoadingScreen.title, size.x / 2 + 1, size.y / 2 + 80 + 1, COUR_FONT, 58, true, true) renderTextRows(loadingText[loadProgressIndex], size.x / 2, size.y / 2 + 121) - DrawText(str("LOADING - ", percent, " %"), size.x / 2, size.y / 2 - 100, COUR_FONT, 19, true, true) + Utils.DrawText(self, str("LOADING - ", percent, " %"), size.x / 2, size.y / 2 - 100, COUR_FONT, 19, true, true) if percent == 100: #If firstloop And SelectedLoadingScreen\title <> "CWM" Then PlaySound_Strict LoadTempSound(("SFX\Horror\Horror8.ogg")) @@ -152,5 +141,5 @@ func _draw(): firstloop = false loaded = true Global.PlayTempSound("SFX/Horror/Horror8.ogg") - DrawText("PRESS ANY KEY TO CONTINUE", size.x / 2, size.y - 50, COUR_FONT, 19, false, true) + Utils.DrawText(self, "PRESS ANY KEY TO CONTINUE", size.x / 2, size.y - 50, COUR_FONT, 19, false, true) diff --git a/src/Utils.gd b/src/Utils.gd index f61e919..61f9609 100644 --- a/src/Utils.gd +++ b/src/Utils.gd @@ -124,6 +124,28 @@ static func DrawImage(target: Control, texture, x: int, y: int): workingPos1.y = y target.draw_texture(texture, workingPos1) +const COUR_FONT = preload("res://GFX/font/cour/Courier New.ttf") +const BLITZ = preload("res://fonts/Blitz.ttf") + +static var _textPos = Vector2(0, 0) +static func DrawText(target: Control, text: String, x: int, y: int, font, fontSize: float, shadowed: bool = false, center: bool = false): + _textPos.x = x + _textPos.y = y + if center: + var textSize = COUR_FONT.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale) + _textPos.x -= textSize.x / 2 + if shadowed: + target.draw_string(font, _textPos + Vector2.ONE, text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale, Color.BLACK) + target.draw_string(font, _textPos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale) + +static func DrawTextRaw(target: Control, text: String, x: int, y: int, font, fontSize: float, center: bool = false, color: Color = Color.WHITE): + _textPos.x = x + _textPos.y = y + floor(fontSize * Global.menuScale) + if center: + var textSize = COUR_FONT.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale) + _textPos.x -= textSize.x / 2 + target.draw_string(font, _textPos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, fontSize * Global.menuScale, color) + static func get_node_aabb(node : Node3D = null, ignore_top_level : bool = true, bounds_transform : Transform3D = Transform3D()) -> AABB: var box : AABB var transform : Transform3D diff --git a/src/file_parsers/B3D.gd b/src/file_parsers/B3D.gd index 3d98286..56a5b46 100644 --- a/src/file_parsers/B3D.gd +++ b/src/file_parsers/B3D.gd @@ -145,7 +145,6 @@ static func ReadNode(reader:BufferStuffReader, parsedResult: B3D): node.mesh = ReadMesh(chunkReader) node.add_child(CreateMesh(node.mesh, parsedResult)) - return node static func ReadBrush(reader:BufferStuffReader): diff --git a/src/file_parsers/X.gd b/src/file_parsers/X.gd index 93ceb85..f874cb3 100644 --- a/src/file_parsers/X.gd +++ b/src/file_parsers/X.gd @@ -597,126 +597,10 @@ func ParseFile(): ParseUnknownDataObject() # TODO: can't be arsed rn elif objectName == "AnimationSet": ParseUnknownDataObject() # TODO: can't be arsed rn - elif objectName == "Header": # 3D World Studio weird header + elif objectName == "Header": # 3D World Studio weird header? ParseUnknownDataObject() elif objectName == "Material": var material = ParseMaterial() materials.push_back(material) else: break - -#static func LoadModel(filePath: String): - #var sillyPath = str("res://", filePath.replace("/Map/", "/map/")) - #var file = FileAccess.open(sillyPath, FileAccess.READ) - # - ## Do a case insensitive lookup only if we have to, it's more expensive. - #if file == null: - #file = FileAccess.open(Utils.GetCaseiFileName(sillyPath), FileAccess.READ) - # - #var fileLines = file.get_as_text(true).split("\n") - # - #var meshDataStart = false - #var hitMeshOnce = false - #var indexDataStart = false - #var meshTextureCoordsStart = false - #var hitTexCoordsOnce = false - #var textureNameStart = false - #var hitTextureOnce = false - #var textureName = "" - #var texture: Texture2D = null - #var meshDataLength = -1 - #var uvsDataLength = -1 - #var indexDataLength = -1 - #var verts = PackedVector3Array() - #var uvs = PackedVector2Array() - #var indexes = PackedInt32Array() - ## oh god oh fuck i hope not - #var is3dWorldStudioFile = false - #for line in fileLines: - #if line.contains("3D World Studio"): - #is3dWorldStudioFile = true - # - #var stripLine = line.strip_edges().strip_escapes().replace(" ", "") - #if stripLine == "{" or stripLine == "}": - #continue - # - #if meshDataStart or indexDataStart: - #if meshDataStart and meshDataLength == -1: - #meshDataLength = int(line.strip_edges().split(";")[0]) - #elif indexDataStart and indexDataLength == -1: - #indexDataLength = int(line.strip_edges().split(";")[0]) - #elif meshDataStart: - #var pointData = line.strip_edges().split(";") - #if pointData.size() == 5: - #meshDataStart = false - #indexDataStart = true - #verts.push_back(Vector3(-float(pointData[0]), float(pointData[1]), float(pointData[2]))) - #elif indexDataStart: - #var indexParts = line.strip_edges().split(";") - #if indexParts.size() == 4: - #indexDataStart = false - #var indexData = indexParts[1].split(",") - #var amount = int(indexParts[0]) - #for i in range(amount): - #indexes.push_back(int(indexData[i])) - #elif textureNameStart: - #textureName = line.strip_edges().split(";")[0].replace("\"", "") - #var texturePath = str("GFX/map/Props/", textureName) - #texture = Global.GetTextureFromCache(texturePath) - #if not texture: - #texture = Global.LoadTexture(texturePath) - #textureNameStart = false - #elif meshTextureCoordsStart: - #if uvsDataLength == -1: - #uvsDataLength = int(line.strip_edges().split(";")[0]) - #else: - ## NOTE: THE FORMAT IS DIFFERENT ON FILES MADE IN - ## 3D WORLD STUDIO FOR SOME REASON?! - #if is3dWorldStudioFile: - #var uvParts = line.strip_edges().strip_escapes().split(";") - #if uvParts.size() == 3: - #meshTextureCoordsStart = false - #else: - #var uvShit = uvParts[0].split(",") - #uvs.push_back(Vector2(float(uvShit[0]), float(uvShit[1]))) - #else: - #var uvParts = line.strip_edges().strip_escapes().split(";") - #if uvParts.size() == 4: - #meshTextureCoordsStart = false - #else: - #uvs.push_back(Vector2(float(uvParts[0]), float(uvParts[1]))) - # - #if line.strip_edges().contains("Mesh ") and not hitMeshOnce: - #meshDataStart = true - #hitMeshOnce = true - #elif line.strip_edges().contains("TextureFilename") and not hitTextureOnce: - #textureNameStart = true - #hitTextureOnce = true - #elif line.strip_edges().contains("MeshTextureCoords") and not hitTexCoordsOnce: - #meshTextureCoordsStart = true - #hitTexCoordsOnce = true - # - #var mesh = MeshInstance3D.new() - #var arr_mesh = ArrayMesh.new() - #var arr = [] - #arr.resize(Mesh.ARRAY_MAX) - # - #arr[Mesh.ARRAY_VERTEX]=verts - #arr[Mesh.ARRAY_TEX_UV]=uvs - #arr[Mesh.ARRAY_INDEX]=indexes - # - #var meshInstance = MeshInstance3D.new() - #arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) - #meshInstance.mesh = arr_mesh - #var mat = StandardMaterial3D.new() - ##mat.albedo_color = Color(randi() % 255 / 255.0, randi() % 255 / 255.0, randi() % 255 / 255.0) - #mat.albedo_texture = texture - ##mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA_DEPTH_PRE_PASS if activeAlbedoHasAlpha else BaseMaterial3D.TRANSPARENCY_DISABLED - #meshInstance.set_surface_override_material(0, mat) - #meshInstance.create_trimesh_collision() - #meshInstance.name = str(filePath, "_", Time.get_unix_time_from_system()) - #var meshSize = _CalcMinMaxPos(verts) - #meshInstance.set_meta("meshWidth", meshSize.x) - #meshInstance.set_meta("meshHeight", meshSize.y) - #meshInstance.set_meta("meshDepth", meshSize.z) - #return meshInstance diff --git a/src/stinky.gd b/src/stinky.gd index b10c3f7..a772b66 100644 --- a/src/stinky.gd +++ b/src/stinky.gd @@ -1,6 +1,7 @@ extends Node3D -# for when it just isn't. +# stinky.gd +# "for when it just isn't." ~ Holly #func _process(delta: float): #$Egg.position.y = X.MeshHeight(self) + 0.5