Skip to content

Commit

Permalink
cfg refactor wip 8
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed May 13, 2024
1 parent cdcf5f4 commit 6ab15d3
Show file tree
Hide file tree
Showing 65 changed files with 152 additions and 127 deletions.
54 changes: 27 additions & 27 deletions Autoload/Graphics.gd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var sprite_id = {
"LIGHTNING" : preload("res://dk_images/trapdoor_64/trap_lightning_std.png"),
"WORD_OF_POWER" : preload("res://dk_images/trapdoor_64/trap_wop_std.png"),
"LAVA" : preload("res://dk_images/trapdoor_64/trap_lava_std.png"),
"TNT" : preload("res://used_images/tnt.png"),
"TNT" : preload("res://extra_images/tnt.png"),
# Spellbooks
"SPELLBOOK_ARMG" : preload("res://dk_images/keepower_64/armagedn_std.png"),
"SPELLBOOK_POSS" : preload("res://dk_images/keepower_64/possess_std.png"),
Expand All @@ -116,11 +116,11 @@ var sprite_id = {
"SPELLBOOK_DWAL" : preload("res://dk_images/keepower_64/dstwall_std.png"),
"SPELLBOOK_TBMB" : preload("res://edited_images/timebomb.png"),
# Decorations/Furniture
"BANNER" : preload("res://used_images/banner.png"),
"FERN" : preload("res://used_images/fern.png"),
"FERN_BROWN" : preload("res://used_images/fern_brown.png"),
"FERN_SMALL" : preload("res://used_images/fern_small.png"),
"FERN_SMALL_BROWN" : preload("res://used_images/fern_small_brown.png"),
"BANNER" : preload("res://extra_images/banner.png"),
"FERN" : preload("res://extra_images/fern.png"),
"FERN_BROWN" : preload("res://extra_images/fern_brown.png"),
"FERN_SMALL" : preload("res://extra_images/fern_small.png"),
"FERN_SMALL_BROWN" : preload("res://extra_images/fern_small_brown.png"),
"FLAGPOLE_BLACKFLAG" : preload("res://dk_images/furniture/flagpole_blackflag_tp/AnimFlagpoleBlack.tres"),
"FLAGPOLE_ORANGEFLAG" : preload("res://dk_images/furniture/flagpole_orangeflag_tp/AnimFlagpoleOrange.tres"),
"FLAGPOLE_PURPLEFLAG" : preload("res://dk_images/furniture/flagpole_purpleflag_tp/AnimFlagpolePurple.tres"),
Expand All @@ -130,24 +130,24 @@ var sprite_id = {
"HEARTFLAME_ORANGE" : preload("res://edited_images/heartflames/heartflame_orange/AnimOrangeHeartFlame.tres"),
"HEARTFLAME_PURPLE" : preload("res://edited_images/heartflames/heartflame_purple/AnimPurpleHeartFlame.tres"),
"HEARTFLAME_WHITE" : preload("res://edited_images/heartflames/heartflame_white/AnimWhiteHeartFlame.tres"),
"ICE_PILLAR" : preload("res://used_images/ice_pillar.png"),
"ICE_PILLAR_SMALL" : preload("res://used_images/ice_rock.png"),
"JUNGLE_CATTAILS" : preload("res://used_images/cattails.png"),
"JUNGLE_LILYPAD" : preload("res://used_images/lilypad.png"),
"ICE_PILLAR" : preload("res://extra_images/ice_pillar.png"),
"ICE_PILLAR_SMALL" : preload("res://extra_images/ice_rock.png"),
"JUNGLE_CATTAILS" : preload("res://extra_images/cattails.png"),
"JUNGLE_LILYPAD" : preload("res://extra_images/lilypad.png"),
"KNIGHTSTATUE" : preload("res://dk_images/statues/anim0958/r1frame01.png"),
"LANTERNPOST_STAND" : preload("res://used_images/lantern_pst.png"),
"LAVA_PILLAR" : preload("res://used_images/lava_pillar.png"),
"LAVA_PILLAR_SMALL" : preload("res://used_images/lava_rock.png"),
"MUSHROOM_GREEN_LUM" : preload("res://used_images/mushroom_green.png"),
"MUSHROOM_RED_LUM" : preload("res://used_images/mushroom_red.png"),
"MUSHROOM_YELLOW_LUM" : preload("res://used_images/mushroom_yellow.png"),
"POTION_BROWN" : preload("res://used_images/potion_brown.png"),
"POTION_RED" : preload("res://used_images/potion_red.png"),
"POTION_WHITE" : preload("res://used_images/potion_white.png"),
"POTION_YELLOW" : preload("res://used_images/potion_yellow.png"),
"ROCK_PILLAR" : preload("res://used_images/rock_pillar.png"),
"ROCK_PILLAR_SMALL" : preload("res://used_images/rock.png"),
"DRUID_LAIR" : preload("res://used_images/lair_druid.png"),
"LANTERNPOST_STAND" : preload("res://extra_images/lantern_pst.png"),
"LAVA_PILLAR" : preload("res://extra_images/lava_pillar.png"),
"LAVA_PILLAR_SMALL" : preload("res://extra_images/lava_rock.png"),
"MUSHROOM_GREEN_LUM" : preload("res://extra_images/mushroom_green.png"),
"MUSHROOM_RED_LUM" : preload("res://extra_images/mushroom_red.png"),
"MUSHROOM_YELLOW_LUM" : preload("res://extra_images/mushroom_yellow.png"),
"POTION_BROWN" : preload("res://extra_images/potion_brown.png"),
"POTION_RED" : preload("res://extra_images/potion_red.png"),
"POTION_WHITE" : preload("res://extra_images/potion_white.png"),
"POTION_YELLOW" : preload("res://extra_images/potion_yellow.png"),
"ROCK_PILLAR" : preload("res://extra_images/rock_pillar.png"),
"ROCK_PILLAR_SMALL" : preload("res://extra_images/rock.png"),
"DRUID_LAIR" : preload("res://extra_images/lair_druid.png"),
# Creatures
"POWER_SIGHT" : preload("res://dk_images/magic_fogs/anim0854/AnimCastedSight.tres"),
"WIZARD" : preload("res://edited_images/creatr_icon_64/wizrd_std.png"),
Expand Down Expand Up @@ -212,8 +212,8 @@ var sprite_id = {
"ORC_PORTRAIT" : preload("res://dk_images/creature_portrait_64/creatr_portrt_orc.png"),
"FLOATING_SPIRIT" : preload("res://dk_images/magic_dust/anim0981/r1frame02.png"),
"FLOATING_SPIRIT_PORTRAIT" : preload("res://dk_images/magic_dust/anim0981/r1frame02.png"),
"DRUID" : preload("res://used_images/druid.png"),
"DRUID_PORTRAIT" : preload("res://used_images/druid_portrait.png"),
"TIME_MAGE" : preload("res://used_images/time_mage.png"),
"TIME_MAGE_PORTRAIT" : preload("res://used_images/time_mage_portrait.png"),
"DRUID" : preload("res://extra_images/druid.png"),
"DRUID_PORTRAIT" : preload("res://extra_images/druid_portrait.png"),
"TIME_MAGE" : preload("res://extra_images/time_mage.png"),
"TIME_MAGE_PORTRAIT" : preload("res://extra_images/time_mage_portrait.png"),
}
17 changes: 17 additions & 0 deletions Autoload/Things.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ enum TYPE {
EXTRA = 696969
}

var default_data = {}
func _init():
# This only takes 1ms
default_data["DATA_EXTRA"] = DATA_EXTRA.duplicate(true)
default_data["DATA_DOOR"] = DATA_DOOR.duplicate(true)
default_data["DATA_TRAP"] = DATA_TRAP.duplicate(true)
default_data["DATA_EFFECTGEN"] = DATA_EFFECTGEN.duplicate(true)
default_data["DATA_CREATURE"] = DATA_CREATURE.duplicate(true)
default_data["DATA_OBJECT"] = DATA_OBJECT.duplicate(true)

func reset_thing_data_to_default(): # Reset data. Takes 1ms.
DATA_EXTRA = default_data["DATA_EXTRA"].duplicate(true)
DATA_DOOR = default_data["DATA_DOOR"].duplicate(true)
DATA_TRAP = default_data["DATA_TRAP"].duplicate(true)
DATA_EFFECTGEN = default_data["DATA_EFFECTGEN"].duplicate(true)
DATA_CREATURE = default_data["DATA_CREATURE"].duplicate(true)
DATA_OBJECT = default_data["DATA_OBJECT"].duplicate(true)

func fetch_sprite(thing_type, sub_type):
var sub_type_data = data_structure(thing_type).get(sub_type)
Expand Down
5 changes: 5 additions & 0 deletions Scenes/FxData.gd → Scenes/CfgLoader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ func start():
print('Parsed all dkcfg files: ' + str(OS.get_ticks_msec() - CODETIME_START) + 'ms')

var CODETIME_LOADCFG_START = OS.get_ticks_msec()
# Step 1: set object data to default
Things.reset_thing_data_to_default()
# Step 2: load data from /fxdata/ config files
load_objects_data()
load_creatures_data()
load_trapdoor_data()
# Step 3: load data from local config files (map00001.objects.cfg)
print('Loaded things from cfg files: ' + str(OS.get_ticks_msec() - CODETIME_LOADCFG_START) + 'ms')



func load_objects_data():
for section in objects_cfg:
if section.begins_with("object"):
Expand Down
6 changes: 3 additions & 3 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
[ext_resource path="res://Scenes/UndoStates.gd" type="Script" id=166]
[ext_resource path="res://Scenes/ThreadedSaveUndo.gd" type="Script" id=167]
[ext_resource path="res://Scenes/Guidelines.gd" type="Script" id=168]
[ext_resource path="res://Scenes/FxData.gd" type="Script" id=169]
[ext_resource path="res://Scenes/CfgLoader.gd" type="Script" id=169]
[ext_resource path="res://Scenes/OldCfgCode.gd" type="Script" id=170]

[sub_resource type="CubeMesh" id=2]
Expand Down Expand Up @@ -334,10 +334,10 @@ script = ExtResource( 37 )
[node name="Game" type="Node" parent="."]
script = ExtResource( 30 )
[node name="FxData" type="Node" parent="."]
[node name="CfgLoader" type="Node" parent="."]
script = ExtResource( 169 )
[node name="OLD_UNUSED_CfgCode" type="Node" parent="FxData"]
[node name="OLD_UNUSED_CfgCode" type="Node" parent="CfgLoader"]
script = ExtResource( 170 )
[node name="TextureCache" type="Node" parent="."]
Expand Down
9 changes: 1 addition & 8 deletions Scenes/OldCfgCode.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ var default_data = {}



#func _init():
# # This only takes 1ms
# default_data["DATA_EXTRA"] = DATA_EXTRA.duplicate(true)
# default_data["DATA_DOOR"] = DATA_DOOR.duplicate(true)
# default_data["DATA_TRAP"] = DATA_TRAP.duplicate(true)
# default_data["DATA_EFFECTGEN"] = DATA_EFFECTGEN.duplicate(true)
# default_data["DATA_CREATURE"] = DATA_CREATURE.duplicate(true)
# default_data["DATA_OBJECT"] = DATA_OBJECT.duplicate(true)

#
#
#func reset_thing_data_to_default():
Expand Down
4 changes: 2 additions & 2 deletions Scenes/OpenMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ onready var oResizeCurrentMapSize = Nodelist.list["oResizeCurrentMapSize"]
onready var oOwnerSelection = Nodelist.list["oOwnerSelection"]
onready var oScriptGenerator = Nodelist.list["oScriptGenerator"]
onready var oOnlyOwnership = Nodelist.list["oOnlyOwnership"]
onready var oFxData = Nodelist.list["oFxData"]
onready var oCfgLoader = Nodelist.list["oCfgLoader"]

var TOTAL_TIME_TO_OPEN_MAP

Expand Down Expand Up @@ -111,7 +111,7 @@ func open_map(filePath):

var map = filePath.get_basename()

oFxData.start()
oCfgLoader.start()

# Open all map file types
oCurrentMap.currentFilePaths = get_accompanying_files(map)
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/banner.png-9be04942c9c5198ab90865299103459d.stex"
path="res://.import/banner.png-c2bf33e6565c83ced32f8bd540e04d4f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/banner.png"
dest_files=[ "res://.import/banner.png-9be04942c9c5198ab90865299103459d.stex" ]
source_file="res://extra_images/banner.png"
dest_files=[ "res://.import/banner.png-c2bf33e6565c83ced32f8bd540e04d4f.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/cattails.png-48c6d31d00288640cca773b1567dc84b.stex"
path="res://.import/cattails.png-5d3f768e8ae52687133f36d497c842c0.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/cattails.png"
dest_files=[ "res://.import/cattails.png-48c6d31d00288640cca773b1567dc84b.stex" ]
source_file="res://extra_images/cattails.png"
dest_files=[ "res://.import/cattails.png-5d3f768e8ae52687133f36d497c842c0.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/druid.png-96f709d99ac9800469bf05f2c9638e60.stex"
path="res://.import/druid.png-ed538b42adab8948dd01b4043287cac8.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/druid.png"
dest_files=[ "res://.import/druid.png-96f709d99ac9800469bf05f2c9638e60.stex" ]
source_file="res://extra_images/druid.png"
dest_files=[ "res://.import/druid.png-ed538b42adab8948dd01b4043287cac8.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/druid_portrait.png-e456008afd51b193dff7abcc8b0380f5.stex"
path="res://.import/druid_portrait.png-0bb0303453604e2986388d1bf6f7260a.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/druid_portrait.png"
dest_files=[ "res://.import/druid_portrait.png-e456008afd51b193dff7abcc8b0380f5.stex" ]
source_file="res://extra_images/druid_portrait.png"
dest_files=[ "res://.import/druid_portrait.png-0bb0303453604e2986388d1bf6f7260a.stex" ]

[params]

Expand Down
File renamed without changes
6 changes: 3 additions & 3 deletions used_images/fern.png.import → extra_images/fern.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/fern.png-15a40304e0fae568fb2f86a3ba4d85b3.stex"
path="res://.import/fern.png-29bd828ce49cfdeba230da469ab20897.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/fern.png"
dest_files=[ "res://.import/fern.png-15a40304e0fae568fb2f86a3ba4d85b3.stex" ]
source_file="res://extra_images/fern.png"
dest_files=[ "res://.import/fern.png-29bd828ce49cfdeba230da469ab20897.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/fern_brown.png-1a715c696472eb4943e092719f3a3809.stex"
path="res://.import/fern_brown.png-e380cab0f2b8ecd31c2890cf92085406.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/fern_brown.png"
dest_files=[ "res://.import/fern_brown.png-1a715c696472eb4943e092719f3a3809.stex" ]
source_file="res://extra_images/fern_brown.png"
dest_files=[ "res://.import/fern_brown.png-e380cab0f2b8ecd31c2890cf92085406.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

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

[deps]

source_file="res://used_images/fern_small.png"
dest_files=[ "res://.import/fern_small.png-5a61522e3a4ccbbfbb0f65ebcaead162.stex" ]
source_file="res://extra_images/fern_small.png"
dest_files=[ "res://.import/fern_small.png-dba9ccdf259768ac76e74765a653a4ef.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/fern_small_brown.png-41329c08ae81db4776b234b31a161c84.stex"
path="res://.import/fern_small_brown.png-c59fa118d591e5aa4af854c65c65ef1b.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/fern_small_brown.png"
dest_files=[ "res://.import/fern_small_brown.png-41329c08ae81db4776b234b31a161c84.stex" ]
source_file="res://extra_images/fern_small_brown.png"
dest_files=[ "res://.import/fern_small_brown.png-c59fa118d591e5aa4af854c65c65ef1b.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/ice_pillar.png-884f0c1378683b8f983ca962b7165bb0.stex"
path="res://.import/ice_pillar.png-aada8d0918cf95a770ea51ca6e513ca7.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/ice_pillar.png"
dest_files=[ "res://.import/ice_pillar.png-884f0c1378683b8f983ca962b7165bb0.stex" ]
source_file="res://extra_images/ice_pillar.png"
dest_files=[ "res://.import/ice_pillar.png-aada8d0918cf95a770ea51ca6e513ca7.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/ice_rock.png-fa1c1a930138e6d30e3a3b302d54d442.stex"
path="res://.import/ice_rock.png-4a1712fe5ad648823f206a73708694c0.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/ice_rock.png"
dest_files=[ "res://.import/ice_rock.png-fa1c1a930138e6d30e3a3b302d54d442.stex" ]
source_file="res://extra_images/ice_rock.png"
dest_files=[ "res://.import/ice_rock.png-4a1712fe5ad648823f206a73708694c0.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/lair_druid.png-3b4bc07b01abd7e969cf0d4660fb6bc0.stex"
path="res://.import/lair_druid.png-8950102b4465793e4fcea4cba9607c7b.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://used_images/lair_druid.png"
dest_files=[ "res://.import/lair_druid.png-3b4bc07b01abd7e969cf0d4660fb6bc0.stex" ]
source_file="res://extra_images/lair_druid.png"
dest_files=[ "res://.import/lair_druid.png-8950102b4465793e4fcea4cba9607c7b.stex" ]

[params]

Expand Down
File renamed without changes
Loading

0 comments on commit 6ab15d3

Please sign in to comment.