
Posted
by Maj.Bitch (24.95.222.*) at
11:57 AM, 3/11/2001:
|
Here goes: Copy your
source files into some directory (preferably not too deep under C:\ ).. Click on your LCCWin32
icon and Open up Wedit. You get a blank screen. I know you're anxious to
get on with compiling but first we are going to configure our wedit
workspace.. Select PROJECT then
CONFIGURATION then select the WORKSPACE TAB.. Here we will make some basic
changes to our Wedit (source editor) which you may find quite helpful.. Do this: Highlight COMMENTS and
select CHANGE COLORS.. Click on the black square in LOWER LEFT CORNER of TOP
(not bottom section).. Hit OKAY. Now, your comments will show up in black
text.. Highlight KEYWORDS and
select CHANGE COLORS. Click on red square on far left of SECOND ROW. Hit
okay.. Now, all our standard C words (like void, return, while, if, etc, will
be in red).. Don't worry about what it looks like right now, just do it
because it'll look just fine when we're done (and you can change it later if
you wish).. Highlight TEXT and select
CHANGE COLORS. Click on the DarkBlue square on 5th Row down, 5th Column over.
Hit okay.. This will be the color of all the rest of the text in our
sourcecode. Highlight BACKGROUND and
select CHANGE COLORS. Click on LightBlue squre on 2nd Row down, 5th Colume
over. Hit okay. This will be the background of our wedit (the colors chosen
work with this background color and are very easy on the eyes.. You'll
see..). Now, our workspace has
been configured. Lastly, select the
GENERAL tab. Make sure that you've got the following selected: "Save
Editor Settings On Exit", "Check Syntax When Saving",
"Use Small Fonts In Output Window", and "Save Files
Automatically Before Build".. These are critical.. For Vertical Line Scroll
- select NORMAL.. Hit OKAY. Let's go and create our
Quake2 project but first close out Wedit (because we want wedit to go ahead
and save our new workspace configuration). Then re-open it up.. Okay... On with creating
our Quake2 project. Select PROJECT then
CREATE because we are going to create our own new Quake2 coding project... It asks you for your
project's name. Call it whatever you want. I name my projects the name of the
directory the source is in. For example, if my directory name is PureDMSrc3
then my project is named that too. I do this in order to avoid confusion as
to which source files in which directory I'm actually working on in wedit...
If I have some source in a project's sub-directories (which I name 1saved,
2saved, 3saved, etc) and sometimes I want to make one of these saved
directories a project also (for testing, etc) then I create a project called
pureDMsrc_3saved (just like that). Do whatever you like but ALWAYS do stuff
to make life simpler.. Anyway.... Okay.. Next, we see that the
name of our project is shown in the first box but we need to enter in the
path for our working directory.. Select BROWSE and find
the directory where your source is located and click on that directory so
that the folder is shown in the open position. Then hit OKAY. Near the bottom of this
little window we need to do this. Make sure that SINGLE
USER is selected.. Make sure that USE
VERSION SYSTEM is not selected.. At the very bottom, click
where it says DYNAMIC LINK LIBARY (DLL) because we want LCC to generate a DLL
file when it compiles. Note that if you were generating an executable (*.exe
file) you'd select console application.. Now, hit CREATE. It will then ask you if
you want to use the WIZARD. Select NO.. We don't want to use the wizard. Now you should see ALL
the *.c files in the directory path you previously entered. If you don't see
any of your source files then you didn't enter the correct directory path so
you need to go back and make that change now.. Okay, to quickly select
all your files do this.. Click on the first source
file on the far left THEN HOLD DOWN SHIFT KEY and click on the last source
file on the far right. This will highlight ALL your source files at once. So
go ahead and do that now and then select OPEN.. This tells the compiler that
these are the source files for your project. Also, here is where
you'll ADD new files to your project and here is where you'll remove source
files from your project. If there are source files in your project directory
which you don't want to be compiled with this project, individually select
the unwanted source files now and hit REMOVE. When you've got all your source
selected hit VALIDATE.. Now, you'll get another
menu window which you'll have to enter in some more information that the
compiler needs. Also, note that each of these menu windows are individually
reachable by later selection PROJECT then CONFIGURATION (if you need them
later).. Okay.. At the top it is asking
you for any pre-processor flags. Do this: type in C_ONLY (just like that..
All caps and no quotation marks). This tells the compiler that our source is
C source only and not C++ or assembly or PASCAL. Just plain C source.. Go
ahead and do that now. Next, you should see the
default path for your lcc include files. This is where the compiler will go
when it finds one of those include statements in your source which look like
this: #include etc. This should be filled in
correctly but you can change the include pathway if your standard include
header files are located someplace special... Next, we get another
window which is our CODE GENERATION menu. Here we add special instructions
for the compiler. Do this: select OPTIMIZE. I've found that the addition of
USE PENTIUM PRO INSTRUCTIONS didn't really add anything which was noticeable
but you can select that one too.. I just select OPTIMIZE and that's it.. Next, make sure you
unselect GENERATE DEBUG INFO because we don't want debug information being
placed inside our gamex86.dll output file. We want a lean and mean dll (for
speed!).. Next, leave the remainder
of the selections in this menu window alone EXCEPT change the WARNING LEVEL
to ALL.. We want to be notified by the compiler of ALL warnings which are
generated during compilation.. Now, Hit NEXT.. Here we are in the LINKER
SETTINGS menu. At the top where it says
output file name, it gives you it's best guess.. Delete all this and type in
the following: C:\quake2\baseq2\gamex86.dll (just like that without any
quotes).. Note, you'll have to
enter this in every time you create a new quake project. This is exactly what
you'll do because this is the default pathway that the quake engine looks for
its gamex86.dll file. However, you can change this to another pathway but
you'll have to tell the quake engine where to find the dll file by doing a
SET GAME console command.. When you've got it all typed in, continue on.. Next, it we need to tell
it any additional files to be linked with our gamex86.dll output file. Here
we enter in this: game.def (just like that).. Your game.def file should be
placed in your LCC sub-directory. We'll do that later.. Here is also where we
link in other *.lib libraries in with our dll output file. Next, the remaining stuff
should already be set appropriately for you but we need to do this.. Where it
says ENTRY POINT we need to type in this: GetGameAPI (just like that). This
tells our compiler to tell other programs (namely the quake2 engine) which
will be using our dll output file that this is where they get into our dll.
This is our dll's entry point. So, go ahead and type that in.. NOTE: Every time you ADD
or REMOVE a file from the project, this menu gets reset back to the defaults
so you'll find yourself in here again (PROJECT, CONFIGURATION, LINKER)
re-entering in the game.def and GetGameAPI information. Bug in LCC? Don't
quite know but this is what I find myself doing quite often.. Leave the bottom line
BLANK.. Hit NEXT. (we are almost
done!).. Lastly, it asks us for
any debugger information in the DEBUGGER menu. Since we've disabled debugger
settings previously, you don't have to do anything with this window. Just hit FINISH. Now, Wedit will open ALL
your project files and a window will appear at the bottom of your screen
where it will show you a progress bar while it generates your Makefile.
Depending on the speed of your computer, this should go very fast. Now, you've got your own
makefile generated for your own project! But... We're not done
quite yet so don't start celebrating. Before we compile we have
to make our game.def file which we told the linker we wanted it to link up
with our dll output file when it compiles. Do this: Open up a simple text
editor (any editor will do) and type in this: EXPORTS Just like that and save
the file as game.def in your LCC sub-directory. If you've got a game.def file
available in some other lcc sub-directory then now is the time to just copy
and paste it into this project's lcc sub-directory. This game.def file tells
the lcc compiler that we want it to export our entry point (like we told it
to)... If you try to compile
without the game.def file, it will give you an error message saying it
couldn't find your game.def file that we told it to link with. OKAY... NOW YOU CAN
COMPILE! Do this: Select COMPILER and
REBUILD-ALL (or hit your F9 key).. To close out the opened
files, hit Ctrl-F4 Notice that all your
C-Language keywords are in red. This is very helpful because when you are
typing in code and you mispell a keyword you'll realize the mistake right
away.. Okay.. you're done! Maj.Bitch |