Giel van Schijndel schreef:
> Dennis Schridde schreef:
>   
>> Am Sonntag, 31. Dezember 2006 00:07 schrieb Giel van Schijndel:
>>     
>>> Dennis Schridde schreef:
>>>       
>>>> Did you remove the hardcoded framerate of 60 before?
>>>> Otherwise you will hardly get anymore than 60fps...
>>>>         
>>> About this hard coded fps setting. Is it the call to SDL_setFramerate()
>>> in lib/framework/frame.c: frameInitialise?
>>>       
>> Yes, I mean that.
>>     
>>> Seems to me btw that we could better put this in a config file or so
>>> than a hard coded value.
>>>       
>> Yes we could. I just didn't have the time to do it, yet...
>>     
> This patch implements it as a configfile setting.
That patch seems to also modify an assert (just to clarify what it
means). If however you don't want that modification, then this one
*only* applies the required changes for the addition of an fps config
setting.

-- 
Giel
Index: lib/framework/frame.c
===================================================================
--- lib/framework/frame.c       (revision 586)
+++ lib/framework/frame.c       (working copy)
@@ -234,6 +234,16 @@
        }
 }
 
+void setFPSlimit(int newfps)
+{
+       SDL_setFramerate( &wzFPSmanager, newfps );
+}
+
+int getFPSlimit()
+{
+       return SDL_getFramerate( &wzFPSmanager );
+}
+
 /*
  * frameInitialise
  *
@@ -279,7 +289,7 @@
        InitFrameStuff();
 
        SDL_initFramerate( &wzFPSmanager );
-       SDL_setFramerate( &wzFPSmanager, 60 );
+       setFPSlimit(60);
 
        // Initialise the resource stuff
        if (!resInitialise())
Index: lib/framework/frame.h
===================================================================
--- lib/framework/frame.h       (revision 586)
+++ lib/framework/frame.h       (working copy)
@@ -67,7 +67,16 @@
  */
 extern UDWORD frameGetAverageRate(void);
 
+/** sets the used framerate limit
+ * \param newfps new framerate limit
+ */
+extern void setFPSlimit(int newfps);
 
+/** returns the used framerate limit
+ * \return currently used framerate limit
+ */
+extern int getFPSlimit();
+
 /* Load the file with name pointed to by pFileName into a memory buffer. */
 BOOL loadFile(const char *pFileName,           // The filename
               char **ppFileData,       // A buffer containing the file contents
Index: src/configuration.c
===================================================================
--- src/configuration.c (revision 586)
+++ src/configuration.c (working copy)
@@ -480,6 +480,15 @@
                setWarzoneKeyNumeric("radarTerrainMode", radarDrawMode);
        }
 
+       // fps limit
+       if(getWarzoneKeyNumeric("fps", &val))
+       {
+               setFPSlimit(val);
+       } else {
+               setFPSlimit(60);
+               setWarzoneKeyNumeric("fps", 60);
+       }
+
        return closeWarzoneKey();
 }
 
@@ -552,6 +561,7 @@
 
        setWarzoneKeyNumeric("radarObjectMode",(SDWORD)bEnemyAllyRadarColor);   
 // enemy/allies radar view
        setWarzoneKeyNumeric("radarTerrainMode",(SDWORD)radarDrawMode);
+       setWarzoneKeyNumeric("fps", getFPSlimit());
 
        if(!bMultiPlayer)
        {
Index: src/keybind.c
===================================================================
--- src/keybind.c       (revision 586)
+++ src/keybind.c       (working copy)
@@ -295,7 +295,7 @@
 /* Writes out the frame rate */
 void   kf_FrameRate( void )
 {
-       CONPRINTF(ConsoleString,(ConsoleString,"FPS %d; PIEs %d; polys %d; 
Terr. polys %d; States %d", frameGetAverageRate(), loopPieCount, loopPolyCount, 
loopTileCount, loopStateChanges));
+       CONPRINTF(ConsoleString,(ConsoleString,"FPS %d; Target-FPS: %d; PIEs 
%d; polys %d; Terr. polys %d; States %d", frameGetAverageRate(), getFPSlimit(), 
loopPieCount, loopPolyCount, loopTileCount, loopStateChanges));
        if (bMultiPlayer) {
                        CONPRINTF(ConsoleString,(ConsoleString,
                                                "NETWORK:  Bytes: s-%d r-%d  
Packets: s-%d r-%d",

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to