The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: muton | Created: 2019-06-19 08:05:35
Subject: How to turn on slow time when it falls below a certain speed
Hi All.

I would like to set it to be 0.5x (turn on slow time) when the speed falls below a certain speed (for example, 50km / h).
However, I do not know how to add code.

Can someone help me?

Last Edited: 2019-07-01 11:47:34 by muton
    Author: muton | Created: 2019-06-25 11:00:29
    Subject: Re: How to turn on slow time when it falls below a certain speed
    I found those codes in ReTimeMod.
    I want to execute case 0 of ReTimeMod when the vehicle speed (pub.speed) is less than 40km / h.
    However, at that time, I do not know how to execute only Case 0 of ReTimeMod.

    I'm glad to get some advice.

    ReTimeMod (void * vcmd)
    {
         long cmd = (long) vcmd;

         switch ((int) cmd) {
             case 0:
                 ReInfo-> _ reTimeMult * = 2.0;
                 if (ReInfo-> _ reTimeMult> 64.0) {
                     ReInfo-> _ reTimeMult = 64.0;
                 }
                 break;
             case 1:
                 ReInfo-> _ reTimeMult * = 0.5;
                 if (ReInfo-> _ reTimeMult <1.0f / 128.0f) {
                     ReInfo-> _ reTimeMult = 1.0f / 128.0f;
                 }
                 break;
             case 2:
                 default:
                 ReInfo-> _ reTimeMult = 1.0;
                 break;
         }

         const int BUFSIZE = 1024;
         char buf [BUFSIZE];

         snprintf (buf, BUFSIZE, "Time x% .2f", 1.0 / ReInfo-> _ reTimeMult);
         ReRaceMsgSet (buf, 5);
    }
    Last Edited: 2019-06-28 11:45:58 by muton