aboutsummaryrefslogtreecommitdiff
path: root/pipermail/nel/2001-April/000400.html
blob: 2121389faab6cf26d195d1f73f0de6d7aad1c7bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Nel] proposed control changes</TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:derikson%40montana.com">
   <LINK REL="Previous"  HREF="000399.html">
   <LINK REL="Next" HREF="000401.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Nel] proposed control changes</H1>
    <B>Dan Erikson</B> 
    <A HREF="mailto:derikson%40montana.com"
       TITLE="[Nel] proposed control changes">derikson@montana.com</A><BR>
    <I>Thu, 12 Apr 2001 20:49:18 -0600</I>
    <P><UL>
        <LI> Previous message: <A HREF="000399.html">[Nel] You guys will let us know when you're done mucking about,
 right?</A></li>
        <LI> Next message: <A HREF="000401.html">[Nel] proposed control changes</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#400">[ date ]</a>
              <a href="thread.html#400">[ thread ]</a>
              <a href="subject.html#400">[ subject ]</a>
              <a href="author.html#400">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Hi all, this is kind of long, sorry.  I had some thoughts that I'd like to
get some feedback on, and some code that you might find useful.

I've put together a patch that changes the mouse control in snowballs so
that the mouse is normally free, and you have to click on the window
and move the mouse in order to move the view around.  This is a change
from the current behavior where the mouse is always locked by the
application.  This allows one to use other applications while the game
is running.  I've even used it to have two instances of snowball running at
the same time, which should be useful for testing reasons.  It'll also alow
for using the mouse in the future for clicking on controls on other parts of
the screen.  The only thing I'm not sure about is how well it will work on
windows.  It looks like it'll work, but it would be nice if someone 
would test it.

I used the right mouse button because the left mouse button is already 
in use
for throwing a snowball, but I think these changes to the controls would
work better:

* Left mouse button to move the view around
* Right mouse button to move forward
* Space button to throw a snowball
* Enter button to enter chat mode
     After text is typed and enter is pressed, return from chat mode
* Mousewheel forward to zoom in
* Mousewheel backwards to zoom out
* Left button turns the view left normally
* If control+left or left_mouse+left, then strafe left
* Right button turns the view right normally
* If control+right or left_mouse+right, then strafe right

The normal mode/chat mode allows us to use the keys for functionality rather
than F1-F12, which is a little harder to remember than something like 
'r' for
toggle radar.  Also, there are a limited number of function buttons, so I
think having access to all the other keys would allow good future expansion.

The changes to the mouse buttons allows one to move around the world using
only the mouse.

It would also be nice to have the ability to customize these keys, but 
that's
something for a little later.

If anyone has any comments about this stuff, I'd love to hear them.

Patch to use right mouse button to move the heading around:

Index: move_listener.cpp
===================================================================
RCS file: /home/cvsroot/code/client/src/move_listener.cpp,v
retrieving revision 1.23
diff -c -r1.23 move_listener.cpp
*** move_listener.cpp    2001/04/10 10:20:48    1.23
--- move_listener.cpp    2001/04/13 02:21:30
***************
*** 54,63 ****
  \****************************************************************/
  CMoveListener::CMoveListener()
  {
!     _MouseFree = false;
    
-     _CursorInit = false;
-
     _Width = 0;
     _Height = 0;
 
--- 54,61 ----
  \****************************************************************/
  CMoveListener::CMoveListener()
  {
!     _MouseFree = true;
    
     _Width = 0;
     _Height = 0;
 
***************
*** 184,190 ****
  \****************************************************************/
  void CMoveListener::operator()(const CEvent&amp; event)
  {
!     static const float eps = 0.001f;
 
     // Rotation
     if (event==EventMouseMoveId)
--- 182,188 ----
  \****************************************************************/
  void CMoveListener::operator()(const CEvent&amp; event)
  {
!     static const float eps = 0.002f;
 
     // Rotation
     if (event==EventMouseMoveId)
***************
*** 196,240 ****
 
         if(!_MouseFree)
         {
!             if(_CursorInit)
             {
!                 float difx =  0.5f-mouseEvent-&gt;X;
!                 float dify =  -(0.5f-mouseEvent-&gt;Y);
!                 if( (float)fabs(difx) &gt; eps || (float)fabs(dify) &gt; eps)
                 {
!                     if ( (float)fabs(difx) &gt; eps)
!                     {
!                          LocalArea-&gt;User.yaw( _RotSpeed*(difx) );
                     }
!                     if ( (float)fabs(dify) &gt; eps)
!                     {
!                          LocalArea-&gt;User.ViewPitch += _RotSpeed*(dify);
!                          if(LocalArea-&gt;User.ViewPitch&gt;(float)Pi/2)
!                          {
!                              LocalArea-&gt;User.ViewPitch = (float)Pi/2;
!                          }
!                          if(LocalArea-&gt;User.ViewPitch&lt;-(float)Pi/2)
!                          {
!                              LocalArea-&gt;User.ViewPitch = -(float)Pi/2;
!                          }
                     }
-                     _Scene-&gt;getDriver()-&gt;setMousePos(0.5,0.5);
                 }
               }
-               else
-               {
-                   _CursorInit = true;
-                 _Scene-&gt;getDriver()-&gt;setMousePos(0.5,0.5);
-               }
         }
     }
  
 
 
-     // Shoot with left mouse button
     if ( event==EventMouseDownId)
     {
         CEventMouse* mouseEvent=(CEventMouse*)&amp;event;
         if(mouseEvent-&gt;Button==leftButton &amp;&amp; CanShot)
         {
             if ( (ClientSocket!=NULL) &amp;&amp; ClientSocket-&gt;connected() )
--- 194,230 ----
 
         if(!_MouseFree)
         {
!             float difx =  _MouseLockX-mouseEvent-&gt;X;
!             float dify =  -(_MouseLockY-mouseEvent-&gt;Y);
!             if( (float)fabs(difx) &gt; eps || (float)fabs(dify) &gt; eps)
             {
!                 if ( (float)fabs(difx) &gt; eps)
!                 {
!                     LocalArea-&gt;User.yaw( _RotSpeed*(difx) );
!                 }
!                 if ( (float)fabs(dify) &gt; eps)
                 {
!                     LocalArea-&gt;User.ViewPitch += _RotSpeed*(dify);
!                     if(LocalArea-&gt;User.ViewPitch&gt;(float)Pi/2)
!                      {
!                         LocalArea-&gt;User.ViewPitch = (float)Pi/2;
                     }
!                     if(LocalArea-&gt;User.ViewPitch&lt;-(float)Pi/2)
!                      {
!                         LocalArea-&gt;User.ViewPitch = -(float)Pi/2;
                     }
                 }
+                 _Scene-&gt;getDriver()-&gt;setMousePos(_MouseLockX,_MouseLockY);
               }
         }
     }
  
 
 
     if ( event==EventMouseDownId)
     {
         CEventMouse* mouseEvent=(CEventMouse*)&amp;event;
+         // Shoot with left mouse button
         if(mouseEvent-&gt;Button==leftButton &amp;&amp; CanShot)
         {
             if ( (ClientSocket!=NULL) &amp;&amp; ClientSocket-&gt;connected() )
***************
*** 249,254 ****
--- 239,259 ----
                 }
             }
         }
+         if(mouseEvent-&gt;Button==rightButton &amp;&amp; _MouseFree)
+         {
+             _MouseLockX = mouseEvent-&gt;X;
+             _MouseLockY = mouseEvent-&gt;Y;
+             changeControlMode();
+         }
+     }
+
+     if(event==EventMouseUpId)
+     {
+         CEventMouse* mouseEvent=(CEventMouse*)&amp;event;
+         if(mouseEvent-&gt;Button==rightButton &amp;&amp; !_MouseFree)
+         {
+             changeControlMode();
+         }
     }
  }
 
***************
*** 260,265 ****
--- 265,271 ----
  {
     server.addListener (EventMouseMoveId, this);
     server.addListener (EventMouseDownId, this);
+     server.addListener (EventMouseUpId, this);
  }
 
 
***************
*** 270,274 ****
--- 276,281 ----
  {
     server.removeListener (EventMouseMoveId, this);
     server.removeListener (EventMouseDownId, this);
+     server.removeListener (EventMouseUpId, this);
  }
 
Index: move_listener.h
===================================================================
RCS file: /home/cvsroot/code/client/src/move_listener.h,v
retrieving revision 1.15
diff -c -r1.15 move_listener.h
*** move_listener.h    2001/03/05 09:39:44    1.15
--- move_listener.h    2001/04/13 02:21:30
***************
*** 119,127 ****
     /// Internal use
     virtual void operator()(const NLMISC::CEvent&amp; event);
    
-     /// true if first setMousePos done
-     bool _CursorInit;
-
     CScene * _Scene;
    
     /// screen width
--- 119,124 ----
***************
*** 155,160 ****
--- 152,160 ----
     float _MouseY;
 
     bool _Shot;
+
+     float _MouseLockX;
+     float _MouseLockY;
  };
 
 
Index: client.cpp
===================================================================
RCS file: /home/cvsroot/code/client/src/client.cpp,v
retrieving revision 1.177
diff -c -r1.177 client.cpp
*** client.cpp    2001/04/12 17:06:42    1.177
--- client.cpp    2001/04/13 02:22:13
***************
*** 1880,1893 ****
     LocalArea-&gt;setEntityMovedCallback( moveEntityInstance );
     LocalArea-&gt;setEntityRemovedCallback( deleteEntityInstance );
 
-     // hide mouse cursor
-     CNELU::Driver-&gt;showCursor(false);
- #ifdef NL_RELEASE
-     CNELU::Driver-&gt;setCapture(true);
- #endif
-
-
-
     // Load meshes
     /*
     vector&lt;string&gt;::iterator itshp;
--- 1880,1885 ----


</pre>


<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="000399.html">[Nel] You guys will let us know when you're done mucking about,
 right?</A></li>
	<LI> Next message: <A HREF="000401.html">[Nel] proposed control changes</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#400">[ date ]</a>
              <a href="thread.html#400">[ thread ]</a>
              <a href="subject.html#400">[ subject ]</a>
              <a href="author.html#400">[ author ]</a>
         </LI>
       </UL>
</body></html>