Post found in the Mojon Twins Forum

Sometimes I give in to reposting already discovered conversations and posts. This entry was found on the Mojon Twins forum regarding tilepaint in the FASE engine.

This Quote would be from Antonio Villena….

It’s not really a function, it’s a macro. It’s called tilepaint. After updating the tile array tiles you have to tell the engine using tilepaint which is the smallest tile rectangle that covers the area you want to update.

For example something like this: tilepaint (1, 2, 3, 4) updates the rectangle that goes from (1, 2) to (3, 4).

I know it’s a bit of a pain in the ass but it’s done that for reasons of efficiency. It would be more convenient to have a second tile array with which to compare to see which tiles the user has changed, but it would be slower.

Here you do a casting:

print_value(3,10, (int) getattr(tmpx, tmpy));

The macro getattr does the following:

#define getattr(x,y) map_attr[x + (y << 4) – y]

The tiles array is declared like this:

unsigned char *tiles= 0x5b40;

When parsing the macro, something like this happens:

print_value(3,10, (int) tiles[tmpx+tmpy*15]);

So you are going to integer 2 bytes (in another architecture would be 4)
an array of unsigned char (one byte).

Anyway, I've created a main.c (with the game.tap) modified from what there is right now the repository that shows the tile number where the character is going, you can be guided by that code.

By the way I have reorganized the directories according to your scheme and compiled in windows. If you have time try it to see if it does also in Linux.

The use of tiles is very flexible, you can change the tiles of the current screen at your leisure with the tiles array and indicate the tile rectangle to be updated with the tilepaint macro. I recommend that you read the reame.html
and try to understand the demo of main.c. If you do not understand something about the demo, you know, ask.

Advertisements

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:

WordPress.com Logo

You are commenting using your WordPress.com 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