blue-nebula / base

Main repository of Blue Nebula, a fast-paced shooter with a unique parkour system. It is a fork of Red Eclipse and is free software.
https://blue-nebula.org
15 stars 6 forks source link

burndelay and shockdelay 0 causes game to crash #177

Closed MoonPadUSer closed 3 years ago

MoonPadUSer commented 3 years ago

when turning burndelay to 0 the game will crash when you start burning.

MoonPadUSer commented 3 years ago

The line that crashes the game seems to be src/game/game.cpp:941 float fluc = float(millis%burndelay)*(0.25f+0.03f)/burndelay;

MoonPadUSer commented 3 years ago

Just found another line that causes it too src/game/game.cpp:3614 else pc *= 0.75f+(float(millis%burndelay)/float(burndelay*4));

MoonPadUSer commented 3 years ago

another one: src/game/hud.cpp:3289 float pc = interval >= burntime-500 ? 1.f+(interval-(burntime-500))/500.f : (interval%burndelay)/float(burndelay/2); if(pc > 1.f) pc = 2.f-pc;

MoonPadUSer commented 3 years ago

I'll use std::max(burndelay, 1) instead of burndelay everywhere it's used to divide, then I'll add a comment When playing on servers with older version, this value can be overriden to be 0, thus add a check to prevent division by 0

robalni commented 3 years ago

It's the same with shockdelay.

MoonPadUSer commented 3 years ago

I'll make a separate PR for fixing shockdelay