Thread: [Elvarg] Fixing doors, inability to remove clipping for walls and objects

Results 1 to 4 of 4
  1. #1 [Elvarg] Fixing doors, inability to remove clipping for walls and objects 
    Registered Member
    Join Date
    Jan 2022
    Posts
    49
    Thanks given
    1
    Thanks received
    10
    Rep Power
    11
    First, inside RegionManager.java, replace the entire "removeClippingForVariableObject" method with:

    Code:
    /**
         * Attempts to remove clipping for a variable object.
         *
         *  @Param x
         *  @Param y
         *  @Param height
         *  @Param type
         *  @Param direction
         *  @Param tall
         */
        private static void removeClippingForVariableObject(int x, int y, int height, int type, int direction,
                                                            boolean tall, PrivateArea privateArea) {
            if (type == 0) {
                if (direction == 0) {
                    removeClipping(x, y, height, 128, privateArea);
                    removeClipping(x - 1, y, height, 8, privateArea);
                } else if (direction == 1) {
                    removeClipping(x, y, height, 2, privateArea);
                    removeClipping(x, y + 1, height, 32, privateArea);
                } else if (direction == 2) {
                    removeClipping(x, y, height, 8, privateArea);
                    removeClipping(x + 1, y, height, 128, privateArea);
                } else if (direction == 3) {
                    removeClipping(x, y, height, 32, privateArea);
                    removeClipping(x, y - 1, height, 2, privateArea);
                }
            } else if (type == 1 || type == 3) {
                if (direction == 0) {
                    removeClipping(x, y, height, 1, privateArea);
                    removeClipping(x - 1, y, height, 16, privateArea);
                } else if (direction == 1) {
                    removeClipping(x, y, height, 4, privateArea);
                    removeClipping(x + 1, y + 1, height, 64, privateArea);
                } else if (direction == 2) {
                    removeClipping(x, y, height, 16, privateArea);
                    removeClipping(x + 1, y - 1, height, 1, privateArea);
                } else if (direction == 3) {
                    removeClipping(x, y, height, 64, privateArea);
                    removeClipping(x - 1, y - 1, height, 4, privateArea);
                }
            } else if (type == 2) {
                if (direction == 0) {
                    removeClipping(x, y, height, 130, privateArea);
                    removeClipping(x - 1, y, height, 8, privateArea);
                    removeClipping(x, y + 1, height, 32, privateArea);
                } else if (direction == 1) {
                    removeClipping(x, y, height, 10, privateArea);
                    removeClipping(x, y + 1, height, 32, privateArea);
                    removeClipping(x + 1, y, height, 128, privateArea);
                } else if (direction == 2) {
                    removeClipping(x, y, height, 40, privateArea);
                    removeClipping(x + 1, y, height, 128, privateArea);
                    removeClipping(x, y - 1, height, 2, privateArea);
                } else if (direction == 3) {
                    removeClipping(x, y, height, 160, privateArea);
                    removeClipping(x, y - 1, height, 2, privateArea);
                    removeClipping(x - 1, y, height, 8, privateArea);
                }
            }
            if (tall) {
                // If an object is tall, it blocks projectiles too
                if (type == 0) {
                    if (direction == 0) {
                        removeClipping(x, y, height, 65536, privateArea);
                        removeClipping(x - 1, y, height, 4096, privateArea);
                    } else if (direction == 1) {
                        removeClipping(x, y, height, 1024, privateArea);
                        removeClipping(x, y + 1, height, 16384, privateArea);
                    } else if (direction == 2) {
                        removeClipping(x, y, height, 4096, privateArea);
                        removeClipping(x + 1, y, height, 65536, privateArea);
                    } else if (direction == 3) {
                        removeClipping(x, y, height, 16384, privateArea);
                        removeClipping(x, y - 1, height, 1024, privateArea);
                    }
                }
                if (type == 1 || type == 3) {
                    if (direction == 0) {
                        removeClipping(x, y, height, 512, privateArea);
                        removeClipping(x - 1, y + 1, height, 8192, privateArea);
                    } else if (direction == 1) {
                        removeClipping(x, y, height, 2048, privateArea);
                        removeClipping(x + 1, y + 1, height, 32768, privateArea);
                    } else if (direction == 2) {
                        removeClipping(x, y, height, 8192, privateArea);
                        removeClipping(x + 1, y + 1, height, 512, privateArea);
                    } else if (direction == 3) {
                        removeClipping(x, y, height, 32768, privateArea);
                        removeClipping(x - 1, y - 1, height, 2048, privateArea);
                    }
                } else if (type == 2) {
                    if (direction == 0) {
                        removeClipping(x, y, height, 66560, privateArea);
                        removeClipping(x - 1, y, height, 4096, privateArea);
                        removeClipping(x, y + 1, height, 16384, privateArea);
                    } else if (direction == 1) {
                        removeClipping(x, y, height, 5120, privateArea);
                        removeClipping(x, y + 1, height, 16384, privateArea);
                        removeClipping(x + 1, y, height, 65536, privateArea);
                    } else if (direction == 2) {
                        removeClipping(x, y, height, 20480, privateArea);
                        removeClipping(x + 1, y, height, 65536, privateArea);
                        removeClipping(x, y - 1, height, 1024, privateArea);
                    } else if (direction == 3) {
                        removeClipping(x, y, height, 81920, privateArea);
                        removeClipping(x, y - 1, height, 1024, privateArea);
                        removeClipping(x - 1, y, height, 4096, privateArea);
                    }
                }
            }
        }
    Then, in Region.java, find the method:

    Code:
    public void removeClip(int x, int y, int height, int shift) {
    Change this line (at the bottom of the method):

    Code:
    clips[height][x - regionAbsX][y - regionAbsY] = /* 16777215 - shift */0;
    To:

    Code:
    clips[height][x - regionAbsX][y - regionAbsY] &= ~shift;
    Yes this code is ugly but I don't have time to re-write it right now.


    Entire fix (includes fix for Solid objects and floors too, persistence of deleted objects) is here: Removing clipping for deleted objects and keeping them deleted by tobywisener Pull Request #157 RSPSApp/elvarg-rsps GitHub

    Open source Elvarg Fork: (GitHub - RSPSApp/elvarg-rsps)
    Feel free to fork it and use it as your base, you can continue to get core improvements, bug fixes etc as we find and fix them
    (we've already fixed a years worth of stuff and added some really cool features like intelligent PK bots)

    Thanks!
    Last edited by Tobias_; 01-05-2023 at 10:45 PM.
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    .supersyn

    myK-'s Avatar
    Join Date
    Aug 2008
    Posts
    1,781
    Thanks given
    22
    Thanks received
    40
    Rep Power
    399
    LFG DAWG!

    Tobias has been puttin' in that work!
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Jan 2022
    Posts
    49
    Thanks given
    1
    Thanks received
    10
    Rep Power
    11
    Quote Originally Posted by myK- View Post
    LFG DAWG!

    Tobias has been puttin' in that work!
    Been no lifing it on this elvarg crap a good few months now

    Thanks, appreciate your support!
    Reply With Quote  
     

  5. #4  
    Throne Scape - Founder/Developer
    Mokhtar's Avatar
    Join Date
    Mar 2018
    Posts
    803
    Thanks given
    43
    Thanks received
    171
    Rep Power
    299
    thanks
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 11
    Last Post: 11-19-2020, 01:55 PM
  2. [317] New to Coding (asking for tips and tricks to learn)
    By The OutCast in forum Help
    Replies: 6
    Last Post: 10-18-2018, 04:54 PM
  3. Replies: 5
    Last Post: 05-06-2015, 04:46 PM
  4. Replies: 3
    Last Post: 12-03-2010, 06:49 AM
  5. checking for walls or objects
    By Pikker in forum Help
    Replies: 16
    Last Post: 11-18-2009, 12:28 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •