Skip to content

Instantly share code, notes, and snippets.

@dideler
Created August 18, 2012 11:53
Show Gist options
  • Save dideler/3386363 to your computer and use it in GitHub Desktop.
Save dideler/3386363 to your computer and use it in GitHub Desktop.
Halo 3: Power Weapons Respawn Timer

Now you can play like a pro, without paying a coach!

######History

I made this while I played Halo 3 around 2008/2009. Why?

  1. I needed better control of power weapons during matches
  2. I wanted to start learning C
  • This was probably my first C program (besides a Hello World)

It was done quickly and dirty. It's pretty shitty but it did its job.

"If it looks stupid but works, it ain't stupid". -Abraham Lincoln

/**
* Halo 3 Weapons Timer
* Author: Dennis Ideler
*/
#include <stdio.h>
#include <time.h>
int main()
{
int sec = 900; // A match is 15 minutes long, or 900 secs.
clock_t t, r, s, m; // Type capable of representing clock ticks
// and supports arithmetical operations.
t = clock() + sec * CLOCKS_PER_SEC; // Convert to clock cycles.
// clock() retruns amount of
// time program been running
r = clock() + 180 * CLOCKS_PER_SEC;
s = clock() + 150 * CLOCKS_PER_SEC;
m = clock() + 120 * CLOCKS_PER_SEC;
while (clock() < t) // Loop until wait time is reached.
{
if(clock() >= m)
{
puts("\n\nMAULER");
m = clock() + 120 * CLOCKS_PER_SEC;
}
if(clock() >= s)
{
putchar('\a');
puts("\n\nSNIPERS");
s = clock() + 150 * CLOCKS_PER_SEC;
}
if(clock() >= r)
{
putchar('\a');
puts("\n\nROCKETS!");
putchar('\a');
r = clock() + 179 * CLOCKS_PER_SEC; // Minus 1 second to recover from time spent beeping.
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment