Tutorial *132*
Hand's up all those who remember the "Time Sucks" message if you spent too long on one map in Doom? OK, now hands up all those who missed this rather cool feature when playing Quake? I thought so, most of you. Well, in this tutorial, we are going to make Time Suck in Quake.

The only file we will be modifying today is SBAR.C. Open that up. Find the function void Sbar_SoloScoreboard (void). This is what pops up when you hold down TAB in single player Quake. Go down until you see this bit:



sprintf (str,"Time :%3i:%i%i", minutes, tens, units);

 Sbar_DrawString (184, 4, str);

and replace it with this code:


    if (minutes < 15)

    {

        sprintf (str,"Time :%3i:%i%i", minutes, tens, units);

        Sbar_DrawString (184, 4, str);

    }

    else

    {

        Sbar_DrawString (184, 4, "Time sucks");

    }

As you can see, all we've done is added a simple IF statement to determine whether it's time to make Time Suck. In Doom, the Time Sucks message activated after 60 minutes, but that's a bit too long for my tastes, so I made it 15 minutes.
This only modifies the single player overlay by the way. If you want to change the deathmatch overlay, you have to find the time section in Sbar_DeathmatchOverlay and Sbar_MiniDeathmatchOverlay.

Next, we're going to modify the intermission screen. For this, we need to make a new graphic. I have already done this, you can get it here. It's named timesux.lmp, and you need to place it in the Quake\ID1\gfx directory for this to work. If you're not happy with this graphic, make your own.

Back in SBAR.C, go down the bottom of the file to the void Sbar_IntermissionOverlay (void) function and find this block of code:



// time

dig = cl.completed_time/60;

Sbar_IntermissionNumber (160, 64, dig, 3, 0);

num = cl.completed_time - dig*60;

Draw_TransPic (234,64,sb_colon);

Draw_TransPic (246,64,sb_nums[0][num/10]);

Draw_TransPic (266,64,sb_nums[0][num%10]);

and replace it with this:


// time

dig = cl.completed_time/60;

if (dig < 15)

{

        Sbar_IntermissionNumber (160, 64, dig, 3, 0);

        num = cl.completed_time - dig*60;

        Draw_TransPic (234,64,sb_colon);

        Draw_TransPic (246,64,sb_nums[0][num/10]);

        Draw_TransPic (266,64,sb_nums[0][num%10]);

}

else

{

        pic = Draw_CachePic ("gfx/timesux.lmp");

        Draw_TransPic (203, 54, pic);

}



Again, we check if the minutes are within the normal range, if not, Time Sucks. If you made your own graphic for timesux.lmp, remember to change the code if necessary. If you are using a different file name, and you'll probably have to change the X and Y co-ordinates for Draw_Transpic. There you have it! Time Sucks in Quake!



 
Not logged in
Sign up
Login:
Passwd: