Haven-res.jar hit-box fix. Fixed after multiple attempts.

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

Moderator: Phades

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Tue May 21, 2013 8:02 am

Yapp thats the one :)
s2m() from MapView.java

Been tinkering for hours trying to get the filters and everything to work here on my end. Have had to do some edits in GaussianPlants.java and CommonpPlants.java for this to work.

One big problem that is still illuding me is the damn kritters:
Rabbits
Hens / Cocks / Chicks
Frogs
DragonFlys

All have the wrong resname. I have attempted to fix it but they still are causing issues as they use the same names as rats or the player itself. If I can weed out the problem it will be possible to get a proper neg data output ingame. And with the help of your neg repairer it should be possible to get all hit-boxes ingame to display properly. :)
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby boshaw » Tue May 21, 2013 10:32 am

https://github.com/boshaw/salem-layer-u ... master.zip

K I updated the files with the new s2m function and other fix discussed in posting.php?mode=reply&f=27&t=30936#pr400392
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Tue May 21, 2013 11:59 am

Sweet testing out right now. :)
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Tue May 21, 2013 12:14 pm

I cant get it to work. :(

Do I need to add other files or maybe I'm typing in the wrong command.

The hnh-fix-neg seems to skip all but the negs listed specifically in the filter file. The rest of the negs are left alone and never edited with the s2m function.

I get this and it stops.
Code: Select all
#<THREAD "interpreter" {19D40BE7}>: Debugger invoked on condition of type UNDEFI
NED-FUNCTION
  The function SALEM-LAYER-UTIL::UBARR->INT is undefined.
Restarts:


Edit: On closer inspection it seams nothing was edited.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby boshaw » Tue May 21, 2013 9:35 pm

Xcom wrote:I cant get it to work. :(

Do I need to add other files or maybe I'm typing in the wrong command.

The hnh-fix-neg seems to skip all but the negs listed specifically in the filter file. The rest of the negs are left alone and never edited with the s2m function.

I get this and it stops.
Code: Select all
#<THREAD "interpreter" {19D40BE7}>: Debugger invoked on condition of type UNDEFI
NED-FUNCTION
  The function SALEM-LAYER-UTIL::UBARR->INT is undefined.
Restarts:


Edit: On closer inspection it seams nothing was edited.


Sorry, i forgot to upload another file that I had updated last night, hence it saying it can't find a function within the source code.
the source should be updated now
https://github.com/boshaw/salem-layer-u ... master.zip

Also early in the thread you gave an example with Cauldron:
Xcom wrote:Just as an example. "cauldron.res" is a res inside the haven-res.jar inside the "gfx/terobjs/" and have a neg layer in it. The filter would simply go in and edit its neg data using the m2s and change the data inside the neg file from

Code: Select all
#Coord bc
0
-10
#Coord bs
0
10


to

Code: Select all
#Coord bc
-5
-5
#Coord bs
10
10



But there seems to be an issue here.
s2m(0,-10) goes to -5,-5 as expected, but s2m(0,10) goes to 5,5 instead of 10,10. m2s doesn't give the right output either in this case.
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Tue May 21, 2013 11:31 pm

Your right the function inside Resource.java goes like this.

Code: Select all
bc = MapView.s2m(non_isometric_bc );

bs = MapView.s2m(non_isometric_bs ).add(bc.inv());


Sorry about the whole scrueup. This part of Resource is a bit confusing.

But it seems you need to subtract the converted BC from BS to get to the correct readout.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby boshaw » Wed May 22, 2013 12:05 am

Xcom wrote:Your right the function inside Resource.java goes like this.

Code: Select all
bc = MapView.s2m(non_isometric_bc );

bs = MapView.s2m(non_isometric_bs ).add(bc.inv());


Sorry about the whole scrueup. This part of Resource is a bit confusing.

But it seems you need to subtract the converted BC from BS to get to the correct readout.


K i added in the subtraction and tested with that cauldron res and got the right output this time, https://github.com/boshaw/salem-layer-u ... master.zip

If you see any more issues just tell me
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Wed May 22, 2013 12:37 am

Should it look like this when its finished?

Code: Select all
  C:/Java/SahFarmbot/res stuff/Latest extract/salem-layer-util-master(1)/salem-l
ayer-util-master/res/gfx/arch/cabin-log.res
  C:/Java/SahFarmbot/res stuff/Latest extract/salem-layer-util-master(1)/salem-l
ayer-util-master/res/gfx/arch/cabin-log-big.res
  C:/Java/SahFarmbot/res stuff/Latest extract/salem-layer-util-master(1)/salem-l
ayer-util-master/res/gfx/arch/cabin-door2m.res
  C:/Java/SahFarmbot/res stuff/Latest extract/salem-layer-util-master(1)/salem-l
ayer-util-master/res/gfx/arch/cabin-door2.res
  C:/Java/SahFarmbot/res stuff/Latest extract/salem-layer-util-master(1)/salem-l
ayer-util-master/res/gfx/arch/cabin-door.res
NIL
SLU(2):
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Wed May 22, 2013 12:57 am

Ohh wow I just loged in with the new res file. Its working perfectly :)

All hit-boxes are correctly displaying except for the regular plants. I didn't add them to the filter file will have to add them now.

This is amazing, thank you so much boshaw and sorry for all the trouble.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Assistance needed to fix hit-box data in haven-res.jar

Postby Xcom » Wed May 22, 2013 3:00 am

I added all the corrections in the filter list except for these objects:

Hen/Cock/Chicken
Moth
Rabbit (or Hare as its called in the res files)
Dragonfly
Frog - correct hit-box but incorrect reading
Blood
Tree log

The listed objects above still are not showing the correct hit-box data. Reasons listed below:

Frog / Moth / Dragonfly are all listed as Rats. They get the same hit-box as the rat so in the case of the frog it coincidentally works out. But dragonfly's and moths don't have a hit-box and in this case causes issues. I have tried to find out why with no success.

Rabbits and Hen/Cock/Chickens have the same issue. They display as if they were the player with the players hit-box. Same attempts to figure out why they display as players have failed as the reasons with the ones listed above.

Tree logs I just kept with there hit-box as they give that nice red outline when you hide trees. Its just convenient and a bad workaround honestly. There might be a better solution so if one is found it should be added that instead of this one.

Blood is a whole mystery on its own. Plants(farm crops)/bushes/chanterelles all had hit-boxes so you could see that nice mini-plant random locations in that small tile they grow on. Ender have that nice simplified plants to remove the affect on farms. This caused issues so I had to go in and hardcode the hit-box in the code instead of the randomize reviving the info from the neg data. But here is the crazy thing. Blood have the same randomize affect so I tried to find and hardcode the blood neg data but mysteriously its not there. Its nowhere to be found and I cant fix it. Editing its neg values crashes when you see blood. The crash printout in the console points to Blood.java but that class or java file doesn't exist anywhere. I have no idea what the hell is going on so I just gave blood back its hit-box and left it at that. I hope someone can help figure out this crazy mystery as its driving me nuts.

But overall it takes a few lines here and there to fix the haven code to match up with the hit-box changes made with this new hit-box correct haven-res.jar. I hope someone that is interested in making pathfinder finds this useful and uses it.

This is the full filter list:

Code: Select all
gfx/terobjs/blood
off=-5,-5
sz=11,11
gfx/terobjs/herbs/chantrelle
off=0,0
sz=0,0
gfx/tiles/wald/flavobjs/f1
off=0,0
sz=0,0
gfx/tiles/fen/flavobjs/f10
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/f1
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/f2
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/temp/f3
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/temp/f4
off=0,0
sz=0,0
gfx/tiles/heath/flavobjs/f1
off=0,0
sz=0,0
gfx/tiles/heath/flavobjs/f2
off=0,0
sz=0,0
gfx/terobjs/ridges/grass/ss
off=-10,-4
sz=14,7
gfx/terobjs/ridges/grass/e
off=-2,-11
sz=5,21
gfx/terobjs/ridges/grass/e2s
off=0,-21
sz=23,22
gfx/terobjs/ridges/grass/es
off=-5,-6
sz=7,16
gfx/terobjs/ridges/grass/ee
off=-4,-10
sz=7,14
gfx/terobjs/ridges/mountain/we
off=-11,0
sz=22,11
gfx/terobjs/ridges/mountain/ws
off=-11,-11
sz=22,11
gfx/terobjs/ridges/mountain/ne
off=-11,-11
sz=11,22
gfx/terobjs/ridges/mountain/ns
off=0,-11
sz=11,22
gfx/terobjs/ridges/mountain/ss
off=-10,0
sz=10,11
gfx/terobjs/ridges/mountain/ee
off=0,-10
sz=11,10
gfx/terobjs/furniture/coffer
off=-5,-4
sz=10,8
gfx/terobjs/furniture/leanto
off=-9,-5
sz=21,10
gfx/terobjs/furniture/wardrobe
off=-8,-3
sz=20,9
gfx/terobjs/furniture/bed-sturdy
off=-8,-5
sz=18,13
gfx/terobjs/furniture/cclosed
off=-3,-3
sz=7,4
gfx/terobjs/furniture/copen
off=-3,-3
sz=7,4
gfx/terobjs/vclaim
off=-12,-4
sz=27,8
gfx/terobjs/htable
off=-2,-5
sz=7,12
gfx/terobjs/crate
off=-6,-3
sz=14,7
gfx/terobjs/trough
off=-7,-4
sz=21,10
gfx/terobjs/dframe2
off=-3,-8
sz=4,18
gfx/terobjs/mining/ladder
off=-4,-1
sz=9,2
gfx/terobjs/lbox
off=-6,-7
sz=10,15
gfx/arch/gates/brick-ns
off=-5,-11
sz=10,21
gfx/arch/gates/fence-ns
off=-5,-11
sz=10,21
gfx/arch/gates/palisade-ns
off=-5,-11
sz=10,21
gfx/arch/gates/brick-we
off=-11,-5
sz=21,10
gfx/arch/gates/fence-we
off=-11,-5
sz=21,10
gfx/arch/gates/palisade-we
off=-11,-5
sz=21,10
gfx/arch/stairs-inn
off=-7,-11
sz=12,23
gfx/arch/door-inn
off=-11,-2
sz=19,5
gfx/kritter/plow/s
off=-3,-3
sz=6,6
gfx/kritter/cow/s
off=-4,-4
sz=11,11
gfx/kritter/cart/s
off=-5,-5
sz=10,10
gfx/kritter/rat/s
off=0,0
sz=1,1
gfx/kritter/deer/s
off=-4,-4
sz=11,11
gfx/kritter/bear/s
off=-8,-8
sz=16,16
gfx/kritter/fox/s
off=-3,-3
sz=7,7
gfx/kritter/troll/s
off=-8,-8
sz=16,16
gfx/terobjs/plants/beetroot
off=0,0
sz=0,0
gfx/terobjs/plants/carrot
off=0,0
sz=0,0
gfx/terobjs/plants/flax
off=0,0
sz=0,0
gfx/terobjs/plants/hemp
off=0,0
sz=0,0
gfx/terobjs/plants/hops
off=0,0
sz=0,0
gfx/terobjs/plants/onion
off=0,0
sz=0,0
gfx/terobjs/plants/peas
off=0,0
sz=0,0
gfx/terobjs/plants/pepper
off=0,0
sz=0,0
gfx/terobjs/plants/poppy
off=0,0
sz=0,0
gfx/terobjs/plants/tea
off=0,0
sz=0,0
gfx/terobjs/plants/tobacco
off=0,0
sz=0,0
gfx/terobjs/plants/wheat
off=0,0
sz=0,0
gfx/terobjs/plants/wine
off=0,0
sz=0,0
gfx/terobjs/plants/pumpkin
off=0,0
sz=0,0


Code needed to get the hit-boxes should look like this, much shorter then previously:

Code: Select all
   ArrayList<Rectangle> getAllNegs2(){
      long time = System.currentTimeMillis();
      
      int meOffcet = -2;
      int meSize = 4;
      
      if( ifYourInABoatTurnThisTrue ){
         meOffcet = -14;
         meSize = 26;
      }
      
      Gob player = getPlayerGob();
      ArrayList<Rectangle> negRec = new ArrayList<Rectangle>();
      synchronized(m_hPanel.ui.mainview.glob.oc){
         for(Gob g : m_hPanel.ui.mainview.glob.oc){
            String name = g.resname();
            
            if( g == player ) continue;
            if( g.getc().equals(player.getc() ) ) continue;
            if( name.equals("gfx/terobjs/trees/log") ) continue;
            if( name.equals("gfx/terobjs/blood") ) continue;
            if( (name.equals("gfx/terobjs/hearth-play") && g.getattr(KinInfo.class) == null) ) continue;
            if( (name.contains("/gates/") && g.GetBlob(0) == 2) ) continue;
            
            if( name.contains("/items/") ) continue; //speed optimization
            
            Coord offcet = new Coord();
            Coord size = new Coord();
            
            if(!kritterFix(g, offcet, size) ){
               Resource.Neg neg = g.getneg();
               if(neg == null){System.out.println("Error neg"); continue;}
               
               offcet = neg.bc;
               size = neg.bs;
            }
            
            if(size.x != 0){
               Rectangle rect = new Rectangle(g.getc().x + offcet.x + meOffcet,
                                       g.getc().y + offcet.y + meOffcet,
                                       size.x + meSize,
                                       size.y + meSize);
               negRec.add(rect);
            }
         }
      }
      
      //System.out.println("Neg compleate. " + (System.currentTimeMillis() - time) );
      return negRec;
   }
   
   boolean kritterFix(Gob g, Coord offcet, Coord size){ // fix for those pesky bugs
   
      if(g.resname().contains("gfx/borka/s") && !g.isHuman()){
         offcet.x = 0;
         offcet.y = 0;
         size.x = 1;
         size.y = 1;
         
         return true;
      }else if(g.resname().contains("gfx/kritter/rat/s") ){
         for(String s : g.resnames() ){
            if(s.contains("gfx/kritter/dragonfly") || s.contains("gfx/kritter/moth") ){
               offcet.x = 0;
               offcet.y = 0;
               size.x = 0;
               size.y = 0;
               
               return true;
            }
         }
      }
      
      return false;
   }


Thanks again boshaw. Would never been able to fix all this without your awesome filter. :)
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 2 guests