Skip to content

Commit

Permalink
load textureanim.toml from anywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Jan 27, 2025
1 parent e09b0ff commit 9c11322
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=auto eol=lf
5 changes: 3 additions & 2 deletions Scenes/CfgLoader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ onready var oGame = Nodelist.list["oGame"]
onready var oMessage = Nodelist.list["oMessage"]
onready var oConfigFilesListWindow = Nodelist.list["oConfigFilesListWindow"]
onready var oCustomSlabSystem = Nodelist.list["oCustomSlabSystem"]

onready var oTextureAnimation = Nodelist.list["oTextureAnimation"]

# These are dictionaries containing dictionaries.
# objects_cfg["section_name"]["key"] will return the "value"
Expand All @@ -16,7 +16,7 @@ onready var oCustomSlabSystem = Nodelist.list["oCustomSlabSystem"]
#var trapdoor_cfg : Dictionary

var paths_loaded = {}
const files_to_load = ["objects.cfg", "creature.cfg", "trapdoor.cfg", "terrain.cfg", "cubes.cfg", "slabset.toml", "columnset.toml"]
const files_to_load = ["objects.cfg", "creature.cfg", "trapdoor.cfg", "terrain.cfg", "cubes.cfg", "slabset.toml", "columnset.toml", "textureanim.toml"]

enum {
LOAD_CFG_FXDATA,
Expand Down Expand Up @@ -64,6 +64,7 @@ func start(mapPath):
match file_name:
"slabset.toml": Slabset.import_toml_slabset(file_path) # .toml import gets run multiple times instead of combining
"columnset.toml": Columnset.import_toml_columnset(file_path)
"textureanim.toml": oTextureAnimation.generate_animation_database(file_path)
_:
var cfgData = Utils.read_dkcfg_file(file_path)
combined_cfg = Utils.super_merge(combined_cfg, cfgData)
Expand Down
2 changes: 0 additions & 2 deletions Scenes/CurrentTextures.gd
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ func start():
# This is important to do here if updating textures while a map is already open
if oDataSlab.get_cell(0,0) != -1:
set_current_texture_pack()

oTextureAnimation.generate_animation_database()

func scan_dk_data_directory():
var path = oGame.DK_DATA_DIRECTORY
Expand Down
5 changes: 2 additions & 3 deletions Scenes/TextureAnimation.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ onready var oMessage = Nodelist.list["oMessage"]

var animation_database_texture = preload("res://Shaders/textureanimationdatabase.png")

func generate_animation_database():
func generate_animation_database(file_path):
# Load TOML file
var file = File.new()
if file.open(oGame.DK_FXDATA_DIRECTORY.plus_file("textureanim.toml"), File.READ) != OK:
oMessage.big("error","couldn't find textureanim.toml")
if file.open(file_path, File.READ) != OK:
return

# Create image for animation database
Expand Down

0 comments on commit 9c11322

Please sign in to comment.