DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Code] Map Controlled Par-Times
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Sun Aug 21, 2005 11:13 am
   Subject: [Code] Map Controlled Par-Times
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

Map Controlled Par Times

Open wl_def.h file and add this line in the "gamestate: defines:

::: CODE :::

#ifdef MAPCONTROL
   float      partime;
#endif   


Next Open wl_game.c and go to the GameLoop function.. find these lines:

::: CODE :::

#ifdef SPEAR
      if (gamestate.mapon == 20)   // give them the key allways
      {
         gamestate.keys |= 1;
         DrawKeys ();
      }
#endif


And add these lines after them:

::: CODE :::

#ifdef MAPCONTROL
      gamestate.partime = 2.0;
      if (tilemap[62][0]>=1 && tilemap[62][0] <=20)
      {
         gamestate.partime = tilemap[62][0];
         if (tilemap[63][0]>=1 && tilemap[63][0] <=3)
         {
            switch(tilemap[63][0])
            {
               case 1: gamestate.partime += .25; break;
               case 2: gamestate.partime += .5; break;
               case 3: gamestate.partime += .75; break;
            }
         }
      }
      gamestate.partime = (gamestate.partime * 4200)/70;
#endif


Lastly, we need to change the wl_inter.c file. So open the file and find the "LevelCompleted" routine. Edit the beginning of the file to look like this:

::: CODE :::

#ifdef MAPCONTROL
   float times_time;
   int t;
#else
   typedef struct {
         float time;
         char timestr[6];
         } times;
#endif


Find the lines:

::: CODE :::

   times parTimes[]=
   {
#ifndef SPEAR


And add directly ABOVE them this:

::: CODE :::

#ifdef MAPCONTROL

   char   times_timestr[6] = "02:00 ";
   times_time = 2.0;
   t = 2;   
   if(tilemap[62][0] >= 1 && tilemap[62][0]<=20)
   {
      t = tilemap[62][0];
      times_time = t;
      times_timestr[0] = '0' + t/10;
      times_timestr[1] = '0' + t%10;
   }
   switch (tilemap[63][0]>=1 && tilemap[63][0] <=3)
   {
      case 1: // 15
         times_time += .25;
         times_timestr[3] = '1';
         times_timestr[4] = '5';
         break;
      case 2: // 30
         times_time += .5;
         times_timestr[3] = '3';
         break;
      case 3: // 45
         times_time += .75;
         times_timestr[3] = '4';
         times_timestr[4] = '5';
         break;
   }   
#else   


Scroll down a little further in the code and find the lines:

::: CODE :::

    {0,   "??:??"},   // Secret level 2
#endif
   };


And add the following After it:

::: CODE :::

#endif


Next, scroll down a little further and find the lines:

::: CODE :::

    #ifdef SPANISH
    Write(30,12,parTimes[gamestate.episode*10+mapon].timestr);
    #else
    Write(26,12,parTimes[gamestate.episode*10+mapon].timestr);
    #endif


and edit it to look like this:

::: CODE :::

#ifdef MAPCONTROL
    Write(26,12,times_timestr);
#else
    #ifdef SPANISH
    Write(30,12,parTimes[gamestate.episode*10+mapon].timestr);
    #else
    Write(26,12,parTimes[gamestate.episode*10+mapon].timestr);
    #endif
#endif


And lastly, scroll down a little further to find the line:

::: CODE :::

    if (gamestate.TimeCount<parTimes[gamestate.episode*10+mapon].time*4200)
      timeleft=(parTimes[gamestate.episode*10+mapon].time*4200)/70-sec;


And modify that line to look like this:

::: CODE :::

#ifdef MAPCONTROL
    if (gamestate.TimeCount<times_time*4200) timeleft=(times_time*4200)/70-sec;
#else   
    if (gamestate.TimeCount<parTimes[gamestate.episode*10+mapon].time*4200)
      timeleft=(parTimes[gamestate.episode*10+mapon].time*4200)/70-sec;
#endif


That's it.. To enable the Partimes from the map, just add the line:

#define MAPCONTROL

to your version.h file and compile the source. It uses the top 2 rightmost points on the map to control the partime now. [62][0] = the minutes for that level... and [63][0] = the seconds for that level. So lets say you wanted a 3:45 par time for the level (3 mins 45 secs)... Then we would place wall value 3 in [62][0] and wall value 3 in [63][0]. It's that simple.

The values for [63][0] can be:

wall tile 0 (mapedit undefined or blank) = :00 seconds
wall tile 1 = :15 seconds
wall tile 2 = :30 seconds
wall tile 3 = :45 seconds

So enjoy editing your games with this easier to use Par-Time control...

Greg
BrotherTank
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Code] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 11220 Tue Mar 11, 2008 12:02 am
AlumiuN View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2381 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 1703 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 1969 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2700 Sun Oct 26, 2003 1:21 am
Guest View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group