Lunchtime Atic Atac

Snap taken using “Retrotechys Speccy Graphics Viewer/Editor”

After a few boring lunchtimes at work with nothing to do, I started tinkering around with a ZX Spectrum .sna file of Atic Atac, the aim being to be able to read some sensible data from the file and display some atic atac screens, using Blitz3D.

 

Prep Work:

  • firstly I obtained a 48kB .sna file of Atic Atac. I figured that as I have paid for the game twice in my life (ZX Spectrum and Xbox One Rare Replay), I was entitled to peep at the code.
  • I downloaded a decent free Hex Editor.
  • I had a good look at Icemarks Atic Atac data format page, as this gives a lot of guidance on specific areas of the data that pertain to drawing the screen.
  • I added 16kB of padding onto the front of the .sna file so that Icemarks memory offsets matched the file that I had.

 

Dev Program 1 – Find enough data to draw the outline of each type of room.

Atic Atac has 13 different room types, including the last room when you escape the haunted house, and the room when you are falling down a trap door.

The actual X and Y points for drawing each room are stored in two sections for each type room. The first part lists each X and Y co-ordinate for every line required to draw the room and the second part is a list of points so that these X and Y co-ordinates can be connected using lines to draw the room.

Example:

The First part of data looks like –  186,42,186,186,42,186,42,42. It is read as Point 1 X co-ord = 186, Point 1 Y co-ord = 42, Point 2 X co-ord =186, Point 2 Y co-ord=186 and so on.

The second part of the data looks like – 1,2,255,3,2,4,255,255. This i read as “Go to the X and Y co-ords of point 1 and draw a line to the X and Y co-ords of point 2. Then 255 means end of that draw function. Next go to the X and Y co-ords of Point 3 and draw a line to the X and Y co-ords of point 2, then go back to the X and Y co-ords of point 3 and draw a line to the X and Y co-ords of point 4.” Then two 255’s in a row means end of drawing that room.

Dev Prog 1 Input:

Type in which type of room you want to draw (0 to 12) and what scale factor you want to use (1 to 4, 1 being original size)

Dev Prog 1 Output:

Room Type 2, Scale Factor 4

Room Type 1, Scale Factor 3

It all looks pretty good with the exception of room type 7 which has an X co-ordinate error on one of the draw points. After some looking it turns out that room type 7, a sideways stairway, isn’t used in the game so the error wouldn’t ever have shown up.

 

Dev Program 2 – Draw the outline of each game room with room attributes.

Rather than just calling up a type of room, I wanted to be able to call up a room number from the game itself and have it display the correct type of room in the correct colour.

The Atic Atac .sna has a table in it with each room listed as room colour and type, so the data looks like 66,3,68,0,64,5 and is read as:

  • Room 0, Colour 66, Room Type 3
  • Room 1, Colour 68, Room Type 0
  • Room 2, Colour 64, Room Type 5

The room numbered order itself is a bit haphazard to say the least. Room 0 is the start screen, Room 1 is the screen above, Room 2 is screen left of that… and so on through the various rooms/floors.

Dev Prog 2 Input:

Type in which room from the game you want to draw (0 to 148) and what scale factor you want to use (1 to 4, 1 being original size)

Dev Prog 2 Output:

Game room 33, Scale Factor 4

Game room 69, Scale Factor 4

 

Dev Program 3 – Add Room objects to the each room rendered.

The game has an object table. This lists all of the objects in the game along with varous object attributes including the type of object the room number its in, the X and Y position it should be drawn in the room and its orientation.

This object table doesn’t seem to be in any specific order so if you walk into room two, you have to scan the entire table to list what objects are in room 2.

Once you have confirmed that the object belongs in the room that you’re in and you have  the object type, you can then jump to the offset of that specific object which contains the X width of the object in bytes, the Y height of the object in pixel rows and then the bitmap of the object itself, and start to draw it in the correct X, Y and orientation.

Dev Prog 3 Input:

Type in which room from the game you want to draw (0 to 148) and what scale factor you want to use (1 to 4, 1 being original size)

Dev Prog 3 Output:

Game Room 0, Scale Factor 4

Game Room 3, Scale Factor 4

Game Room 6, Scale Factor 4

So with all of this dev work done… “WHAT IS IT GOOD FOR… ABSOLUTELY NOTHING!!” but fun nerdiness all the same.