BCX Basic Forum

You must log on, to access files that were uploaded by BCX forum members. => User Contributions => Topic started by: MrBcx on December 15, 2019, 08:57:58 PM

Title: Tetris
Post by: MrBcx on December 15, 2019, 08:57:58 PM
Here is your early Christmas Present from MrBcx  :-)

I found the original "C" source code on the Wayback Machine and subsequently found it on Github.  The code on the Wayback Machine showed this was programmed in the early 1990's by someone in Japan.  If you go to the Github link (linked at the top of the source file), you can see what the unmodified  version looks like.  I made lots of changes.

I initially got it to compile using Pelles C 9.0 by changing timeGetTime() with GetTickCount() in 3 places.  It was playable for a while but before I could ever finish even one level, all the blocks would turn white.  That was a pretty good indication that there was a resource leak.  I found the leaks, plugged them and started making improvements.  It still has minor glitches occasionally but overall it's very playable.  It doesn't save high scores, or starting levels.  That's for another day (maybe).

There is no BCX Basic file, only my modified "C" file, but I was glad to be able to use some of the BCX routines to simplify my modifications.

The attached zip has the "C" file, a resource file containing the blue background and icon, my Pelles batch file, and a 32 and 64 bit version of the game.

I first played Tetris on my 8-bit Atari a long time ago but I still enjoy it when I just want to kill a few minutes and zone out.

I hope you will enjoy it.   ---MrBcx


PS: Use the arrow keys to play

-- left and right move blocks
-- up arrow rotates blocks
-- down arrow does a "soft down"
-- space bar does a "hard" down

Title: Re: Tetris
Post by: MrBcx on October 03, 2025, 08:39:38 PM
I've tinkered with this off and on over the last 6 years or so.

Here is a somewhat improved version, now coded in BCX BASIC, so future mods will be easier.

'***************************************************************
'  BCX Tetris by MrBcx      October 2025        MIT License
'  Compiles in BED using Pelles C, MSVC(2022), and Clang 21.1.x
'  Compiles in BED using MINGW if you do not link Tetris.res
'
'  Tetris.res contains a manifest, app icon, and a windows bmp
'  of St. Basil's Cathedral that Tetris uses during gameplay but
'  it is not absolutely needed to play the game.
'***************************************************************
Title: Re: Tetris
Post by: Robert on October 04, 2025, 02:25:19 AM
Hi MrBcx:

Nice ! Lots of good stuff to learn from.

The background tile of St.Basil's taught me something. In the lower left of the image are some figures which I discovered were part of a momument; Russian heroes Minin and Pozharsky, who I had never heard of and a statue I had never seen before. The statue used to be in the middle of Red Square but was moved to it's current location when Stalin began his mass military parades in Red Square. Anyway, back to Tetris.

I unpacked the .res and tweaked the contents for my setup.

After I compiled and ran Tetris I noticed that the bottom of the Form was cutoff. I thought to myself that the form size must have been determined for a pre-Vista setup. I looked at your MSVC batch files and saw that the compiler target is Windows 10 but the linker is set to 5.02, (XP ?).

Tetris is a great little game for taking a break and getting a good focus on eye hand coordination.

Thanks
Title: Re: Tetris
Post by: MrBcx on October 04, 2025, 11:41:02 AM
Quote from: Robert on October 04, 2025, 02:25:19 AMHi MrBcx:

Nice ! Lots of good stuff to learn from.

The background tile of St.Basil's taught me something. In the lower left of the image are some figures which I discovered were part of a momument; Russian heroes Minin and Pozharsky, who I had never heard of and a statue I had never seen before. The statue used to be in the middle of Red Square but was moved to it's current location when Stalin began his mass military parades in Red Square. Anyway, back to Tetris.

I unpacked the .res and tweaked the contents for my setup.

After I compiled and ran Tetris I noticed that the bottom of the Form was cutoff. I thought to myself that the form size must have been determined for a pre-Vista setup. I looked at your MSVC batch files and saw that the compiler target is Windows 10 but the linker is set to 5.02, (XP ?).

Tetris is a great little game for taking a break and getting a good focus on eye hand coordination.

Thanks

Thanks Robert ... I've never been a hardcore gamer but I do enjoy short simple
distractions like Tetris, Asteroids, Poker, and one of my favorites World of Goo
while watching YouTube and similar mind numbing activities.
Title: Re: Tetris
Post by: MrBcx on October 04, 2025, 01:27:41 PM
Here is a screen grab of an alternative Cathedral background for anyone wanting it.

I think it gives a restful neutral contrast behind the falling blocks.

Title: Re: Tetris
Post by: MrBcx on October 04, 2025, 06:11:35 PM
FYI -

If it matters to anyone, my updated Lcc-Win32 \include\ and \lib\  files

now successfully compiles my 2025 version of Tetris.


ref: https://bcxbasiccoders.com/smf/index.php?topic=1412.msg7748;topicseen#msg7748