|
From: <cro...@li...> - 2002-12-25 06:45:49
|
Module Name: crossfire
Committed By: garbled
Date: Wed Dec 25 06:45:47 UTC 2002
Modified Files:
crossfire: ChangeLog
crossfire/common: object.c
crossfire/include: global.h player.h sproto.h
crossfire/server: attack.c c_misc.c commands.c login.c pets.c player.c
spell_util.c time.c
Log Message:
New Arrow and Pet Code:
Add bowmode and petmode commands. Allowing the player to change the firing
style for bows to one of either threewide, or spreadshot.
Allow players to change the operating modes of his pet with petmode. Can
be either seek and destroy, defend, or normal historical behavior.
Change bows to impart speed to arrows based on damage and other magical
plusses. Damage decays over distance, to stop arrows from flying forever.
Very fast moving arrows will pierce multiple targets. An arrow moving at a
speed greater than 10.0 will go straight through a target, losing 1.0 of
speed in the process.
Change magic missile to use spell_find_dir instead of find_dir to stop it
from flying in a circle and hitting the caster, and to make it stop
flying into walls to hit creatures behind the walls.
The following files had too many changes to show the context diffs here:
cvs rdiff -r1.14 -r1.15 crossfire/server/pets.c
cvs rdiff -r1.111 -r1.112 crossfire/server/player.c
Start of context diffs
Index: crossfire/ChangeLog
diff -c crossfire/ChangeLog:1.25 crossfire/ChangeLog:1.26
*** crossfire/ChangeLog:1.25 Sat Dec 21 00:02:32 2002
--- crossfire/ChangeLog Tue Dec 24 22:45:46 2002
***************
*** 17,22 ****
--- 17,36 ----
------------------------------------------------------------------------------
Changes for CVS:
+ New Arrow and Pet Code:
+ Add bowmode and petmode commands. Allowing the player to change the firing
+ style for bows to one of either threewide, or spreadshot.
+ Allow players to change the operating modes of his pet with petmode. Can be
+ either seek and destroy, defend, or normal historical behavior.
+ Change bows to impart speed to arrows based on damage and other magical
+ plusses. Damage decays over distance, to stop arrows from flying forever.
+ Very fast moving arrows will pierce multiple targets. An arrow moving at a
+ speed greater than 10.0 will go straight through a target, losing 1.0 of
+ speed in the process.
+ Change magic missile to use spell_find_dir instead of find_dir to stop it
+ from flying in a circle and hitting the caster, and to make it stop
+ flying into walls to hit creatures behind the walls.
+
Various bug fixes:
common/living.c: Reset glow_radius for players, so they stop glowing
after they snuff out their torch or whatever.
Index: crossfire/common/object.c
diff -c crossfire/common/object.c:1.60 crossfire/common/object.c:1.61
*** crossfire/common/object.c:1.60 Sat Nov 30 19:46:25 2002
--- crossfire/common/object.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_object_c =
! * "$Id: object.c,v 1.60 2002/12/01 03:46:25 mwedel Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_object_c =
! * "$Id: object.c,v 1.61 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 67,73 ****
int freedir[SIZEOFFREE]= {
0,1,2,3,4,5,6,7,8,1,2,2,2,3,4,4,4,5,6,6,6,7,8,8,8,
1,2,2,2,2,2,3,4,4,4,4,4,5,6,6,6,6,6,7,8,8,8,8,8};
!
/* Moved this out of define.h and in here, since this is the only file
* it is used in. Also, make it an inline function for cleaner
--- 67,76 ----
int freedir[SIZEOFFREE]= {
0,1,2,3,4,5,6,7,8,1,2,2,2,3,4,4,4,5,6,6,6,7,8,8,8,
1,2,2,2,2,2,3,4,4,4,4,4,5,6,6,6,6,6,7,8,8,8,8,8};
! int rightof_x[9]= {0, 1, -1, 0, -1, -1, 1, 0, 1};
! int rightof_y[9]= {0, 0, -1, -1, 1, 0, 1, 1, -1};
! int leftof_x[9] = {0, -1, 1, 0, 1, 1, -1, 0, -1};
! int leftof_y[9] = {0, 0, 1, 1, -1, 0, -1, -1, 1};
/* Moved this out of define.h and in here, since this is the only file
* it is used in. Also, make it an inline function for cleaner
Index: crossfire/include/global.h
diff -c crossfire/include/global.h:1.39 crossfire/include/global.h:1.40
*** crossfire/include/global.h:1.39 Tue Nov 12 21:49:04 2002
--- crossfire/include/global.h Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_global_h =
! * "$Id: global.h,v 1.39 2002/11/13 05:49:04 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_global_h =
! * "$Id: global.h,v 1.40 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 206,211 ****
--- 206,213 ----
extern int freearr_x[SIZEOFFREE], freearr_y[SIZEOFFREE];
extern int maxfree[SIZEOFFREE], freedir[SIZEOFFREE];
+ extern int rightof_x[9], rightof_y[9];
+ extern int leftof_x[9], leftof_y[9];
extern New_Face *blank_face, *empty_face;
extern New_Face *dark_faces[];
Index: crossfire/include/player.h
diff -c crossfire/include/player.h:1.28 crossfire/include/player.h:1.29
*** crossfire/include/player.h:1.28 Fri Nov 29 20:17:41 2002
--- crossfire/include/player.h Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_player_h =
! * "$Id: player.h,v 1.28 2002/11/30 04:17:41 mwedel Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_player_h =
! * "$Id: player.h,v 1.29 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 48,53 ****
--- 48,72 ----
range_size = 6
} rangetype;
+ typedef enum _bowtype {
+ bow_normal = 0,
+ bow_threewide = 1,
+ bow_spreadshot = 2,
+ bow_n = 3, /* must stay at 3 */
+ bow_ne = 4,
+ bow_e = 5,
+ bow_se = 6,
+ bow_s = 7,
+ bow_sw = 8,
+ bow_w = 9,
+ bow_nw = 10 /* must stay at 10 */
+ } bowtype_t;
+
+ typedef enum _petmode {
+ pet_normal = 0,
+ pet_sad = 1,
+ pet_defend = 2
+ } petmode_t;
typedef enum usekeytype {
key_inventory=0,
***************
*** 78,83 ****
--- 97,104 ----
sint16 known_spells[NROFREALSPELLS]; /* Spells known by the player */
uint16 nrofknownspells; /* Index in the above array */
rangetype shoottype; /* Which range-attack is being used by player */
+ bowtype_t bowtype; /* which firemode? */
+ petmode_t petmode; /* which petmode? */
object *ranges[range_size];/* object for each range. Set up in fix player. Note */
/* That not all are used, it is just nice to map this 1:1 */
/* With the range names */
Index: crossfire/include/sproto.h
diff -c crossfire/include/sproto.h:1.76 crossfire/include/sproto.h:1.77
*** crossfire/include/sproto.h:1.76 Wed Dec 18 08:39:56 2002
--- crossfire/include/sproto.h Tue Dec 24 22:45:46 2002
***************
*** 162,167 ****
--- 162,169 ----
int command_players(object *op, char *paramss);
int command_logs(object *op, char *params);
int command_applymode(object *op, char *params);
+ int command_bowmode(object *op, char *params);
+ int command_petmode(object *op, char *params);
int command_usekeys(object *op, char *params);
int command_resistances(object *op, char *params);
int command_help(object *op, char *params);
Index: crossfire/server/attack.c
diff -c crossfire/server/attack.c:1.78 crossfire/server/attack.c:1.79
*** crossfire/server/attack.c:1.78 Tue Nov 26 00:48:20 2002
--- crossfire/server/attack.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_attack_c =
! * "$Id: attack.c,v 1.78 2002/11/26 08:48:20 garbled Exp $";
*/
/*
CrossFire, A Multiplayer game for X-windows
--- 1,6 ----
/*
* static char *rcsid_attack_c =
! * "$Id: attack.c,v 1.79 2002/12/25 06:45:46 garbled Exp $";
*/
/*
CrossFire, A Multiplayer game for X-windows
***************
*** 865,871 ****
}
/* Missile hit victim */
! if (hit_something)
{
/* Stop arrow */
if (container == NULL) {
--- 865,873 ----
}
/* Missile hit victim */
! /* if the speed is > 10, then this is a fast moving arrow, we go straight
! through the target */
! if (hit_something && op->speed <= 10.0)
{
/* Stop arrow */
if (container == NULL) {
***************
*** 896,901 ****
--- 898,906 ----
}
return NULL;
}
+
+ if (hit_something && op->speed >= 10.0)
+ op->speed -= 1.0;
/* Missile missed victim - reassemble missile */
if (container) {
Index: crossfire/server/c_misc.c
diff -c crossfire/server/c_misc.c:1.26 crossfire/server/c_misc.c:1.27
*** crossfire/server/c_misc.c:1.26 Wed Dec 11 11:54:52 2002
--- crossfire/server/c_misc.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_c_misc_c =
! * "$Id: c_misc.c,v 1.26 2002/12/11 19:54:52 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_c_misc_c =
! * "$Id: c_misc.c,v 1.27 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 333,338 ****
--- 333,356 ----
if (worldmap_to_weathermap(op->x, op->y, &wx, &wy, op->map->path) != 0)
return 1;
+ if (QUERY_FLAG(op, FLAG_WIZ)) {
+ /* dump the weather, Dm style! Yo! */
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Real temp: %d",
+ real_world_temperature(op->x, op->y, op->map));
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Base temp: %d",
+ weathermap[wx][wy].temp);
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Humid: %d",
+ weathermap[wx][wy].humid);
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Wind: dir=%d speed=%d",
+ weathermap[wx][wy].winddir, weathermap[wx][wy].windspeed);
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Pressure: %d",
+ weathermap[wx][wy].pressure);
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Avg Elevation: %d",
+ weathermap[wx][wy].avgelev);
+ new_draw_info_format(NDI_UNIQUE, 0, op, "Rainfall: %d Water: %d",
+ weathermap[wx][wy].rainfall, weathermap[wx][wy].water);
+ }
+
temp = real_world_temperature(op->x, op->y, op->map);
new_draw_info_format(NDI_UNIQUE, 0, op, "It's currently %d degrees "
"Centigrade out.", temp);
***************
*** 717,722 ****
--- 735,811 ----
new_draw_info_format(NDI_UNIQUE, 0, op, "Applymode %s set to %s",
(unapply==op->contr->usekeys?"":"now"),
types[op->contr->unapply]);
+ return 1;
+ }
+
+ int command_bowmode(object *op, char *params)
+ {
+ bowtype_t oldtype=op->contr->petmode;
+ static char *types[] =
+ {"normal", "threewide", "spreadshot", "firenorth",
+ "firene", "fireeast", "firese", "firesouth",
+ "firesw", "firewest", "firenw"};
+ char buf[MAX_BUF];
+ int i, found;
+
+ if (!params) {
+ new_draw_info_format(NDI_UNIQUE, 0, op, "bowmode is set to %s",
+ types[op->contr->bowtype]);
+ return 1;
+ }
+
+ for (i=0,found=0; i<=bow_nw; i++) {
+ if (!strcmp(params, types[i])) {
+ found++;
+ op->contr->bowtype=i;
+ break;
+ }
+ }
+ if (!found) {
+ sprintf(buf, "bowmode: Unknown options %s, valid options are:", params);
+ for (i=0; i<=bow_nw; i++) {
+ strcat(buf, " ");
+ strcat(buf, types[i]);
+ if (i < bow_nw)
+ strcat(buf, ",");
+ else
+ strcat(buf, ".");
+ }
+ new_draw_info_format(NDI_UNIQUE, 0, op, buf);
+ return 0;
+ }
+ new_draw_info_format(NDI_UNIQUE, 0, op, "bowmode %s set to %s",
+ (oldtype==op->contr->bowtype?"":"now"),
+ types[op->contr->bowtype]);
+ return 1;
+ }
+
+ int command_petmode(object *op, char *params)
+ {
+ petmode_t oldtype=op->contr->petmode;
+ static char *types[]={"normal", "sad", "defend"};
+
+ if (!params) {
+ new_draw_info_format(NDI_UNIQUE, 0, op, "petmode is set to %s",
+ types[op->contr->petmode]);
+ return 1;
+ }
+
+ if (!strcmp(params,"normal"))
+ op->contr->petmode=pet_normal;
+ else if (!strcmp(params,"sad"))
+ op->contr->petmode=pet_sad;
+ else if (!strcmp(params,"defend"))
+ op->contr->petmode=pet_defend;
+ else {
+ new_draw_info_format(NDI_UNIQUE, 0, op,
+ "petmode: Unknown options %s, valid options are normal,"
+ "sad (seek and destroy), defend", params);
+ return 0;
+ }
+ new_draw_info_format(NDI_UNIQUE, 0, op, "petmode %s set to %s",
+ (oldtype==op->contr->petmode?"":"now"),
+ types[op->contr->petmode]);
return 1;
}
Index: crossfire/server/commands.c
diff -c crossfire/server/commands.c:1.30 crossfire/server/commands.c:1.31
*** crossfire/server/commands.c:1.30 Wed Dec 18 08:39:58 2002
--- crossfire/server/commands.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_commands_c =
! * "$Id: commands.c,v 1.30 2002/12/18 16:39:58 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_commands_c =
! * "$Id: commands.c,v 1.31 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 108,113 ****
--- 108,115 ----
{"weather", command_weather, 0.0},
{"title", command_title, 0.0},
{"usekeys", command_usekeys, 0.0},
+ {"bowmode", command_bowmode, 0.0},
+ {"petmode", command_petmode, 0.0},
{"version", command_version, 0.0},
{"wimpy", command_wimpy, 0.0},
{"who", command_who, 0.0},
Index: crossfire/server/login.c
diff -c crossfire/server/login.c:1.38 crossfire/server/login.c:1.39
*** crossfire/server/login.c:1.38 Tue Nov 26 00:48:20 2002
--- crossfire/server/login.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_login_c =
! * "$Id: login.c,v 1.38 2002/11/26 08:48:20 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_login_c =
! * "$Id: login.c,v 1.39 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 278,283 ****
--- 278,285 ----
fprintf(fp,"listening %d\n",pl->listening);
fprintf(fp,"spell %d\n",pl->chosen_spell);
fprintf(fp,"shoottype %d\n",pl->shoottype);
+ fprintf(fp,"bowtype %d\n",pl->bowtype);
+ fprintf(fp,"petmode %d\n",pl->petmode);
fprintf(fp,"peaceful %d\n",pl->peaceful);
fprintf(fp,"digestion %d\n",pl->digestion);
fprintf(fp,"pickup %d\n", pl->mode);
***************
*** 514,519 ****
--- 516,525 ----
pl->gen_hp=value;
else if (!strcmp(buf,"shoottype"))
pl->shoottype=(rangetype)value;
+ else if (!strcmp(buf,"bowtype"))
+ pl->bowtype=(bowtype_t)value;
+ else if (!strcmp(buf,"petmode"))
+ pl->petmode=(petmode_t)value;
else if (!strcmp(buf,"gen_sp"))
pl->gen_sp=value;
else if (!strcmp(buf,"gen_grace"))
Index: crossfire/server/spell_util.c
diff -c crossfire/server/spell_util.c:1.70 crossfire/server/spell_util.c:1.71
*** crossfire/server/spell_util.c:1.70 Tue Nov 12 21:24:54 2002
--- crossfire/server/spell_util.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_spell_util_c =
! * "$Id: spell_util.c,v 1.70 2002/11/13 05:24:54 garbled Exp $";
*/
--- 1,6 ----
/*
* static char *rcsid_spell_util_c =
! * "$Id: spell_util.c,v 1.71 2002/12/25 06:45:46 garbled Exp $";
*/
***************
*** 1520,1526 ****
void move_missile(object *op) {
int i;
! object *owner;
sint16 new_x, new_y;
owner = get_owner(op);
--- 1520,1526 ----
void move_missile(object *op) {
int i;
! object *owner, *tmp;
sint16 new_x, new_y;
owner = get_owner(op);
***************
*** 1552,1559 ****
}
op->x = new_x;
op->y = new_y;
! i=find_dir(op->map,op->x,op->y,get_owner(op));
! if(i&&i!=op->direction){
op->direction=absdir(op->direction+((op->direction-i+8)%8<4?-1:1));
SET_ANIMATION(op, op->direction);
}
--- 1552,1559 ----
}
op->x = new_x;
op->y = new_y;
! i=spell_find_dir(op->map, op->x, op->y, get_owner(op));
! if(i > 0 && i != op->direction){
op->direction=absdir(op->direction+((op->direction-i+8)%8<4?-1:1));
SET_ANIMATION(op, op->direction);
}
Index: crossfire/server/time.c
diff -c crossfire/server/time.c:1.46 crossfire/server/time.c:1.47
*** crossfire/server/time.c:1.46 Thu Dec 12 21:09:49 2002
--- crossfire/server/time.c Tue Dec 24 22:45:46 2002
***************
*** 1,6 ****
/*
* static char *rcsid_time_c =
! * "$Id: time.c,v 1.46 2002/12/13 05:09:49 garbled Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_time_c =
! * "$Id: time.c,v 1.47 2002/12/25 06:45:46 garbled Exp $";
*/
/*
***************
*** 625,630 ****
--- 625,637 ----
}
}
+ /* if the arrow is moving too slow.. stop it. 0.5 was chosen as lower
+ values look rediculous. */
+ if (op->speed < 0.5 && op->type==ARROW) {
+ stop_arrow(op);
+ return;
+ }
+
/* Calculate target map square */
new_x = op->x + DIRX(op);
new_y = op->y + DIRY(op);
***************
*** 733,738 ****
--- 740,749 ----
remove_ob (op);
op->x = new_x;
op->y = new_y;
+
+ /* decrease the speed as it flies. 0.05 means a standard bow will shoot
+ about 17 squares. Tune as needed. */
+ op->speed -= 0.05;
insert_ob_in_map (op, op->map, op,0);
}
|