Re: [tuxracer-devel] Speed Boosts
Status: Beta
Brought to you by:
jfpatry
|
From: Bill S. <Bil...@Ve...> - 2000-08-14 15:34:14
|
Course sent as requested. Looking forward to your review ;-).
The speed stuff was trivial, but I'll put some of the relevant code here:
In render_util.c I added the following two functions:
void print_speed()
{
char buff[30];
float v;
flat_mode();
v = (g_game.current_speed / 0.44704);
sprintf( buff, "%.1f MPH", v );
if (v > g_game.max_speed) {
g_game.max_speed = v;
}
print_max_speed();
glColor3f( text_colour.r, text_colour.g, text_colour.b );
glRasterPos2i( 85, 5 );
print_string( GLUT_BITMAP_HELVETICA_10, buff );
void print_max_speed()
{
char buff[30];
flat_mode();
sprintf( buff, "%.1f MPH Max", g_game.max_speed );
glColor3f( text_colour.r, text_colour.g, text_colour.b );
glRasterPos2i( 150, 5 );
print_string( GLUT_BITMAP_HELVETICA_10, buff );
}
g_game.max_speed get initialized where the other stuff does at the start of a
game.
print_speed() is called right after print_time() in racing.c
print_max_speed() gets called in game_over so you can see your max speed at the
end.
The 0.44704 in print_speed converts meters/second to miles/hour.
I'm no C coder, so don't laugh if any of it is pathetic. I basically just copied
the pattern
of print_time.
Enjoy!
Jasmin Patry wrote:
> On Mon, Aug 14, 2000 at 07:12:43AM -0400, Bill Scherer wrote:
> > Jasmin Patry wrote:
> >
> > > On Thu, Aug 10, 2000 at 07:18:39PM +0100, Peter Allen wrote:
> > > > btw why does there appear to be a layer of water (snow coloured) at
> > > > a low level. Is this intentional? (It makes for interesting skate board
> > > > ramps with "water" at the bottom)
> > >
> > > It's just there to prevent the track from ending in empty space. It
> > > will be replaced by something better eventually.
> >
> > Wait... That's one of the best parts of a course I made. If you don't
> > make the last jump, you end up in a pool of water at the bottom and
> > can't finish. You do get to swim around and hunt for herring
> > though...
>
> Heh. :)
>
> > Being my first post to list, let me say that a few of my colleagues
> > and have enjoyed TuxRacer very much. I've added current and max
> > speed displays, which are great fun. I suppose I can come up with a
> > patch if anyone's interested.
>
> We're going to be adding displays very soon. It's simple enough that I
> don't think you need to send a patch (unless you did something very
> clever :), though of course it wouldn't hurt to see how you did it.
> Please post it to the list if you do decide to send it.
>
> > We also have a great course (mentioned above). Is there somewhere to
> > submit them for review?
>
> You can send it to me at jf...@cg.... Please tar and gzip
> before sending. I look forward to playing it!
>
> Thanks,
> Jasmin
>
> --
> Jasmin Patry Master's Student, Dept. of Computer Science
> jf...@cg... http://www.cgl.uwaterloo.ca/~jfpatry/
>
> _______________________________________________
> tuxracer-devel mailing list
> tux...@li...
> http://lists.sourceforge.net/mailman/listinfo/tuxracer-devel
--
William K. Scherer
Sr. Member of Applications Staff - Verizon Wireless
Bill.Scherer_at_VerizonWireless.com
|