public static void unpackConfig(Archive streamLoader)
        {
            Default317Buffer stream = new Default317Buffer(streamLoader.decompressFile("seq.dat"));
            int length = stream.getUnsignedLEShort();

            if (animations == null)
            {
                animations = new AnimationSequence[length];
            }
            for (int animation = 0; animation < length; animation++)
            {
                if (animations[animation] == null)
                {
                    animations[animation] = new AnimationSequence();
                }
                animations[animation].readValues(stream);
            }
        }
        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));
        }
Exemple #3
0
        private Model getAnimatedModel()
        {
            if (npcAppearance != null)
            {
                int frameId = -1;
                if (base.animation >= 0 && base.animationDelay == 0)
                {
                    frameId = AnimationSequence.animations[base.animation].primaryFrames[base.currentAnimationFrame];
                }
                else if (base.queuedAnimationId >= 0)
                {
                    frameId = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame];
                }
                Model model = npcAppearance.getChildModel(-1, frameId, null);
                return(model);
            }

            long l  = appearanceOffset;
            int  k  = -1;
            int  i1 = -1;
            int  j1 = -1;
            int  k1 = -1;

            if (base.animation >= 0 && base.animationDelay == 0)
            {
                AnimationSequence animation = AnimationSequence.animations[base.animation];
                k = animation.primaryFrames[base.currentAnimationFrame];
                if (base.queuedAnimationId >= 0 && base.queuedAnimationId != base.standAnimationId)
                {
                    i1 = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame];
                }
                if (animation.playerReplacementShield >= 0)
                {
                    j1 = animation.playerReplacementShield;
                    l += j1 - appearance[5] << 40;
                }

                if (animation.playerReplacementWeapon >= 0)
                {
                    k1 = animation.playerReplacementWeapon;
                    l += k1 - appearance[3] << 48;
                }
            }
            else if (base.queuedAnimationId >= 0)
            {
                k = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame];
            }

            Model model_1 = (Model)mruNodes.get(l);

            if (model_1 == null)
            {
                bool flag = false;
                for (int i2 = 0; i2 < 12; i2++)
                {
                    int k2 = appearance[i2];
                    if (k1 >= 0 && i2 == 3)
                    {
                        k2 = k1;
                    }
                    if (j1 >= 0 && i2 == 5)
                    {
                        k2 = j1;
                    }
                    if (k2 >= 256 && k2 < 512 && !IdentityKit.cache[k2 - 256].bodyModelCached())
                    {
                        flag = true;
                    }
                    if (k2 >= 512 && !ItemDefinition.getDefinition(k2 - 512).equipModelCached(gender))
                    {
                        flag = true;
                    }
                }

                if (flag)
                {
                    if (aLong1697 != -1L)
                    {
                        model_1 = (Model)mruNodes.get(aLong1697);
                    }
                    if (model_1 == null)
                    {
                        return(null);
                    }
                }
            }

            if (model_1 == null)
            {
                Model[] models = new Model[12];
                int     j2     = 0;
                for (int l2 = 0; l2 < 12; l2++)
                {
                    int i3 = appearance[l2];
                    if (k1 >= 0 && l2 == 3)
                    {
                        i3 = k1;
                    }
                    if (j1 >= 0 && l2 == 5)
                    {
                        i3 = j1;
                    }
                    if (i3 >= 256 && i3 < 512)
                    {
                        Model model_3 = IdentityKit.cache[i3 - 256].getBodyModel();
                        if (model_3 != null)
                        {
                            models[j2++] = model_3;
                        }
                    }

                    if (i3 >= 512)
                    {
                        Model model_4 = ItemDefinition.getDefinition(i3 - 512).getEquippedModel(gender);
                        if (model_4 != null)
                        {
                            models[j2++] = model_4;
                        }
                    }
                }

                model_1 = new Model(j2, models);
                for (int part = 0; part < 5; part++)
                {
                    if (bodyPartColour[part] != 0)
                    {
                        model_1.recolour(ConstantData.GetAppearanceColor(part, 0),
                                         ConstantData.GetAppearanceColor(part, bodyPartColour[part]));
                        if (part == 1)
                        {
                            model_1.recolour(ConstantData.GetBeardColor(0), ConstantData.GetBeardColor(bodyPartColour[part]));
                        }
                    }
                }

                model_1.createBones();
                model_1.applyLighting(64, 850, -30, -50, -30, true);
                mruNodes.put(model_1, l);
                aLong1697 = l;
            }

            if (preventRotation)
            {
                return(model_1);
            }
            Model model_2 = Model.aModel_1621;

            model_2.replaceWithModel(model_1, Animation.isNullFrame(k) & Animation.isNullFrame(i1));
            if (k != -1 && i1 != -1)
            {
                model_2.mixAnimationFrames(AnimationSequence.animations[base.animation].flowControl, i1, k);
            }
            else if (k != -1)
            {
                model_2.applyTransformation(k);
            }
            model_2.calculateDiagonals();
            model_2.triangleSkin = null;
            model_2.vertexSkin   = null;
            return(model_2);
        }
        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;
        }