Well, as I am developing my current game, Hunters, I have seen some freezing of the program. This is mostly due to only having half the memory I normally do, but it made me think: how can I optimize my code? I have included both the main file and the header with this post. I hope my code is well documented.
Cookies for help!
My eyes are bleeding.
No offense, but you really need to split up that code a bit more before i will even try to look at it seriously.
Your main function is about 470 lines long.
You almost exclusively use globals.
You declare/define all your classes in one .h file.
But enough of that 
At a glance;
while (clock() < log_time) {}
Use proper timing (search the forum), and see if the problems clear up.
Use a profiler and isolate some functions for us or write some pseudo code.. i don't have time to go through code but if you posted snippets or ideas i and others could make some quick comments.
In terms of memory: pass by reference, mmap large files, use a memory pool if you have lots of allocation/deallocation. Make your contructors as simple as possible and use initialization syntax for variables rather than assignment. (some compilers still haven't figured this out in all cases).
I really don't think you have anything that is overly time-/memory- consuming.
Remake your timing function. clock() has very (!) poor accuracy; it only changes value about 6-7 times per second (on winXP).
Try it yourself:
Well, I did this:
long timer; void plus_time() {timer++}; install_int(plus_time, 1);
instead of clock(), and it runs a lot better now. Thanks! 
As for the code, it was in just 1 file for quite a while. I split it for a bit of convenience. I use globals out of habit, and it seems to work just fine. (I really don't like using non-global variables that much)
You should try to think about the design before you start coding, so you don't have to write everything as a global "just in case". But anyway; glad it worked better with allegro's timer 
Also, you should read the timer section in the manual fort he "proper" way to do it (volatile etc).
I have considered replacing the shot and enemy arrays with vectors. Think that would help at all?
I think it would. It would conveniently remove the cap on max number of enemies...
Oh. Yeah. Cool. BTW, the actual max number is 80 right now... 
Hey, I think I found something: When I include <vector>, I get warning about includes with:
<ul>
<li> windows.h</li>
<li> c++io.h</li>
<li> fpos.h</li>
<li> gthr.h</li>
<li> gthr-default.h</li>
<li> wingdi.h</li>
<li> iosfwd.h</li>
<li> stl_algobase.h</li>
<li> vector.h</li>
</ul>
Does anyone know what's wrong?
clock() has very (!) poor accuracy; it only changes value about 6-7 times per second (on winXP).
It does not do what you think it does...
Well, anyone know why <vector> is trying to include "windows.h"? Please?
It returns the number of "ticks" (1000/second on my machine) since the process started. Only, it does so in rather large "jumps".
Or am i wrong?
kikaru, can you paste all of your include statements in order.
Ok, here:
#include <allegro.h> #include <math.h> #include <stdio.h> #include "hunters.h" #include <vector>
hunters.h has this in the include:
#include <allegro.h> #include <math.h> #include <stdio.h> #include <vector>
[EDIT]
Hey, isn't there like "winalleg.h" or something that I need to include? 
[EDIT 2]
I added "winalleg.h", and it work perfectly! Thanks for your help guys!