Reflection Modification

General feedback and discussion of the game.

Moderator: Forum Moderators

User avatar
pipapopinguin
Posts: 39
Joined: November 3rd, 2019, 10:36 am

Re: Reflection Modification

Post by pipapopinguin »

I had reupload my modification to the add-ons server, since I forgot my password :annoyed:. 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.
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
User avatar
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

Post by Atreides »

Atreides wrote: March 11th, 2024, 12:23 am 20240310 19:42:29 warning scripting/lua: Cannot resolve variable 'new_reflection_animations[].offset' for reading.
I looked into this again and I think I fixed it.

Code: Select all

new_reflection_animations[$i].offset
: appears twice and the second one seems to be causing the warnings because it may be outside the "for i loop" so $i is null. I changed it to index 0 (because all surrounding code was using that index) and presto, no more warnings. Hope that helps or at least points towards the correct fix.

Whether 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.
User avatar
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

Post by Atreides »

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:

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
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.
User avatar
ZombieKnight
Posts: 376
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Reflection Modification

Post by ZombieKnight »

Base game does reflect castles on its own :D
User avatar
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

Post by Atreides »

ZombieKnight wrote: February 13th, 2025, 5:43 pm Base game does reflect castles on its own :D
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
mentos987
Posts: 31
Joined: September 17th, 2021, 10:47 pm

Re: Reflection Modification

Post by mentos987 »

Very nice addon, here is a bug for you.
Attachments
Untitled.png
User avatar
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

Post by Atreides »

mentos987 wrote: June 23rd, 2025, 10:21 am Very nice addon, here is a bug for you.
The reflection looks all right. The bug may be in BfW's new elevation graphic.
User avatar
ZombieKnight
Posts: 376
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Reflection Modification

Post by ZombieKnight »

mentos987 wrote: June 23rd, 2025, 10:21 am Very nice addon, here is a bug for you.
It really is problem of core Wesnoth.
mentos987
Posts: 31
Joined: September 17th, 2021, 10:47 pm

Re: Reflection Modification

Post by mentos987 »

Well, it only happens with the reflection addon turned on.
User avatar
ZombieKnight
Posts: 376
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Reflection Modification

Post by ZombieKnight »

Oh, may be, sorry then.
User avatar
pipapopinguin
Posts: 39
Joined: November 3rd, 2019, 10:36 am

Re: Reflection Modification

Post by pipapopinguin »

mentos987 wrote: June 23rd, 2025, 10:21 am Very nice addon, here is a bug for you.
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.
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
mentos987
Posts: 31
Joined: September 17th, 2021, 10:47 pm

Re: Reflection Modification

Post by mentos987 »

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.
User avatar
pipapopinguin
Posts: 39
Joined: November 3rd, 2019, 10:36 am

Re: Reflection Modification

Post by pipapopinguin »

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.
Author of Corpse Mod 2, Breeze-Mod,Reflections and don't click here.
Post Reply