I found which compiler setting I had to twiddle - it was the "Eliminate
unused assignments" one. Now my code compiles to 302,112 bytes too!
Since I had so much trouble with this , I wrote a guide to help others do
it. Here it is , included and also attached - I hope people find it useful -
maybe you should include it as part of the LT source download.
Vic
How to compile the LaserTank source using LCC
[1] Download the LCC compiler system from
http://www.cs.virginia.edu/~lcc-win32/
If you may want to use LCC for other things , you should also download
the documentation.
[2] Install the LCC compiler simply by double-clicking on its icon or name.
I recommmend that you accept the default install directory of C:\lcc to make
what follows easier to do.
[3] Download the LaserTank source files contained in the file source.zip
from Jim Kindley's site at http://www.jccontrols.net/laser/lt4.html
[4] Unzip the source files into the root directory C:\ . This should
automatically create a new directory in C:\lcc called C:\lcc\ltank32 which
contains the source files you need. If not , unzip anywhere , manually
create a directory in C:\lcc and copy or move the unzipped files into the
new directory.
[5] Start up LCC from the Start menu - an editor called Wedit should pop up.
[6] In Wedit , from the menu select File then New then Project... Type any
project name you want into the Project name box , say , LaserTank then click
OK.
[7] A form labelled "Definition of a new project" should appear with your
chosen project name in the first box.
[8] Choose a working directory name and type it into the next box - a good
choice is the directory created in step [4] , in the above case ,
C:\lcc\ltank32
[9] Click on the next box and Wedit should automatically choose an output
directory for you.
[10] Check the "Type of project" area at the bottom. The radio button should
be on "Windows executable". If it is not , click it on.
[11] Click "Create".
[12] An information box will pop up asking if you want to use the wizard.
Click "No".
[13] A window labelled "Add source files to project" will then appear. Click
on the drop-down arrow to the right of the label "Files of type:" and select
"All" from the drop-down list. All the contents of your working directory
should be shown in the window above.
[14] Ctrl-click all the C files (ltank.c , ltank2.c , ltank_d.c and
lt_sfx.c) and also ltank.rc then click "Open".
[15] A window labelled "Source files for project(null)" should appear with
the files you have selected in it. Click "Validate".
[16] A window labelled "Compiler settings" should appear. Select "Optimize"
and "Eliminate unused assignments" and if "Generate Debug info" is selected
, then click it off. When finished , click "Next".
[17] A window labelled "Linker settings" should appear. In the box labelled
"Additional files to be included in the link" , type ole32.lib shell32.lib
winmm.lib and click "Next".
[18] Click "Finish".
[19] A window labelled "Building Makefile" should show for a few seconds ,
followed by a message in red text on the status bar saying "Makefile
generation successful". You are now ready to compile.
[20] Click on "Compiler" from the main menu and select "Make".
[21] The compile and link will occur and you will get a message in the lower
window saying "LaserTank.exe built successfully.(0.8 sec). Look in the \lcc
subdirectory of your working directory to find the LaserTank.exe file .
[22] You can experiment with the various compiler settings by choosing
"Compiler" and then "Settings" from the main menu. Change what you like then
you can either select "Generate makefile" followed by "Make" from the
compiler menu or simply "Rebuild all" from the compiler menu. In version
4.0.3 of LaserTank , you will get the following warning "Warning
c:\lcc\ltank32\ltank2.c: 537 assignment of pointer to struct tagBITMAPINFO
to pointer to char" . This means there is an error in the source code , but
that the compiler has managed to compile successfully anyway , so the error
may be safely ignored. If you change the warning parameter in the compiler
settings from "Normal" to "All" , you will see dozens of errors , all of
which can be safely ignored.
[23] Now that you have successfully built a project , you are ready to edit
it. Get the LCC-Win32 documentation from the LCC web site , learn C , study
Jim Kindley's source code , and start making improvements. Good luck!