<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Anotherguest</id>
	<title>ModdingWiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Anotherguest"/>
	<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/wiki/Special:Contributions/Anotherguest"/>
	<updated>2026-05-14T05:01:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.11</generator>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2791</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2791"/>
		<updated>2010-04-27T15:00:37Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Copy xx&amp;amp;0x1f                           |ON     |NO     |&lt;br /&gt;
 |Ax    |pixels from the line above             |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte as colour to fill with, |ON     |NO     |&lt;br /&gt;
 |Cx    |repeat 0xvalue&amp;amp;0x1f times              |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 255 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2790</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2790"/>
		<updated>2010-04-27T14:54:23Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Copy xx-0x20 or xx-0xa0                |ON     |NO     |&lt;br /&gt;
 |Ax    |pixels from the line above             |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte as colour to fill with, |ON     |NO     |&lt;br /&gt;
 |Cx    |repeat xx-0x40 times or xx-0xcx times  |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 255 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2782</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2782"/>
		<updated>2010-04-23T17:57:02Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Copy xx-0x20 or xx-0xa0                |ON     |NO     |&lt;br /&gt;
 |Ax    |pixels from the line above             |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat xx-0x40 times   |ON     |NO     |&lt;br /&gt;
 |Cx    |                    or xx-0xcx times   |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 255 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2781</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2781"/>
		<updated>2010-04-23T11:06:50Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Copy x pixels from the line above      |ON     |NO     |&lt;br /&gt;
 |Ax    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat x times         |ON     |NO     |&lt;br /&gt;
 |Cx    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 255 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2780</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2780"/>
		<updated>2010-04-23T08:50:18Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Take previous pixel from previous image|ON     |NO     |&lt;br /&gt;
 |Ax    |and repeat it x times                  |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat x times         |ON     |NO     |&lt;br /&gt;
 |Cx    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 255 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2779</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2779"/>
		<updated>2010-04-23T08:49:53Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Take previous pixel from previous image|ON     |NO     |&lt;br /&gt;
 |Ax    |and repeat it x times                  |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat x times         |ON     |NO     |&lt;br /&gt;
 |Cx    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 256 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2778</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2778"/>
		<updated>2010-04-23T07:43:13Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Take previous pixel from previous image|ON     |NO     |&lt;br /&gt;
 |      |and repeat it x times                  |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Ax    |Repeat the next block x times          |OFF    |YES    |&lt;br /&gt;
 |      |                                       |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat x times         |ON     |NO     |&lt;br /&gt;
 |Cx    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 256 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2777</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2777"/>
		<updated>2010-04-22T19:57:26Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Take previous pixel from previous image|ON     |NO     |&lt;br /&gt;
 |      |and repeat it x times,read next &amp;amp; skip |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Ax    |Repeat the next block x times          |OFF    |YES    |&lt;br /&gt;
 |      |                                       |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat x times         |ON     |NO     |&lt;br /&gt;
 |Cx    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 256 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2776</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2776"/>
		<updated>2010-04-22T19:50:55Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Compression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
If the animation isn&#039;t &#039;fullscreen&#039; then when decompressed it does not have to be 64&#039;000 long (320x200) While the animation starts drawing at 0,0 it can finish anywhere. In the example above the changes finish about 1/3 way down the screen, so the decompressed data is about 20&#039;000 bytes long. Another thing to note is that unlike still screens, images are filled in row-by-row, without columns being filled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. The first complication is at the first byte. If this is $FF then it is normal data and the image should be read normally. (That is $FF is a control byte and should be treated as such.) If it is not, then the first byte is the x location to start drawing the image (on the first line, that is it can be said to stand for &#039;x pixels of transparent color&#039;.)&lt;br /&gt;
&lt;br /&gt;
There are 5 types of control byte. The highest bit of control bytes indicates what to set the &#039;transparency flag&#039; to (1 on; 0, off) while the next two define what the control byte does. The fourth bit may not have a function, and the lower four bits are the number of pixels of image to be affected.&lt;br /&gt;
&lt;br /&gt;
There are two &#039;special cases&#039;; $00 and $7F\$FF. The first stops decompression and the second is used for long stretches of transparent pixels.&lt;br /&gt;
&lt;br /&gt;
There are a number of complicated rules that have yet to be worked out. Some control bytes that set the &#039;T-flag&#039; to on must be preceeded by a control byte that does the same thing, it is not known why. Some values ($80, $7F, $Ex) are not used or have not yet been observed&lt;br /&gt;
&lt;br /&gt;
A basic summary of this is as follows; &#039;T-flag&#039; indicates what the transparency flag is set to after the control byte is read. &#039;H-flag&#039; indicates whether the control byte must be preceded by a control byte that has its highest bit set to 1.&lt;br /&gt;
&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |Type  |Function                               |T-flag |H-flag |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0     |Output next byte as literal and STOP   |ON     |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |0x,8x |If T-flag ON, x transparent pixels     |FLIPPED|NO     |&lt;br /&gt;
 |      |follow. If T-flag OFF, read next x     |       |       |&lt;br /&gt;
 |      |x bytes and output                     |       |       |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |2x    |Take previous pixel from previous image|ON     |NO     |&lt;br /&gt;
 |Ax    |and repeat it x times,read next,skip   |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |4x    |Read next byte, repeat x times         |ON     |NO     |&lt;br /&gt;
 |Cx    |                                       |OFF    |YES    |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
 |7F    |Read next word, (add 256 if trans on)  |ON     |NO     |&lt;br /&gt;
 |FF    |output that many bytes of transparent  |OFF    |NO     |&lt;br /&gt;
 +------+---------------------------------------+-------+-------+&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2762</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2762"/>
		<updated>2010-04-14T06:20:29Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Animation frames */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They are either a fullscreen frame (type $5b5d( ][ )) using the alternative compression mode used in the start image or a modified form of the animation start compression that has not yet been figured out(type $4646(FF) and type $4352(RC)).&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. There seem to be more types of control bytes with slightly different functions. As yet this compression has not been reverse-engineered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2758</id>
		<title>Jazz Jackrabbit Cutscene Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=Jazz_Jackrabbit_Cutscene_Format&amp;diff=2758"/>
		<updated>2010-04-13T09:08:52Z</updated>

		<summary type="html">&lt;p&gt;Anotherguest: /* Animation Start Image */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jazz Jackrabbit cutscenes (.0SC) are the movies played at the end of levels and episodes. They have an exceedingly complex format that has been poorly understood. They contain sound, music, graphics and text. The following snippets of information have been gathered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Headers ==&lt;br /&gt;
&lt;br /&gt;
There are three headers, only the first being of a fixed size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== File header ===&lt;br /&gt;
&lt;br /&gt;
 0     19     Signature   File signature &#039;Digital Dimensions&#039; + $1A&lt;br /&gt;
 19    4      Img point   Pointer to start of image data header&lt;br /&gt;
 23    4x + 2 Page header Header for pages&lt;br /&gt;
 ?     4y + 2 Img header  Image header&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Page and Image headers ===&lt;br /&gt;
&lt;br /&gt;
 0     2      Num         Number of entries (Pages or images) in file&lt;br /&gt;
 2     4x     Pointers    Pointers to data&lt;br /&gt;
&lt;br /&gt;
These two headers have almost identical formats. The page header stores the pointers to pages or &#039;scripts&#039; in the cutscene while the graphic header stores the pointers to palettes, still screens and animated screens used by pages. While the length of the page header is always 4 times the number of pages, the graphics header is always much shorter IF there are animated screens. (One pointer to an animated screen can have dozens of animations in it, each counting as one graphic.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
The page, or script is the basic segment of the cutscene. Each page can display some font and a graphic and can transition to other pages. The page data contains a number of sub-segments of varying length that may or may not be present and in various orders.&lt;br /&gt;
&lt;br /&gt;
 0     1      Sig         Signature &#039;P&#039;&lt;br /&gt;
 2     2      Pagenum     Page number, as value, not string, starts with $0001&lt;br /&gt;
 4     2      Pal         Palette used&lt;br /&gt;
 6     ?      Segs        Optional and vital strings in no particular order&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
       1      End         End of page data &#039;E&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sub segments ===&lt;br /&gt;
&lt;br /&gt;
Page sub-segments are usually in the following order; in some cases this is necessary (You cannot have a text segment without defining what fonts it can use.) in other cases just the way things are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Music ====&lt;br /&gt;
&lt;br /&gt;
Indicates what music file will play during the movie. This is set on the first page only and cannot be changed. Optional, a cutscene may not use music.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $2A; this is a music string&lt;br /&gt;
 1     1      Len         Length of music file name&lt;br /&gt;
 2     len    Name        Name of music file, inc .PSM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Fonts ====&lt;br /&gt;
&lt;br /&gt;
Indicates what fonts will be used in the movie, several allowed. These appear on the first page only and cannot be changed. The value given to each font in this string will be used throughout the movie in font sub-segments. Optional, a cutscene may not use fonts.&lt;br /&gt;
&lt;br /&gt;
 0     1      ID          Id $58; this is a font string&lt;br /&gt;
 1     2      Fontnum     What number this font is&lt;br /&gt;
 3     1      Len         Length of font name&lt;br /&gt;
 4     len    Name        Font name, excluding extension (.0FN added automatically)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animations and Images ====&lt;br /&gt;
&lt;br /&gt;
Indicates what graphic is displayed on the page. Vital and each page must have at least one of these. If a page has an animation it will NOT have a text or any image sub-segments&lt;br /&gt;
&lt;br /&gt;
 IMAGE&lt;br /&gt;
 0    1      Img sig     Image signature, $46&lt;br /&gt;
 1    2      h loc       Location of image on screen in pixels. For fullscreen images this is&lt;br /&gt;
 3    2      v loc       usually 0,0; for smaller images (rare) this can be anything&lt;br /&gt;
 5    2      Graphnum    Graphic to use, 0 is black screen, palettes cannot be used.&lt;br /&gt;
&lt;br /&gt;
 ANIMATION&lt;br /&gt;
 0    1      Graph sig   Graphics signature, $A6&lt;br /&gt;
 1    4      Anim loop   For animated screens, loops the animation. If no loop, page must move on&lt;br /&gt;
                         before loop ends or Jazz will crash. Loop value is 1&lt;br /&gt;
 4    2      Anim sp     Animation speed, lower = slower; usually $xx00&lt;br /&gt;
 6    2      Graphnum    Graphic to use, must be an animated screen graphic&lt;br /&gt;
 8    1      Play sig    Ply animation signature, $A7, optional (See following)&lt;br /&gt;
 9    1      Play        For pages that do NOT loop an animation AND do NOT have a set time before&lt;br /&gt;
                         they move on (Duration.) this plays the animation then goes to the next&lt;br /&gt;
                         page. This can only be 1, otherwise it and its signature are absent&lt;br /&gt;
&lt;br /&gt;
==== Text ====&lt;br /&gt;
&lt;br /&gt;
This is really a collection of related segments and signatures. Generally last on the page, these all relate to text strings written on the page. In general you can expect them to start with a &#039;W&#039; signature, though this is not guaranteed. These do not appear on any page with an animation and are optional.&lt;br /&gt;
&lt;br /&gt;
Signatures can be in any order as long as what they do &#039;makes sense&#039; (For example you cannot write any text until you&#039;ve set the font used, the palette zero color AND the justification, but after you have you can write as many lines as you want. You can can change the font used twice without writing anything. You can start a block, write something then start a new block.)&lt;br /&gt;
&lt;br /&gt;
The signatures change values in the movie (All values start at 0) For example the &#039;F&#039; signature sets the font text is written in. It must be set before text is written and all text following it will use that font until it is reset. Values are not reset when a page is switched, meaning that you can write many pages of text in a font after setting it once.&lt;br /&gt;
&lt;br /&gt;
 ?    1      Write sig    Write signature, &amp;quot;W&amp;quot;; indicates text segment start; there can be more than one&lt;br /&gt;
                          segment of text on a page. The following values affect ALL the text in a&lt;br /&gt;
                          given text block and always appear in a given order. Note that if a new&lt;br /&gt;
                          block starts, ALL values are NOT reset.&lt;br /&gt;
 +1   2      Top margin   The page margins; Text cannot normally appear above or left of this location&lt;br /&gt;
 +3   2      Left margin  unless this is reset or the text wraps around from the right/bottom of the screen&lt;br /&gt;
 +5   2      Pix h        The location of the first line of text, in pixels from the margins. The second&lt;br /&gt;
 +7   2      Pix v        value (v) appears not to be read, just the horizontal one, which can, if larger&lt;br /&gt;
                          than 320, wrap around and move text vertically (640 moves text down 2 lines...)&lt;br /&gt;
                          If this block is not the first block, NEITHER value is read or used!&lt;br /&gt;
&lt;br /&gt;
 ?    1      Shad sig     $DB sets shadows&lt;br /&gt;
 +1   1      Shadow       $01 turns shadows on, $00 turns them off. Default is off&lt;br /&gt;
 +2   1      Shad color   Palette color used for shadows&lt;br /&gt;
&lt;br /&gt;
 ?    1      Font sig     Change font signature, &amp;quot;F&amp;quot;; indicates what font will be used for the&lt;br /&gt;
                          text following&lt;br /&gt;
 +1   2      Font         Font used. Must be a valid font number&lt;br /&gt;
&lt;br /&gt;
 ?    1      Just sig     Justification signature &amp;quot;J&amp;quot;&lt;br /&gt;
 +1   1      Just         Justification. Text is either left(0) or right(1) aligned; this defines&lt;br /&gt;
                          the text start (The position value above reads either left or right.)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Pal sig      Palette zero value signature, &amp;quot;A&amp;quot;&lt;br /&gt;
 +1   2      Pal zero     Palette &#039;zero color&#039;; this value in the palette is set as color 0 for&lt;br /&gt;
                          the font; thus the same font can be several different colors depending&lt;br /&gt;
                          on its zero color. For example a font pixel $0E can be color $1F or $2E&lt;br /&gt;
                          depending on the value (In this case $11 or $20)&lt;br /&gt;
&lt;br /&gt;
 ?    1      Line sig     Sentence signature, &amp;quot;@&amp;quot;&lt;br /&gt;
 +1   1      Length       Sentence length, in letters&lt;br /&gt;
 +2   len    Text         Text, letter displayed is this value&#039;s letter in the font file. The value $7F&lt;br /&gt;
                          is space. Values over $80 move into the next font (Crashes game if there is no&lt;br /&gt;
                          next font.) Thus $81 in font 1 will become $01 in font 2&lt;br /&gt;
&lt;br /&gt;
 ?    1     Pnum sig      Signature for special text, &amp;quot;^&amp;quot; Text that uses this is usually the &#039;Page x of y&#039;&lt;br /&gt;
 +1   len   Length        This is the same as the usual text signature stuff, after this a string of text&lt;br /&gt;
                          follows. The difference is that values over $89 are allowed and can do special&lt;br /&gt;
                          things. $8B is current page number and $8A is the number of pages in the cutscene.&lt;br /&gt;
                          $8C is &#039;000&#039; and higher values seem to be &#039;0&#039; Possibly these refer to values in&lt;br /&gt;
                          memory.&lt;br /&gt;
&lt;br /&gt;
 ?    1     Move sig      Move line signature, &amp;quot;_&amp;quot;&lt;br /&gt;
 +1   2     Line move     Changes the height of all following text lines by this amount, in pixels. Thus if&lt;br /&gt;
                          this value is 5, the first line will be 5 pixels lower, the second 10, the 3rd 15...&lt;br /&gt;
                          As such it is usually reset to 0 after the desired text is done. This is usually used&lt;br /&gt;
                          to position a line of text specially on a background image or relative to other text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== An example =====&lt;br /&gt;
&lt;br /&gt;
The following is a segment of text taken from &amp;lt;tt&amp;gt;ORDER.0SC&amp;lt;/tt&amp;gt; in Jazz CD, starting at position $8A in the file. It is some of the text for the first page of the Order Info cutscene:&lt;br /&gt;
&lt;br /&gt;
 57          Text block start sig &lt;br /&gt;
 14 00 00 00 Location of text left limit, 20 pixels from left of screen&lt;br /&gt;
 36 01       Font start, 310 pixels&lt;br /&gt;
 BE 01 &lt;br /&gt;
 DB 01 00    Text has shadows of color 0&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 4A 01       Font is aligned right&lt;br /&gt;
 41 00 00    Font zero color is value 0&lt;br /&gt;
 5E 0C       Special text string follows, 12 characters long&lt;br /&gt;
 10 1B 21... Text&lt;br /&gt;
&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 41 00 00    Font zero color = 0&lt;br /&gt;
 4A 00       Font aligned left&lt;br /&gt;
 46 02 00    Font used is 2&lt;br /&gt;
 40 00       Text string follows, 0 long (Move down a line)&lt;br /&gt;
 40 1D       Text string follows, 29 long&lt;br /&gt;
 7F 7F...    &#039;Had enough excitement...&#039;&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F... &#039;We didn&#039;t think...&#039;&lt;br /&gt;
&lt;br /&gt;
 46 01 00    Font used is font 1&lt;br /&gt;
 40 00       Move down a line&lt;br /&gt;
 40 1D 7F    &#039;You are playing...&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Misc ====&lt;br /&gt;
&lt;br /&gt;
There are a number of less complex segments that may appear on each page.&lt;br /&gt;
&lt;br /&gt;
 Screen transition segment&lt;br /&gt;
 0    1      Sig         Screen transition signature $3F&lt;br /&gt;
 1    1      Trans       Transition, 0 = none, 1 = speckle 2 = circle&lt;br /&gt;
&lt;br /&gt;
 Page duration segment&lt;br /&gt;
 1    1       Sig         Signature &#039;]&#039;&lt;br /&gt;
 2    1       Duration    How long in seconds page stays before transitioning to next page&lt;br /&gt;
&lt;br /&gt;
 Music transition segment&lt;br /&gt;
 1    1       Sig         Signature, &#039;Q&#039;&lt;br /&gt;
 2    1       Music trans Music transition, $2D stops music on page transition&lt;br /&gt;
&lt;br /&gt;
 Yes/no input segment&lt;br /&gt;
 1    1       Sig         Signature $23, if present page accepts only &amp;quot;y&amp;quot; or &amp;quot;n&amp;quot; as input and will&lt;br /&gt;
                          switch to the next page ONLY if &amp;quot;y&amp;quot; is pressed, otherwise the movie will end&lt;br /&gt;
&lt;br /&gt;
 ???&lt;br /&gt;
 1    1       ???          Signature &#039;&amp;gt;&#039;; apparently does something unknown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
There are three kinds of graphic, palette, still screen and animated screen. Each has its own unique format.&lt;br /&gt;
&lt;br /&gt;
=== Palette ===&lt;br /&gt;
&lt;br /&gt;
The palette is the 256 colors used by a screen to display graphics and fonts. A page may only use one palette but a cutscene can have several. Palettes are [[Jazz Jackrabbit RLE compression]] compressed and decompress to 768 bytes in length, 256 3-byte RGB values. (The same format as palette blocks in other Jazz files such as [[Jazz Jackrabbit Tile Format]] Palettes are 6-bit stored as 8-bit, so each value must be multiplied by four to get the &#039;true&#039; color for bitmaps.&lt;br /&gt;
&lt;br /&gt;
Palettes are usually the first graphics entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Static screens ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that fill an entire screen and act as the background to a page. Like palettes they are [[Jazz Jackrabbit RLE compression]] compressed, but decompress to 64&#039;004 bytes in length. Note that while other image sizes are possible, in practice only fullscreen images are seen.&lt;br /&gt;
&lt;br /&gt;
 0     2      Width       Width of following screen&lt;br /&gt;
 2     2      Height      Height of following screen&lt;br /&gt;
 4     hw     Data        Screen data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Animation sequences ===&lt;br /&gt;
&lt;br /&gt;
These are 320x200 images that animate. They cannot have font displayed over them and are the traditional &#039;movie&#039; part of Jazz cutscenes. Their format is complex and poorly understood but relies on at least two forms of unique RLE compression. There is a header followed by a start image compressed in one way, followed by a number of &#039;frames&#039; compressed in another manner.&lt;br /&gt;
&lt;br /&gt;
 0     2      Sig        Signature &#039;AN&#039;&lt;br /&gt;
 2     2      ?	         Must be $0002?&lt;br /&gt;
 4     2      ?	         Is always $0007?&lt;br /&gt;
 6     2      Pal sig    Palette signature &#039;PL&#039;&lt;br /&gt;
 8     2      Palsize    Size of following unused palette (Always $300)&lt;br /&gt;
 10    768    Palette    Unused(?) palette, uncompressed&lt;br /&gt;
 778   ?      Anim st    Animation start image&lt;br /&gt;
 ?     ?      Anims      Following animation frames&lt;br /&gt;
 ...&lt;br /&gt;
 ..&lt;br /&gt;
 .&lt;br /&gt;
 ?     4      End	 End of anim sequence, $5F $45 $00 $00 &#039;_E  &#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Animation Start Image ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first row of data changed from black to pink. showing how columns are colored, not pixels.]]&lt;br /&gt;
&lt;br /&gt;
This image is written onto a &#039;blank&#039; screen when a page is started and the other animations work by overwriting this. In many cases it works like the &#039;background&#039; of a .GIF image. The data will ALWAYS decompress to a 64&#039;000 byte fullscreen image.&lt;br /&gt;
&lt;br /&gt;
The way the image is drawn however is interesting. Instead of drawing each line pixel by pixels as static screens to, when a pixel of a given color is drawn, all the pixels directly beneath it will be colored the same. This is a great space saver; instead of coloring all of the background of an image blue, for example, only the first line must be blue; all the other lines below it will then be this color as well.&lt;br /&gt;
&lt;br /&gt;
An image is built up by lower lines overwriting earlier ones, line by line. In the image left the first row of the image has been changed from black to pink, also changing all the columns under it to pink. Lower lines overwrite this with other colors, thus building up the image.&lt;br /&gt;
&lt;br /&gt;
Color 255 ($FF) is &#039;transparent&#039;; in practice this means &#039;skip over this column, it&#039;s already the right color&#039; In our &#039;blue screen&#039; example above, all the other rows would be colored transparent, since the entire screen would be blue and we wouldn&#039;t want to change that. In the example image above all the pink columns have been skipped over until another color was needed. It is possible to show the exact same image by replacing the transparent pixels with the value of the pixel above them, but this takes up a lot more space and takes longer to draw.&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen What to do to the screen before the image is displayed. $3131 is &#039;rle image&#039;&lt;br /&gt;
                         $4c31 means use other form of compression for image&lt;br /&gt;
                         $4646 means &#039;leave as is&#039; This image usually uses &#039;reset&#039;; clearing the&lt;br /&gt;
                         screen and writing the image on it&lt;br /&gt;
 2     2      Anim size  Size of animation data to follow&lt;br /&gt;
 4     ?      data       Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used on the first image can be either normal [[Jazz Jackrabbit RLE compression]] ($3131 tag) or a more complex form of the usual ($4c31 tag), with a wider variety of control bytes. It may be considered to contain elements or RLEW as well. The upshot of this is to allow a large image to be compressed rather more efficiently than standard RLE. The types of control bytes are as follows for this format:&lt;br /&gt;
&lt;br /&gt;
 $0x $...	Next x + 1 bytes are &#039;literals&#039;; each byte colors 1 column (Max val $3F)		&lt;br /&gt;
 $4x $yy        Next x + 1 columns drawn in color yy (Max value $7E)&lt;br /&gt;
 $7F $xxxx $yy	Next xxxx columns colored with color yy&lt;br /&gt;
 $8x		Next x + 1 pixels are skipped, they&#039;re already the right color (Max val $FE)&lt;br /&gt;
 $FF $xxxx	Skip next xxxx pixels of picture, they&#039;re already the right color&lt;br /&gt;
&lt;br /&gt;
==== Animation frames ====&lt;br /&gt;
&lt;br /&gt;
[[File:Jazz0SCimage2.PNG|200px|thumb|right|An image from ENDLEVEL.0SC with the first animation frame in the wrong location.]]&lt;br /&gt;
&lt;br /&gt;
These follow the first image and are usually compressed to much smaller sizes as they involve changes to the previous screen rather than drawing a whole new screen. They also use a modified form of the animation start compression that has not yet been figured out.&lt;br /&gt;
&lt;br /&gt;
The frame is drawn by taking the previous screen and drawing the changes over it. In the example picture right the second animation frame has been moved left by 200 pixels so it is written over a black background. It can bee seen how little of the image has been changed and also how much of it is transparent. (In the middle of the smoke this is most easily seen where black pixels show where the previous screen had the right color grays not to need changing.)&lt;br /&gt;
&lt;br /&gt;
It can also be seen that an animation can erase a previous frame by changing pixels back to what they were previously. In the example image some smoke fragments are visible because they have not been overwritten.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Format:&lt;br /&gt;
 0     2      Set screen Almost always $4646, &#039;leave previous screen&#039;&lt;br /&gt;
 2     2      Anim size	 Size of animation data to follow&lt;br /&gt;
 4     ?      data	 Image data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Compression =====&lt;br /&gt;
&lt;br /&gt;
The compression used in animation frames is not the same as that of the first image, though it appears similar. There seem to be more types of control bytes with slightly different functions. As yet this compression has not been reverse-engineered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Jazz Jackrabbit]]&lt;br /&gt;
[[Category: File Formats]]&lt;br /&gt;
[[Category:Graphics Files]]&lt;/div&gt;</summary>
		<author><name>Anotherguest</name></author>
	</entry>
</feed>