PDA

View Full Version : Example of a change with layer merging



cscase
September 9th, 2013, 05:19
I'm working on getting my head wrapped around using 3.0's layer merging, and just trying to do some simple things to figure out how it works. I have a couple of questions, and also thought in the process of asking them, I'd write up some of the basic things I've figured out in hopes that it might be helpful to others in figuring this out. For me, examples are really helpful.

I wanted to make a new ruleset based on the CoC one, and start with a few simple changes, like replacing the background for the character select window.

Here's what I did so far. If I'm doing something silly or going about this in a backward way, please let me know!

Create a custom ruleset based on the CoC ruleset.
To create a new ruleset based on the existing CoC ruleset, I made a new ruleset folder called CustomCoC and put a base.xml in there like this:


<?xml version="1.0" encoding="iso-8859-1"?>


<root version="3.0" release="1" logo="logo.png">


<importruleset source="CallOfCthulhu" />

</root>

Replace the graphic for the character select window
I have a .png that is the same size as the existing one that I'd like to sub in. I gather that within my new ruleset, there's no requirement that I place things in the same folders that they were in in the source ruleset, as long as I reference them correctly, but it seems like it would be good practice to do so, if only to keep confusion down, right?

So, first, in my customCoC folder, I create the folder graphics\frames and I put my charselect.png there.
But just placing the file in there doesn't do anything. I need to also replace the framedef that uses that graphic.

That's defined in graphics\graphics_frames.xml, so if I want to stay consistent, I ought to put my new definition in the same place. I copy in that file into my ruleset from the original CoC one, and I deleted everything except the framedef I want to modify. That leaves me with this in the file:

<?xml version="1.0" encoding="iso-8859-1"?>

<root>
<!-- Character selection -->
<framedef name="charselect">
<bitmap file="graphics/frames/charselect.png" />
<offset>68,75,77,51</offset>
<insideoffset>0,0,5,7</insideoffset>
</framedef>
</root>

With framedef it is all or nothing - I can't just update the bitmap file property and not specify the other properties. I must supply the whole framedef.

Next I also need to tell FG, in my base.xml, that this new file is there. I add this line into my base.xml:

<includefile source="graphics/graphics_frames.xml" />


So, having done this, I've got a new charselect frame.

But one problem is that here (and in the CoC ruleset, too), I've got a background that is not made to tile in a window that's resizable. So if the user grabs that corner and drags it, it looks awful.

To do that, I need to edit the windowclass charselect_host and charselect_client. They're in campaign\campaign_chars.xml, so I create that file in my own ruleset.

With windowclass, I can use merge properties and I don't have to repeat everything in the windowclass. I can just add the part I want to add, so in my file I put:

<windowclass name="charselect_host" merge="join">
<sizelimits>
<maximum width="615" height="415" />
</sizelimits>
</windowclass>

<windowclass name="charselect_client" merge="join">
<sizelimits>
<maximum width="615" height="415" />
</sizelimits>
</windowclass>

Does this make sense? I set the max size the same as the min and that makes the window unable to be resized.

But the problem then is that I still have the little resizing handle in the bottom-right corner. What would be the best way for me to remove that? Am I on the right track so far, or am I going about these things in an inefficient manner? Is this example helpful to anybody?

Thanks!
Scott

Moon Wizard
September 10th, 2013, 00:28
You are definitely on the right track.

In order to merge/delete an existing control in a windowclass, it has to be named. Since the resize control is not named, there is no easy way to make a small edit. You would have to replace the charselect_host and charselect_client windowclass objects.

I was just doing the exact same thing on my side, except that I updated the resize and close controls to have names in the charselect window. However, I may have to wait until people ask for those names, since checking and renaming controls across all rulesets is very time-consuming.

Regards,
JPG