Skip to content

Commit

Permalink
spellbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Jan 30, 2025
1 parent 15a54c0 commit ad3413f
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Autoload/Graphics.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ var sprite_id = {
"SPELLBOOK_CHKN" : preload("res://dk_images/keepower_64/chicken_std.png"),
"SPELLBOOK_DWAL" : preload("res://dk_images/keepower_64/dstwall_std.png"),
"SPELLBOOK_TBMB" : preload("res://edited_images/timebomb.png"),
"SPELLBOOK_RBND" : preload("res://dk_images/crspell_64/rebound_std.png"),
"SPELLBOOK_FRZ" : preload("res://edited_images/freeze.png"),
"SPELLBOOK_SLOW" : preload("res://dk_images/crspell_64/slowdn_std.png"),
"SPELLBOOK_FLGT" : preload("res://dk_images/crspell_64/flight_std.png"),
"SPELLBOOK_VSN" : preload("res://edited_images/vision.png"),
"SPELLBOOK_TUNLR" : preload("res://edited_images/tunlr.png"),
# Objects
046 : preload("res://dk_images/furniture/torture_machine_tp/r1frame01.png"),
098 : preload("res://dk_images/furniture/workshop_machine_tp/AnimWorkshopMachine.tres"),
Expand Down
3 changes: 2 additions & 1 deletion Autoload/Names.gd
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ const things = {
"SPELLBOOK_FRZ" : "Freeze",
"SPELLBOOK_SLOW" : "Slow",
"SPELLBOOK_FLGT" : "Flight",
"SPELLBOOK_VSN" : "Vision"
"SPELLBOOK_VSN" : "Vision",
"SPELLBOOK_TUNLR" : "Create Tunneller"
}
}

Expand Down
20 changes: 11 additions & 9 deletions Scenes/CfgLoader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func load_objects_data(cfg): # 10ms
newName = objSection.get("Name", Things.DATA_OBJECT[id][Things.NAME_ID])

animID = objSection.get("AnimationID")
newSprite = get_sprite(animID, newName)
if newSprite == null or int(animID) == 777: # 777 is the AnimationID for all spellbooks in objects.cfg, which unearth uses separate sprites for
newSprite = get_sprite(newName, animID)
if newSprite == null:
newSprite = Things.DATA_OBJECT[id][Things.SPRITE]

newGenre = objSection.get("Genre")
Expand All @@ -124,7 +124,7 @@ func load_objects_data(cfg): # 10ms
else:
newName = objSection.get("Name", "UNDEFINED_NAME")
animID = objSection.get("AnimationID")
newSprite = get_sprite(animID, newName)
newSprite = get_sprite(newName, animID)

newGenre = objSection.get("Genre")

Expand Down Expand Up @@ -196,7 +196,7 @@ func load_creatures_data(cfg): # 3ms
var creature_id = id_number + 1
if not Things.DATA_CREATURE.has(creature_id):
var newName = creatures[id_number]
var newSprite = get_sprite(newName, null)
var newSprite = get_sprite(newName, -1)
Things.DATA_CREATURE[creature_id] = [newName, newSprite, "CREATURE"]

func load_trapdoor_data(cfg): # 1ms
Expand All @@ -213,7 +213,7 @@ func load_trapdoor_data(cfg): # 1ms

var data = cfg[section]
var newName = data.get("Name", null)
var newSprite = get_sprite(newName, null)
var newSprite = get_sprite(newName, -1)
var crateName = data.get("Crate", null)

if trapOrDoor == Things.TYPE.DOOR:
Expand All @@ -228,12 +228,14 @@ func load_trapdoor_data(cfg): # 1ms
Things.DATA_TRAP[id] = [newName, newSprite]
Things.LIST_OF_BOXES[crateName] = [trapOrDoor, id]

func get_sprite(first_priority, second_priority):
if Graphics.sprite_id.has(first_priority): return first_priority
if Graphics.sprite_id.has(second_priority): return second_priority
func get_sprite(newName, animID):
if int(animID) == 777: # 777 is the AnimationID for all spellbooks in objects.cfg, which unearth uses separate sprites for
if Graphics.sprite_id.has(newName): return newName

if Graphics.sprite_id.has(animID): return animID
if Graphics.sprite_id.has(newName): return newName
return null


func load_campaign_data(mapPath):
var levelsDirPath = mapPath.get_base_dir().get_base_dir()
var parentDirFolderName = levelsDirPath.get_file()
Expand Down
35 changes: 35 additions & 0 deletions edited_images/freeze.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/freeze.png-b991a392386b2c768b70d52fae1b4670.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://edited_images/freeze.png"
dest_files=[ "res://.import/freeze.png-b991a392386b2c768b70d52fae1b4670.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=true
flags/anisotropic=true
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
35 changes: 35 additions & 0 deletions edited_images/tunlr.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/tunlr.png-5ee07be07f580222ed34b6e66df689de.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://edited_images/tunlr.png"
dest_files=[ "res://.import/tunlr.png-5ee07be07f580222ed34b6e66df689de.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=true
flags/anisotropic=true
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
35 changes: 35 additions & 0 deletions edited_images/vision.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/vision.png-c4196433746555ae4b132c85c9fb1715.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://edited_images/vision.png"
dest_files=[ "res://.import/vision.png-c4196433746555ae4b132c85c9fb1715.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=true
flags/anisotropic=true
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

0 comments on commit ad3413f

Please sign in to comment.