SUVLEIR 3.0

Soporte técnico sobre los lanzamientos de MojonTwins y comentarios sobre los güegos. Ofrecemos soporte técnico con Fourspriter, te ayudamos con ZX Basic o Z88DK, te damos pistas some cómo saltarse un bicho y cosas así.

Moderador: na_th_an

Avatar de Usuario
na_th_an
Mensajes: 26413
Registrado: Vie, 09 Ene 2009, 12:18

SUVLEIR 3.0

Mensajepor na_th_an » Lun, 05 Mar 2012, 14:43

ENGLISH READERS PLEASE SCROLL DOWN A TINY BIT!
THIS IS JUST A SIMPLE PACKAGE TO CREATE AND DISPLAY SIMPLE VECTORIAL IMAGES ON THE SPECTRUM

Hemos medio arreglado SUVLEIR 2 para incluir un par de cosas que necesitábamos para hacer una idea de olla, y lo hemos llamado SUVLEIR 3. Además, como Britlion en el foro de ZX Basic ha portado la rutina de relleno que usábamos, SPPFill, de Alvin Albrecht, a ZX Basic, ahora podemos usar los diseños vectoriales de forma nativa desde nuestro juego en ZX Basic.

Repego aquí las mini instrucciones, y dejo la chicha gorda para un mini tutorial de cómo integrar esto con un sencillo motor de movimiento en vista cenital que publicaré en tcyr.

Por cierto, casi todo lo que dice en el minimanual de SUVLEIR 2 :arrow: http://www.ojodepez-fanzine.net/mojonia ... f=12&t=538 es aplicable a este SUVLEIR 3, así que no está de más releérselo.


$this->bbcode_second_pass_quote('', 'C')omo usar SUVLEIR 3

Suponemos que ya hemos hecho un dibujo con draw.exe... Es un poco tosco pero no debería ser demasiado complicado hacerse con él. Al pulsar "S" en draw.exe se nos generará un archivo import.bin en la misma carpeta: es el binario de nuestro dibujo. Este binario además contendrá un mapa de durezas a nivel de carácter comprimido con un sencillo RLE. El mapa de durezas podemos editarlo pulsando "G" en el editor y pintando los rectángulos correspondientes.

Una vez tengamos import.bin...

USANDO SINCLAIR BASIC

Si usamos Sinclair BASIC puro en un emulador de Spectrum, tendremos que hacer lo siguiente:

1.- Hacer un CLEAR X, con X = 62000 - N - 1, donde N es lo que ocupa, en bytes, el archivo import.bin.
2.- Importamos gfxparser.bin en 63000
3.- Importamos import.bin en RAM, por ejemplo en 62000 - N
4.- Para mostrar la imagen, haremos:
$this->bbcode_second_pass_code('', '10 LET msb=INT (address/256): LET lsb=address-256*msb: POKE 65366, lsb: POKE 65367, msb: RANDOMIZE USR 63000')
Donde "address" es la dirección donde cargamos import.bin

5.- La rutina dibujará el diseño en pantalla y descomprimirá el mapa de durezas a partir de 62000. Por tanto, para ver si la posición x, y es un obstáculo, basta con:
$this->bbcode_second_pass_code('', '20 IF PEEK (62000 + 32 * y + x) = 1 THEN PRINT "Obstaculo"')

USANDO ZX BASIC

Si usamos el compilador ZX Basic de Boriel, el proceso es mucho más cómodo, en especial si usamos varias imagenes.

1.- Copiar los archivos gfxParser.bas y SPPFill.bas en la carpeta de tu proyecto.
2.- Copiar import.bin en la carpeta de tu proyecto y renombrar el archivo, por ejemplo a "imagen001.bin"
3.- Crear un archivo pantallas.bas que usaremos para incluir todas las imagenes en el proyecto. Por ahora, solo tenemos una, así que este archivo contendrá algo así:
$this->bbcode_second_pass_code('', 'Sub contenedorImagenes
imagen001:
Asm
IncBin "imagen001.bin"
End Asm
End Sub')

Es importante la etiqueta. Si incluimos más imagenes, deberemos crear bloques parecidos dentro de contenedorImagenes, con la etiqueta, y el IncBin dentro del bloque Asm/End Asm.

4.- En nuestro archivo .bas principal, incluimos gfxparser y pantallas.bas:
$this->bbcode_second_pass_code('', '#include once "gfxParser.bas"
#include once "pantallas.bas"')

5.- Para mostrar una imagen, simplemente llamamos a la rutina gpParseBinary pasándole la dirección donde está la imagen, en este caso la dirección de la etiqueta que se define en pantallas.bas justo antes del IncBin de la imagen, o sea:
$this->bbcode_second_pass_code('', 'gpParseBinary (@imagen001)')

6.- Para leer el mapa de durezas, sólo tendremos que llamar a gpIsHard pasándole las coordenadas:
$this->bbcode_second_pass_code('', 'If gpisHard (x, y) Then Print "Obstaculo": End If')


In english:
$this->bbcode_second_pass_quote('', 'H')ow to use SUVLEIR 3

First of all we should make a design using draw.exe (cdraw folder). It's a bit dull (moreso, a bit crap), but it shouldn't be too complicated to get used to it. If you press "S" in draw.exe, an importme.bin fine will be generated in the same folder containing our design. That binary will also contain a character-level hardness map RLE-compressed which you can use to detect colisions (if you used this to draw a game level, for example). The hardness layer can be edited pressing "G" in the editor and drawing over the cells.

Once we have import.bin...

USING SINCLAIR BASIC

If we use pure Sinclair BASIC in a Spectrum emulator, we have to:

1.- Perform a CLEAR X, with X = 62000 - N - 1, where N is import.bin's size in bytes.
2.- Import gfxparser.bin at 63000. That file is in the gfxparser folder.
3.- Import import.bin somewhere over RAMTOP, for example at 62000 - N
4.- To make the parser render the image, we just...
$this->bbcode_second_pass_code('', '10 LET msb=INT (address/256): LET lsb=address-256*msb: POKE 65366, lsb: POKE 65367, msb: RANDOMIZE USR 63000')
Where address is where we imported import.bin.

5.- The routine will render the design on screen and will uncompress the hardness layer from 62000 onwards. So, to check if coordinates (x,y) are non-walkable, you just...
$this->bbcode_second_pass_code('', '20 IF PEEK (62000 + 32 * y + x) = 1 THEN PRINT "Obstacle"')

USING ZX BASIC

If we use Boriel's ZX Basic compiler, the process is way more comfy and less fiddly.

1.- Copy the files gfxParser.bas and SPPFill.bas in your project folder. They are located in the gfxparser_Bas folder.
2.- Copy import.bin to your project folder, and rename it. For example "image001.bin"
3.- Create a file screens.bas which we'll use to include all our screens in the project. Right away we only have one, so this fill should contain something like (don't forget to add a comment on top, ZX Basic might not like your file if you don't).
$this->bbcode_second_pass_code('', '' Images
Sub imageContainer
image001:
Asm
IncBin "image001.bin"
End Asm
End Sub')

The label is very important as it's used to tell the routine where the image is. If we include more images, we should create similar blocks inside the imageContainer subroutine, with new labels, and the correct IncBin inside the assembly block.

4.- In our main .bas file, just include gfxparser and screens.bas:
$this->bbcode_second_pass_code('', '#include once "gfxParser.bas"
#include once "screens.bas"')

5.- To render a image, just call gpParseBinary passing the address where the image is as a parameter. In this case, the address of the label you defined before the assembly block, that is,
$this->bbcode_second_pass_code('', 'gpParseBinary (@image001)')

6.- To read the hardness layer, just call gpIsHard passing the coordinates:
$this->bbcode_second_pass_code('', 'If gpisHard (x, y) Then Print "Obstacle": End If')
Adjuntos
SUVLEIR3.rar
(345.28 KiB) Descargado 645 veces
Como diría Rorshach: "Urm..."