… | |
… | |
1350 | /* f is a number the represents the number of kg above (positive num) |
1350 | /* f is a number the represents the number of kg above (positive num) |
1351 | * or below (negative number) that the player is carrying. If above |
1351 | * or below (negative number) that the player is carrying. If above |
1352 | * weight limit, then player suffers a speed reduction based on how |
1352 | * weight limit, then player suffers a speed reduction based on how |
1353 | * much above he is, and what is max carry is |
1353 | * much above he is, and what is max carry is |
1354 | */ |
1354 | */ |
1355 | f = (carrying / 1000) - max_carry[stats.Str]; |
1355 | float f = (carrying / 1000) - max_carry[stats.Str]; |
1356 | if (f > 0) |
1356 | if (f > 0.f) |
1357 | speed = speed / (1.f + f / max_carry[stats.Str]); |
1357 | speed = speed / (1.f + f / max_carry[stats.Str]); |
1358 | } |
1358 | } |
1359 | |
1359 | |
1360 | speed += bonus_speed / 10.f; /* Not affected by limits */ |
1360 | speed += bonus_speed / 10.f; /* Not affected by limits */ |
1361 | |
|
|
1362 | speed = speed * speed_reduce_from_disease; |
1361 | speed *= speed_reduce_from_disease; |
1363 | |
1362 | |
1364 | /* Put a lower limit on speed. Note with this speed, you move once every |
1363 | /* Put a lower limit on speed. Note with this speed, you move once every |
1365 | * 100 ticks or so. This amounts to once every 12 seconds of realtime. |
1364 | * 25 ticks or so. This amounts to once every 3 seconds of realtime. |
1366 | */ |
1365 | */ |
1367 | if (speed < 0.01f && type == PLAYER) |
1366 | if (speed < 0.04f && type == PLAYER) |
1368 | speed = 0.01f; |
1367 | speed = 0.04f; |
1369 | |
1368 | |
1370 | if (speed != old_speed) |
1369 | if (speed != old_speed) |
1371 | set_speed (speed); |
1370 | set_speed (speed); |
1372 | |
1371 | |
1373 | if (type == PLAYER) |
1372 | if (type == PLAYER) |