/// <summary>Converts a planar proportional font character and caches it.</summary>
        /// <param name="index">The index of the pic.</param>
        /// <param name="fontseg">The font pointer.</param>
        /// <returns>The converted pic.</returns>
        public byte[] CachePChar(int index, fontstruct fontseg)
        {
            int offset = fontseg.Get_location(index);
            int byteWidth = (fontseg.Get_width(index) + 7) >> 3;
            int height = fontseg.height;

            byte[] buffer = new byte[byteWidth * height * 2];
            Array.Copy(fontseg.Pointer.Buffer, fontseg.Pointer.BaseIndex + offset, buffer, 0, buffer.Length);

            _pics[index] = buffer;
            return buffer;
        }
Example #2
0
        //==========================================================================

        /*
        ====================
        =
        = SetupGraphics
        =
        ====================
        */
        private void SetupGraphics()
        {
            InitGrFile(); // load the graphic file header

            //
            // go through the pics and make scalable shapes, the discard the pic
            //
            for(int i = MAN1PIC; i < DASHPIC; i++)
            {
                CachePic((short) (STARTPICS + i));

                SC_MakeShape(
                  grsegs[STARTPICS + i],
                  pictable[i].width,
                  pictable[i].height,
                  ref scalesegs[i]);

                MMFreePtr(ref grsegs[STARTPICS + i]);
            }

            //
            // load the basic graphics
            //
            needgr[STARTFONT] = 1;
            needgr[STARTTILE8] = 1;

            for(int i = DASHPIC; i < ENDPIC; i++)
                needgr[STARTPICS + i] = 1;

            CacheGrFile(); // load all graphics now (no caching)

            fontseg = new fontstruct(grsegs[STARTFONT]);
        }