Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14570/include Modified Files: data.h defs.h proto.h wlib.h Log Message: This lengthy patch contains one groundbreaking item - allowing user to configure directly the size of the local and map windows. Most of this patch fixes all the problems that needed to be solved to make this happen. First off, it was necessary to have the netrekrc defaults read in BEFORE windows are generated. So in both cowmain. and playback.c, the order of newwin() and resetdefaults() were exchanged. This created a problem though in the netrekrc Windows Allowed Message settings required the window to actually exist first, so this was yanked out of the resetdefaults() routine and placed into newwin(). It was also copied over to the reread netrekrc function, so that rereading netrekrc will update the WAMs. Half-finished code for rechecking windows geometry after reading defaults is now obsolete, and a comment has been left to that effect. This exchange also fixes one of the problems with richText. The netrekrc richText option now works, as it controls what sort of message windows are created. Still buggy, but at least it's mostly functional. Getting back to the initial goal, WINSIDE and SCALE were moved from defines to variables. This required some changes to be made. Any static variable which relied on WINSIDE had to be moved into functions. This was not so difficult, as it just required some view/fullview variables to be redefined in the star redraw functions, and tts_ypos had to be changed a bit so that the preferred value was not the value in data.c but rather a value based on WINSIDE. With WINSIDE now a variable, the checkGeometry function can now set WINSIDE to match the geometry in the user's netrekrc file. Some (ok a LOT) of work still needs to be done, to separate WINSIDE into 2 variables, TWINSIDE and GWINSIDE, so local and map can be different size squares. Testing WINSIDE=1000 revealed that the star sectors did not scale properly, and indeed it was a design flaw which needed to be fixed. Star sectors now are defined to be the size of the local window, and the star density remains constant no matter what size window. As it is now possible to have GWIDTH divided by star sectors != integer, it was necessary to put in some additonal checks against drawing stars outside of galactic bounds, and to add an additional star sector in either direction to handle the case where we need a fraction of a star sector to fill in space (i.e if WINSIDE = 1000, local stretches 40000 galactic units, that makes galaxy 2.5 star sectors wide, and since most things get rounded down, we need to create 2.5 + 1 = 3 star sectors). It turns out the old code made 4x as many star sectors as there was galaxy, for some odd reason, so this is a nice improvement actually! Since the local window can now be expanded, I added in a dashed line to show the old 20000x20000 local scale, because some data is not sent beyond this (ie other people's weapons). A new INFORANGE constant is defined, and if WINSIDE > INFORANGE, we draw these dashed lines to indicate fog of war. The SMALL_SCREEN option, which wasn't functional anyways, was removed as it is now obsolete. New draw line function W_MakeDashedLine for making a line using the dashed pen. Added in a debug statement to ignore feature packet settings to test the new infoborg features. Index: wlib.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/wlib.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- wlib.h 19 Mar 2007 00:05:13 -0000 1.10 +++ wlib.h 5 Apr 2007 12:57:22 -0000 1.11 @@ -149,6 +149,12 @@ int x1, int y1, W_Color color); +extern void W_MakeDashedLine (W_Window window, + int x0, + int y0, + int x1, + int y1, + W_Color color); extern void W_MapWindow (W_Window window); extern void W_UnmapWindow (W_Window window); extern int W_EventsPending (void); Index: defs.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/defs.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- defs.h 1 Apr 2007 10:11:36 -0000 1.17 +++ defs.h 5 Apr 2007 12:57:22 -0000 1.18 @@ -27,14 +27,6 @@ #define MAXPLASMA 1 #define PKEY 128 - -#ifdef SMALL_SCREEN -#define WINSIDE 400 -#else -#define WINSIDE 500 /* Size of strategic and - * tactical windows */ -#endif - #define CORNER_DIST (int)(sqrt)(WINSIDE*WINSIDE/2) #define BORDER 1 /* border width for option @@ -57,8 +49,6 @@ * on a side */ #define WARP1 20 /* warp one will move 20 * spaces per update */ -#define SCALE 40 /* Window will be one pixel - * for 20 spaces */ #define EXPDIST 350 /* At this range a torp will * explode */ #define DETDIST 1700 /* At this range a player Index: data.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- data.h 4 Apr 2007 10:34:21 -0000 1.70 +++ data.h 5 Apr 2007 12:57:22 -0000 1.71 @@ -48,6 +48,9 @@ extern struct memory universe; extern struct planet pdata[]; +extern int WINSIDE; /* This used to be a define ... */ +extern int SCALE; /* and so was this ... */ + extern unsigned int oldalert; extern unsigned char oldtourn; extern unsigned int oldengflag; Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- proto.h 4 Apr 2007 10:34:21 -0000 1.44 +++ proto.h 5 Apr 2007 12:57:22 -0000 1.45 @@ -560,6 +560,12 @@ int x1, int y1, W_Color color); +void W_MakeDashedLine (W_Window window, + int x0, + int y0, + int x1, + int y1, + W_Color color); void W_CacheLine (W_Window window, int x0, int y0,