718 RS3 DATA UPGRADE - WEIRD OBJECT POSITIONS

Mar 21, 2016
52
25
50
Sup guys, I was playing with Odin's Bane client which is a 718 that supports things up to 900 (or 905, idk). Basically I was trying to make the client support maps from rev 921.
What I have done already:
- Updated the textures decoder, there was missing opcodes from MaterialRaw class.
- Updated the object definitions.
- Added the LocPositionAdjustment for static objects decoder (took it from: RS910/Client).
- I've not seen any model decoder updates, also, since my problem isn't related to models (as far I know), I think that I'm messing wrong with some positioning stuff.
- I've also packed the indexes 5, 7, 53, 19, 16 (textures from RS3) and from index 2, I've moved the archives group 1, 2, 6, 10

This is what I'm getting:

javaw_c7hGTk44ft.pngjavaw_L5sG1cdoER.pngjavaw_8z5iVnIJ2H.png

This is what I did for static objects, which looks very similar to the 910 client
Java:
public final void decodeStaticObjects(AbstractRenderer renderer, byte[] data, int dx, int dy, CollisionMap[] collisionMaps) {
        try {
            RsByteBuffer buffer = new RsByteBuffer(data);
            int objectId = -1;
            int offset;
            while ((offset = buffer.readSmart()) != 0) {
                objectId += offset;
                int location = 0;
                int positionOffset;

                while ((positionOffset = buffer.readUnsignedSmart(0)) != 0) {
                    location += positionOffset - 1;
                    int localX = (location >> 6 & 0x3F);
                    int localY = (location & 0x3F);
                    int plane = location >> 12;
                    LocPositionAdjustment object = new LocPositionAdjustment(buffer);
                    int type = object.getType();
                    int rotation = object.getRotation();
                    if (localX >= 0 && localX < 64 && localY >= 0) {
                        if (localY >= 64) {
                            continue;
                        }

                        int x = localX + dx;
                        int y = localY + dy;
                        ObjectDefinitions objectDefs = this.objectDefsLoader.getObjectDefinitions(objectId);

                        int sizeX;
                        int sizeY;

                        if ((rotation & 0x1) == 0x0) {
                            sizeX = -1125834887 * objectDefs.sizeX;
                            sizeY = -565161399 * objectDefs.sizeY;
                        } else {
                            sizeX = -565161399 * objectDefs.sizeY;
                            sizeY = -1125834887 * objectDefs.sizeX;
                        }

                        int limX = sizeX + x;
                        int limY = sizeY + y;

                        int mapWidth = -954368823 * width;
                        int mapHeight = 181474463 * length;

                        if (x >= mapWidth || y >= mapHeight || limX <= 0 || limY <= 0 || (type != GameObjectType.T10.getType(0) && GameObjectType.T11.getType(0) != type && (x <= 0 || y <= 0 || x >= mapWidth - 1 || y >= mapHeight - 1))) {
                            continue;
                        }
                        CollisionMap collisionMap = null;
                        if (!this.flatSurface) {
                            int objectPlane = plane;
                            if (x > 0 && y > 0 && (this.groundBytes1.flags[1][x][y] & 0x2) == 0x2) {
                                objectPlane = plane - 1;
                            }

                            if (objectPlane >= 0 && objectPlane < 4) {
                                collisionMap = collisionMaps[objectPlane];
                            }
                        }
                        if (plane < 0 || plane > 3) {
                            continue;
                        }
                        System.out.println("+object (" + objectDefs.name + ") x = " + (x * 64) + ", y = " + (y * 64) + ", plane = " + plane + ", object_id = " + objectId + ", rotation = " + rotation + ", type = " + type + " (game_type = " + GameObjectType.T10.getType(0) + ")");
                        this.addObject(renderer, plane, plane, x, y, objectId, rotation, type, collisionMap, -1, 0);
                    }
                }
            }
        } catch (RuntimeException runtimeexception) {
            throw Class346.method4175(runtimeexception, new StringBuilder().append("aaa.cc(").append(')').toString());
        }
    }
If anyone knows of any tips of any class or something I must have gone unnoticed and being able to help, I would be very grateful! Thanks all help
(I'm looking too much to the client, maybe I'm missing something on server-sided? Idk)
 
This is the binary format of the map locs for 910:

It's also found in the client you linked obv, but this is the simplified version of it.
The problem is a lot of the related stuff for this to work can be different from 910 to 921, this is multiple years worth of changes.
 
This is the binary format of the map locs for 910:

It's also found in the client you linked obv, but this is the simplified version of it.
The problem is a lot of the related stuff for this to work can be different from 910 to 921, this is multiple years worth of changes.

Hi! sorry for taking so long to reply
I did exactly what this method does on client-side & server-side, it still the same as the pictures.
Idk if they changed their model decoder (maybe that can have some influence? Idk). Honestly, Idk what to check anymore, I've compared all "readRegions" or "readLocations" or any similar method and they look the same.


Thank you for help
 

Users who are viewing this thread (total: 1, members: 0, guests: 1)