Sure, give me a minute to root it out.
EDIT: Right, this is what I have.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
// Water resistance
if(lplayer->in_water_stable || lplayer->in_water)
{
f32 max_down = 2.0*BS;
if(speed.Y < -max_down) speed.Y = -max_down;
f32 max = 2.5*BS;
if(speed.getLength() > max)
{
speed = speed / speed.getLength() * max;
}
// Start timer for 15 seconds until drowning
StartUnderwaterTimer();
}
lplayer->setSpeed(speed);
}
At the beginning of the environment.cpp near enough, I have this...
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
void StartUnderwaterTimer ()
{
unsigned int x_minutes=0;
unsigned int x_seconds=0;
unsigned int x_milliseconds=0;
unsigned int totaltime=0,count_down_time_in_secs=0,time_left=0;
clock_t x_startTime,x_countTime;
count_down_time_in_secs=15; // 15 is 15 seconds, 1 minute is 60, 1 hour is 3600
// Start The Clock
x_startTime=clock();
// update timer
time_left=count_down_time_in_secs-x_seconds;
while (time_left>0)
{
x_countTime=clock(); // update timer difference
x_milliseconds=x_countTime-x_startTime;
x_seconds=(x_milliseconds/(CLOCKS_PER_SEC))-(x_minutes*60);
time_left=count_down_time_in_secs-x_seconds; // subtract to get difference
}
if (time_left == 0)
{
begin:
ServerRemotePlayer *srp = (0); srp->setHP(srp->getHP() - 1);
Sleep(2000);
goto begin;
}
}