Clarification from Antonio Villena

I do want to post some clarifications sent to me by the author of the FASE engine Antonio Villena.

I was having some issues with the edge detection so I had to ask Antonio since I wasn’t feeling all that smart.

Here is his response and it’s worth taking notes.

The clipping code is managed by the engine.
There are different ways to do and you can configure with
clipup, clipdn and cliphr in config.def.

clipup and clipdn is for the Y axis.
There are 3 options: disabled,
solved by a bar and solved by code.
The bar solution is a non-used space of 8 pixels
with attributes ink and paper with the same color.
This way the sprite is hidden.
Solved by code is the elegant solution,
but requires code in the engine (less free bytes for your code).

clipup / clipdn
0, 1 or 2. 0 disabled,
1 clipping bar,
2 with code.
This is for clipping the sprites in the upper bound of the playing area.
If you need clipping, a black clipping bar on top is recommended
because requires minimum code.
Only use with code if the playing window is on the top of the screen
and there is no space for the clipping bar

This elegant solution as a little glitch
(indistinguishable during movement).
If start in even lines the sprite is correctly clipped,
but if start in odd one the sprites starts 1 pixel shifted.
Look at images game.png and game2.png.

For the X-axis there is no code solution.
You only can put cliphr to 1 and using bars to hide.

If you are talking about this little glitch in Y axis,
the only way to solve is with bar solution (clipup and clipdn to 2).

What does this bitshift represent?

x = scrw<<12;

About the <<12 shift. It's related to the scrw constant.
This constant in extracted from map.tmx and generated in build/define.h.
Is the wide in cells of the screen.
In the example is 15 (is a 15×10 cell game area).

A cell in the tile area is 16 pixel, so we really need a < scrw<<4 )

And when you go to the left screen you need position the main character
to the rightmost area (same edge before):

x= scrw8;

So instead of this:

x= scrw<<4<<8

I simplify with 12.

Finally, I sent an example code to Antonio, who noticed an error almost immediately, he is brilliant and quick at reading code.

The bit of code is now irrelevant since I corrected it before I posted the blog, but I had an incorrectly named constant.

This constant “scry” doesn’t exists.
The correct one is scrh (h for height).
Look at build/define.h if you have doubts.
These 4 constants are extracted from gfx/map.tmx.
If you plan to use a fixed background you need to make
a map.tmx with 1×1 screens (maph=1 and mapw=1).

Sorry, but the engine forces you to define a map.

Antonio comments needs to be remembered by me.


Author: andydansby

I'm a hobbyist coder working with the ZX Spectrum. Living in New York state near the Syracuse area. I grew up in Virgina. The first computer my parents bought for me was a Timex Sinclair 2068.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s