What's this about?
A few days ago I found the long version of my old ScreenHack 2008 entry and thought that I could upload it if I worked a bit on the code style and added some comments.
So I went and changed that mess into something a little more readable. Hopefully I didn't break anything in the process.
I made a few changes to the code for readability but I didn't rewrite it all. The logic and the basic way it works remains the same as in the ScreenHack 2008 entry.
So, what's new?
After doing some changes to the code and compressing it, it was about 23 lines long so I thought I might add some more features.
First, I thought about adding sound. One option was to add some sound effect for complete lines but I didn't like the idea. Another option would be to load and play some background tune (MIDI or WAV) but, while I liked this idea, I had to upload a tetris tune and I wasn't sure if that was OK as I wanted to keep it in the original ScreenHack spirit.
So, with sound discarded there was two options left:
Two Rotate buttons instead on one: The original entry had only one Rotate button. I added a second button so now you can rotate left or right.
Wall Kick: In the original entry you can't rotate a piece if it's close to the wall. After squeezing my code as much as I could, I was able to add a simple (yet space-wasting) wall kicking. Unfortunately, it only works on the main walls and not on walls formed with other pieces.
Left/Right to move the piece.
Down to make the piece move down faster.
A/S to rotate the piece left/right.
Esc to quit.
In the long version, I included some different functions for drawing the blocks that may result in versions of the code longer than the ScreenHack limit.
I can't help but to think that pieces need more variety in colors, though.
This is the ScreenHack code for the version in the first image:
2#define f(a,b) for (a = 0; a < b; a++)
In the attached zip you'll find both the long and short versions of the code and the Allegro 4.4 binary for Windows.
In the long version of the code, all identifiers are preceded by a $. If you want to compile this version just do a Replace All to remove those characters.
I also might add this to the Depot.
I hope you like it.