work on intro event + in game ui stuff

This commit is contained in:
Holly Stubbs 2025-04-20 01:07:20 +01:00
parent c57e2bd426
commit 64bac176aa
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
13 changed files with 218 additions and 228 deletions

36
UIRoot.gd Normal file
View file

@ -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)

1
UIRoot.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://c7bo5yefn1pbv

BIN
fonts/Blitz.ttf Executable file

Binary file not shown.

35
fonts/Blitz.ttf.import Normal file
View file

@ -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={}

View file

@ -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://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://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"] [sub_resource type="Environment" id="Environment_d5g72"]
background_mode = 1 background_mode = 1
@ -16,8 +17,14 @@ fog_depth_begin = 1.0
[node name="DynamicMap" type="Node3D"] [node name="DynamicMap" type="Node3D"]
script = ExtResource("1_mytgt") script = ExtResource("1_mytgt")
[node name="UILayer" type="CanvasLayer" parent="."] [node name="UIRoot" type="Control" parent="."]
layer = 64 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="."] [node name="EventSystem" type="Node" parent="."]
script = ExtResource("2_vb526") script = ExtResource("2_vb526")

View file

@ -29,7 +29,10 @@ func EntityParent(obj: Node, parent: Node):
if obj.get_parent() == null: if obj.get_parent() == null:
parent.add_child(obj) parent.add_child(obj)
else: else:
obj.reparent(parent, true) if parent:
obj.reparent(parent, true)
else:
obj.reparent(self, true)
func EntityDistance(ent1: Node3D, ent2: Node3D): func EntityDistance(ent1: Node3D, ent2: Node3D):
return ent1.global_position.distance_to(ent2.global_position) return ent1.global_position.distance_to(ent2.global_position)
@ -423,12 +426,20 @@ var UpdateDoorsTimer: float = 0.0
var QuickLoadPercent: int = -1 var QuickLoadPercent: int = -1
var RemoteDoorOn: bool = false var RemoteDoorOn: bool = false
var TempLightVolume: float 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 Brightness: int = INI.GetInt(Global.options["options"], "brightness")
@onready var CameraFogNear: float = INI.GetFloat(Global.options["options"], "camera fog near") @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 CameraFogFar: float = INI.GetFloat(Global.options["options"], "camera fog far")
@onready var worldEnvironment: WorldEnvironment = $WorldEnvironment @onready var worldEnvironment: WorldEnvironment = $WorldEnvironment
@onready var env: Environment = worldEnvironment.environment @onready var env: Environment = worldEnvironment.environment
@onready var uiRoot: Control = $UIRoot
func _process(delta: float) -> void: func _process(delta: float) -> void:
@ -476,7 +487,7 @@ func _process(delta: float) -> void:
#UpdateScreens() #UpdateScreens()
#UpdateRoomLights(Camera) #UpdateRoomLights(Camera)
#Else #Else
UpdateDoors() #UpdateDoors() TODO: PUT BACK
if QuickLoadPercent == -1 or QuickLoadPercent == 100: if QuickLoadPercent == -1 or QuickLoadPercent == 100:
eventSystem.UpdateEvents() eventSystem.UpdateEvents()
#UpdateScreens() #UpdateScreens()
@ -491,6 +502,16 @@ func _process(delta: float) -> void:
UpdateParticles() UpdateParticles()
#Use427() #Use427()
#UpdateMonitorSaving() #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 SelectedMap = ""
var PlayerZone = 0 var PlayerZone = 0

View file

@ -699,93 +699,86 @@ func UpdateEvents():
#user_camera_pitch = 0 #user_camera_pitch = 0
#RotateEntity Global.player, 0, EntityYaw(Camera), 0 #RotateEntity Global.player, 0, EntityYaw(Camera), 0
# #
#ElseIf e\EventState3 < 40 elif e.EventState3 < 40:
#If Inventory(0)<>Null Then if map.Inventory[0] != null:
#Msg = "Press "+KeyName(KEY_INV)+" to open the inventory." #map.Msg = "Press "+KeyName(KEY_INV)+" to open the inventory."
#MsgTimer=70*7 map.Msg = "Press TAB to open the inventory." # TODO: Make pull from setting.
#e\EventState3 = 40 map.MsgTimer=70*7
#Exit e.EventState3 = 40
#EndIf break
#EndIf if map.SelectedItem != null:
# e.EventState3 = e.EventState3 + Global.FPSfactor / 5.0
#If SelectedItem <> Null Then elif e.EventState3 >= 150.0 and e.EventState3 < 700:
#e\EventState3 = e\EventState3+FPSfactor/5.0 if e.room.NPC[3].State == 7:
#EndIf if e.room.NPC[3].Sound2 == null:
# e.room.NPC[3].Sound2 = Global.LoadSound("SFX\\Room\\Intro\\Guard\\Ulgrin\\BeforeDoorOpen.ogg")
#ElseIf e\EventState3 => 150.0 And e\EventState3 < 700 e.room.NPC[3].SoundChn2 = Global.PlaySound2(e.room.NPC[3].Sound2, Global.player.camera, e.room.NPC[3].Collider)
#If e\room\NPC[3]\State = 7 Then print("Playing guard sound before cell opening")
#If e\room\NPC[3]\Sound2 = 0
#e\room\NPC[3]\Sound2 = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\BeforeDoorOpen.ogg") Global.UpdateSoundOrigin(e.room.NPC[3].SoundChn2, Global.player.camera, e.room.NPC[3].Collider)
#e\room\NPC[3]\SoundChn2 = PlaySound2(e\room\NPC[3]\Sound2,Camera,e\room\NPC[3]\Collider)
#DebugLog "Playing guard sound before cell opening" if (not Global.ChannelPlaying(e.room.NPC[3].SoundChn2)):
#EndIf #BlinkTimer = -10
#
#UpdateSoundOrigin(e\room\NPC[3]\SoundChn2,Camera,e\room\NPC[3]\Collider) 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)
#If (Not ChannelPlaying(e\room\NPC[3]\SoundChn2))
#;BlinkTimer = -10 #e\room\NPC[3]\State = 7
# #e\room\NPC[4]\State = 7
#e\room\NPC[3]\Sound = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\ExitCell.ogg") #e\room\NPC[5]\State = 7
#e\room\NPC[3]\SoundChn = PlaySound2(e\room\NPC[3]\Sound, Camera, e\room\NPC[3]\Collider) e.room.NPC[3].State = 9
# e.room.NPC[4].State = 9
#;e\room\NPC[3]\State = 7 e.room.NPC[5].State = 9
#;e\room\NPC[4]\State = 7
#;e\room\NPC[5]\State = 7 e.room.RoomDoors[6].locked = false
#e\room\NPC[3]\State = 9 map.UseDoor(e.room.RoomDoors[6], false)
#e\room\NPC[4]\State = 9 e.room.RoomDoors[6].locked = true
#e\room\NPC[5]\State = 9 else:
# e.room.NPC[3].Sound2.queue_free()
#e\room\RoomDoors[6]\locked = False
#UseDoor(e\room\RoomDoors[6], False) #PointEntity e\room\NPC[3]\obj, Collider
#e\room\RoomDoors[6]\locked = True #RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\obj), 0
#EndIf
#Else #PointEntity e\room\NPC[4]\obj, Collider
#FreeSound_Strict e\room\NPC[3]\Sound2 #RotateEntity e\room\NPC[4]\Collider, 0, EntityYaw(e\room\NPC[4]\obj), 0
#
#;PointEntity e\room\NPC[3]\obj, Collider e.EventState3 = min(e.EventState3 + Global.FPSfactor / 4, 699)
#;RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\obj), 0
# #outside the cell
#;PointEntity e\room\NPC[4]\obj, Collider 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:
#;RotateEntity e\room\NPC[4]\Collider, 0, EntityYaw(e\room\NPC[4]\obj), 0 e.room.NPC[3].State = 5
# e.room.NPC[3].EnemyX = map.EntityX(Global.player)
#e\EventState3 = Min(e\EventState3+FPSfactor/4,699) e.room.NPC[3].EnemyY = map.EntityY(Global.player)
# e.room.NPC[3].EnemyZ = map.EntityZ(Global.player)
#;outside the cell
#If Distance(EntityX(Collider),EntityZ(Collider),PlayerRoom\x-(3072+1024)*RoomScale, PlayerRoom\z+192.0*RoomScale)>1.5 Then if e.EventState3 > 250:
#;e\room\NPC[3]\State = 5 if e.room.NPC[3].SoundChn != null:
#;e\room\NPC[3]\EnemyX = EntityX(Collider) if Global.ChannelPlaying(e.room.NPC[3].SoundChn):
#;e\room\NPC[3]\EnemyY = EntityY(Collider) Global.StopChannel(e.room.NPC[3].SoundChn)
#;e\room\NPC[3]\EnemyZ = EntityZ(Collider) 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")
#If e\EventState3 > 250 Then e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider)
#If e\room\NPC[3]\SoundChn<>0 Then
#If ChannelPlaying(e\room\NPC[3]\SoundChn) Then StopChannel e\room\NPC[3]\SoundChn #e\room\NPC[3]\PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale)
#EndIf #e\room\NPC[4]\PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale)
#FreeSound_Strict e\room\NPC[3]\Sound #e.room.NPC[3].PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale)
#e\room\NPC[3]\Sound = LoadSound_Strict("SFX\Room\Intro\Guard\Ulgrin\Escort"+Rand(1,2)+".ogg") #e.room.NPC[4].PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale)
#e\room\NPC[3]\SoundChn = PlaySound2(e\room\NPC[3]\Sound, Camera, e\room\NPC[3]\Collider)
# e.EventState3 = 710
#;e\room\NPC[3]\PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale) else: #inside the cell
#;e\room\NPC[4]\PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-1584*RoomScale, 0.3, PlayerRoom\z-1040*RoomScale) e.room.NPC[3].State = 9
#e\room\NPC[3]\PathStatus = FindPath(e\room\NPC[3],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale) #PointEntity e\room\NPC[3]\Collider, Collider
#e\room\NPC[4]\PathStatus = FindPath(e\room\NPC[4],PlayerRoom\x-320*RoomScale, 0.3, PlayerRoom\z-704*RoomScale) #RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\Collider), 0
#
#e\EventState3 = 710 if e.EventState3 - (Global.FPSfactor / 4) < 350 and e.EventState3 >= 350:
#EndIf e.room.NPC[3].Sound.queue_free()
#Else ;inside the cell e.room.NPC[3].Sound = Global.LoadAudio("SFX\\Room\\Intro\\Guard\\Ulgrin\\ExitCellRefuse" + str(randi_range(1, 2)) + ".ogg")
#e\room\NPC[3]\State = 9 e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider)
#;PointEntity e\room\NPC[3]\Collider, Collider elif e.EventState3 - (Global.FPSfactor / 4) < 550 and e.EventState3 >= 550:
#;RotateEntity e\room\NPC[3]\Collider, 0, EntityYaw(e\room\NPC[3]\Collider), 0 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")
#If e\EventState3-(FPSfactor/4) < 350 And e\EventState3=>350 Then e.room.NPC[3].SoundChn = Global.PlaySound2(e.room.NPC[3].Sound, Global.player.camera, e.room.NPC[3].Collider)
#FreeSound_Strict e\room\NPC[3]\Sound #elif e.EventState3 > 630:
#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
#PositionEntity Collider, EntityX(Collider), EntityY(Collider), Min(EntityZ(Collider), EntityZ(e\room\obj,True)+490*RoomScale) #PositionEntity Collider, EntityX(Collider), EntityY(Collider), Min(EntityZ(Collider), EntityZ(e\room\obj,True)+490*RoomScale)
#If e\room\RoomDoors[6]\open = True Then #If e\room\RoomDoors[6]\open = True Then
#e\room\RoomDoors[6]\locked = False #e\room\RoomDoors[6]\locked = False

View file

@ -20,6 +20,9 @@ var frameDelay = 1
func _process(delta: float) -> void: func _process(delta: float) -> void:
if loadStage == 0 and frameDelay == 0: if loadStage == 0 and frameDelay == 0:
Global.player = load("res://scenes/world/Player.tscn").instantiate()
map.add_child(Global.player)
LoadEntities.Go(map) LoadEntities.Go(map)
LoadAllSounds.Go(map) LoadAllSounds.Go(map)
@ -162,8 +165,7 @@ func _process(delta: float) -> void:
Global.PlayTempSound(map.StepSFX[0][0][0]) Global.PlayTempSound(map.StepSFX[0][0][0])
Global.player = load("res://scenes/world/Player.tscn").instantiate() # NOTE: ORIGINAL PLAYER LOAD POS
map.add_child(Global.player)
Global.player.BlinkTimer = -10 Global.player.BlinkTimer = -10
#Global.player.BlurTimer = 100 #Global.player.BlurTimer = 100

View file

@ -30,17 +30,6 @@ var bgImage: CompressedTexture2D
const COUR_FONT = preload("res://GFX/font/cour/Courier New.ttf") 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): func generateTextRows(string = "", mw = 0):
var arrayIndex = 0; var arrayIndex = 0;
var strings = [""]; var strings = [""];
@ -65,7 +54,7 @@ func generateTextRows(string = "", mw = 0):
func renderTextRows(rows: Array, x: int, y: int): func renderTextRows(rows: Array, x: int, y: int):
for i in range(rows.size()): for i in range(rows.size()):
var textSize = COUR_FONT.get_string_size(rows[i], HORIZONTAL_ALIGNMENT_LEFT, -1, 19 * Global.menuScale) 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 loadProgressIndex: int = 0
var loadingText: Array = [] var loadingText: Array = []
@ -141,10 +130,10 @@ func _draw():
if selectedLoadingScreen.title == "CWM": if selectedLoadingScreen.title == "CWM":
pass # TODO! pass # TODO!
else: 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) 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 percent == 100:
#If firstloop And SelectedLoadingScreen\title <> "CWM" Then PlaySound_Strict LoadTempSound(("SFX\Horror\Horror8.ogg")) #If firstloop And SelectedLoadingScreen\title <> "CWM" Then PlaySound_Strict LoadTempSound(("SFX\Horror\Horror8.ogg"))
@ -152,5 +141,5 @@ func _draw():
firstloop = false firstloop = false
loaded = true loaded = true
Global.PlayTempSound("SFX/Horror/Horror8.ogg") 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)

View file

@ -124,6 +124,28 @@ static func DrawImage(target: Control, texture, x: int, y: int):
workingPos1.y = y workingPos1.y = y
target.draw_texture(texture, workingPos1) 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: static func get_node_aabb(node : Node3D = null, ignore_top_level : bool = true, bounds_transform : Transform3D = Transform3D()) -> AABB:
var box : AABB var box : AABB
var transform : Transform3D var transform : Transform3D

View file

@ -145,7 +145,6 @@ static func ReadNode(reader:BufferStuffReader, parsedResult: B3D):
node.mesh = ReadMesh(chunkReader) node.mesh = ReadMesh(chunkReader)
node.add_child(CreateMesh(node.mesh, parsedResult)) node.add_child(CreateMesh(node.mesh, parsedResult))
return node return node
static func ReadBrush(reader:BufferStuffReader): static func ReadBrush(reader:BufferStuffReader):

View file

@ -597,126 +597,10 @@ func ParseFile():
ParseUnknownDataObject() # TODO: can't be arsed rn ParseUnknownDataObject() # TODO: can't be arsed rn
elif objectName == "AnimationSet": elif objectName == "AnimationSet":
ParseUnknownDataObject() # TODO: can't be arsed rn ParseUnknownDataObject() # TODO: can't be arsed rn
elif objectName == "Header": # 3D World Studio weird header elif objectName == "Header": # 3D World Studio weird header?
ParseUnknownDataObject() ParseUnknownDataObject()
elif objectName == "Material": elif objectName == "Material":
var material = ParseMaterial() var material = ParseMaterial()
materials.push_back(material) materials.push_back(material)
else: else:
break 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

View file

@ -1,6 +1,7 @@
extends Node3D extends Node3D
# for when it just isn't. # stinky.gd
# "for when it just isn't." ~ Holly
#func _process(delta: float): #func _process(delta: float):
#$Egg.position.y = X.MeshHeight(self) + 0.5 #$Egg.position.y = X.MeshHeight(self) + 0.5