This commit is contained in:
Holly Stubbs 2025-03-03 19:35:36 +00:00
parent 22167a7048
commit c415b80801
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
6 changed files with 227 additions and 112 deletions

View file

@ -3,25 +3,26 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cp5m56t5o58m0"
path="res://.godot/imported/pic1.jpg-ef2d2f1a1cefc5f1ab1f63a12db97fc0.ctex"
path.s3tc="res://.godot/imported/pic1.jpg-ef2d2f1a1cefc5f1ab1f63a12db97fc0.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://GFX/895pics/pic1.jpg"
dest_files=["res://.godot/imported/pic1.jpg-ef2d2f1a1cefc5f1ab1f63a12db97fc0.ctex"]
dest_files=["res://.godot/imported/pic1.jpg-ef2d2f1a1cefc5f1ab1f63a12db97fc0.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@ -31,4 +32,4 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
detect_3d/compress_to=0

View file

@ -1,19 +1,13 @@
[gd_scene load_steps=7 format=3 uid="uid://bc46lc1tdvrio"]
[gd_scene load_steps=5 format=3 uid="uid://bc46lc1tdvrio"]
[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)
sky_horizon_color = Color(0.615875, 0.658795, 0.726562, 1)
[sub_resource type="Sky" id="Sky_qyldw"]
sky_material = SubResource("ProceduralSkyMaterial_tvhkv")
[sub_resource type="Environment" id="Environment_d5g72"]
background_mode = 2
sky = SubResource("Sky_qyldw")
background_mode = 1
ambient_light_source = 2
ambient_light_color = Color(1, 1, 1, 1)
sdfgi_use_occlusion = true
[node name="DynamicMap" type="Node3D"]
@ -34,7 +28,6 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0,
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.2, 12.2, 0.3)
visible = false
use_collision = true
size = Vector3(15.4238, 0.866943, 15.2599)

View file

@ -18,8 +18,15 @@ func EntityYaw(obj: Node3D, global: bool = false):
func EntityRoll(obj: Node3D, global: bool = false):
return rad_to_deg(obj.global_rotation.z if global else obj.rotation.z)
func ScaleSprite(obj: Sprite3D, x: float, y: float):
obj.scale.x = x
obj.scale.y = y
func EntityParent(obj: Node, parent: Node):
parent.add_child(obj)
if obj.get_parent() == null:
parent.add_child(obj)
else:
obj.reparent(parent, true)
func ScaleEntity(obj: Node3D, x: float, y: float, z: float):
if obj == null:
@ -406,6 +413,8 @@ var ParticleTextures = [
load(Utils.GetCaseiFileName("GFX/particle.png"))
]
var DecalTextures = []
var MenuOpen = false
var InvOpen = false
var OtherOpen = null
@ -463,7 +472,7 @@ func _process(delta: float) -> void:
#Update294()
#UpdateRoomLights(Camera)
#EndIf
#UpdateDecals()
UpdateDecals()
#UpdateMTF()
#UpdateNPCs()
#UpdateItems()
@ -473,6 +482,8 @@ func _process(delta: float) -> void:
var emitters: Array = []
func UpdateEmitters():
# TODO: Particle emitters temp disabled!!
return
Global.player.InSmoke = false
for e: Emitter in emitters:
if Global.FPSfactor > 0: #and (PlayerRoom == e.room or e.room.dist < 8):
@ -527,8 +538,6 @@ func UpdateEmitters():
#EndIf
func CreateEmitter(x: float, y: float, z: float, emittertype: int) -> Emitter:
print("TEMP: PARTICLE EMITTERS DISABLED!")
return
var e: Emitter = Emitter.new()
e.Obj = Node3D.new()
@ -732,8 +741,12 @@ func CreateDoor(lvl, x:float, y:float, z:float, angle:float, room:Room, dopen =
d.buttons[i].scale.y = 0.03
d.buttons[i].scale.z = 0.03
EntityParent(d.buttons[0], d.frameobj)
EntityParent(d.buttons[1], d.frameobj)
if d.frameobj:
EntityParent(d.buttons[0], d.frameobj)
EntityParent(d.buttons[1], d.frameobj)
else:
parent.add_child(d.buttons[0])
parent.add_child(d.buttons[1])
if big > 0:
d.buttons[0].global_position.x = x - 432.0 * Constants.RoomScale
@ -775,6 +788,8 @@ func CreateDoor(lvl, x:float, y:float, z:float, angle:float, room:Room, dopen =
d.obj2.rotation.y = deg_to_rad(angle + 180)
print("BTNHERE: ", d.buttons[0].global_position)
d.angle = angle
d.open = dopen
@ -817,6 +832,90 @@ func CreateDoor(lvl, x:float, y:float, z:float, angle:float, room:Room, dopen =
return d
var decals: Array = []
func CreateDecal(id: int, x: float, y: float, z: float, pitch: float, yaw: float, roll: float):
var d:SCPDecal = SCPDecal.new()
d.x = x
d.y = y
d.z = z
d.pitch = pitch
d.yaw = yaw
d.roll = roll
d.MaxSize = 1.0
d.Alpha = 1.0
d.Size = 1.0
d.obj = Sprite3D.new()
add_child(d.obj)
d.blendmode = 1
if DecalTextures.size() - 1 < id:
return null
d.obj.texture = DecalTextures[id]
#EntityFX(d\obj, 0)
#SpriteViewMode(d\obj, 2)
PositionEntity(d.obj, x, y, z)
RotateEntity(d.obj, pitch, yaw, roll)
d.ID = id
if d.obj != null:
return null
return d
func UpdateDecals():
for d:SCPDecal in decals:
if d.SizeChange != null:
d.Size += d.SizeChange * Global.FPSfactor
ScaleSprite(d.obj, d.Size, d.Size)
if d.ID == 0:
if d.timer <= 0:
var angle# = Rand(360)
var temp# = Rnd(d\Size)
var d2:SCPDecal = CreateDecal(1, EntityX(d.obj) + Global.Cos(angle) * temp, EntityY(d.obj) - 0.0005, EntityZ(d.obj) + Global.Sin(angle) * temp, EntityPitch(d.obj), randi_range(0, 360), EntityRoll(d.obj))
d2.Size = randf_range(0.1, 0.5)
ScaleSprite(d2.obj, d2.Size, d2.Size)
#PlaySound2(DecaySFX(Rand(1, 3)), Camera, d2\obj, 10.0, Rnd(0.1, 0.5))
#;d\Timer = d\Timer + Rand(50,150)
d.timer = randi_range(50, 100)
else:
d.timer = d.timer - Global.FPSfactor
#;elif d.Id == 6:
#; EntityBlend d\obj, 2
if d.Size >= d.MaxSize:
d.SizeChange = 0
d.Size = d.MaxSize
if d.AlphaChange != null:
d.Alpha = min(d.Alpha + Global.FPSfactor * d.AlphaChange, 1.0)
d.obj.modulate.a = d.Alpha
if d.lifetime > 0:
d.lifetime = max(d.lifetime - Global.FPSfactor, 5.0)
if d.Size <= 0 or d.Alpha <= 0 or d.lifetime == 5.0:
d.obj.queue_free()
decals.erase(d)
func CreateButton(x: float, y: float, z: float, pitch: float, yaw: float, roll: float = 0):
var obj = X.LoadModel("GFX/map/Button.x") #CopyEntity(ButtonOBJ)
ScaleEntity(obj, 0.03, 0.03, 0.03)
PositionEntity(obj, x, y, z)
RotateEntity(obj, pitch, yaw, roll)
#EntityPickMode(obj, 2)
return obj
func FillRoom(r:Room):
#CatchErrors("Uncaught (FillRoom)")
#Local d.Doors, d2.Doors, sc.SecurityCams, de.Decals, r2.Rooms, sc2.SecurityCams
@ -867,23 +966,22 @@ func FillRoom(r:Room):
#; CameraFogRange dp\cam,0.5,8.0
#; CameraFogColor dp\cam,98,133,162
#; CameraFogMode dp\cam,1
#
#;doors to observation booth
#d = CreateDoor(r\zone, r\x + 928.0 * RoomScale,0,r\z + 640.0 * RoomScale,0,r,False,False,False,"ABCD")
#d = CreateDoor(r\zone, r\x + 928.0 * RoomScale,0,r\z - 640.0 * RoomScale,0,r,True,False,False,"ABCD")
#d\AutoClose = False
#
#;doors to the room itself
#d = CreateDoor(r\zone, r\x+416.0*RoomScale,0,r\z - 640.0 * RoomScale,0,r,False,False,1)
#d = CreateDoor(r\zone, r\x+416.0*RoomScale,0,r\z + 640.0 * RoomScale,0,r,False,False,1)
#
#;the forest
#If I_Zone\HasCustomForest = False Then
#Local fr.Forest = New Forest
# doors to observation booth
var d = CreateDoor(r.zone, r.x + 928.0 * Constants.RoomScale, 0, r.z + 640.0 * Constants.RoomScale, 0, r, false, false, false, "ABCD")
d = CreateDoor(r.zone, r.x + 928.0 * Constants.RoomScale, 0, r.z - 640.0 * Constants.RoomScale, 0, r, true, false, false, "ABCD")
d.AutoClose = false
# doors to the room itself
d = CreateDoor(r.zone, r.x + 416.0 * Constants.RoomScale, 0, r.z - 640.0 * Constants.RoomScale, 0, r, false, false, 1)
d = CreateDoor(r.zone, r.x + 416.0 * Constants.RoomScale, 0, r.z + 640.0 * Constants.RoomScale, 0, r, false, false, 1)
# the forest
#if not I_Zone.HasCustomForest:
#var fr.Forest = New Forest
#r\fr=fr
#GenForestGrid(fr)
#PlaceForest(fr,r\x,r\y+30.0,r\z,r)
#EndIf
#;EntityParent fr\Forest_Pivot,r\obj
#
#; PositionEntity dp\cam,EntityX(fr\Door[0],True),r\y+31.0,EntityZ(fr\Door[0],True),True
@ -925,7 +1023,7 @@ func FillRoom(r:Room):
d.AutoClose = false
d.open = false
r.obj.reparent(d.buttons[0])
EntityParent(d.buttons[0], r.obj)
d.buttons[0].global_position.x = r.x - 288.0 * Constants.RoomScale
d.buttons[0].global_position.y = 0.7
d.buttons[0].global_position.x = r.z - 640.0 * Constants.RoomScale
@ -1000,40 +1098,37 @@ func FillRoom(r:Room):
#;dem.DevilEmitters = CreateDevilEmitter(r\x-655.0*RoomScale,r\y+370.0*RoomScale,r\z+240.0*RoomScale,r,2)
#;dem\isDeconGas = True
#;[End Block]
#Case "lockroom2"
#;[Block]
#For i = 0 To 5
#de.Decals = CreateDecal(Rand(2,3), r\x+Rnd(-392,520)*RoomScale, 3.0*RoomScale+Rnd(0,0.001), r\z+Rnd(-392,520)*RoomScale,90,Rnd(360),0)
#de\Size = Rnd(0.3,0.6)
#ScaleSprite(de\obj, de\Size,de\Size)
#CreateDecal(Rand(15,16), r\x+Rnd(-392,520)*RoomScale, 3.0*RoomScale+Rnd(0,0.001), r\z+Rnd(-392,520)*RoomScale,90,Rnd(360),0)
#de\Size = Rnd(0.1,0.6)
#ScaleSprite(de\obj, de\Size,de\Size)
#CreateDecal(Rand(15,16), r\x+Rnd(-0.5,0.5), 3.0*RoomScale+Rnd(0,0.001), r\z+Rnd(-0.5,0.5),90,Rnd(360),0)
#de\Size = Rnd(0.1,0.6)
#ScaleSprite(de\obj, de\Size,de\Size)
#Next
#
elif rn == "lockroom2":
for i in range(6):
var de: SCPDecal = CreateDecal(randi_range(2,3), r.x + randf_range(-392,520) * Constants.RoomScale, 3.0 * Constants.RoomScale + randf_range(0,0.001), r.z + randi_range(-392,520) * Constants.RoomScale, 90, randf_range(0, 360), 0)
de.Size = randf_range(0.3,0.6)
ScaleSprite(de.obj, de.Size, de.Size)
CreateDecal(randi_range(15,16), r.x + randf_range(-392,520) * Constants.RoomScale, 3.0 * Constants.RoomScale + randf_range(0,0.001), r.z + randf_range(-392,520) * Constants.RoomScale, 90, randf_range(0, 360), 0)
de.Size = randf_range(0.1,0.6)
ScaleSprite(de.obj, de.Size, de.Size)
CreateDecal(randi_range(15,16), r.x + randf_range(-0.5,0.5), 3.0 * Constants.RoomScale + randf_range(0,0.001), r.z + randf_range(-0.5,0.5), 90, randf_range(0, 360), 0)
de.Size = randf_range(0.1, 0.6)
ScaleSprite(de.obj, de.Size, de.Size)
#sc.SecurityCams = CreateSecurityCam(r\x + 512.0 * RoomScale, r\y + 384 * RoomScale, r\z + 384.0 * RoomScale, r, True)
#sc\angle = 45 + 90
#sc\turn = 45
#TurnEntity(sc\CameraObj, 40, 0, 0)
#EntityParent(sc\obj, r\obj)
#
#PositionEntity(sc\ScrObj, r\x + 668 * RoomScale, 1.1, r\z - 96.0 * RoomScale)
#TurnEntity(sc\ScrObj, 0, 90, 0)
#EntityParent(sc\ScrObj, r\obj)
#
#sc.SecurityCams = CreateSecurityCam(r\x - 384.0 * RoomScale, r\y + 384 * RoomScale, r\z - 512.0 * RoomScale, r, True)
#sc\angle = 45 + 90 + 180
#sc\turn = 45
#
#TurnEntity(sc\CameraObj, 40, 0, 0)
#EntityParent(sc\obj, r\obj)
#
#PositionEntity(sc\ScrObj, r\x + 96.0 * RoomScale, 1.1, r\z - 668.0 * RoomScale)
#EntityParent(sc\ScrObj, r\obj)
#;[End Block]
elif rn == "gatea":
r.RoomDoors[2] = CreateDoor(r.zone, r.x - 4064.0 * Constants.RoomScale, r.y - 1280.0 * Constants.RoomScale, r.z + 3952.0 * Constants.RoomScale, 0, r, false)
r.RoomDoors[2].AutoClose = false
@ -3303,8 +3398,7 @@ func FillRoom(r:Room):
#sc\turn = 45
#TurnEntity(sc\CameraObj, 20, 0, 0)
#;[End Block]
#Case "room106"
#;[Block]
elif rn == "room106":
#it = CreateItem("Level 5 Key Card", "key5", r\x - 752.0 * RoomScale, r\y - 592 * RoomScale, r\z + 3026.0 * RoomScale)
#EntityParent(it\collider, r\obj)
#
@ -3313,23 +3407,27 @@ func FillRoom(r:Room):
#
#it = CreateItem("Recall Protocol RP-106-N", "paper", r\x + 268.0 * RoomScale, r\y - 576 * RoomScale, r\z + 2593.0 * RoomScale)
#EntityParent(it\collider, r\obj)
#
#d = CreateDoor(r\zone, r\x - 968.0 * RoomScale, -764.0 * RoomScale, r\z + 1392.0 * RoomScale, 0, r, False, False, 4)
#d\AutoClose = False : d\open = False
#
#d = CreateDoor(r\zone, r\x, 0, r\z - 464.0 * RoomScale, 0, r, False, False, 4)
#d\AutoClose = False : d\open = False
#
#d = CreateDoor(r\zone, r\x - 624.0 * RoomScale, -1280.0 * RoomScale, r\z, 90, r, False, False, 4)
#d\AutoClose = False : d\open = False
#
#r\Objects[6] = LoadMesh_Strict("GFX\map\room1062.b3d")
#
#ScaleEntity (r\Objects[6],RoomScale,RoomScale,RoomScale)
var d = CreateDoor(r.zone, r.x - 968.0 * Constants.RoomScale, -764.0 * Constants.RoomScale, r.z + 1392.0 * Constants.RoomScale, 0, r, false, false, 4)
d.AutoClose = false
d.open = false
d = CreateDoor(r.zone, r.x, 0, r.z - 464.0 * Constants.RoomScale, 0, r, false, false, 4)
d.AutoClose = false
d.open = false
d = CreateDoor(r.zone, r.x - 624.0 * Constants.RoomScale, -1280.0 * Constants.RoomScale, r.z, 90, r, false, false, 4)
d.AutoClose = false
d.open = false
r.Objects[6] = B3D.Load("GFX/map/room1062.b3d")
EntityParent(r.Objects[6], r.obj)
ScaleEntity(r.Objects[6], Constants.RoomScale, Constants.RoomScale, Constants.RoomScale)
#EntityType r\Objects[6], HIT_MAP
#EntityPickMode r\Objects[6], 3
#PositionEntity(r\Objects[6],r\x+784.0*RoomScale,-980.0*RoomScale,r\z+720.0*RoomScale,True)
#
PositionEntity(r.Objects[6], r.x + 784.0 * Constants.RoomScale, -980.0 * Constants.RoomScale, r.z + 720.0 * Constants.RoomScale, true)
#;If BumpEnabled Then
#;
#; For i = 1 To CountSurfaces(r\Objects[6])
@ -3358,36 +3456,33 @@ func FillRoom(r:Room):
#; Next
#;
#;EndIf
#
#EntityParent(r\Objects[6], r\obj)
#
#For n = 0 To 2 Step 2
#r\Objects[n] = CopyEntity(LeverBaseOBJ)
#r\Objects[n+1] = CopyEntity(LeverOBJ)
#
#r\Levers[n/2] = r\Objects[n+1]
#
#For i% = 0 To 1
#ScaleEntity(r\Objects[n+i], 0.04, 0.04, 0.04)
#PositionEntity (r\Objects[n+i], r\x - (555.0 - 81.0 * (n/2)) * RoomScale, r\y - 576.0 * RoomScale, r\z + 3040.0 * RoomScale, True)
#
#EntityParent(r\Objects[n+i], r\obj)
#Next
#RotateEntity(r\Objects[n], 0, 0, 0)
#RotateEntity(r\Objects[n+1], 10, -180, 0)
#
for n in range(0, 3, 2):
r.Objects[n] = X.LoadModel("GFX/map/leverbase.x") #CopyEntity(LeverBaseOBJ)
r.Objects[n + 1] = X.LoadModel("GFX/map/leverhandle.x") #CopyEntity(LeverOBJ)
r.Levers[n / 2] = r.Objects[n + 1]
for i in range(2):
EntityParent(r.Objects[n + i], r.obj)
ScaleEntity(r.Objects[n + i], 0.04, 0.04, 0.04)
PositionEntity(r.Objects[n + i], r.x - (555.0 - 81.0 * (n / 2)) * Constants.RoomScale, r.y - 576.0 * Constants.RoomScale, r.z + 3040.0 * Constants.RoomScale, true)
RotateEntity(r.Objects[n], 0, 0, 0)
RotateEntity(r.Objects[n + 1], 10, -180, 0)
#;EntityPickMode(r\Objects[n * 2 + 1], 2)
#EntityPickMode r\Objects[n+1], 1, False
#EntityRadius r\Objects[n+1], 0.1
#;makecollbox(r\Objects[n * 2 + 1])
#Next
#
#RotateEntity(r\Objects[1], 81,-180,0)
#RotateEntity(r\Objects[3], -81,-180,0)
#
#r\Objects[4] = CreateButton(r\x - 146.0*RoomScale, r\y - 576.0 * RoomScale, r\z + 3045.0 * RoomScale, 0,0,0)
#EntityParent (r\Objects[4],r\obj)
#
RotateEntity(r.Objects[1], 81, -180, 0)
RotateEntity(r.Objects[3], -81, -180, 0)
r.Objects[4] = CreateButton(r.x - 146.0 * Constants.RoomScale, r.y - 576.0 * Constants.RoomScale, r.z + 3045.0 * Constants.RoomScale, 0,0,0)
EntityParent(r.Objects[4], r.obj)
#sc.SecurityCams = CreateSecurityCam(r\x + 768.0 * RoomScale, r\y + 1392.0 * RoomScale, r\z + 1696.0 * RoomScale, r, True)
#sc\angle = 45 + 90 + 180
#sc\turn = 20
@ -4404,13 +4499,14 @@ func CalculateRoomTemplateExtents(r: RoomTemplate):
return
#GetMeshExtents(GetChild(r\obj,2))
var aabb = Utils.get_node_aabb(r.obj)
r.MinX = aabb.position.x
r.MinY = aabb.position.y
r.MinZ = aabb.position.z
r.MaxX = aabb.size.x
r.MaxY = aabb.size.y
r.MaxZ = aabb.size.z
# TODO: ROOM AABB NOT WORK BECAUSE NOT IN TREE!!
#var aabb = Utils.get_node_aabb(r.obj)
#r.MinX = aabb.position.x
#r.MinY = aabb.position.y
#r.MinZ = aabb.position.z
#r.MaxX = aabb.size.x
#r.MaxY = aabb.size.y
#r.MaxZ = aabb.size.z
print("roomtemplateextents: ", r.MinX, ", ", r.MinY, ", ", r.MinZ, ", ", r.MaxX, ", ", r.MaxY, ", ", r.MaxZ)

View file

@ -17,10 +17,13 @@ static func LoadRMesh(file: String, rt: RoomTemplate):
fileHandle.close()
var header = ReadString(reader)
var hasTriggerBox = header == "RoomMesh.HasTriggerBox"
var hasTriggerBox = false
if header != "RoomMesh" and header != "RoomMesh.HasTriggerBox":
print(str(correctedPath, " is Not RMESH"))
return
if header == "RoomMesh.HasTriggerBox":
hasTriggerBox = true
print("\"", header, "\"")
var scene = Node3D.new()
scene.name = str(fileName, "_", rt.Name, "_", RMESH_LOAD_COUNT)
@ -366,9 +369,10 @@ static func LoadRMesh(file: String, rt: RoomTemplate):
meshInstance.create_trimesh_collision()
#meshInstance.visible = false
scene.add_child(meshInstance)
meshInstance.name = ReadString(reader)
rt.TempTriggerbox[tb] = meshInstance
rt.TempTriggerboxName[tb] = ReadString(reader)
meshInstance.name = rt.TempTriggerboxName[tb]
rt.TempTriggerbox[tb] = meshInstance
count = reader.readInt() # point entities
for i1 in range(count):

View file

@ -594,9 +594,9 @@ func ParseFile():
elif objectName == "Mesh":
ParseMesh(scene)
elif objectName == "AnimTicksPerSecond":
ParseUnknownDataObject()
ParseUnknownDataObject() # TODO: can't be arsed rn
elif objectName == "AnimationSet":
ParseUnknownDataObject()
ParseUnknownDataObject() # TODO: can't be arsed rn
elif objectName == "Header": # 3D World Studio weird header
ParseUnknownDataObject()
elif objectName == "Material":

21
src/objects/Decal.gd Normal file
View file

@ -0,0 +1,21 @@
class_name SCPDecal
var obj: Sprite3D
var SizeChange: float
var Size: float
var MaxSize: float
var AlphaChange: float
var Alpha: float
var blendmode: int
var fx: int
var ID: int
var timer: float
var lifetime: float
var x: float
var y: float
var z: float
var pitch: float
var yaw: float
var roll: float