FrozenSand / ioq3-for-UrbanTerror-4

The officially supported ioquake3 engine by the Frozen Sand Development Team for the game Urban Terror 4.x
http://www.urbanterror.info
GNU General Public License v2.0
148 stars 65 forks source link

Ignored com_maxfps when client is downloading a file #44

Closed anthonynguyen closed 10 years ago

anthonynguyen commented 10 years ago

(fixes FrozenSand/UrbanTerror42#37)

Barbatos commented 10 years ago

Did you try your fix? Is it working as expected?

anthonynguyen commented 10 years ago

Yes. @Yascor has also confirmed that it works.

ghost commented 10 years ago

True, full downloading speed!

Barbatos commented 10 years ago

Thanks!

fastslack commented 10 years ago

When i try to compile it on linux i got:

DED_CC code/qcommon/vm_x86_64.c
code/qcommon/vm_x86_64.c: In function ‘VM_CallCompiled’:
code/qcommon/vm_x86_64.c:1062:7: warning: variable ‘programCounter’ set but not used [-Wunused-but-set-variable]
  int  programCounter;
       ^
CC code/qcommon/vm_x86_64_assembler.c
code/qcommon/vm_x86_64_assembler.c: In function ‘emit_mov’:
code/qcommon/vm_x86_64_assembler.c:596:11: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
   else if(!arg2.v.reg & R_64)
           ^
LD build/release-linux-x86_64/Quake3-UrT-Ded.x86_64
build/release-linux-x86_64/ded/common.o: In function `Com_Frame':
common.c:(.text+0x4bac): undefined reference to `CL_IsDownloading'
collect2: error: ld returned 1 exit status
make[2]: *** [build/release-linux-x86_64/Quake3-UrT-Ded.x86_64] Error 1
make[2]: Leaving directory `/home/fastslack/mtwProjects/ioq3-for-UrbanTerror-4'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/home/fastslack/mtwProjects/ioq3-for-UrbanTerror-4'
make: *** [release] Error 2
danielepantaleone commented 10 years ago

The new function call needs to be excluded with preprocessor directives: the server engine knows nothing of the client one so at compile time that portion of the code must be excluded:

if (!com_dedicated->integer && com_maxfps->integer > 0 && !com_timedemo->integer 
#if BUILD_CLIENT == 1
&& !CL_IsDownloading()
#endif
) {
// code goes here
anthonynguyen commented 10 years ago

BUILD_CLIENT is a Makefile flag, but it isn't set as a CFLAG, so the preprocessor has no knowledge of it. In this particular case, you'd have to do #ifndef DEDICATED instead of #if BUILD_CLIENT == 1. Another solution is here: Barbatos/ioq3-for-UrbanTerror-4@80567926

danielepantaleone commented 10 years ago

Yeah well, you got the point ^^

anthonynguyen commented 10 years ago

:tongue: