Example #1
0
        public Model getHeadModel()
        {
            if (childrenIDs != null)
            {
                EntityDefinition definition = getChildDefinition();
                if (definition == null)
                {
                    return(null);
                }
                else
                {
                    return(definition.getHeadModel());
                }
            }

            if (headModelIds == null)
            {
                return(null);
            }
            bool someModelsNotCached = false;

            for (int i = 0; i < headModelIds.Length; i++)
            {
                if (!Model.isCached(headModelIds[i]))
                {
                    someModelsNotCached = true;
                }
            }

            if (someModelsNotCached)
            {
                return(null);
            }
            Model[] headModels = new Model[headModelIds.Length];
            for (int j = 0; j < headModelIds.Length; j++)
            {
                headModels[j] = Model.getModel(headModelIds[j]);
            }

            Model headModel;

            if (headModels.Length == 1)
            {
                headModel = headModels[0];
            }
            else
            {
                headModel = new Model(headModels.Length, headModels);
            }
            if (modifiedModelColours != null)
            {
                for (int c = 0; c < modifiedModelColours.Length; c++)
                {
                    headModel.recolour(modifiedModelColours[c], originalModelColours[c]);
                }
            }

            return(headModel);
        }
Example #2
0
        public static EntityDefinition getDefinition(int id)
        {
            for (int c = 0; c < 20; c++)
            {
                if (EntityDefinition.cache[c].id == id)
                {
                    return(EntityDefinition.cache[c]);
                }
            }

            EntityDefinition.bufferIndex = (EntityDefinition.bufferIndex + 1) % 20;
            EntityDefinition definition = EntityDefinition.cache[EntityDefinition.bufferIndex] = new EntityDefinition();

            EntityDefinition.stream.position = EntityDefinition.streamOffsets[id];
            definition.id = id;
            definition.loadDefinition(EntityDefinition.stream);
            return(definition);
        }
Example #3
0
        public Model getChildModel(int frameId2, int frameId1, int[] framesFrom2)
        {
            if (childrenIDs != null)
            {
                EntityDefinition childDefinition = getChildDefinition();
                if (childDefinition == null)
                {
                    return(null);
                }
                else
                {
                    return(childDefinition.getChildModel(frameId2, frameId1, framesFrom2));
                }
            }

            Model model = (Model)modelCache.get(id);

            if (model == null)
            {
                bool notCached = false;
                for (int m = 0; m < modelIds.Length; m++)
                {
                    if (!Model.isCached(modelIds[m]))
                    {
                        notCached = true;
                    }
                }

                if (notCached)
                {
                    return(null);
                }
                Model[] childModels = new Model[modelIds.Length];
                for (int m = 0; m < modelIds.Length; m++)
                {
                    childModels[m] = Model.getModel(modelIds[m]);
                }

                if (childModels.Length == 1)
                {
                    model = childModels[0];
                }
                else
                {
                    model = new Model(childModels.Length, childModels);
                }
                if (modifiedModelColours != null)
                {
                    for (int c = 0; c < modifiedModelColours.Length; c++)
                    {
                        model.recolour(modifiedModelColours[c], originalModelColours[c]);
                    }
                }

                model.createBones();
                model.applyLighting(64 + brightness, 850 + contrast, -30, -50, -30, true);
                modelCache.put(model, id);
            }

            Model childModel = Model.aModel_1621;

            childModel.replaceWithModel(model, Animation.isNullFrame(frameId1) & Animation.isNullFrame(frameId2));
            if (frameId1 != -1 && frameId2 != -1)
            {
                childModel.mixAnimationFrames(framesFrom2, frameId2, frameId1);
            }
            else if (frameId1 != -1)
            {
                childModel.applyTransformation(frameId1);
            }
            if (scaleXY != 128 || scaleZ != 128)
            {
                childModel.scaleT(scaleXY, scaleXY, scaleZ);
            }
            childModel.calculateDiagonals();
            childModel.triangleSkin = null;
            childModel.vertexSkin   = null;
            if (boundaryDimension == 1)
            {
                childModel.singleTile = true;
            }
            return(childModel);
        }
        public async Task StartupCoroutine()
        {
            if (!wasClientStartupCalled)
            {
                wasClientStartupCalled = true;
            }
            else
            {
                throw new InvalidOperationException($"Failed. Cannot call startup on Client multiple times.");
            }

            drawLoadingText(20, "Starting up");

            if (clientRunning)
            {
                rsAlreadyLoaded = true;
                return;
            }

            clientRunning = true;
            bool   validHost = true;
            String s         = getDocumentBaseHost();

            if (s.EndsWith("jagex.com"))
            {
                validHost = true;
            }
            if (s.EndsWith("runescape.com"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.2"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.229"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.228"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.227"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.226"))
            {
                validHost = true;
            }
            if (s.EndsWith("127.0.0.1"))
            {
                validHost = true;
            }
            if (!validHost)
            {
                genericLoadingError = true;
                return;
            }

            if (signlink.cache_dat != null)
            {
                for (int i = 0; i < 5; i++)
                {
                    caches[i] = new FileCache(signlink.cache_dat, signlink.cache_idx[i], i + 1);
                }
            }

            connectServer();
            archiveTitle = requestArchive(1, "title screen", "title", expectedCRCs[1], 25);
            fontSmall    = new GameFont("p11_full", archiveTitle, false);
            fontPlain    = new GameFont("p12_full", archiveTitle, false);
            fontBold     = new GameFont("b12_full", archiveTitle, false);
            drawLogo();
            loadTitleScreen();
            Archive archiveConfig   = requestArchive(2, "config", "config", expectedCRCs[2], 30);
            Archive archiveTextures = requestArchive(6, "textures", "textures", expectedCRCs[6], 45);
            //Archive archiveWord = requestArchive(7, "chat system", "wordenc", expectedCRCs[7], 50);
            Archive archiveSounds = requestArchive(8, "sound effects", "sounds", expectedCRCs[8], 55);

            tileFlags       = new byte[4, 104, 104];
            intGroundArray  = CollectionUtilities.Create3DJaggedArray <int>(4, 105, 105);
            worldController = new WorldController(intGroundArray);
            for (int z = 0; z < 4; z++)
            {
                currentCollisionMap[z] = new CollisionMap();
            }

            minimapImage = new Sprite(512, 512);
            Archive archiveVersions = requestArchive(5, "update list", "versionlist", expectedCRCs[5], 60);

            drawLoadingText(60, "Connecting to update server");
            StartOnDemandFetcher(archiveVersions);
            Animation.init(onDemandFetcher.getAnimCount());
            Model.init(onDemandFetcher.fileCount(0), onDemandFetcher);

            songChanging = true;
            onDemandFetcher.request(2, nextSong);
            while (onDemandFetcher.immediateRequestCount() > 0)
            {
                processOnDemandQueue(false);

                await TaskDelayFactory.Create(1);

                if (onDemandFetcher.failedRequests > 3)
                {
                    loadError();
                    return;
                }
            }

            drawLoadingText(65, "Requesting animations");
            int fileRequestCount = onDemandFetcher.fileCount(1);

            for (int id = 0; id < fileRequestCount; id++)
            {
                onDemandFetcher.request(1, id);
            }

            if (!await ProcessAnimationsAsync(fileRequestCount))
            {
                return;
            }

            drawLoadingText(70, "Requesting models");
            fileRequestCount = onDemandFetcher.fileCount(0);
            for (int id = 0; id < fileRequestCount; id++)
            {
                int modelId = onDemandFetcher.getModelId(id);
                if ((modelId & 1) != 0)
                {
                    onDemandFetcher.request(0, id);
                }
            }

            fileRequestCount = onDemandFetcher.immediateRequestCount();
            while (onDemandFetcher.immediateRequestCount() > 0)
            {
                int remaining = fileRequestCount - onDemandFetcher.immediateRequestCount();
                if (remaining > 0)
                {
                    drawLoadingText(70, "Loading models - " + (remaining * 100) / fileRequestCount + "%");
                }
                processOnDemandQueue();

                await TaskDelayFactory.Create(1);
            }

            if (caches[0] != null)
            {
                drawLoadingText(75, "Requesting maps");
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 47, 48));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 47, 48));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 48, 48));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 48, 48));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 49, 48));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 49, 48));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 47, 47));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 47, 47));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 48, 47));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 48, 47));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 48, 148));
                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 48, 148));
                fileRequestCount = onDemandFetcher.immediateRequestCount();
                while (onDemandFetcher.immediateRequestCount() > 0)
                {
                    int remaining = fileRequestCount - onDemandFetcher.immediateRequestCount();
                    if (remaining > 0)
                    {
                        drawLoadingText(75, "Loading maps - " + (remaining * 100) / fileRequestCount + "%");
                    }
                    processOnDemandQueue(false);

                    await TaskDelayFactory.Create(1);
                }
            }

            fileRequestCount = onDemandFetcher.fileCount(0);
            for (int id = 0; id < fileRequestCount; id++)
            {
                int  modelId  = onDemandFetcher.getModelId(id);
                byte priority = 0;
                if ((modelId & 8) != 0)
                {
                    priority = 10;
                }
                else if ((modelId & 0x20) != 0)
                {
                    priority = 9;
                }
                else if ((modelId & 0x10) != 0)
                {
                    priority = 8;
                }
                else if ((modelId & 0x40) != 0)
                {
                    priority = 7;
                }
                else if ((modelId & 0x80) != 0)
                {
                    priority = 6;
                }
                else if ((modelId & 2) != 0)
                {
                    priority = 5;
                }
                else if ((modelId & 4) != 0)
                {
                    priority = 4;
                }
                if ((modelId & 1) != 0)
                {
                    priority = 3;
                }
                if (priority != 0)
                {
                    onDemandFetcher.setPriority(priority, 0, id);
                }
            }

            //Don't need to even preload.
            await((WebGLOnDemandFetcher)onDemandFetcher).preloadRegionsAsync(membersWorld);

            //Remove low memory check.
            int count = onDemandFetcher.fileCount(2);

            for (int id = 1; id < count; id++)
            {
                if (onDemandFetcher.midiIdEqualsOne(id))
                {
                    onDemandFetcher.setPriority((byte)1, 2, id);
                }
            }

            //We don't unpack media here on WebGL because it
            //causes memory problems.

            drawLoadingText(83, "Unpacking textures");
            Rasterizer.unpackTextures(archiveTextures);
            Rasterizer.calculatePalette(0.80000000000000004D);
            Rasterizer.resetTextures();
            drawLoadingText(86, "Unpacking config");
            AnimationSequence.unpackConfig(archiveConfig);
            GameObjectDefinition.load(archiveConfig);
            FloorDefinition.load(archiveConfig);
            ItemDefinition.load(archiveConfig);
            EntityDefinition.load(archiveConfig);
            IdentityKit.load(archiveConfig);
            SpotAnimation.load(archiveConfig);
            Varp.load(archiveConfig);
            VarBit.load(archiveConfig);
            ItemDefinition.membersWorld = membersWorld;

            //Removed low memory check
            drawLoadingText(90, "Unpacking sounds");

            //Sound loading disabled in WebGL.
            byte[] soundData = archiveSounds.decompressFile("sounds.dat");
            Effect.load(new Default317Buffer(soundData));
        }
Example #5
0
        public void updatePlayerAppearance(Default317Buffer stream)
        {
            stream.position = 0;
            gender          = stream.getUnsignedByte();
            headIcon        = stream.getUnsignedByte();
            npcAppearance   = null;
            this.team       = 0;
            for (int slot = 0; slot < 12; slot++)
            {
                int itemId1 = stream.getUnsignedByte();
                if (itemId1 == 0)
                {
                    appearance[slot] = 0;
                    continue;
                }

                int itemId2 = stream.getUnsignedByte();
                appearance[slot] = (itemId1 << 8) + itemId2;
                if (slot == 0 && appearance[0] == 65535)
                {
                    npcAppearance = EntityDefinition.getDefinition(stream.getUnsignedLEShort());
                    break;
                }

                if (appearance[slot] >= 512 && appearance[slot] - 512 < ItemDefinition.itemCount)
                {
                    int team = ItemDefinition.getDefinition(appearance[slot] - 512).teamId;
                    if (team != 0)
                    {
                        this.team = team;
                    }
                }
            }

            for (int bodyPart = 0; bodyPart < 5; bodyPart++)
            {
                int colour = stream.getUnsignedByte();
                if (colour < 0 || colour >= ConstantData.GetAppearanceColorRowLength(bodyPart))
                {
                    colour = 0;
                }
                bodyPartColour[bodyPart] = colour;
            }

            base.standAnimationId = stream.getUnsignedLEShort();
            if (base.standAnimationId == 65535)
            {
                base.standAnimationId = -1;
            }
            base.standTurnAnimationId = stream.getUnsignedLEShort();
            if (base.standTurnAnimationId == 65535)
            {
                base.standTurnAnimationId = -1;
            }
            base.walkAnimationId = stream.getUnsignedLEShort();
            if (base.walkAnimationId == 65535)
            {
                base.walkAnimationId = -1;
            }
            base.turnAboutAnimationId = stream.getUnsignedLEShort();
            if (base.turnAboutAnimationId == 65535)
            {
                base.turnAboutAnimationId = -1;
            }
            base.turnRightAnimationId = stream.getUnsignedLEShort();
            if (base.turnRightAnimationId == 65535)
            {
                base.turnRightAnimationId = -1;
            }
            base.turnLeftAnimationId = stream.getUnsignedLEShort();
            if (base.turnLeftAnimationId == 65535)
            {
                base.turnLeftAnimationId = -1;
            }
            base.runAnimationId = stream.getUnsignedLEShort();
            if (base.runAnimationId == 65535)
            {
                base.runAnimationId = -1;
            }
            name             = TextClass.formatName(TextClass.longToName(stream.getLong()));
            combatLevel      = stream.getUnsignedByte();
            skill            = stream.getUnsignedLEShort();
            visible          = true;
            appearanceOffset = 0L;
            for (int slot = 0; slot < 12; slot++)
            {
                appearanceOffset <<= 4;
                if (appearance[slot] >= 256)
                {
                    appearanceOffset += appearance[slot] - 256;
                }
            }

            if (appearance[0] >= 256)
            {
                appearanceOffset += appearance[0] - 256 >> 4;
            }
            if (appearance[1] >= 256)
            {
                appearanceOffset += appearance[1] - 256 >> 8;
            }
            for (int bodyPart = 0; bodyPart < 5; bodyPart++)
            {
                appearanceOffset <<= 3;
                appearanceOffset  += bodyPartColour[bodyPart];
            }

            appearanceOffset <<= 1;
            appearanceOffset  += gender;
        }
        public IEnumerator StartupCoroutine()
        {
            if (!wasClientStartupCalled)
            {
                wasClientStartupCalled = true;
            }
            else
            {
                throw new InvalidOperationException($"Failed. Cannot call startup on Client multiple times.");
            }

            drawLoadingText(20, "Starting up");

            if (clientRunning)
            {
                rsAlreadyLoaded = true;
                yield break;
            }

            clientRunning = true;
            bool   validHost = true;
            String s         = getDocumentBaseHost();

            if (s.EndsWith("jagex.com"))
            {
                validHost = true;
            }
            if (s.EndsWith("runescape.com"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.2"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.229"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.228"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.227"))
            {
                validHost = true;
            }
            if (s.EndsWith("192.168.1.226"))
            {
                validHost = true;
            }
            if (s.EndsWith("127.0.0.1"))
            {
                validHost = true;
            }
            if (!validHost)
            {
                genericLoadingError = true;
                yield break;
            }

            if (signlink.cache_dat != null)
            {
                for (int i = 0; i < 5; i++)
                {
                    caches[i] = new FileCache(signlink.cache_dat, signlink.cache_idx[i], i + 1);
                }
            }

            connectServer();
            archiveTitle = requestArchive(1, "title screen", "title", expectedCRCs[1], 25);
            fontSmall    = new GameFont("p11_full", archiveTitle, false);
            fontPlain    = new GameFont("p12_full", archiveTitle, false);
            fontBold     = new GameFont("b12_full", archiveTitle, false);
            GameFont fontFancy = new GameFont("q8_full", archiveTitle, true);

            drawLogo();
            loadTitleScreen();
            Archive archiveConfig    = requestArchive(2, "config", "config", expectedCRCs[2], 30);
            Archive archiveInterface = requestArchive(3, "interface", "interface", expectedCRCs[3], 35);
            Archive archiveMedia     = requestArchive(4, "2d graphics", "media", expectedCRCs[4], 40);
            Archive archiveTextures  = requestArchive(6, "textures", "textures", expectedCRCs[6], 45);
            Archive archiveWord      = requestArchive(7, "chat system", "wordenc", expectedCRCs[7], 50);
            Archive archiveSounds    = requestArchive(8, "sound effects", "sounds", expectedCRCs[8], 55);

            tileFlags       = new byte[4, 104, 104];
            intGroundArray  = CollectionUtilities.Create3DJaggedArray <int>(4, 105, 105);
            worldController = new WorldController(intGroundArray);
            for (int z = 0; z < 4; z++)
            {
                currentCollisionMap[z] = new CollisionMap();
            }

            minimapImage = new Sprite(512, 512);
            Archive archiveVersions = requestArchive(5, "update list", "versionlist", expectedCRCs[5], 60);

            drawLoadingText(60, "Connecting to update server");
            StartOnDemandFetcher(archiveVersions);
            Animation.init(onDemandFetcher.getAnimCount());
            Model.init(onDemandFetcher.fileCount(0), onDemandFetcher);

            songChanging = true;
            onDemandFetcher.request(2, nextSong);
            while (onDemandFetcher.immediateRequestCount() > 0)
            {
                processOnDemandQueue();

                yield return(new WaitForSeconds(0.1f));

                if (onDemandFetcher.failedRequests > 3)
                {
                    loadError();
                    yield break;
                }
            }

            drawLoadingText(65, "Requesting animations");
            int fileRequestCount = onDemandFetcher.fileCount(1);

            for (int id = 0; id < fileRequestCount; id++)
            {
                onDemandFetcher.request(1, id);
            }

            while (onDemandFetcher.immediateRequestCount() > 0)
            {
                int remaining = fileRequestCount - onDemandFetcher.immediateRequestCount();
                if (remaining > 0)
                {
                    drawLoadingText(65, "Loading animations - " + (remaining * 100) / fileRequestCount + "%");
                }

                try
                {
                    processOnDemandQueue();
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Failed to process animation demand queue. Reason: {e.Message} \n Stack: {e.StackTrace}");
                    signlink.reporterror($"Failed to process animation demand queue. Reason: {e.Message} \n Stack: {e.StackTrace}");
                    throw;
                }

                yield return(new WaitForSeconds(0.1f));

                if (onDemandFetcher.failedRequests > 3)
                {
                    loadError();
                    yield break;
                }
            }

            drawLoadingText(70, "Requesting models");
            fileRequestCount = onDemandFetcher.fileCount(0);
            for (int id = 0; id < fileRequestCount; id++)
            {
                int modelId = onDemandFetcher.getModelId(id);
                if ((modelId & 1) != 0)
                {
                    onDemandFetcher.request(0, id);
                }
            }

            fileRequestCount = onDemandFetcher.immediateRequestCount();
            while (onDemandFetcher.immediateRequestCount() > 0)
            {
                int remaining = fileRequestCount - onDemandFetcher.immediateRequestCount();
                if (remaining > 0)
                {
                    drawLoadingText(70, "Loading models - " + (remaining * 100) / fileRequestCount + "%");
                }
                processOnDemandQueue();

                yield return(new WaitForSeconds(0.1f));
            }

            GC.Collect();
            if (caches[0] != null)
            {
                drawLoadingText(75, "Requesting maps");
                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 47, 48));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 47, 48));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 48, 48));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 48, 48));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 49, 48));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 49, 48));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 47, 47));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 47, 47));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 48, 47));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 48, 47));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(0, 48, 148));
                yield return(null);

                onDemandFetcher.request(3, onDemandFetcher.getMapId(1, 48, 148));
                yield return(null);

                fileRequestCount = onDemandFetcher.immediateRequestCount();
                while (onDemandFetcher.immediateRequestCount() > 0)
                {
                    int remaining = fileRequestCount - onDemandFetcher.immediateRequestCount();
                    if (remaining > 0)
                    {
                        drawLoadingText(75, "Loading maps - " + (remaining * 100) / fileRequestCount + "%");
                    }
                    processOnDemandQueue();

                    yield return(new WaitForSeconds(0.1f));
                }
            }

            fileRequestCount = onDemandFetcher.fileCount(0);
            for (int id = 0; id < fileRequestCount; id++)
            {
                int  modelId  = onDemandFetcher.getModelId(id);
                byte priority = 0;
                if ((modelId & 8) != 0)
                {
                    priority = 10;
                }
                else if ((modelId & 0x20) != 0)
                {
                    priority = 9;
                }
                else if ((modelId & 0x10) != 0)
                {
                    priority = 8;
                }
                else if ((modelId & 0x40) != 0)
                {
                    priority = 7;
                }
                else if ((modelId & 0x80) != 0)
                {
                    priority = 6;
                }
                else if ((modelId & 2) != 0)
                {
                    priority = 5;
                }
                else if ((modelId & 4) != 0)
                {
                    priority = 4;
                }
                if ((modelId & 1) != 0)
                {
                    priority = 3;
                }
                if (priority != 0)
                {
                    onDemandFetcher.setPriority(priority, 0, id);
                }
            }

            onDemandFetcher.preloadRegions(membersWorld);

            //Remove low memory check.
            int count = onDemandFetcher.fileCount(2);

            for (int id = 1; id < count; id++)
            {
                if (onDemandFetcher.midiIdEqualsOne(id))
                {
                    onDemandFetcher.setPriority((byte)1, 2, id);
                }
            }

            drawLoadingText(80, "Unpacking media");

            //Default cache can cause some errors, so wecan surpress them here.
            try
            {
                InitializeUnpackedMedia(archiveMedia);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Media Error: {e}");
            }

            drawLoadingText(83, "Unpacking textures");
            Rasterizer.unpackTextures(archiveTextures);
            Rasterizer.calculatePalette(0.80000000000000004D);
            Rasterizer.resetTextures();
            drawLoadingText(86, "Unpacking config");
            AnimationSequence.unpackConfig(archiveConfig);
            GameObjectDefinition.load(archiveConfig);
            FloorDefinition.load(archiveConfig);
            ItemDefinition.load(archiveConfig);
            EntityDefinition.load(archiveConfig);
            IdentityKit.load(archiveConfig);
            SpotAnimation.load(archiveConfig);
            Varp.load(archiveConfig);
            VarBit.load(archiveConfig);
            ItemDefinition.membersWorld = membersWorld;

            //Removed low memory check
            drawLoadingText(90, "Unpacking sounds");
            byte[]           soundData = archiveSounds.decompressFile("sounds.dat");
            Default317Buffer stream    = new Default317Buffer(soundData);

            Effect.load(stream);

            drawLoadingText(95, "Unpacking interfaces");
            GameFont[] fonts = { fontSmall, fontPlain, fontBold, fontFancy };
            RSInterface.unpack(archiveInterface, fonts, archiveMedia);
            drawLoadingText(100, "Preparing game engine");
            for (int _y = 0; _y < 33; _y++)
            {
                int firstXOfLine = 999;
                int lastXOfLine  = 0;
                for (int _x = 0; _x < 34; _x++)
                {
                    if (minimapBackgroundImage.pixels[_x + _y * minimapBackgroundImage.width] == 0)
                    {
                        if (firstXOfLine == 999)
                        {
                            firstXOfLine = _x;
                        }
                        continue;
                    }

                    if (firstXOfLine == 999)
                    {
                        continue;
                    }
                    lastXOfLine = _x;
                    break;
                }

                compassHingeSize[_y] = firstXOfLine;
                compassWidthMap[_y]  = lastXOfLine - firstXOfLine;
            }

            for (int _y = 5; _y < 156; _y++)
            {
                int min = 999;
                int max = 0;
                for (int _x = 25; _x < 172; _x++)
                {
                    if (minimapBackgroundImage.pixels[_x + _y * minimapBackgroundImage.width] == 0 &&
                        (_x > 34 || _y > 34))
                    {
                        if (min == 999)
                        {
                            min = _x;
                        }
                        continue;
                    }

                    if (min == 999)
                    {
                        continue;
                    }
                    max = _x;
                    break;
                }

                minimapLeft[_y - 5]      = min - 25;
                minimapLineWidth[_y - 5] = max - min;
            }

            Rasterizer.setBounds(479, 96);
            chatboxLineOffsets = Rasterizer.lineOffsets;
            Rasterizer.setBounds(190, 261);
            sidebarOffsets = Rasterizer.lineOffsets;
            Rasterizer.setBounds(512, 334);
            viewportOffsets = Rasterizer.lineOffsets;

            int[] ai = new int[9];
            for (int i8 = 0; i8 < 9; i8++)
            {
                int k8 = 128 + i8 * 32 + 15;
                int l8 = 600 + k8 * 3;
                int i9 = Rasterizer.SINE[k8];
                ai[i8] = l8 * i9 >> 16;
            }

            WorldController.setupViewport(500, 800, 512, 334, ai);

            GameObject.clientInstance           = this;
            GameObjectDefinition.clientInstance = this;
            EntityDefinition.clientInstance     = this;

            //TODO: Disabled censor
            //Censor.load(archiveWord);
            mouseDetection = new MouseDetection(this);
            //startRunnable(mouseDetection, 10);
            yield break;
        }