#elif defined(SVQC)
#endif
+float showfps_prevfps;
+float showfps_prevfps_time;
+int showfps_framecounter;
+
+float showfps_delay;
+
+float showfps_frametimeavg;
+float showfps_frametimeavg1; // 1 frame ago
+float showfps_frametimeavg2; // 2 frames ago
+void FPSReporter_Think()
+{
+ if(!sv_showfps) { return; }
+
+ float currentTime = gettime(GETTIME_REALTIME);
+ if(cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage"))
+ {
+ float currentframetime = currentTime - showfps_prevfps_time;
+ showfps_frametimeavg = (showfps_frametimeavg + showfps_frametimeavg1 + showfps_frametimeavg2 + currentframetime)/4; // average three frametimes into framecounter for slightly more stable fps readings :P
+ showfps_frametimeavg2 = showfps_frametimeavg1;
+ showfps_frametimeavg1 = showfps_frametimeavg;
+
+ float weight;
+ weight = cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight");
+ if(currentframetime > 0.0001) // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter.
+ {
+ if(fabs(showfps_prevfps - (1/showfps_frametimeavg)) > showfps_prevfps * cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold")) // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant
+ showfps_prevfps = (1/currentframetime);
+ showfps_prevfps = (1 - weight) * showfps_prevfps + weight * (1/showfps_frametimeavg); // framecounter just used so there's no need for a new variable, think of it as "frametime average"
+ }
+ showfps_prevfps_time = currentTime;
+ }
+ else
+ {
+ showfps_framecounter += 1;
+ if(currentTime - showfps_prevfps_time > autocvar_hud_panel_engineinfo_framecounter_time)
+ {
+ showfps_prevfps = showfps_framecounter/(currentTime - showfps_prevfps_time);
+ showfps_framecounter = 0;
+ showfps_prevfps_time = currentTime;
+ }
+ }
+
+ if(time >= showfps_delay)
+ {
+ showfps_delay = time + sv_showfps;
+ localcmd("\ncmd report fps ", sprintf("%.*f", autocvar_hud_panel_engineinfo_framecounter_decimals, showfps_prevfps), "\n");
+ }
+
+ //drawstring_aspect(pos, sprintf(_("FPS: %.*f"), autocvar_hud_panel_engineinfo_framecounter_decimals, prevfps), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+}
+
entity porto;
vector polyline[16];
void Porto_Draw()
else if(fovlock > 0 && autocvar_cl_specfov) { setproperty(VF_FOV, GetCurrentFov(fovlock)); }
else { setproperty(VF_FOV, GetCurrentFov(fov)); }
+ FPSReporter_Think();
+
float tempcamera = false;
if(gametype == MAPINFO_TYPE_JAILBREAK)
self.velocity_z = 225;
self.flags |= FL_WATERJUMP;
SET_JUMP_HELD(self);
+#ifdef SVQC
self.teleport_time = time + 2; // safety net
+#elif defined(CSQC)
+ pmove_waterjumptime = time + 2;
+#endif
}
}
}
void PM_Main()
{
- float buttons = PHYS_INPUT_BUTTON_MASK(self);
+ int buttons = PHYS_INPUT_BUTTON_MASK(self);
#ifdef CSQC
self.items = getstati(STAT_ITEMS, 0, 24);
self.parm_idlesince = time;
}
#endif
- float buttons_prev = self.buttons_old;
+ int buttons_prev = self.buttons_old;
self.buttons_old = buttons;
self.movement_old = self.movement;
self.v_angle_old = self.v_angle;
self.race_penalty = 0;
#endif
- float not_allowed_to_move = 0;
+ bool not_allowed_to_move = false;
#ifdef SVQC
if (self.race_penalty)
- not_allowed_to_move = 1;
+ not_allowed_to_move = true;
#endif
#ifdef SVQC
if (time < game_starttime)
- not_allowed_to_move = 1;
+ not_allowed_to_move = true;
#endif
if (not_allowed_to_move)