Reflection Modification
Moderator: Forum Moderators
- pipapopinguin
- Posts: 39
- Joined: November 3rd, 2019, 10:36 am
Re: Reflection Modification
I had reupload my modification to the add-ons server, since I forgot my password
. So anyways, in the new update I fixed some issues, where units would have larger reflections than they have bodymass above the water and also that undead variations should be properly displayed in water.
- Atreides
- Posts: 1250
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off
Re: Reflection Modification
I looked into this again and I think I fixed it.
Code: Select all
new_reflection_animations[$i].offsetWhether it looks nicer now... hehe, hard to tell. As usual there's a good chance it doesn't matter. : )
Keeps my logs clearer anyways! LOL.
- Atreides
- Posts: 1250
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off
Re: Reflection Modification
Wow, I noticed a nice upgrade to the add-on, it now no longer reflects onto land. I'd noticed that from the start but decided not to mention it since I figured it might be unfixable. Glad to see it is not.
I did notice a new bug though. It seems that if you turn the mod off (say for a huge map where perhaps it might be wise to run as "bare" as possible for speed) it actually still reflects castles!
Being a curious cat I dove into the code and I noticed an alarming fact. Some of the code is at top level and will be loaded always.
A sample:
There is another similar chunk after the wall:ref macro ends
This is in reflection.cfg which is loaded by the main.cfg. Should the part between the macros not be inside the modification tag inside a start event? And the macros moved to the macros.cfg. That'd only load it if the mod is toggled on.
I did notice a new bug though. It seems that if you turn the mod off (say for a huge map where perhaps it might be wise to run as "bare" as possible for speed) it actually still reflects castles!
Being a curious cat I dove into the code and I noticed an alarming fact. Some of the code is at top level and will be loaded always.
A sample:
Code: Select all
[/terrain_graphics]
#enddef
#Castles
#Some tiles, such as encampments, have other types of images and needed adjustment for that
{CASTLE:REFLECTION Ch castle/castle}
{CASTLE:REFLECTION Kh castle/keep}
{CASTLE:REFLECTION Cha castle/snowy/castle}
{CASTLE:REFLECTION Kha castle/snowy/keep}
{CASTLE:REFLECTION (Kme,Cme) castle/aquatic-camp/castle}
[terrain_graphics]
map="
, *
*, *
, 2
*, *
, 1
*, *
, *"
[tile]
pos=1
type=Cme
[/tile]
[tile]
pos=2
type=!,C*,K*
[/tile]
[image]
name=castle/aquatic-camp/castle@V-convex-br.png~FL(vertical)~O(40%)
layer=-483
center=117,200
variations=";2;3;4;5;6"
[/image]
[image]
name=castle/aquatic-camp/castle@V-convex-bl.png~FL(vertical)~O(40%)
layer=-483
center=63,228
variations=";2;3;4;5;6"
[/image]
[/terrain_graphics]
{CASTLE:REFLECTION (Kte,Cte) castle/troll/regular CAMPADJUSTMENT=218}
{CASTLE:REFLECTION Cm castle/aquatic-castle/castle}
[terrain_graphics]
map="
, *
*, *
, 2
*, *
, 1
*, *
, *"
[tile]
pos=1
type=Cm
[/tile]
[tile]
pos=2
type=!,C*,K*
[/tile]
[image]
name=castle/aquatic-castle/castle@V-concave-br.png~FL(vertical)~O(40%)
layer=-483
center=117,200
variations=";2;3;4;5;6"
[/image]
[image]
name=castle/aquatic-castle/castle@V-concave-bl.png~FL(vertical)~O(40%)
layer=-483
center=63,228
variations=";2;3;4;5;6"
[/image]
[/terrain_graphics]
{CASTLE:REFLECTION Km castle/aquatic-castle/keep}
{CASTLE:REFLECTION Cv castle/elven/castle}
{CASTLE:REFLECTION Kv castle/elven/keep}
{CASTLE:REFLECTION Cvr castle/elven-ruin/castle}
{CASTLE:REFLECTION Kvr castle/elven-ruin/keep}
{CASTLE:REFLECTION Cva castle/winter-elven/castle}
{CASTLE:REFLECTION Kva castle/winter-elven/keep}
{CASTLE:REFLECTION Co castle/orcish/fort}
{CASTLE:REFLECTION Ko castle/orcish/keep}
{CASTLE:REFLECTION Coa castle/winter-orcish/fort}
{CASTLE:REFLECTION Koa castle/winter-orcish/keep}
{CASTLE:REFLECTION Cd castle/sand/castle}
{CASTLE:REFLECTION Kd castle/sand/keep}
{CASTLE:REFLECTION Cdr castle/sand/ruin-castle}
{CASTLE:REFLECTION Kdr castle/sand/ruin-keep}
{CASTLE:REFLECTION (!,Chr,Chs,Ce*,Ke*,!,Ch*) castle/sunken-ruin}
{CASTLE:REFLECTION (!,Khr,!,Kh*) castle/sunkenkeep}
{CASTLE:REFLECTION Cf*,Kf* castle/outside-dwarven/dwarven-castle}
{CASTLE:REFLECTION Cfa,Kfa castle/winter-dwarven/dwarven-castle}
{CASTLE:REFLECTION Cfr,Kfr castle/ruin-dwarven/dwarven-castle}
{CASTLE:REFLECTION (Cud*,Kud*) castle/dwarven-castle}
{CASTLE:REFLECTION Ce,Ke castle/encampment/regular CAMPADJUSTMENT=218}
{CASTLE:REFLECTION Cer,Ker castle/encampment-ruin/regular CAMPADJUSTMENT=218}
{CASTLE:REFLECTION Cea,Kea castle/encampment/snow CAMPADJUSTMENT=218}
{CASTLE:REFLECTION Ket* castle/encampment/tall-keep}
###{CASTLE:REFLECTION Cha castle/keep}
#define WALL:REFLECTION TYPE IMAGEPATH
This is in reflection.cfg which is loaded by the main.cfg. Should the part between the macros not be inside the modification tag inside a start event? And the macros moved to the macros.cfg. That'd only load it if the mod is toggled on.
- ZombieKnight
- Posts: 376
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: Reflection Modification
Base game does reflect castles on its own 
- Atreides
- Posts: 1250
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off
Re: Reflection Modification
Is that so? My copy must be broken then : ( I just moved the reflections addon out of the addons dir and suddenly the castles, trees and walls don't reflect anymore. ; )
Seriously though I did some more testing and it turns out that if you load a MP scenario/campaign or a SP campaign there are no reflections. The reflections are only appearing on random maps & maps in the editor dir! It appears to be something related to no scenario file being loaded.
P.S. It seems there's a bug in Wesnoth causing this since it too is about random scenarios and custom maps.
https://github.com/wesnoth/wesnoth/issu ... 2904048974
- Atreides
- Posts: 1250
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off
Re: Reflection Modification
The reflection looks all right. The bug may be in BfW's new elevation graphic.
- ZombieKnight
- Posts: 376
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: Reflection Modification
It really is problem of core Wesnoth.
Re: Reflection Modification
Well, it only happens with the reflection addon turned on.
- ZombieKnight
- Posts: 376
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: Reflection Modification
Oh, may be, sorry then.
- pipapopinguin
- Posts: 39
- Joined: November 3rd, 2019, 10:36 am
Re: Reflection Modification
Hello, I haven't been that active in the last months, but I'm still glad, that I managed to see your feedback. I adjusted the layer those trees got generated with (from like -200 to -89, since elevations are at -90). If you see any other bugs be sure to let me now, I will work on them as soon as I have the time.
Re: Reflection Modification
The same issue still remains.
Also, would you be fine with reflections going into main?
Doing it for main would require code in lua or c++ though, so I would not be copying too much of your work.
It would likely not use the night sky reflections.
Also, would you be fine with reflections going into main?
Doing it for main would require code in lua or c++ though, so I would not be copying too much of your work.
It would likely not use the night sky reflections.
- pipapopinguin
- Posts: 39
- Joined: November 3rd, 2019, 10:36 am
Re: Reflection Modification
hello,
I just pushed a new update. It seems like the big trees used a different macro than the other forest tiles and i only adjusted the layering of all other forest tiles when there's elevation behind them (in the previous update). The big trees now use the same macro as all other forest tiles and I tested it and it now seems to work (please inform me if I'm wrong).
I also wouldn't mind if mainline took the reflections and added them to the default experience, but I probably wouldn't much of a help in the actual implementation as I have other things to do, but I could support where I can.
I just pushed a new update. It seems like the big trees used a different macro than the other forest tiles and i only adjusted the layering of all other forest tiles when there's elevation behind them (in the previous update). The big trees now use the same macro as all other forest tiles and I tested it and it now seems to work (please inform me if I'm wrong).
I also wouldn't mind if mainline took the reflections and added them to the default experience, but I probably wouldn't much of a help in the actual implementation as I have other things to do, but I could support where I can.