From b9f20aade86302d710a5b4d9f6669961b5b2503c Mon Sep 17 00:00:00 2001
From: black <black@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sun, 5 Dec 2004 13:58:16 +0000
Subject: [PATCH] -Fixed a minor bug in CL_Video -Changed func_t from int to
 unsigned int - probably this breaks some things  but at least it fixes an
 annoying crash of the DP with the current Nexuiz  build.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4829 d7cf8633-e32d-0410-b094-e92efae38249
---
 cl_video.c       | 2 +-
 pr_comp.h        | 2 +-
 pr_execprogram.h | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/cl_video.c b/cl_video.c
index 7707dd77..2d6069e6 100644
--- a/cl_video.c
+++ b/cl_video.c
@@ -208,7 +208,7 @@ void CL_VideoFrame( void ) // update all videos
 			if( realtime - video->lasttime > CLTHRESHOLD )
 				SuspendVideo( video );
 			else if( video->state == CLVIDEO_PAUSE )
-				video->starttime = realtime + video->framenum * video->framerate;
+				video->starttime = realtime - video->framenum * video->framerate;
 			else 
 				VideoFrame( video );
 
diff --git a/pr_comp.h b/pr_comp.h
index 6b35e5c1..7a744645 100644
--- a/pr_comp.h
+++ b/pr_comp.h
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef PR_COMP_H
 #define PR_COMP_H
 
-typedef int	func_t;
+typedef unsigned int	func_t;
 typedef int	string_t;
 
 typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
diff --git a/pr_execprogram.h b/pr_execprogram.h
index e0e9d24e..5089e275 100644
--- a/pr_execprogram.h
+++ b/pr_execprogram.h
@@ -266,8 +266,10 @@
 				startprofile = profile;
 				pr_xstatement = st - pr_statements;
 				pr_argc = st->op - OP_CALL0;
-				if (!OPA->function)
+				if (!OPA->function )
 					Host_Error("NULL function");
+				else if (OPA->function > (unsigned) progs->numfunctions)
+					Host_Error("Bad function number");
 
 				newf = &pr_functions[OPA->function];
 
-- 
2.39.5