Resource Layer Utility

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Re: Resource Layer Utility

Postby aghmed » Mon Jan 14, 2013 10:26 pm

well thats why:
Image
my friend made small function that draw 3 rectangles, inside is 2 subtiles smaller than neg size middle is neg size and last is 2 sub bigger
2 subtiles means 1 subtile from every side
if rect is blue then i didn't walked on it, if green then i'm touching it if red then i'm inside

this rabbit is 1 subtile too small from south


btw chanterlies and blood have neg (?)
Image
Image
public static class StupidJavaCodeContainer {
/* oh, i love swing. */
class checkOutMyPathfinder{
Image
}}
User avatar
aghmed
 
Posts: 238
Joined: Fri Sep 07, 2012 7:20 pm
Location: between London and third part of LSD

Re: Resource Layer Utility

Postby boshaw » Mon Jan 14, 2013 11:39 pm

The Neg portion of the resources have been limited use in the client.

the CC Coord in the Neg files are used mostly for specifying a point or offset in some calculation for finding the correctly spot on the screen.

Examples:
Code: Select all
setCursor(makeawtcurs(curs.layer(Resource.imgc).img, curs.layer(Resource.Negc).cc));
...
private static Cursor makeawtcurs(BufferedImage img, Coord hs) {
   java.awt.Dimension cd = Toolkit.getDefaultToolkit().getBestCursorSize(img.getWidth(), img.getHeight());
   BufferedImage buf = TexI.mkbuf(new Coord((int)cd.getWidth(), (int)cd.getHeight()));
   java.awt.Graphics g = buf.getGraphics();
   g.drawImage(img, 0, 0, null);
   g.dispose();
   return(Toolkit.getDefaultToolkit().createCustomCursor(buf, new java.awt.Point(hs.x, hs.y), ""));
}

In that case the CC is used to specify the 'hot-spot' point in a cursor

In many others you find things like:
Code: Select all
Coord dc = mousepos.add(curs.layer(Resource.Negc).cc.inv());

Which has more to do with properly centering the object or in the case of the above properly finding the real coordinate of the mouse pointer.

If you look in ImageSprite.java you'll also find CC being used as an offset to once again properly position a coordinate:
Code: Select all
   
public boolean checkhit(Coord c) {
   c = c.add(ImageSprite.this.cc);
   if((c.x < img.o.x) || (c.y < img.o.y) || (c.x >= img.o.x + img.sz.x) || (c.y >= img.o.y + img.sz.y))
      return(false);
   int cl = img.img.getRGB(c.x - img.o.x, c.y - img.o.y);
   return(Utils.rgbm.getAlpha(cl) >= 128);
}


Moving on back to BS and BC coordinates in Neg you'll find that they are used in a manner that suggests that they are the defining hitboxes of the resource, BS and BC are also used with the creation of crop sprites however a bit more strangely there which i don't fully comprehend.

Also you can refer to Ender's 'hitbox' highlighting of hidden objects which also uses BC and BS:
Code: Select all
if(Config.showHidden && Config.hide) {
   g.chcolor(255, 0, 0, 128);
   synchronized(glob.oc) {
      for(Gob gob : glob.oc) {
         Resource res = gob.getres();
         if(!gob.hide || ((res != null)&&(res.skiphighlight)))
            continue;
         Resource.Neg neg = gob.getneg();
         if(neg == null)
            continue;
         if((neg.bs.x > 0) && (neg.bs.y > 0)) {
            Coord c1 = gob.getc().add(neg.bc);
            Coord c2 = c1.add(neg.bs);
            g.frect(m2s(c1).add(oc),
               m2s(new Coord(c2.x, c1.y)).add(oc),
               m2s(c2).add(oc),
               m2s(new Coord(c1.x, c2.y)).add(oc));
         }
      }
   }
   g.chcolor();
}


the SZ coord is unknown, i didn't notice it being used at all in the default client.

however, one thing to note about the Neg is that outside of it's use in offsets with CC or crops with BS and BC they aren't used anywhere else. The bounding box drawing that i mentioned with BS and BC is only turned on by a variable that you can't normally turn on without proper command line arguments. This suggests that some of the coordinates inside Neg were most likely used by Loftar or Jorb to help figure out if they did their hitboxes correctly or for debugging purposes. So if one of them is wrong or others are just missing then it's most likely that they stopped having to use them for that purpose; therefore, they lost their meaning overtime and they didn't care to fix them.

The ones that really needed their correct values are mostly crops which did directly use BS and BC to generate the random strands that you see when they are rendered. Aside from that I don't see their purpose in the default client at all outside of debugging for Loftar, which really doesn't surprise me if a few of them aren't 100% correct.
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Resource Layer Utility

Postby Oddity » Tue Feb 26, 2013 10:56 am

Where the hell could I get my gfx/borka/wow.res, since it's not in my Ender's res/ folder and doesn't appear in my /%USERNAME%/.haven/cache ? It's not in my Java cache if I go through control panel or whatever, either.
jadamkaz wrote:ah i remember my run in with odditown they are good ppl im sure the only reason they killed ME is because they are troll hunters and i was a troll
User avatar
Oddity
 
Posts: 1948
Joined: Sun Jun 20, 2010 12:04 am
Location: BC, Canadia

Re: Resource Layer Utility

Postby borka » Tue Feb 26, 2013 11:52 am

i got it in
Code: Select all
haven-res.jar/res/gfx/borka/
in Ender...
Avatar by SacreDoom
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
User avatar
borka
 
Posts: 9965
Joined: Thu Feb 03, 2011 7:47 pm
Location: World of Sprucecap

Re: Resource Layer Utility

Postby Oddity » Tue Feb 26, 2013 8:25 pm

Ah, right, the haven-res.jar! I knew there was some place I wasn't looking, but I couldn't remember it. thanks
jadamkaz wrote:ah i remember my run in with odditown they are good ppl im sure the only reason they killed ME is because they are troll hunters and i was a troll
User avatar
Oddity
 
Posts: 1948
Joined: Sun Jun 20, 2010 12:04 am
Location: BC, Canadia

Re: Resource Layer Utility

Postby mvgulik » Tue Mar 19, 2013 11:03 am

Can't see how to drop a requests in GitHub for LayerUtil. (assuming its disabled.)

I don't mind seeing a additional LayerUtil option(advanced) to dump the images in the res files as they are. (CQ: a binary copy of the res image part, instead of writing a re-coded PNG image.)
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Resource Layer Utility

Postby boshaw » Tue Mar 19, 2013 5:42 pm

mvgulik wrote:Can't see how to drop a requests in GitHub for LayerUtil. (assuming its disabled.)

I don't mind seeing a additional LayerUtil option(advanced) to dump the images in the res files as they are. (CQ: a binary copy of the res image part, instead of writing a re-coded PNG image.)


If you don't mind using SBCL, you can download my salem-layer-util dev tree which supports HNH and does exactly that.
You can find it here: https://github.com/boshaw/salem-layer-util/tree/dev

I tested it with haven-res and played a bit and everything seemed fine so it should work.

once you download the stuff, you can use the instructions on the github for the original salem-layer-util, but there's an added option
Code: Select all
:layer "layers/hnh"
when using (run...) to make it do hnh stuff.

Eventually i planned to make it work with ABCL (usable through JVM) or just distribute an executable so you didn't need to download SBCL and stuff, but that's not avaiable at the moment. I could make you an executable though if you're on windows, but from SBCL they are like 50mb if that's an issue for you.

I have to fix some stuff for a guy from salem and then i can try working on the ABCL stuff if you don't want to have to download SBCL and that.
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Resource Layer Utility

Postby mvgulik » Tue Mar 19, 2013 6:22 pm

Aha, thanks for the info. Did not know your Salem-res tool could do that.

I'm not in a rush. So I probably just wait a bit.
(I'm also not to fund on installing, and trying to figure out, additional code/script software/language.)

If I really need to I can pry a image bit-copy out of the res files with python. I just thought its nice/good to have that options with your res tools. (HnH LayerUtil included of course. ;) )
Last edited by mvgulik on Tue Mar 19, 2013 6:28 pm, edited 1 time in total.
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Resource Layer Utility

Postby boshaw » Tue Mar 19, 2013 6:27 pm

Yeah, I've been slowly converting the salem-layer-util into a general purpose file layer utility that decodes and encodes based on layer files you can make yourself in the layer folder.

Part of the goal is to also make it usable in a variety of ways so you don't need SBCL, one being ABCL, but i haven't gotten there yet. Once i get to that though, it's probably going to replace the old LayerUtil
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Resource Layer Utility

Postby mvgulik » Tue Mar 19, 2013 6:47 pm

Roger.
Looking forward to it. :)
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 1 guest