Update of /cvsroot/netrek/client/netrekxp/src
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13775/src
Modified Files:
data.c defaults.c feature.c input.c option.c
Log Message:
Added netrekrc option "useAllFeatures" to ignore server
settings for info/control feature packets.
Added netrekrc option "autoPhaser" to phaser exact
location of enemy target closest to cursor. Works on
local or map window.
To do for autophaser:
1) Add sanity check to location (such as ship max
phaser range).
2) Add support for phasering plasmas.
Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- input.c 23 Jul 2008 10:09:34 -0000 1.47
+++ input.c 21 May 2009 02:37:28 -0000 1.48
@@ -54,6 +54,8 @@
struct obtype *target;
unsigned char key = ' ';
+void phaseraction (W_Event * data);
+
/* this used to be 177 for an unknown reason...I think it may * have included
* various control characters. We don't support * those anyway right?? - jn */
#define MAXKEY 224
@@ -1697,8 +1699,7 @@
}
else if (data->key == W_MBUTTON)
{
- course = (unsigned char) (getcourse (data->Window, data->x, data->y));
- sendPhaserReq (course);
+ phaseraction(data);
}
else if (data->key == W_XBUTTON1)
{
@@ -1913,6 +1914,48 @@
}
/******************************************************************************/
+/*** phaseraction() ***/
+/******************************************************************************/
+void
+phaseraction (W_Event * data)
+{
+ unsigned char course;
+ int x, y;
+ register struct player *j;
+ struct obtype *gettarget (W_Window ww,
+ int x,
+ int y,
+ int targtype),
+ *target;
+
+ if (autoPhaser) /* add range check here */ {
+ target = gettarget (data->Window, data->x, data->y, TARG_ENEMY | TARG_CLOAK);
+ if (target->o_num == -1) { /* failed to find a target */
+ course = (unsigned char) (getcourse (data->Window, data->x, data->y));
+ sendPhaserReq (course);
+ return;
+ }
+ j = &players[target->o_num];
+ if (data->Window == mapw)
+ {
+ x = j->p_x * GWINSIDE / GWIDTH;
+ y = j->p_y * GWINSIDE / GWIDTH;
+ }
+ else
+ {
+ x = (j->p_x - me->p_x) / scaleFactor + TWINSIDE / 2;
+ y = (j->p_y - me->p_y) / scaleFactor + TWINSIDE / 2;
+ }
+ /* Sanity check on x, y? Use ship max phaser range? */
+ /* How about phasering plasma? */
+ course = (unsigned char) (getcourse (data->Window, x, y));
+ }
+ else
+ course = (unsigned char) (getcourse (data->Window, data->x, data->y));
+ sendPhaserReq (course);
+}
+
+/******************************************************************************/
/*** getcourse() ***/
/******************************************************************************/
int
@@ -3333,19 +3376,13 @@
void
Key112 (W_Event * data)
{
- unsigned char course;
-
#ifdef AUTOKEY
if (autoKey)
autoKeyPhaserReqOn ();
else
- {
- course = getcourse (data->Window, data->x, data->y);
- sendPhaserReq (course);
- }
+ phaseraction(data);
#else
- course = (unsigned char) (getcourse (data->Window, data->x, data->y));
- sendPhaserReq (course);
+ phaseraction (data);
#endif /* AUTOKEY */
}
Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- defaults.c 9 May 2009 21:21:43 -0000 1.96
+++ defaults.c 21 May 2009 02:37:28 -0000 1.97
@@ -43,6 +43,13 @@
NULL
}
},
+ {"autoPhaser", &autoPhaser, RC_INT,
+ {
+ "Phaser exact location of enemy target closest to cursor",
+ "Enemy must be within phaser range of your ship",
+ NULL
+ }
+ },
{"autoQuit", &autoQuit, RC_INT,
{
"Autoquit timer (default 60)",
@@ -907,6 +914,16 @@
NULL
}
},
+ {"useAllFeatures", &useAllFeatures, RC_INT,
+ {
+ "Ignore server settings for info/control feature packets.",
+ "This will automatically turn on motion mouse steering",
+ "show army counts, show other's speed, show cloakers, turn",
+ "keys, visibility range and beeplite regardless of what",
+ "features the server requests that you turn off.",
+ NULL
+ }
+ },
{"useCheckPlanets", &useCheckPlanets, RC_BOOL,
{
"Crosscheck with server to make sure all planet information is",
Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- data.c 9 May 2009 21:21:43 -0000 1.118
+++ data.c 21 May 2009 02:37:28 -0000 1.119
@@ -924,5 +924,7 @@
int mapscaleFactor = 40; /* allows for scaling of galactic window, unused */
int fullBitmapRotation = 1; /* draw old bitmap sets to all angles */
int hideConsole = 0; /* show console window or not */
+int autoPhaser = 1; /* phaser exact location of enemy target closest to cursor */
+int useAllFeatures = 1; /* ignore server settings for info/control feature packets */
struct context *context;
Index: feature.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- feature.c 9 May 2009 21:21:43 -0000 1.26
+++ feature.c 21 May 2009 02:37:28 -0000 1.27
@@ -302,16 +302,26 @@
break;
}
}
- /* Ignore these feature packets for testing purposes */
-#if DEBUG
- motion_mouse_steering = 1;
- F_show_army_count = 1;
- F_show_other_speed = 1;
- F_show_cloakers = 1;
- F_turn_keys = 1;
- F_show_visibility_range = 1;
-#endif
#endif /* BEEPLITE */
+ /* Ignore these feature packets? */
+ if (useAllFeatures)
+ {
+ motion_mouse_steering = 1;
+ F_show_army_count = 1;
+ F_show_other_speed = 1;
+ F_show_cloakers = 1;
+ F_turn_keys = 1;
+ F_show_visibility_range = 1;
+#ifdef BEEPLITE
+ F_beeplite_flags = LITE_PLAYERS_MAP |
+ LITE_PLAYERS_LOCAL |
+ LITE_SELF |
+ LITE_PLANETS |
+ LITE_SOUNDS |
+ LITE_COLOR |
+ LITE_TTS;
+#endif
+ }
}
/******************************************************************************/
Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- option.c 21 May 2009 00:15:03 -0000 1.57
+++ option.c 21 May 2009 02:37:28 -0000 1.58
@@ -298,6 +298,7 @@
struct option Weapons_Menu[] = {
{0, "Weapons Menu", &MenuPage, 0, 0, 0, NULL, &Menus_Range},
{1, "Page %d (click to change)", &MenuPage, 0, 0, 0, NULL, &Menus_Range},
+ {1, "use auto aim phasers", &autoPhaser, 0, 0, 0, NULL, NULL},
{1, "use color weapon bitmaps", &colorWeapons, 0, 0, 0, NULL, NULL},
{1, "show weapons on galactic", &weaponsOnMap, 0, 0, 0, NULL, NULL},
#ifdef JUBILEE_PHASERS
@@ -438,6 +439,7 @@
{1, "", &messageHUD, 0, 0, 0, messagehudmess, &messagehud_range},
#endif
{1, "use double buffering", &doubleBuffering, 0, 0, 0, NULL, NULL},
+ {1, "turn on all feature packets", &useAllFeatures, 0, 0, 0, NULL, NULL},
{1, "done", ¬done, 0, 0, 0, NULL, NULL},
{-1, NULL, 0, 0, 0, 0, NULL, NULL}
};