----------  Weitergeleitete Nachricht  ----------

Subject: WZ2100 Res Proj: Shurcool's Selection Box Patch
Date: Samstag, 6. Januar 2007 23:36
From: Dmitri Shuralyov <[EMAIL PROTECTED]>
To: [email protected]

Hi,

  This is my small patch to improve/fix the way the selection box is drawn
 (it's the box that appears when you try to select multiple units at once).

  My changes are:
  1) [FIX/ADDITION] -the selection box is now filled in with a translucent
 shade of grey, like Pumpkin Studios intended it, but it wasn't working due
 to a bug. Can be disabled with the --noTranslucent command line parameter
 (theoretically along with all other transparency effects, but in practice it
 doesn't seem to affect anything else because the check for
 war_GetTranslucent() is not used anywhere else). 2) [FIX] -the selection box
 now always pulses consistently inwards, no matter in which orientation you
 drag it (ie. from top-left to bottom-right, from bottom-left to top-right,
 etc.) 3) [FIX] -the selection box doesn't flash/disappear momentarily
 sometimes when the mouse cursor is positioned at the very edge of the screen
 anymore

  Only two files were modified: display3d.c and warzoneconfig.c

  In display3d.c, only one function was modified: (Lines 3437-3478)
/* Draws the strobing 3D drag box that is used for multiple selection */
  void drawDragBox( void )
  -the 2nd and 3rd changes were made in here

  In warzoneconfig.c, only one function was modified: (Lines 60-71)
  //Sets all states
  void war_SetDefaultStates(void)
  -the first change was done here. I've changed so that by default it sets
  war_SetTranslucent(TRUE);
  war_SetAdditive(TRUE);
  because there is no reason for them to be disabled by default (as there are
 no other value for them loaded in the config file or anything, but it can be
 set to false through command lines --noTranslucent and --noAdditive). This
 is needed to make the selection box filled in by default.

  I know that you guys can see the differences I've made yourself with the
 Diff tool or whatever, but I just wanted to explain what I've changed and
 with what purpose. I hope it's all correct (I've compiled it of course, and
 it works fine).

  Here are some low quality jpeg shots showing the difference in the
 selection box before and after:

  Before - http://img177.imageshack.us/img177/1811/wzbeforexi5.jpg
  After - http://img458.imageshack.us/img458/9318/wzaftertg7.jpg

  Thanks,
  shurcooL

-------------------------------------------------------
Index: src/display3d.c
===================================================================
--- src/display3d.c     (revision 602)
+++ src/display3d.c     (working copy)
@@ -3436,6 +3436,9 @@
 /* Draws the strobing 3D drag box that is used for multiple selection */
 void   drawDragBox( void )
 {
+       int minX, maxX;         // SHURCOOL: These 4 ints will hold the corners 
of the selection box
+       int minY, maxY;
+
        if(dragBox3D.status == DRAG_DRAGGING AND buildState == BUILD3D_NONE)
        {
                if(gameTime - dragBox3D.lastTime > BOX_PULSE_SPEED)
@@ -3447,15 +3450,28 @@
                        }
                        dragBox3D.lastTime = gameTime;
                }
+
+               // SHURCOOL: Determine the 4 corners of the selection box, and 
use them for consistent selection box rendering
+               minX = min(dragBox3D.x1, mX);
+               maxX = max(dragBox3D.x1, mX);
+               minY = min(dragBox3D.y1, mY);
+               maxY = max(dragBox3D.y1, mY);
+
+               // SHURCOOL: Reduce the box in size to produce a (consistent) 
pulsing inward effect
+               minX += dragBox3D.boxColourIndex/2;
+               maxX -= dragBox3D.boxColourIndex/2;
+               minY += dragBox3D.boxColourIndex/2;
+               maxY -= dragBox3D.boxColourIndex/2;
+
                pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_OFF);
-               
iV_Box(dragBox3D.x1+dragBox3D.boxColourIndex/2,dragBox3D.y1+dragBox3D.boxColourIndex/2,
-                               
mX-dragBox3D.boxColourIndex/2,mY-dragBox3D.boxColourIndex/2,
+               iV_Box(minX, minY,
+                               maxX, maxY,
                                boxPulseColours[dragBox3D.boxColourIndex]);
                if (war_GetTranslucent())
                {
-                       
pie_UniTransBoxFill(dragBox3D.x1+dragBox3D.boxColourIndex/2+1,dragBox3D.y1+dragBox3D.boxColourIndex/2+1,
-                                       
(mX-dragBox3D.boxColourIndex/2)-1,(mY-dragBox3D.boxColourIndex/2)-1,
-                                       0x00ffffff,16);
+                       pie_UniTransBoxFill(minX+1, minY+1,
+                                       maxX-1, maxY-1,
+                                       0x00ffffff, 16);
                }
                pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
        }
Index: src/warzoneconfig.c
===================================================================
--- src/warzoneconfig.c (revision 602)
+++ src/warzoneconfig.c (working copy)
@@ -62,8 +62,8 @@
        //set those here and reset in clParse or loadConfig
        pie_SetFogCap(FOG_CAP_UNDEFINED);
        war_SetFog(FALSE);
-       war_SetTranslucent(FALSE);
-       war_SetAdditive(FALSE);
+       war_SetTranslucent(TRUE);       // SHURCOOL: These two should be true 
(ie. enabled) by default; not false
+       war_SetAdditive(TRUE);          // SHURCOOL: It means that the renderer 
should be allowed to use translucency/additive rendering modes
 
        war_SetPlayAudioCDs(TRUE);
 

Attachment: pgpW7q5CwWGfG.pgp
Description: PGP signature

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to