This commit is contained in:
2023-05-06 19:02:24 +02:00
parent d066215cf3
commit 76948c6501
46 changed files with 1031 additions and 85 deletions

View File

@@ -9,3 +9,45 @@ in Rust and Godot.
Most of the Moorhuhn Games are structured quite similarly, Most of the Moorhuhn Games are structured quite similarly,
which makes supporting them relatively easy. which makes supporting them relatively easy.
## Supported Games
Support of games primarily depends on who developed them - Games with structurally similar data are easier to support than games who use a different engine.
* `.wtn` "Witan Entertainment Engine"
* [ ] Moorhuhn
* [ ] Moorhuhn 2
* `.dat` Torque3D Engine
* [ ] Moorhuhn Kart
* [ ] Moorhuhn Kart Extra
* `data/datafile.dat` "Sproing Interactive Engine"
* [ ] Moorhuhn Winter
* [ ] Moorhuhn 3
* [ ] Moorhuhn X
* [ ] Moorhuhn Kart 2
* [ ] Moorhuhn Remake
* [ ] Moorhuhn Invasion
* [x] Moorhuhn Schatzjäger 1
* [ ] Moorhuhn Piraten
* [x] Moorhuhn Schatzjäger 2
* [x] Moorhuhn Schatzjäger 3
* [ ] Moorhuhn Invasion
* `.sar` Starforce 3D Engine (Visual Imagination Software "VIS" GbR)
* [ ] Moorhuhn Kart 3
* [ ] Moorhuhn Director's Cut
* [ ] Moorhuhn Kart Thunder
* `*.dat` "Phenomedia 2D Engine"
* [ ] Schatz des Pharao
* [ ] Fluch des Goldes
* [ ] Moorhuhn Wanted
* `*.dat` "SnapDragon Games Engine"
* [ ] Moorhuhn Atlantis
* Other games with unknown engine
* [ ] Moorhuhn im Anflug
* [ ] Moorhuhn Mah-Jongg
* [ ] Moorhuhn Soccer
* [ ] Moorhuhn - Juwel der Finsternis
* [ ] Moorhuhn DS
* [ ] Moorhuhn Star Karts
* [ ] Moorhuhn Jahrmarkt-Party
* [ ] Moorhuhn Tiger & Chicken
* [ ] Moorhuhn Xtreme

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8vn1dpq37mve"
path="res://.godot/imported/atlantis.webp-71117e2d49dbc49c7cc0e5336c8f50f4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/atlantis.webp"
dest_files=["res://.godot/imported/atlantis.webp-71117e2d49dbc49c7cc0e5336c8f50f4.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mh1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://wetnflcj1b0w"
path="res://.godot/imported/mh1.jpg-0113f246dda8d7a00aeccfff363df422.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh1.jpg"
dest_files=["res://.godot/imported/mh1.jpg-0113f246dda8d7a00aeccfff363df422.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mh2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brovl1cel1uiw"
path="res://.godot/imported/mh2.jpg-7634c5424dbec62028b0551bafd683d6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh2.jpg"
dest_files=["res://.godot/imported/mh2.jpg-7634c5424dbec62028b0551bafd683d6.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mh3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ix132vewff0h"
path="res://.godot/imported/mh3.jpg-2a0f34dc462f52a417c82c9065e01f31.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh3.jpg"
dest_files=["res://.godot/imported/mh3.jpg-2a0f34dc462f52a417c82c9065e01f31.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mh_kart.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bk5a3xob0raqj"
path="res://.godot/imported/mh_kart.jpg-203e059edc8ceb39d4997a65174c282f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh_kart.jpg"
dest_files=["res://.godot/imported/mh_kart.jpg-203e059edc8ceb39d4997a65174c282f.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dkhygfyylbjov"
path="res://.godot/imported/mh_kart2.jpg-df28ab8b030fb04ec2537dbafed41669.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh_kart2.jpg"
dest_files=["res://.godot/imported/mh_kart2.jpg-df28ab8b030fb04ec2537dbafed41669.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://l8groudaf385"
path="res://.godot/imported/mh_kart3.webp-cd0a1d369d601eb772768e86765fd5fb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh_kart3.webp"
dest_files=["res://.godot/imported/mh_kart3.webp-cd0a1d369d601eb772768e86765fd5fb.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cjp0ilsodyu4j"
path="res://.godot/imported/mh_kart4.jpg-9fd1987e808148ea4b2bf46b441297a1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mh_kart4.jpg"
dest_files=["res://.godot/imported/mh_kart4.jpg-9fd1987e808148ea4b2bf46b441297a1.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhdir.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bmybnhi2i2ep"
path="res://.godot/imported/mhdir.jpg-a6edb7073e05db08cc8bd853ab69b221.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhdir.jpg"
dest_files=["res://.godot/imported/mhdir.jpg-a6edb7073e05db08cc8bd853ab69b221.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhinv.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chcjw51coc53r"
path="res://.godot/imported/mhinv.jpg-5e6f32efeb6c5c444b464ac7c4b51396.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhinv.jpg"
dest_files=["res://.godot/imported/mhinv.jpg-5e6f32efeb6c5c444b464ac7c4b51396.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhpir.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpigwqlll0kbf"
path="res://.godot/imported/mhpir.jpg-92183ff5b1181fe8e28d25ac29e972b2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhpir.jpg"
dest_files=["res://.godot/imported/mhpir.jpg-92183ff5b1181fe8e28d25ac29e972b2.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhrem.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bst48atkwn7r1"
path="res://.godot/imported/mhrem.png-7e09db4c14a158cb8f1fd84bd98367d7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhrem.png"
dest_files=["res://.godot/imported/mhrem.png-7e09db4c14a158cb8f1fd84bd98367d7.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfyupkljq2f10"
path="res://.godot/imported/mhrem.webp-8e89833773bdb9027a347585d47ceb87.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhrem.webp"
dest_files=["res://.godot/imported/mhrem.webp-8e89833773bdb9027a347585d47ceb87.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhw.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://baqjofchj6yaw"
path="res://.godot/imported/mhw.webp-89eac726f99c77cf92c78a53979d2fd9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhw.webp"
dest_files=["res://.godot/imported/mhw.webp-89eac726f99c77cf92c78a53979d2fd9.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhwant.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://l37kev18676o"
path="res://.godot/imported/mhwant.jpg-d15d1e121f9ae09e921541e006f70afa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhwant.jpg"
dest_files=["res://.godot/imported/mhwant.jpg-d15d1e121f9ae09e921541e006f70afa.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

BIN
godot/cover_art/mhx.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://k8i84cvnuun"
path="res://.godot/imported/mhx.jpg-662a2670710d66b9ea032641446be9a4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/mhx.jpg"
dest_files=["res://.godot/imported/mhx.jpg-662a2670710d66b9ea032641446be9a4.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://by4wug5r7311q"
path="res://.godot/imported/schatzjaeger_2.jpg-35704813d2dff20d1557372d487467a7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/schatzjaeger_2.jpg"
dest_files=["res://.godot/imported/schatzjaeger_2.jpg-35704813d2dff20d1557372d487467a7.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bkn3cdrm1fj8b"
path="res://.godot/imported/schatzjaeger_3.jpg-fddffd2f244176f10eb39bf982468ba7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover_art/schatzjaeger_3.jpg"
dest_files=["res://.godot/imported/schatzjaeger_3.jpg-fddffd2f244176f10eb39bf982468ba7.ctex"]
[params]
compress/mode=0
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/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
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

4
godot/main.gd Normal file
View File

@@ -0,0 +1,4 @@
extends ScrollContainer
func _on_install():
pass

View File

@@ -1,32 +1,234 @@
[gd_scene load_steps=3 format=3 uid="uid://cmqfu6cc780h4"] [gd_scene load_steps=21 format=3 uid="uid://cmqfu6cc780h4"]
[ext_resource type="Theme" uid="uid://ks2uyxqg6u4k" path="res://mhjnr/theme.tres" id="1_4qyey"] [ext_resource type="Theme" uid="uid://ks2uyxqg6u4k" path="res://mhjnr/theme.tres" id="1_4qyey"]
[ext_resource type="Texture2D" uid="uid://wetnflcj1b0w" path="res://cover_art/mh1.jpg" id="2_epsv5"]
[ext_resource type="Texture2D" uid="uid://dyga5qn124307" path="res://cover_art/schatzjaeger.webp" id="2_f5uhf"] [ext_resource type="Texture2D" uid="uid://dyga5qn124307" path="res://cover_art/schatzjaeger.webp" id="2_f5uhf"]
[ext_resource type="Script" path="res://main.gd" id="2_j1xqk"]
[ext_resource type="Texture2D" uid="uid://baqjofchj6yaw" path="res://cover_art/mhw.webp" id="3_wgtv5"]
[ext_resource type="Texture2D" uid="uid://brovl1cel1uiw" path="res://cover_art/mh2.jpg" id="4_fb5aq"]
[ext_resource type="Texture2D" uid="uid://ix132vewff0h" path="res://cover_art/mh3.jpg" id="5_q44ta"]
[ext_resource type="Texture2D" uid="uid://k8i84cvnuun" path="res://cover_art/mhx.jpg" id="6_b76vr"]
[ext_resource type="Texture2D" uid="uid://bst48atkwn7r1" path="res://cover_art/mhrem.png" id="7_ios37"]
[ext_resource type="Texture2D" uid="uid://chcjw51coc53r" path="res://cover_art/mhinv.jpg" id="8_1fm4r"]
[ext_resource type="Texture2D" uid="uid://l37kev18676o" path="res://cover_art/mhwant.jpg" id="8_yb215"]
[ext_resource type="Texture2D" uid="uid://bk5a3xob0raqj" path="res://cover_art/mh_kart.jpg" id="9_b3ixn"]
[ext_resource type="Texture2D" uid="uid://cpigwqlll0kbf" path="res://cover_art/mhpir.jpg" id="9_v7fae"]
[ext_resource type="Texture2D" uid="uid://dkhygfyylbjov" path="res://cover_art/mh_kart2.jpg" id="10_1woe1"]
[ext_resource type="Texture2D" uid="uid://l8groudaf385" path="res://cover_art/mh_kart3.webp" id="11_7me0v"]
[ext_resource type="Texture2D" uid="uid://bmybnhi2i2ep" path="res://cover_art/mhdir.jpg" id="11_fweyu"]
[ext_resource type="Texture2D" uid="uid://cjp0ilsodyu4j" path="res://cover_art/mh_kart4.jpg" id="12_hv57k"]
[ext_resource type="Texture2D" uid="uid://by4wug5r7311q" path="res://cover_art/schatzjaeger_2.jpg" id="14_tnyyh"]
[ext_resource type="Texture2D" uid="uid://bkn3cdrm1fj8b" path="res://cover_art/schatzjaeger_3.jpg" id="15_kbsip"]
[ext_resource type="Texture2D" uid="uid://8vn1dpq37mve" path="res://cover_art/atlantis.webp" id="16_xvpbi"]
[node name="main" type="MarginContainer"] [node name="main" type="ScrollContainer"]
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_right = 20.0
offset_bottom = 154.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_4qyey") theme = ExtResource("1_4qyey")
script = ExtResource("2_j1xqk")
[node name="ScrollContainer" type="ScrollContainer" parent="."] [node name="margins" type="MarginContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
[node name="VBoxContainer" type="VBoxContainer" parent="margins"]
layout_mode = 2
size_flags_horizontal = 3
alignment = 1
[node name="JNR" type="VBoxContainer" parent="margins/VBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] [node name="Label" type="Label" parent="margins/VBoxContainer/JNR"]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 40 theme_override_font_sizes/font_size = 40
text = "Schatzjäger" text = "Moorhuhn Schatzjäger"
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/VBoxContainer"] [node name="JNR" type="HFlowContainer" parent="margins/VBoxContainer/JNR"]
layout_mode = 2 layout_mode = 2
[node name="Button" type="Button" parent="ScrollContainer/VBoxContainer/HBoxContainer"] [node name="Schatzjaeger1" type="Button" parent="margins/VBoxContainer/JNR/JNR"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2 layout_mode = 2
icon = ExtResource("2_f5uhf") icon = ExtResource("2_f5uhf")
flat = true flat = true
icon_alignment = 1 icon_alignment = 1
expand_icon = true
[node name="Schatzjaeger2" type="Button" parent="margins/VBoxContainer/JNR/JNR"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
icon = ExtResource("14_tnyyh")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Schatzjaeger3" type="Button" parent="margins/VBoxContainer/JNR/JNR"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
icon = ExtResource("15_kbsip")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Atlantis" type="Button" parent="margins/VBoxContainer/JNR/JNR"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("16_xvpbi")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Kart" type="VBoxContainer" parent="margins/VBoxContainer"]
layout_mode = 2
[node name="Label2" type="Label" parent="margins/VBoxContainer/Kart"]
layout_mode = 2
theme_override_font_sizes/font_size = 40
text = "Moorhuhn Kart"
[node name="JNR2" type="HFlowContainer" parent="margins/VBoxContainer/Kart"]
layout_mode = 2
[node name="Kart" type="Button" parent="margins/VBoxContainer/Kart/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("9_b3ixn")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Kart2" type="Button" parent="margins/VBoxContainer/Kart/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("10_1woe1")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Kart3" type="Button" parent="margins/VBoxContainer/Kart/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("11_7me0v")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Kart4" type="Button" parent="margins/VBoxContainer/Kart/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("12_hv57k")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Shoot" type="VBoxContainer" parent="margins/VBoxContainer"]
layout_mode = 2
[node name="Label2" type="Label" parent="margins/VBoxContainer/Shoot"]
layout_mode = 2
theme_override_font_sizes/font_size = 40
text = "Shoot 'em Up"
[node name="JNR2" type="HFlowContainer" parent="margins/VBoxContainer/Shoot"]
layout_mode = 2
[node name="MH1" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("2_epsv5")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHW" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("3_wgtv5")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MH2" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("4_fb5aq")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MH3" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("5_q44ta")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHX" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("6_b76vr")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHREM" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("7_ios37")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHWAN" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("8_yb215")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHPIR" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("9_v7fae")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHINV" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("8_1fm4r")
flat = true
icon_alignment = 1
expand_icon = true
[node name="MHDIR" type="Button" parent="margins/VBoxContainer/Shoot/JNR2"]
custom_minimum_size = Vector2(200, 256)
layout_mode = 2
disabled = true
icon = ExtResource("11_fweyu")
flat = true
icon_alignment = 1
expand_icon = true

View File

@@ -7,35 +7,52 @@
[sub_resource type="GDScript" id="GDScript_oemh7"] [sub_resource type="GDScript" id="GDScript_oemh7"]
script/source = "extends MarginContainer script/source = "extends MarginContainer
@export var entry = \"main\" @export var entry: String = \"main\"
@export var window_size: Vector2i = Vector2i(800, 600)
var menu: Node var menu: Node
@onready var translations: Translation = load(\"datafile://data/text.csv\")
func _ready() -> void: func _ready() -> void:
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_RESIZE_DISABLED, true)
DisplayServer.window_set_size(window_size)
DisplayServer.window_set_position(
(DisplayServer.screen_get_size(0) - window_size) / 2, 0
)
set_menu(entry) set_menu(entry)
func set_menu(name: String) -> void: func set_menu(name: String) -> void:
if menu != null: if menu != null:
menu.queue_free() menu.queue_free()
var translations: Translation = load(\"datafile://data/text.csv\")
menu = load(\"datafile://data/menu/screens/%s.xml\" % name).instantiate() menu = load(\"datafile://data/menu/screens/%s.xml\" % name).instantiate()
add_child(menu) add_child(menu)
move_child(menu, 0) move_child(menu, 0)
connect_actions()
translate()
func connect_actions() -> void:
for button in menu.find_children(\"*\", \"Button\"): for button in menu.find_children(\"*\", \"Button\"):
if not button.has_meta(\"action\"): if not button.has_meta(\"action\"):
continue continue
var action = button.get_meta(\"action\") var action = button.get_meta(\"action\")
var callable = Callable(self, \"_on_action_%s\" % action.name) var callable = Callable(self, \"_on_action_%s\" % action.name)
button.z_index = 1
button.connect(\"pressed\", callable.bindv(action.args)) button.connect(\"pressed\", callable.bindv(action.args))
for node in menu.find_children(\"*\"): func translate() -> void:
if \"text\" in node: for node in menu.find_children(\"*\"):
if \"text\" in node and not translations.get_message(node.text).is_empty():
node.text = translations.get_message(node.text) node.text = translations.get_message(node.text)
func _on_minimize_pressed() -> void:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MINIMIZED)
func _on_close_pressed() -> void: func _on_close_pressed() -> void:
get_tree().quit() get_tree().quit()
func _on_action_SetMenu(name: String) -> void: func _on_action_SetMenu(name: String) -> void:
set_menu(name) set_menu(name)
@@ -74,4 +91,5 @@ theme_override_colors/icon_hover_color = Color(0.780392, 0.435294, 0.360784, 1)
icon = ExtResource("4_a24a2") icon = ExtResource("4_a24a2")
flat = true flat = true
[connection signal="pressed" from="Titlebar/Minimize" to="." method="_on_minimize_pressed"]
[connection signal="pressed" from="Titlebar/Close" to="." method="_on_close_pressed"] [connection signal="pressed" from="Titlebar/Close" to="." method="_on_close_pressed"]

View File

@@ -13,15 +13,16 @@ config_version=5
config/name="MHJNR" config/name="MHJNR"
run/main_scene="res://mhjnr/level.tscn" run/main_scene="res://mhjnr/level.tscn"
config/features=PackedStringArray("4.0", "GL Compatibility") config/features=PackedStringArray("4.0", "GL Compatibility")
boot_splash/bg_color=Color(0, 0, 0, 1) boot_splash/bg_color=Color(0, 0, 0, 0)
boot_splash/image="res://icon.png" boot_splash/image="res://icon.png"
boot_splash/fullsize=false boot_splash/fullsize=false
boot_splash/use_filter=false
config/icon="res://icon.png"
[display] [display]
window/size/viewport_width=800 window/size/viewport_width=512
window/size/viewport_height=600 window/size/viewport_height=256
window/size/resizable=false
window/size/borderless=true window/size/borderless=true
[input] [input]

View File

@@ -76,7 +76,10 @@ where
"xml" => { "xml" => {
serde_xml_rs::from_str::<UiTag>(String::from_utf8(data).map_err(custom_err)?.as_str()) serde_xml_rs::from_str::<UiTag>(String::from_utf8(data).map_err(custom_err)?.as_str())
.map_err(custom_err) .map_err(custom_err)
.map(DatafileFile::Ui) .map(|mut it| {
it.post_process();
DatafileFile::Ui(it)
})
} }
"txt" => { "txt" => {
let stem = path let stem = path

View File

@@ -1,7 +1,7 @@
use serde::de::Error; use serde::de::Error;
use serde::{Deserialize, Deserializer}; use serde::{Deserialize, Deserializer};
#[derive(Debug, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub enum UiTag { pub enum UiTag {
Menu(UiMenu), Menu(UiMenu),
Image(UiImage), Image(UiImage),
@@ -11,7 +11,7 @@ pub enum UiTag {
ToggleButton(UiToggleButton), ToggleButton(UiToggleButton),
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct UiMenu { pub struct UiMenu {
pub selected: String, pub selected: String,
#[serde(rename = "OnBack")] #[serde(rename = "OnBack")]
@@ -20,54 +20,55 @@ pub struct UiMenu {
pub children: Vec<UiTag>, pub children: Vec<UiTag>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct UiImage { pub struct UiImage {
pub texture: String, pub texture: String,
#[serde(deserialize_with = "deserialize_vec2")] #[serde(deserialize_with = "deserialize_vec2")]
pub position: [i32; 2], pub position: [i32; 2],
#[serde(deserialize_with = "deserialize_vec2")] #[serde(deserialize_with = "deserialize_vec2")]
pub size: [i32; 2], pub size: [i32; 2],
#[serde(rename = "fademode")] #[serde(rename = "fademode", default)]
pub fade_mode: FadeMode, pub fade_mode: FadeMode,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct UiTextButton { pub struct UiTextButton {
pub name: Option<String>, pub name: Option<String>,
pub text: String, pub text: String,
#[serde(deserialize_with = "deserialize_vec2")] #[serde(deserialize_with = "deserialize_vec2")]
pub position: [i32; 2], pub position: [i32; 2],
#[serde(rename = "halign")] #[serde(rename = "halign", default)]
pub horizontal_align: HorizontalAlign, pub horizontal_align: HorizontalAlign,
#[serde(rename = "fademode")] #[serde(rename = "fademode", default)]
pub fade_mode: FadeMode, pub fade_mode: FadeMode,
#[serde(rename = "OnSelect")] #[serde(rename = "OnSelect")]
pub on_select: String, pub on_select: String,
} }
/// This sometimes appears completely empty /// This is a really weird node, sometimes it has children and sometimes, don't ask me why,
#[derive(Debug, Deserialize)] /// it appears as a normal tag and then gets closed by an empty tag of this kind.
#[derive(Debug, Clone, Deserialize)]
pub struct UiTextArea { pub struct UiTextArea {
#[serde(deserialize_with = "deserialize_vec2", default)] #[serde(deserialize_with = "deserialize_vec2_opt", default)]
pub position: [i32; 2], pub position: Option<[i32; 2]>,
#[serde(deserialize_with = "deserialize_vec2", default)] #[serde(deserialize_with = "deserialize_vec2_opt", default)]
pub size: [i32; 2], pub size: Option<[i32; 2]>,
#[serde(rename = "$value", default)] #[serde(rename = "$value", default)]
pub children: Vec<UiTag>, pub children: Vec<UiTag>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct UiStaticText { pub struct UiStaticText {
pub text: String, pub text: String,
#[serde(deserialize_with = "deserialize_vec2")] #[serde(deserialize_with = "deserialize_vec2")]
pub position: [i32; 2], pub position: [i32; 2],
#[serde(rename = "halign")] #[serde(rename = "halign", default)]
pub horizontal_align: HorizontalAlign, pub horizontal_align: HorizontalAlign,
#[serde(rename = "fademode")] #[serde(rename = "fademode", default)]
pub fade_mode: FadeMode, pub fade_mode: FadeMode,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct UiToggleButton { pub struct UiToggleButton {
pub name: Option<String>, pub name: Option<String>,
pub text: String, pub text: String,
@@ -85,15 +86,49 @@ pub struct UiToggleButton {
pub target_l_offset: [i32; 2], pub target_l_offset: [i32; 2],
#[serde(rename = "targetROffset", deserialize_with = "deserialize_vec2")] #[serde(rename = "targetROffset", deserialize_with = "deserialize_vec2")]
pub target_r_offset: [i32; 2], pub target_r_offset: [i32; 2],
#[serde(rename = "noSound")] #[serde(rename = "noSound", default)]
pub no_sound: Option<bool>, pub no_sound: bool,
#[serde(rename = "OnChange")] #[serde(rename = "OnChange")]
pub on_change: String, pub on_change: String,
#[serde(rename = "OnSelect")] #[serde(rename = "OnSelect")]
pub on_select: String, pub on_select: String,
} }
#[derive(Debug, Deserialize)] impl UiTag {
pub fn post_process(&mut self) {
if let UiTag::Menu(menu) = self {
let children: Vec<UiTag> = menu.children.drain(..).collect();
let mut area_stack: Vec<Vec<UiTag>> = vec![vec![]];
for mut child in children {
child.post_process();
if let UiTag::TextArea(mut area) = child {
let children = area_stack.pop().unwrap();
let opening_tag = area_stack.last_mut().map(|it| it.last_mut());
if let Some(Some(UiTag::TextArea(opening_tag))) = opening_tag {
opening_tag.children = children;
} else {
area_stack.push(children);
}
if area.position.is_some() && area.size.is_some() {
let children = area.children.drain(..).collect();
area_stack.last_mut().unwrap().push(UiTag::TextArea(area));
area_stack.push(children);
}
} else {
area_stack.last_mut().unwrap().push(child);
}
}
menu.children = area_stack.pop().unwrap();
debug_assert!(area_stack.is_empty());
}
}
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum HorizontalAlign { pub enum HorizontalAlign {
Left, Left,
@@ -101,17 +136,46 @@ pub enum HorizontalAlign {
Right, Right,
} }
#[derive(Debug, Deserialize)] impl Default for HorizontalAlign {
fn default() -> HorizontalAlign {
HorizontalAlign::Left
}
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum FadeMode { pub enum FadeMode {
None, None,
} }
impl Default for FadeMode {
fn default() -> Self {
FadeMode::None
}
}
fn deserialize_vec2_opt<'de, D>(deserializer: D) -> Result<Option<[i32; 2]>, D::Error>
where
D: Deserializer<'de>,
{
if let Some(buf) = Option::<String>::deserialize(deserializer)? {
to_vec2::<D>(buf).map(Some)
} else {
Ok(None)
}
}
fn deserialize_vec2<'de, D>(deserializer: D) -> Result<[i32; 2], D::Error> fn deserialize_vec2<'de, D>(deserializer: D) -> Result<[i32; 2], D::Error>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
{ {
let buf = String::deserialize(deserializer)?; to_vec2::<D>(String::deserialize(deserializer)?)
}
fn to_vec2<'de, D>(buf: String) -> Result<[i32; 2], D::Error>
where
D: Deserializer<'de>,
{
let mut values: Vec<Result<i32, D::Error>> = buf let mut values: Vec<Result<i32, D::Error>> = buf
.split(',') .split(',')
.into_iter() .into_iter()

View File

@@ -177,7 +177,9 @@ impl ResourceFormatLoaderVirtual for DatafileLoader {
.rsplitn(3, '/') .rsplitn(3, '/')
.collect_tuple() .collect_tuple()
.expect("Illegal path for UI"); .expect("Illegal path for UI");
let ui = convert_ui(ui, None, base_path); let mut ui = convert_ui(ui, base_path);
own_children(&mut ui, None);
let mut scene = PackedScene::new(); let mut scene = PackedScene::new();
scene.pack(ui); scene.pack(ui);
@@ -284,3 +286,13 @@ impl ResourceFormatLoaderVirtual for DatafileLoader {
} }
} }
} }
fn own_children(node: &mut Gd<Node>, owner: Option<&mut Gd<Node>>) {
let iter = node.get_children(false);
let owner = owner.unwrap_or(node);
for mut child in iter.iter_shared() {
println!("{:#?}", child);
child.set_owner(owner.share());
own_children(&mut child, Some(owner));
}
}

View File

@@ -1,9 +1,7 @@
use godot::builtin::{Rect2, Vector2, Vector2i}; use godot::builtin::{Rect2, Vector2, Vector2i};
use godot::engine::{FontFile, Image}; use godot::engine::{FontFile, Image};
use godot::prelude::utilities::{print_verbose, prints}; use godot::prelude::utilities::prints;
use godot::prelude::{Color, Gd, Share, ToVariant}; use godot::prelude::{Color, Gd, Share, ToVariant};
use std::ops::Index;
use unicode_segmentation::UnicodeSegmentation;
const CHARSET: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜabcdefghijklmnopqrstuvwxyzäöüß0123456789,;.:!?\ const CHARSET: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜabcdefghijklmnopqrstuvwxyzäöüß0123456789,;.:!?\
+-*/=<>()[]{}\"$%&#~_^@|¡¿™©®º¹²³ªÀÁÂÃÅÆÇÈÉÊËÌÍÎÏIÐGÑÒÓÔÕŒØSŠÙÚÛÝÞŸŽàáâãåæçèéêëìíî\ +-*/=<>()[]{}\"$%&#~_^@|¡¿™©®º¹²³ªÀÁÂÃÅÆÇÈÉÊËÌÍÎÏIÐGÑÒÓÔÕŒØSŠÙÚÛÝÞŸŽàáâãåæçèéêëìíî\
@@ -14,13 +12,6 @@ pub fn load_bitmap_font(image: Gd<Image>) -> Gd<FontFile> {
let mut font_file = FontFile::new(); let mut font_file = FontFile::new();
let chroma_key = Color {
r: 0.0,
g: 0.0,
b: 0.0,
a: 0.0,
};
let mut was_empty_column = true; let mut was_empty_column = true;
let mut char_x = 0; let mut char_x = 0;
let mut char_width = 0; let mut char_width = 0;

View File

@@ -1,6 +1,6 @@
use crate::formats::ui_xml::{HorizontalAlign, UiTag}; use crate::formats::ui_xml::{HorizontalAlign, UiTag};
use godot::builtin::{Array, Dictionary, GodotString, ToVariant, Vector2}; use godot::builtin::{Array, Dictionary, GodotString, ToVariant, Vector2};
use godot::engine::control::{LayoutPreset, SizeFlags}; use godot::engine::control::LayoutPreset;
use godot::engine::global::HorizontalAlignment; use godot::engine::global::HorizontalAlignment;
use godot::engine::node::InternalMode; use godot::engine::node::InternalMode;
use godot::engine::{load, Button, Control, Label, Node, SpinBox, TextureRect}; use godot::engine::{load, Button, Control, Label, Node, SpinBox, TextureRect};
@@ -9,12 +9,12 @@ use itertools::Itertools;
const ACTION_META_NAME: &str = "action"; const ACTION_META_NAME: &str = "action";
pub fn convert_ui(ui: UiTag, owner: Option<Gd<Node>>, base_path: &str) -> Gd<Node> { pub fn convert_ui(ui: UiTag, base_path: &str) -> Gd<Node> {
match ui { match ui {
UiTag::Menu(menu) => { UiTag::Menu(menu) => {
let mut gd_menu = Control::new_alloc(); let mut gd_menu = Control::new_alloc();
gd_menu.set_anchors_preset(LayoutPreset::PRESET_FULL_RECT, false); gd_menu.set_anchors_preset(LayoutPreset::PRESET_FULL_RECT, false);
attach_children(&mut gd_menu, owner, menu.children, base_path); attach_children(&mut gd_menu, menu.children, base_path);
gd_menu.upcast() gd_menu.upcast()
} }
UiTag::Image(image) => { UiTag::Image(image) => {
@@ -37,10 +37,10 @@ pub fn convert_ui(ui: UiTag, owner: Option<Gd<Node>>, base_path: &str) -> Gd<Nod
} }
UiTag::TextArea(area) => { UiTag::TextArea(area) => {
let mut text_area = Control::new_alloc(); let mut text_area = Control::new_alloc();
text_area.set_anchors_preset(LayoutPreset::PRESET_FULL_RECT, false); // text_area.set_anchors_preset(LayoutPreset::PRESET_, false);
text_area.set_position(to_vec2(area.position), false); text_area.set_position(to_vec2(area.position.unwrap()), false);
text_area.set_size(to_vec2(area.size), false); text_area.set_size(to_vec2(area.size.unwrap()), false);
attach_children(&mut text_area, owner, area.children, base_path); attach_children(&mut text_area, area.children, base_path);
text_area.upcast() text_area.upcast()
} }
UiTag::ToggleButton(toggle) => { UiTag::ToggleButton(toggle) => {
@@ -54,10 +54,7 @@ pub fn convert_ui(ui: UiTag, owner: Option<Gd<Node>>, base_path: &str) -> Gd<Nod
} }
spin_box.set_meta("text".into(), toggle.text.to_variant()); spin_box.set_meta("text".into(), toggle.text.to_variant());
spin_box.set_meta("target".into(), toggle.target.to_variant()); spin_box.set_meta("target".into(), toggle.target.to_variant());
spin_box.set_meta( spin_box.set_meta("no_sound".into(), toggle.no_sound.to_variant());
"no_sound".into(),
toggle.no_sound.unwrap_or(false).to_variant(),
);
attach_call_meta(&mut spin_box, toggle.on_change); attach_call_meta(&mut spin_box, toggle.on_change);
spin_box.upcast() spin_box.upcast()
} }
@@ -87,22 +84,18 @@ impl Into<HorizontalAlignment> for HorizontalAlign {
} }
} }
fn attach_children<T>( fn attach_children<T>(node: &mut Gd<T>, children: Vec<UiTag>, base_path: &str)
node: &mut Gd<T>, where
owner: Option<Gd<Node>>,
children: Vec<UiTag>,
base_path: &str,
) where
T: Inherits<Node>, T: Inherits<Node>,
{ {
let owner_node = owner.unwrap_or_else(|| node.share().upcast()); let mut parent = node.share().upcast();
for child in children { for child in children {
let mut child = convert_ui(child, Some(owner_node.share()), base_path); parent.add_child(
node.share() convert_ui(child, base_path),
.upcast() false,
.add_child(child.share(), false, InternalMode::INTERNAL_MODE_FRONT); InternalMode::INTERNAL_MODE_DISABLED,
child.set_owner(owner_node.share()); );
} }
} }

View File

@@ -66,16 +66,18 @@ fn extract(datafile: &Datafile, file: &mut File) {
} }
fn main() { fn main() {
let file_name = Some(NullString::from("data\\loading\\sprites.txt")); let file_name = Some(NullString::from(
"data\\menu\\screens\\options_controls.xml",
));
let dat_path = "E:\\Games\\Schatzjäger\\data\\datafile.dat"; let dat_path = "E:\\Games\\Schatzjäger\\data\\datafile.dat";
let mut file = File::open(dat_path).unwrap(); let mut file = File::open(dat_path).unwrap();
let dat: Datafile = Datafile::read(&mut file).unwrap(); let dat: Datafile = Datafile::read(&mut file).unwrap();
println!("{:#?}", dat); println!("{:#?}", dat);
extract(&dat, &mut file); // extract(&dat, &mut file);
/*if let Some(file_name) = file_name { if let Some(file_name) = file_name {
let target = dat.files.iter().find(|it| it.name == file_name).unwrap(); let target = dat.files.iter().find(|it| it.name == file_name).unwrap();
file.seek(SeekFrom::Start(target.pos as u64)).unwrap(); file.seek(SeekFrom::Start(target.pos as u64)).unwrap();
let mut data = vec![0u8; target.len as usize]; let mut data = vec![0u8; target.len as usize];
@@ -85,10 +87,12 @@ fn main() {
.extension() .extension()
.and_then(OsStr::to_str) .and_then(OsStr::to_str)
{ {
Some("xml") => println!( Some("xml") => {
"{:#?}", let mut data =
from_str::<UiTag>(String::from_utf8(data).unwrap().as_str()) from_str::<UiTag>(String::from_utf8(data).unwrap().as_str()).unwrap();
), data.post_process();
println!("{:#?}", data)
}
Some("txt") => { Some("txt") => {
if false { if false {
/*let decr = decrypt_txt(&mut data); /*let decr = decrypt_txt(&mut data);
@@ -124,7 +128,7 @@ fn main() {
Some(ext) => eprintln!("Unknown file extension <{}>", ext), Some(ext) => eprintln!("Unknown file extension <{}>", ext),
None => eprintln!("Failed to read"), None => eprintln!("Failed to read"),
} }
}*/ }
} }
// pub fn decr2() // pub fn decr2()