:: New Mir3 Source discussion Thread ::

smoochy boys on tour

Omikkk

Dedicated Member
Dedicated Member
Jul 20, 2006
232
10
65
Poland
i didn't want to create a new topic, so i'm asking here. would it be hard to change m2server.exe into eiserver.exe? eiserver is based on m2server
Code:
// <PACKAGEINFO>

Producer: Pascal; Type: EXE; Flags: never build, perform normal dup unit check

Data   Unit Name                         Flags
-----  --------------------------------  --------------------------------
5B01h  _Server_JOB_ItemGen               main unit
CD10h  NMUDP                             implicitly imported
C700h  System                            
8100h  SysInit                           
A91Ch  WinSock                           $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
4B1Ch  Windows                           $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
5E10h  Classes                           implicitly imported
C710h  Consts                            implicitly imported
5110h  TypInfo                           implicitly imported
0210h  SysUtils                          implicitly imported
9D10h  SysConst                          implicitly imported
7310h  ActiveX                           implicitly imported
331Ch  Messages                          $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
B300h  Forms                             
1610h  Math                              implicitly imported
B010h  Printers                          implicitly imported
571Ch  WinSpool                          $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
2B10h  Graphics                          implicitly imported
141Ch  Commctrl                          $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
8F10h  FlatSB                            implicitly imported
DF10h  StdActns                          implicitly imported
B810h  Clipbrd                           implicitly imported
2610h  Controls                          implicitly imported
A510h  MultiMon                          implicitly imported
7610h  Menus                             implicitly imported
8710h  Contnrs                           implicitly imported
CD10h  ImgList                           implicitly imported
4510h  ActnList                          implicitly imported
C11Ch  Imm                               $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
6410h  StdCtrls                          implicitly imported
A110h  Spin                              implicitly imported
9110h  ExtCtrls                          implicitly imported
C210h  Buttons                           implicitly imported
471Ch  MMSystem                          $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
3510h  ADODB                             implicitly imported
6110h  DBCommon                          implicitly imported
7710h  DbConsts                          implicitly imported
B010h  Db                                implicitly imported
A310h  Mask                              implicitly imported
4610h  ComObj                            implicitly imported
7110h  ComConst                          implicitly imported
6E10h  DBLogDlg                          implicitly imported
C110h  Mtx                               implicitly imported
0D10h  OleCtrls                          implicitly imported
1010h  OleConst                          implicitly imported
C110h  AxCtrls                           implicitly imported
EC10h  StdVCL                            implicitly imported
B210h  ADOConst                          implicitly imported
9310h  OLEDB                             implicitly imported
5510h  ADOInt                            implicitly imported
1710h  DBTables                          implicitly imported
B110h  DBPWDlg                           implicitly imported
C310h  BdeConst                          implicitly imported
9610h  Bde                               implicitly imported
B810h  SMIntf                            implicitly imported
DD10h  IniFiles                          implicitly imported
F310h  FileCtrl                          implicitly imported
A010h  Dialogs                           implicitly imported
491Ch  Dlgs                              $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
331Ch  CommDlg                           $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
281Ch  ShlObj                            $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
2A1Ch  ShellAPI                          $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
BB1Ch  RegStr                            $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
3F1Ch  WinInet                           $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
EF1Ch  UrlMon                            $WEAKPACKAGEUNIT unit, original containment of $WEAKPACKAGEUNIT, implicitly imported
A010h  HUtil32                           implicitly imported
2E10h  ScktComp                          implicitly imported
0510h  SyncObjs                          implicitly imported
C900h  ObjConsts                         
6900h  ObjCustom                         
DF00h  svMain2                           
5600h  SrvSetup                          
AE00h  IdSrvClient                       
A200h  UsrEngn                           
FA00h  NoticeM                           
0D00h  Grobal3                           
DA00h  ObjBase2                          
A900h  SQLEngn                           
A500h  DBSql                             
DA00h  itmunit                           
FF00h  mudutil                           
5700h  LocalDB                           
4000h  CastleMan                         
FD00h  ObjNpc                            
3F00h  ObjMon2                           
4800h  Guild                             
3100h  M2Share                           
6100h  MfdbDef                           
D000h  Envir                             
AA00h  Event                             
AE00h  EDcode                            
6F00h  ObjMon                            
0F00h  Magic                             
D200h  RunSock                           
1C00h  FrnEngn                           
6200h  RunDB                             
AF00h  ObjMMon                           
C900h  InstantMaps                       
FA00h  ch_Monsterfile                    
EF00h  ch_Magicfile                      
B200h  ch_StditemFile                    
B700h  InterMsgClient                    
4B00h  InterServerMsg                    
2300h  Mission                           
1E00h  ObjGuard                          
EC00h  ObjAxeMon                         
5100h  ch_SetupFile                      
F500h  FSrvValue                         
5C00h  ObjRacer                          
0700h  HorseRace

it would be enough to have a working ei3.0 eiserver, then we could make it to job, i don't know.
 

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,399
33
195
Germany
You need a clean and never packed EI exe to do it. all other is crap...
If you use a Unpacked (before packed) you get more problems and it is unstable.
 

Nightwolf

Developer
VIP
Jul 16, 2003
2,133
21
285
Manchester, UK
one thing i do know is wemade use the same login server for mir2 and mir3 which we have within the phil set of mir2 files as for the main server exe i'm sure it is possible to edit the philis m2server code for mir3 as there are references for EI in there.
 

ElAmO

Ethernity Developer
Developer
Feb 27, 2006
370
562
185
Mallorca, Spain
What if we develop only server side?
Got long to decrypt the packets being sent by the client to the server and encrypt the response to redirect the client.
I just made that part of LoginServer and character selection.

It is a big job but to create a complete emulator for the mir could benefit.
 

DjDarkBoyZ

Dev
Golden Oldie
Aug 11, 2006
1,065
228
260
127.Ø.Ø.1
What if we develop only server side?
Got long to decrypt the packets being sent by the client to the server and encrypt the response to redirect the client.
I just made that part of LoginServer and character selection.

It is a big job but to create a complete emulator for the mir could benefit.

The problem of this is the Client limitations, bugs, cheats...

The Mir3 Comunity need to make a new server/client files in open source, like mir2 comunity.

Time ago Coly created this Thread to talk about it, about the programing language, etc, but the problem of allways... Nothing...

I started a mir3 project now, the client side only atm, reads wil/wix, its coded in VB.Net and is using SlimDX lib making the programing task very easy and the render performance its better than Managed DX.

I have my own wil viewer and map viewer.

I can help if people decides to start a big project, i know C# if helps.
I think the Client can be created in 6 months perfectly by 3 or more persons in a team using SVN or something like this, order and assign tasks.

I think Mir3 comunity can be better, need to open the sources and knowleadge.

I am willing to collaborate, someone else? or want to see the same thing every day?

Have a nice day. ;)
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
There's two different Cell struct:

:: Delphi Code ::
:: (Map Header) ::


Code:
  // Map Header
  PMapFileHeader = ^TMapFileHeader;
  TMapFileHeader = packed record
    mfhDesc            : array [0..19] of Char;
    mfhAttr            : Word;
    mfhWidth           : Word;
    mfhHeight          : Word;
    mfhEventFileIdx    : Byte;
    mfhFogColor        : Byte;
  end;

  // Tile Record
  PTileInfo = ^TTileInfo;
  TTileInfo = packed record
    tiFileIdx          : Byte;
    tiImageIdx         : Word;
  end;

  // Cell Record
  PCellInfo = ^TCellInfo;
  TCellInfo = packed record
    ciBarrier          : Byte;  // Baiere  
    ciFrontAnimation   : Byte;  // Animation 
    ciBackAnimation    : Byte;  // Animation 
    ciTopFile          : Byte;  // Top Object 
    ciBotFile          : Byte;  // Bottom Object 
    ciBotImg           : Word;  // Bottom Image
    ciTopImg           : Word;  // Top Image
    ciAniFrame         : Byte;
    ciAniTick          : Byte;
    ciAniCurrTick      : Word;
    ciLigth            : Byte;  // Licht  
  end;

http://www.lomcn.co.uk/forum/showthread.php?67450-Mir-2-and-Mir-3-Map-Structure-Etc

With Mir3 I know Old Ligth and New Ligth System. The New Maps from Wemade use diff. System.
Animation is a Byte only.

#region Fields
public byte Flag;
public byte ObjAni1; <-- The Animation Info
public byte ObjAni2;
public ushort FileIndex;
public ushort Obj1;
public ushort Obj2;
public ushort DoorIdx;
public byte DoorOffset;
public ushort Light;
#endregion

the ID mean the Animation Time Region. A Array of 255 Fields thats hold a Record / Enum with Time and Animation Count.
like this :

1 = Tree 1 ( Time 200 ) 4 Image Animation
2 = Tree 2 ( Time 190 ) 6 Image Animation
etc.

So with one is correct?
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
aren't they for different languages? first one is delphi, second looks like c#
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
B = byte

In first we have:
1B,1B,1B,1B,1B,2B,2B,1B,1B,2B,1B
In second:
1B,1B,1B,2B,2B,2B,2B,1B,2B

So in C# code we have 2 less fields and different length (fe Light).
 

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,399
33
195
Germany
both ar 14 byte ;-) ...

the different is thats DjDarkBoyZ is using bit shifting and I not. (so my way is faster)

public ushort FileIndex; <-- this is not ushort normal
ciTopFile : Byte; // Top Object
ciBotFile : Byte; // Bottom Object

if this correct or not, I can't say it.
ciAniFrame : Byte;
ciAniTick : Byte;
ciAniCurrTick : Word;


the way you use of the end is your joys... ;-)



Amm one thing I have write wrong :

Not Correct :
ciFrontAnimation : Byte; // Animation
ciBackAnimation : Byte; // Animation

Correct :
ciBackAnimation : Byte; // Animation
ciFrontAnimation : Byte; // Animation
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
One simple question - whats the difference between C1 and C2 color in wil files?
Ive used same code for both and it seems to work fine
 

Jamie

LOMCN Developer
Developer
Mar 29, 2003
4,797
299
370
United Kingdom
One simple question - whats the difference between C1 and C2 color in wil files?
Ive used same code for both and it seems to work fine

I guess I can share this information,

C1 = normal image.
C2 = Parts of the image that can coloured.
 

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,399
33
195
Germany
C0 : Black (if you have a Black background allready then you can ignor it and speed up your Code)
C1 : Alpha Channel FF (255 - No Alpha)
C2 : Alpha Channel 7F (127 - 50% Alpha)

;-)

Here my very old and a bit little bad code in Delphi...

Code:
        function ByteSwapColor(Color:Integer):Integer; register;
        asm
          BSWAP EAX
          SHR  EAX,8
        end;



            for Y:=0 to FHeaderImage.imgHeight-1 do
            begin
              FAlpha := FImage.AlphaScanline[Y];
              PIncX^ := 0;  X := 0; PCount^ := 0;
              CopyMemory(PCount, PInteger(Integer(FWIL)+ PosCount), sizeOf(Word));
              Inc(PosCount, 2);
              while X < PCount^ do
              begin
                Inc(X);
                case PByte(Integer(FWIL)+ PosCount)^ of
                  192: begin
                         Inc(PosCount, 2); Inc(x); FHelp := 0; PColorCount^ := 0;
                         CopyMemory(PColorCount, PInteger(Integer(FWIL)+ PosCount), 2);
                         while FHelp < PColorCount^ do
                         begin
                           FImage.Pixels[PIncX^, Y] := 0;
                           FAlpha[PIncX^]           := 255;
                           Inc(FHelp); Inc(PIncX^);
                         end;
                         Inc(PosCount, 2);
                       end;//case in
                  193: begin
                         Inc(PosCount, 2); Inc(X); FHelp := 0; PColorCount^ := 0;
                         CopyMemory(PColorCount, PInteger(Integer(FWIL)+ PosCount), 2);
                         Inc(PosCount, 2);
                         while FHelp < PColorCount^ do
                         begin
                           PEncodeRGBA^ := 0;
                           CopyMemory(PEncodeRGBA, PInteger(Integer(FWIL)+ PosCount), 2);
                           PBGR^ := ($FF00 or (Trunc((((PEncodeRGBA^ and 63488) shr 11) * 8.225806) + 0.5))) shl 8;
                           PBGR^ := (PBGR^ or (Trunc((((PEncodeRGBA^ and  2016) shr  5) * 4.047619) + 0.5))) shl 8;
                           PBGR^ := (PBGR^ or (Trunc((((PEncodeRGBA^ and    31) shr  0) * 8.225806) + 0.5)));
                           FPixelInfo               := StrToInt('$'+IntToHex(PBGR^, 8));
                           FImage.Pixels[PIncX^, Y] := ByteSwapColor(FPixelInfo);
                           FAlpha[PIncX^]           := 255;
                           Inc(x); Inc(PosCount, 2); Inc(FHelp); Inc(PIncX^);
                         end;//while
                       end;//case in
                  194: begin
                         Inc(PosCount, 2); Inc(X); FHelp := 0; PColorCount^ := 0;
                         CopyMemory(PColorCount, PInteger(Integer(FWIL)+ PosCount), 2);
                         Inc(PosCount, 2);
                         while FHelp < PColorCount^ do
                         begin
                           PEncodeRGBA^ := 0;
                           CopyMemory(PEncodeRGBA, PInteger(Integer(FWIL)+ PosCount), 2);
                           PBGR^ := ($7F00 or (Trunc((((PEncodeRGBA^ and 63488) shr 11) * 8.225806) + 0.5))) shl 8;
                           PBGR^ := (PBGR^ or (Trunc((((PEncodeRGBA^ and  2016) shr  5) * 4.047619) + 0.5))) shl 8;
                           PBGR^ := (PBGR^ or (Trunc((((PEncodeRGBA^ and    31) shr  0) * 8.225806) + 0.5)));
                           FPixelInfo               := StrToInt('$'+IntToHex(PBGR^, 8));
                           FImage.Pixels[PIncX^, Y] := ByteSwapColor(FPixelInfo);
                           FAlpha[PIncX^]           := FPixelInfo shr 24;
                           Inc(X); Inc(PosCount, 2); Inc(FHelp); Inc(PIncX^);
                         end;//while
                       end;//case in
                  else X := PCount^;
                end;//case
              end;//while
            end;//for

I hope it helps some one...
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
Your welcome, Mind if i ask what your working on?
Atm im gonna make map viever in Xna, but the point is learn C#, Xna maybe other things. Just for fun - maybe i code a bit server and client but i atm i think i cant write my version of mir ^^

@Coly
Thanks:) Atm my code look similar to urs:
Code:
for (int h = 0; h < image.Height; h++)
            {
                Int16 RowSize = BitConverter.ToInt16(ImageData, offset); // total size for this row
                offset += 2;
                x = 0;
                byteOffset = 0;
                while (byteOffset < RowSize)
                {
                    wColor = BitConverter.ToInt16(ImageData, offset);
                    offset += 2;
                    byteOffset++;
                    switch (wColor)
                    {
                        case 0x00C0: //blank
                            wSize = BitConverter.ToInt16(ImageData, offset);
                            offset += 2;
                            byteOffset++;
                            for (int i = 0; i < wSize; i++)
                                if (x < image.Width)
                                {
                                    MirColors[x++ + h * image.Width] = Color.TransparentBlack;
                                }
                            break;

                        case 0x00C1: //normal color
                            wSize = BitConverter.ToInt16(ImageData, offset);
                            offset += 2;
                            byteOffset++;
                            for (int i = 0; i < wSize; i++)
                            {
                                int pixel = BitConverter.ToInt16(ImageData, offset);
                                offset += 2;
                                byteOffset++;
                                byte red = Convert.ToByte(((pixel & 0xF800) >> 11) * 8.225806);
                                byte green = Convert.ToByte(((pixel & 0x7E0) >> 5) * 4.047619);
                                byte blue = Convert.ToByte(((pixel & 0x1F) >> 0) * 8.225806);
                                if (x < image.Width)
                                {
                                    MirColors[x++ + h * image.Width] = new Color(red, green, blue, 255);
                                }
                            }
                            break;

                        case 0x00C2: //alpha
                            wSize = BitConverter.ToInt16(ImageData, offset);
                            offset += 2;
                            byteOffset++;
                            for (int i = 0; i < wSize; i++)
                            {
                                int pixel = BitConverter.ToInt16(ImageData, offset);
                                offset += 2;
                                byteOffset++;
                                byte red = Convert.ToByte(((pixel & 0xF800) >> 11) * 8.225806);
                                byte green = Convert.ToByte(((pixel & 0x7E0) >> 5) * 4.047619);
                                byte blue = Convert.ToByte(((pixel & 0x1F) >> 0) * 8.225806);
                                if (x < image.Width)
                                {
                                    MirColors[x++ + h * image.Width] = new Color(red, green, blue, 127);
                                }
                            }
                            break;
                    }
                }
            }

It seems to work but not tested much:) And i think i need to learn much about optimalization

P.S. Big thanks to u Coly and Kaori for help with this :)
 

Ashran

Golden Oldie
Golden Oldie
Dec 11, 2007
611
9
125
Palma, Mallorca
Hi!

I was doing some tests (yes, I have exams right now, but i'm very lazy :lol), and i checked kaorimim's source and that below posted and began a c++/opengl client (i'm checking what i've learned this year xD)

well, i can load a wil and i convert an image to an opengl tex, but i have no idea of which is the better way to manage wils, players or the game... :S

well, i know that i have to stop doing this... i need to study, but later i'll check it again :P

here's an screen:

hispatest.png

PS: a lot of thanks Kaori, Coly and the other guys (and girls ;))!
 

zhimingcom

Dedicated Member
Dedicated Member
Oct 21, 2011
28
0
27
coly,ive seen ur post about the heaher of map file , tiles ,cellinfo. but can you give us some explaination of how the members will be used? code samples or sth. btw, your map editor is great
 

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,399
33
195
Germany
It dit not made sense for me to post source code.
Most of the member use C# or VB and not Delphi.

What program language you use?


[MENTION=13166]Ashran[/MENTION] you need at first a good Cash Manager thats handle all the files and Images.
Mir3 use for the Map Image file the IDs 0 to 74, this is a good point to handle Map files
in a Array or List... like you prefer...
 
Last edited:

Skunkmeister

LOMCN VIP
VIP
Jul 10, 2007
203
19
105
Atm im gonna make map viever in Xna, but the point is learn C#, Xna maybe other things. Just for fun - maybe i code a bit server and client but i atm i think i cant write my version of mir ^^

[MENTION=7646]Coly[/MENTION]
Thanks:) Atm my code look similar to urs:
Code:
for (int h = 0; h < image.Height; h++)
            {
                Int16 RowSize = BitConverter.ToInt16(ImageData, offset); // total size for this row
                offset += 2;
                x = 0;
                byteOffset = 0;
                while (byteOffset < RowSize)
                {
                    wColor = BitConverter.ToInt16(ImageData, offset);
                    offset += 2;
                    byteOffset++;
                    switch (wColor)
                    {
                        case 0x00C0: //blank
                            wSize = BitConverter.ToInt16(ImageData, offset);
                            offset += 2;
                            byteOffset++;
                            for (int i = 0; i < wSize; i++)
                                if (x < image.Width)
                                {
                                    MirColors[x++ + h * image.Width] = Color.TransparentBlack;
                                }
                            break;

                        case 0x00C1: //normal color
                            wSize = BitConverter.ToInt16(ImageData, offset);
                            offset += 2;
                            byteOffset++;
                            for (int i = 0; i < wSize; i++)
                            {
                                int pixel = BitConverter.ToInt16(ImageData, offset);
                                offset += 2;
                                byteOffset++;
                                byte red = Convert.ToByte(((pixel & 0xF800) >> 11) * 8.225806);
                                byte green = Convert.ToByte(((pixel & 0x7E0) >> 5) * 4.047619);
                                byte blue = Convert.ToByte(((pixel & 0x1F) >> 0) * 8.225806);
                                if (x < image.Width)
                                {
                                    MirColors[x++ + h * image.Width] = new Color(red, green, blue, 255);
                                }
                            }
                            break;

                        case 0x00C2: //alpha
                            wSize = BitConverter.ToInt16(ImageData, offset);
                            offset += 2;
                            byteOffset++;
                            for (int i = 0; i < wSize; i++)
                            {
                                int pixel = BitConverter.ToInt16(ImageData, offset);
                                offset += 2;
                                byteOffset++;
                                byte red = Convert.ToByte(((pixel & 0xF800) >> 11) * 8.225806);
                                byte green = Convert.ToByte(((pixel & 0x7E0) >> 5) * 4.047619);
                                byte blue = Convert.ToByte(((pixel & 0x1F) >> 0) * 8.225806);
                                if (x < image.Width)
                                {
                                    MirColors[x++ + h * image.Width] = new Color(red, green, blue, 127);
                                }
                            }
                            break;
                    }
                }
            }

It seems to work but not tested much:) And i think i need to learn much about optimalization

P.S. Big thanks to u Coly and Kaori for help with this :)

u will find anomalies in some wil images that will cause them to draw incorrectly or throw errors in that code, but its a start. lookup my MirEvo sourcefor 99.9% working code, tested on hum, magic, tiles and interface, basically i found some images wouldnt render and modified the code to read the strange format used in some images (like 0.1%). it was things like 1 or 2 null bytes that needed to be skiped in color data or it would corrupt the image.
 

Jamie

LOMCN Developer
Developer
Mar 29, 2003
4,797
299
370
United Kingdom
Not sure if I've released this before but Here's my OLD Optimized code. I have recently learned of a new technique which is faster, however I am able to create textures Extremely fast with the code below.

Code:
        public void CreateTexture(BinaryReader BReader)
        {
            byte[] Bytes = FullImageBytes(BReader);
            if (Bytes == null) return;

            LastAccess = Main.Time;
            ImageTexture = new Texture(DXManager.Device, Size.Width, Size.Height, 0, Usage.None, Format.A8R8G8B8, Pool.Managed);

            GraphicsStream GS = ImageTexture.LockRectangle(0, LockFlags.Discard);
            GS.Write(Bytes);
            GS.Dispose();
            ImageTexture.UnlockRectangle(0);
        }

        private byte[] FullImageBytes(BinaryReader BReader)
        {
            byte[] Pixels = new byte[Size.Width * Size.Height * 4];
            byte[] FileBytes = BReader.ReadBytes(Length * 2);

            int End = 0, OffSet = 0, Count;

            for (int Y = 0; Y < Size.Height; Y++)
            {
                OffSet = End;
                End += (FileBytes[OffSet + 1] << 8 | FileBytes[OffSet]) * 2 + 2;
                OffSet += 2; //New line
                for (int X = 0; X < Size.Width; )
                    switch (FileBytes[OffSet])
                    {
                        case 192: //No Colour
                            X += FileBytes[OffSet + 3] << 8 | FileBytes[OffSet + 2];
                            OffSet += 4;
                            break;
                        case 193: //Solid Colour
                        case 194: //Overlay Colour
                        case 195: // ??
                            Count = FileBytes[OffSet + 3] << 8 | FileBytes[OffSet + 2];
                            OffSet += 4;
                            for (int I = 0; I < Count; I++)
                            {
                                int ColIndex = FileBytes[OffSet + 1] << 8 | FileBytes[OffSet];
                                OffSet += 2;
                                if (X >= Size.Width) continue;
                                Pixels[(Y * Size.Width + X) * 4 + 3] = 255;
                                Pixels[(Y * Size.Width + X) * 4 + 2] = (byte)((ColIndex / 2048) * 8 + 7);
                                Pixels[(Y * Size.Width + X) * 4 + 1] = (byte)(((ColIndex %= 2048) / 32) * 4);
                                Pixels[(Y * Size.Width + X) * 4] = (byte)((ColIndex % 32) * 8 + 7);
                                X++;
                            }
                            break;
                        default:
                            return null;
                    }
            }


            return Pixels;
        }
 
Last edited: