Changes

Talk:R-Type

2,879 bytes added, 19:37, 30 April 2010
In Nicholas CAMPBELL and CNG versions, code seems to be offseted to -14 bytes.
In original code, the subprogram that load levels is located at #5B64.It gets level number at #719C ,compute track number track=((lvl-#30)*4)+8 and download the 3 tracks (#3600 bytes) at #C4AE so levels are located at track 8,4,12,16,20,24,28 ,32 and to finish it calls #8F2A to do loading.
[[User:Fano|Fano]] 13:08, 20 November 2009 (UTC)
 
== Objets/Sprites subsytem ==
 
The routines used to put sprites/objects to the rendering system (#8D08,#8D70,#8DDE,#8E34) take the following parameters :
*HL sprite graphics address
*D,E sprite dimension in char units (height,width)
*B,C sprite position in char units (y,x)
 
Sprite graphics are composed of theses structures:
*BYTE : attribute
*BYTE*8 : 1bit graphics , only present if attribute <> #36
 
Attribute seems to be only used to compute color, only the 2 lower bits are used like this :
* 10 (2) : color 1
* 11 (3) : color 3
* 00 (0) or 01 (1) : color 2
 
There are 2 routines to solve sprite dimensions and adress from a sprite number in A : #8E97 for basic sprites (héro,modules,weapons,logo,etc...) and #8E90 for levels sprites.Theses routines return pixels address in HL and dimensions in char units in D,E.
 
Sprites tables are composed of theses structures :
*BYTE width in char units
*BYTE height in char units
*WORD pixels address
 
The basic sprites table if located at #BC67 and level sprites table address can be found at (#C4BA)
 
Here is some example code written in Basic to convert R-Type sprites from uncompressed 64K type 1 SNA to BMP format :[[file:R_extractspr.x]]
 
Example :
[[File:Spr_40.png‎]]
 
(Violet chars are marked as #36 so they are ignored)
 
[[User:Fano|Fano]] 16:47, 21 November 2009 (UTC)
 
==Level graphics==
 
Let's continue for 2K10 !
 
Game screen is composed of 8*5 blocks of 4*4 chars (8*8 pixies).Blocks are stored in memory in the same way as sprites except char pixies are always presents.
 
Per char :
 
*BYTE : flags, defines color, bit 7 defines if char is solid.
*BYTE*8 : 1bit graphics
 
There are 16 chars so 144 bytes per block.
 
Levels are composed of columns of 5 blocks.The first column of the level is located at #C4B1 (byte).The column number 0 is located at (#C4BC)
 
A column address (word) can be computed like this : (column*5) + (#C4BC)
 
Each byte of the column is a block number :
* bit 7 -> set if verticaly reversed
* bit 6 -> set if horizontaly reversed
* bits 0->5 block index
 
Using block index , it is possible to compute address (word) with this simple formula :
 
(#C4BC)-((index+1)*144)
 
Routine at #167B solves block index in A and return block address in HL.
 
Code located at #5C4F draws the first screen of the level before scrolling.It uses the sprite code (#8D08,#8D70,#8DDE,#8E34) to put the level graphics on screen.
 
Current column is located at #7A84 and there is a copy of (#C4BC) at #C4AE.When game passes a checkpoint , it saves the current column at #C4AE so when player dies, game restarts at #C4AE.
 
Code located at #8A7F feeds scrolling , update attribute array , draw blocks on right side of the screen.There are 4 routines to feed scroll according to reverse flags.
 
* #1E4C - x=N y=N
* #1E83 - x=R y=N
* #1EC3 - x=N y=R
* #1640 - x=R y=R
 
[[User:Fano|Fano]] 20:23, 6 January 2010 (UTC)
115
edits