Alternate Monster Graphics

You can provide up to three different 'Graphic Sets' for each of the 27 different types of monsters in the game.  Changing the graphics for a monster does not change its behaviour in any way; it only changes the graphics.  Each such set of graphics is described in a section of the CSBgraphics.dat file.  The CSBgraphics.dat 'ID' is equal to the numeric Monster Type multiplied by three plus the 'Alternate Graphic Number' minus 1.  For example, Alternate Graphics 1, 2, and 3 for a Screamer will be contained in CSBgraphics.dat ID numbers 18, 19, and 20.  Each such graphic ID contains several structures which are patterned after the runtime internal structures (in order to lessen the confusion somewhat).  Many of the fields in these structures are not needed by the Alternate Graphics capability but should be set to zero to allow for possible future enhancements.  Each ID has this structure:

============================================
struct ALTMONGRAPH
{
  MONSTERDESC monsterDesc;
  ITEM12      item12;
  ITEM110     item110;
  i32         graphicOffsets[10]; // relative to graphic[0]
  ui8         graphic[4];
};

The member 'graphic[4]' is actually all of the required graphics for the creature and will, of course, be much greater than four bytes in length.  You cannot display even a single pixel with only four bytes! 

The member 'graphicOffsets[10]' contains the byte offsets of the required graphics for the creature such as Front View, Side View,  etc.  Not all the graphics need to be present.  Only the Front view is necessary.  The flags in MONSTERDESC (see below) tell which graphics are actually present.  If a view is missing the Front view is used.

The graphics offsets are specified in the order:

If a view is missing then the associated offset is omitted.  If, for example, a monster has no 'Back Graphic' then the offsets would be:

Why is there provision for ten graphics rather than four?  I don't know.  It appears that there might be a way to allow for mirror images.  Perhaps for non-symmetrical  monsters.  If such a thing is needed, we will look into it.

============================================
struct MONSTERDESC
{
  ui8 uByte0;      //Not Used.  Must be zero.
  ui8 attackSound; //Not Used.  Must be zero.
  i16 word2;       //flags describing the monster. Not Used. Must be zero.
  MONSTERDESC_WORD4 word4;  //Flags describing monster and graphics
  ui8  uByte6;    // Not used.  Must be zero.
  ui8  uByte7;    // Not used.  Must be zero.
  ui8  uByte8[6]; // Not used.  Must be zero.
  i16 word14;     // Not used.  Must be zero
  i16 word16;     // Not Used.  Must be zero.
  i16 word18;     // Not used.  Must be zero.
  i16 word20;     // Not used.  Must be zero.
  ui8 uByte22[4]; // Not Used.  Must be zero.
};

You can see that very little of this structure is used.  Only the flags saying which graphics exist.

===============================================
struct ITEM12
{
  i16 ITEM12_word0; // The base graphic number.  Not used.  Must be zero.
  i16 ITEM12_word2; // The first derived graphic.  Not used.  Must be zero.
  ui8 frontRearByteWidth; // Width in bytes of the front and rear graphics.
  ui8 frontRearHeight;    // Height of the front and rear graphics.
  ui8 sideByteWidth;      // Width in bytes of the Side graphic
  ui8 sideHeight;         // Height of the Side graphic
  ui8 attackByteWidth;    // Width in bytes of the Attack Graphic
  ui8 attackHeight;       // Height of the Attack Graphic
  ui8 uByte10;            // bits 0-3 = transparent color
                          // Other bits not used and must be zero.
  ui8 uByte11;            // Not used.  Must be zero.
};

================================================
struct ITEM110s
{
  ui8 MonsterXYonScreen[10]; //Pairs of bytes...for each position in cell
};

struct ITEM110
{
  ITEM110s s[11];//indexed by relative cell number 0-10
};

The ITEM110 structure tells
the x- and y-offsets within the viewport where the monster's graphic should be drawn for each of the 10 possible relative cell numbers (relative to the party) and for each of the five possible positions within each of these cells .

And that is all you ned to know except how to draw a graphic.  And I don't know that either.