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

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

Moderator: Phades

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

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

Full list of code tinkering in Enders client for this to work.

In Resource.java comment the 2 lines shown below to remove the s2m conversion.

Code: Select all
   public Neg(byte[] buf) {
       int off;
      
       cc = cdec(buf, 0);
       bc = cdec(buf, 4);
       bs = cdec(buf, 8);
       sz = cdec(buf, 12);
      //bc = MapView.s2m(bc);
      
      //bs = MapView.s2m(bs).add(bc.inv());


In CommonPlant.java, GaussianPlant.java and GrowingPlant.java edit the lines requiring neg values to work.

From this:
Code: Select all
      Coord c = neg.bc.add(rnd.nextInt(neg.bs.x), rnd.nextInt(neg.bs.y));

To this:
Code: Select all
      Coord bc = new Coord(-4,-4);
      Coord c = bc.add(rnd.nextInt(12), rnd.nextInt(12));


GrowingPlant.java is a bit more complicated but should look like this:

Code: Select all
      if(Config.simple_plants){
          //c = neg.bc.add(neg.bs).sub(5, 5);
         c = Coord.z; // new
      } else {
          //c = new Coord(rnd.nextInt(neg.bs.x), rnd.nextInt(neg.bs.y)).add(neg.bc);
         Coord bc = new Coord(-5,-5);
         c = new Coord(rnd.nextInt(11), rnd.nextInt(11)).add(bc); // new
      }


I haven't had the time to test all this out for several hours so your pc might blow up if you try this out. Use with care I guess. :)
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

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

Postby borka » Wed May 22, 2013 3:39 am

ty again Mr. HnH Scientist (and ty to boshaw too!) :D
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: Haven-res.jar hit-box fix. Fixed after multiple attempts

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

borka wrote:ty again Mr. HnH Scientist (and ty to boshaw too!) :D


Most of the credit should go to boshaw. He probably did more work then I did. :)

But there are still those mysterious hit-box fixes to be fixed inside the haven code. There are easy workarounds to it so overall it should be a easy way to get all the hit-boxes but a bit of code tinkering might be able to weed out those bugs as well.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

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

Postby Xcom » Wed May 22, 2013 1:03 pm

Discovered a few negs that wasn't converted. :(

I think it crashes in the middle of the process somehow.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

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

Postby boshaw » Wed May 22, 2013 3:56 pm

Xcom wrote:Discovered a few negs that wasn't converted. :(

I think it crashes in the middle of the process somehow.


Which resource files to be exact?
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

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

Postby Xcom » Wed May 22, 2013 10:05 pm

I found brick walls to have still not converted.

gfx/arch/walls/brick

I didn't find many more but I suspect all wall types and a few others had missing conversions.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

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

Postby boshaw » Wed May 22, 2013 10:23 pm

Xcom wrote:I found brick walls to have still not converted.

gfx/arch/walls/brick

I didn't find many more but I suspect all wall types and a few others had missing conversions.


Really now? Interesting, i tested with the bricks and they seemed to convert for me from:
Code: Select all
off = -6,-6
sz=11,11


to:
Code: Select all
off=-5,-2
sz=13,4


which is expected with s2m and the subtraction on the sz.

What are your brick neg values cosign out to be or what are the expected one?
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

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

Postby Xcom » Wed May 22, 2013 11:41 pm

The brick values after the conversion.

These negs:

gfx/arch/walls/brick-ns
gfx/arch/walls/brick-we
gfx/arch/walls/brick-cp

Code: Select all
Size bs   (0, 11)
Offset bc (0, -11)


They are supposed to be:
Code: Select all
Size bs   (10, 10)
Offset bc (-5, -5)


I suspect its got something to do with my settings or something. When it reaches res/gfx/arch/cabin-door it stops and pauses for 30 seconds. After about 30 or so it NILs then goes back to console.

Code: Select all
  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: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby boshaw » Thu May 23, 2013 1:20 am

Xcom wrote:The brick values after the conversion.

These negs:

gfx/arch/walls/brick-ns
gfx/arch/walls/brick-we
gfx/arch/walls/brick-cp

Code: Select all
Size bs   (0, 11)
Offset bc (0, -11)


They are supposed to be:
Code: Select all
Size bs   (10, 10)
Offset bc (-5, -5)

interesting, what are you're original neg values for your brick resource files? (before editing their bs/bc values with this script)

Xcom wrote:I suspect its got something to do with my settings or something. When it reaches res/gfx/arch/cabin-door it stops and pauses for 30 seconds. After about 30 or so it NILs then goes back to console.

Code: Select all
  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):

No, that actually means it ran through all the files just fine and did the edits. I just didn't add any verbose print statements to tell you the progress along the way for this yet.
User avatar
boshaw
 
Posts: 1538
Joined: Tue Jun 01, 2010 10:22 pm

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

Postby Xcom » Thu May 23, 2013 3:29 am

I found cupboards to not have been edited as well.

Code: Select all
Size bs   (0, 11)
Offset bc (0, -11)


Both for cupboards and walls.

Those are the numbers both before and after they have been edited.
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 1 guest