From DoomWiki.org

picture format edits[edit]

Hi Wesley, I wanted to approve these edits but I'm not sure they're correct. You state "There is also a different picture format used for the starting screens, help pages, and the Heretic picture format.". Do you mean TITLEPIC by starting screens, or something else? I'm not aware of a different picture format for TITLEPIC/HELP/CREDIT etc., nor changes made for Heretic. Can you elaborate, please? — Shambler (talk) 08:10, 15 April 2019 (CDT)


Wesley[edit]

It is not clear how this discussion is supposed to take place, this does not seem to be a forum.

The first question is going to be what this particular page is going to be about? Is it just about patch format? (then it should call it patch format and not picture format). If it is about all the formats then it might have to admit to png and the other formats that some other ports use.

The term "picture format" may mean different things in different Doom ports. In DoomLegacy, it refers to a picture format, that is used instead of patch format. DoomLegacy may dynamically decide to render a particular texture or patch using picture format instead. To do this it renders the patches into a buffer and then saves that buffer as a picture.

I cleaned up the Doom picture format page because it seemed to be about the patch format, and kept trying to call it something else. The sentence about other formats is true, there are other formats in the modern implementations of Doom. The vanilla Doom may be pretty close to using patches for everything, but not many people who are going to explore the code are going to go to that source. I left it an ambiguous sentence that warned them to look out for other formats when these other page types are concerned.

I spent several hours tracking down specifics, and then had to give that up because it was open-ended work.

Specifics[edit]

This is what I found out looking at DoomLegacy. (the page formatter is mangling this, it reads like the original when in EDIT).


******* Doom Large Images If this cannot do more than one line, it is pretty useless.

******* Doom Large Images
*** From doom.wad
Graphics
 TITLEPIC, HELP1, INTERPIC  patch
 WIMAP0, WIMAP1, WIMAP2   patch
 M_DOOM    patch
 END sequence   patch
 ENDPIC, PFUB1 PFUB2, VICTORY2  patch
Patches
 SKY1, SKY2, SKY3, SKY4     patch
Sprites
 - all monster, weapon, object patches


*** From doom2.wad
Graphics
 TITLEPIC, BOSSBACK, CREDIT, HELP, INTERPIC  patch
 M_DOOM    patch
 - several menu labels  patch
 - map names            patch
Patches
 RSKY1, RSKY2, RSKY3     patch
 - all wall texture patches
Sprites
 - all monster, weapon, object patches
Textures
 texture lump


*** From heretic.wad
Graphics
 M_HTIC     patch
 MAPE1, MAPE2, MAPE3   patch
Lumps
 CREDIT, TITLE, E2END      raw
 FINAL1, FINAL2   raw
 HELP1, HELP2     raw
Patches
 SKY1, SKY2, SKY3     patch


*** From legacy.wad
 CREDIT    patch
 RSKY1, RSKY2, RSKY3     patch
 - several menu labels  patch
   RANKINGS  patch
Lumps
 SBOHEALT  lmp  pic_t
 SBOARMOR  lmp  pic_t
 SBOEMPTY  lmp  pic_t
 SBOFRAGS  lmp  pic_t


*** Function calling
* Doom
 HELP1, HELP2
 -> V_DrawScalePatch

* Doom2
 HELP, CREDIT
 -> V_DrawScalePatch

* Heretic
 HELP1, HELP2
 -> V_DrawRawScreen_Num


* Doom status bar overlay
- draws status bar images that are lumps stored in pic_t format
  - DoomLegacy feature, lumps are from legacy.wad
    - status bar health   SBOHEALT
    - status bar armor    SBOARMOR
    - status bar frags    SBOFRAGS
 -> V_DrawScalePic_Num
    -> W_CachePicNum
    -> V_BlitScalePic


* Functions

Func D_PageDrawer ()
{
// Draws whole screen patches.
// Fills the borders by repeating a flat.
// Used for TITLEPIC, HELP1, HELP2, ORDER, CREDIT, FINAL1, FINAL2, E2END
}

Func V_DrawScalePic_Num ()
{
// Used for Legacy overlay graphics
 -> W_CachePicNum
 -> V_BlitScalePic
}

Func V_DrawRawScreen ()
{
// Used for Legacy credits.
// Used for heretic: TITLE, HELP1, HELP2, ORDER, CREDIT, FINAL1, FINAL2, E2END
  -> W_CacheRawAsPic
  -> V_BlitScalePic
}

Func W_CacheRawAsPic ()
{
// convert raw heretic picture to legacy pic_t format
// Used for heretic: TITLE, HELP1, HELP2, ORDER, CREDIT, FINAL1, FINAL2, E2END
}

Func W_CachePicName, W_CachePicNum ()
{
- reads a lump that is in pic_t format
}

Func V_BlitScalePic ()
{
- renders images that are in pic_t format
  - can only draw pic mode = PALETTE
  - the usual pic are sized for 320x200
}


*** pic_t format
<<code>>
// This is the Doom PIC format (not the Pictor PIC format).
typedef enum {
    PALETTE         = 0,  // 1 byte is the index in the doom palette (as usual)
    INTENSITY       = 1,  // 1 byte intensity
    INTENSITY_ALPHA = 2,  // 2 byte : alpha then intensity
    RGB24           = 3,  // 24 bit rgb
    RGBA32          = 4,  // 32 bit rgba
} pic_mode_t;

pic_t image format
{
    uint16_t  width;
    byte      zero;   // set to 0 allow autodetection of pic_t 
                      // mode instead of patch or raw
    byte      mode;   // see pic_mode_t above
    uint16_t  height;
    uint16_t  reserved1;  // set to 0
    byte      data[0];
}
<</code>>

In spite of the mode definition above, all actual Doom pic seem to be mode 0.


*** Flats
- stored as a raw image without a header
- original was 64x64 raw image
  - DoomLegacy will accept other square sizes, upto 256x256
- drawn horizontally (by rows)

func  R_GetFlat
// just reads a lump into a cache

==