From 19a7c38471fc4cf5b2295e9fc60737145363e0a5 Mon Sep 17 00:00:00 2001
From: havoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Thu, 5 Apr 2007 08:47:17 +0000
Subject: [PATCH] fixed bug where dpmod weapons fired twice as often as
 intended (frametime is now 0 in calls to PlayerPreThink/PlayerPostthink on
 input moves)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7054 d7cf8633-e32d-0410-b094-e92efae38249
---
 sv_phys.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sv_phys.c b/sv_phys.c
index 0dd67604..08e8aea8 100644
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -2004,13 +2004,16 @@ void SV_Physics_ClientMove(void)
 	prvm_edict_t *ent;
 	ent = host_client->edict;
 
-	// call player physics
+	// call player physics, this needs the proper frametime
+	prog->globals.server->frametime = sv.frametime;
 	SV_ClientThink();
 
-	// call standard client pre-think
+	// call standard client pre-think, with frametime = 0
 	prog->globals.server->time = sv.time;
+	prog->globals.server->frametime = 0;
 	prog->globals.server->self = PRVM_EDICT_TO_PROG(ent);
 	PRVM_ExecuteProgram (prog->globals.server->PlayerPreThink, "QC function PlayerPreThink is missing");
+	prog->globals.server->frametime = sv.frametime;
 
 	// make sure the velocity is sane (not a NaN)
 	SV_CheckVelocity(ent);
@@ -2033,10 +2036,12 @@ void SV_Physics_ClientMove(void)
 
 	SV_CheckVelocity (ent);
 
-	// call standard player post-think
+	// call standard player post-think, with frametime = 0
 	prog->globals.server->time = sv.time;
+	prog->globals.server->frametime = 0;
 	prog->globals.server->self = PRVM_EDICT_TO_PROG(ent);
 	PRVM_ExecuteProgram (prog->globals.server->PlayerPostThink, "QC function PlayerPostThink is missing");
+	prog->globals.server->frametime = sv.frametime;
 
 	if(ent->fields.server->fixangle)
 	{
-- 
2.39.5