version 1.114 | | version 1.115 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.114 2005/10/07 19:38:49 akirschbaum Exp $"; | | * "$Id: attack.c,v 1.115 2005/10/18 16:54:31 gros Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
if (get_attack_mode (&op, &hitter, &simple_attack)) | | if (get_attack_mode (&op, &hitter, &simple_attack)) |
goto error; | | goto error; |
| | |
/* GROS: Handle for plugin attack event */ | | /* Lauwenmark: Handle for plugin attack event */ |
if ((evt = find_event(op, EVENT_ATTACK)) != NULL) | | execute_event(op, EVENT_ATTACK,hitter,hitter,NULL,SCRIPT_FIX_ALL); |
{ | | |
CFParm CFP; | | /* Lauwenmark: This is used to handle script_weapons with weapons. |
int k, l; | | * Only used for players. |
uint32 n; | | */ |
k = EVENT_ATTACK; | | |
l = SCRIPT_FIX_ALL; | | |
n = 0; | | |
CFP.Value[0] = &k; | | |
CFP.Value[1] = hitter; | | |
CFP.Value[2] = hitter; | | |
CFP.Value[3] = op; | | |
CFP.Value[4] = NULL; | | |
CFP.Value[5] = &n; | | |
CFP.Value[6] = &base_dam; | | |
CFP.Value[7] = &base_wc; | | |
CFP.Value[8] = &l; | | |
CFP.Value[9] = (void*)evt->hook; | | |
CFP.Value[10]= (void*)evt->options; | | |
if (findPlugin(evt->plugin)>=0) | | |
((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); | | |
} | | |
/* GROS: This is used to handle script_weapons with weapons. Only used for players */ | | |
if (hitter->type==PLAYER) | | if (hitter->type==PLAYER) |
{ | | { |
if (hitter->current_weapon != NULL) | | if (hitter->current_weapon != NULL) |
{ | | { |
/* GROS: Handle for plugin attack event */ | | /* Lauwenmark: Handle for plugin attack event */ |
if ((evt = find_event(hitter->current_weapon, EVENT_ATTACK)) != NULL) | | execute_event(hitter, EVENT_ATTACK,hitter->current_weapon, |
{ | | op,NULL,SCRIPT_FIX_ALL); |
CFParm CFP; | | } |
int k, l; | | |
uint32 n; | | |
n = 0; | | |
k = EVENT_ATTACK; | | |
l = SCRIPT_FIX_ALL; | | |
CFP.Value[0] = &k; | | |
CFP.Value[1] = hitter; | | |
CFP.Value[2] = hitter->current_weapon; | | |
CFP.Value[3] = op; | | |
CFP.Value[4] = NULL; | | |
CFP.Value[5] = &n; | | |
CFP.Value[6] = &base_dam; | | |
CFP.Value[7] = &base_wc; | | |
CFP.Value[8] = &l; | | |
CFP.Value[9] = (void*)evt->hook; | | |
CFP.Value[10]= (void*)evt->options; | | |
if (findPlugin(evt->plugin)>=0) | | |
(PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); | | |
} | | } |
}; | | |
}; | | |
op_tag = op->count; | | op_tag = op->count; |
hitter_tag = hitter->count; | | hitter_tag = hitter->count; |
| | |
| | |
int sretval = 0; /* GROS - Needed for script return value */ | | int sretval = 0; /* GROS - Needed for script return value */ |
tag_t victim_tag, hitter_tag; | | tag_t victim_tag, hitter_tag; |
sint16 victim_x, victim_y; | | sint16 victim_x, victim_y; |
event *evt; | | |
| | |
/* Disassemble missile */ | | /* Disassemble missile */ |
if (op->inv) { | | if (op->inv) { |
| | |
victim_y = victim->y; | | victim_y = victim->y; |
victim_tag = victim->count; | | victim_tag = victim->count; |
hitter_tag = hitter->count; | | hitter_tag = hitter->count; |
/* GROS: Handling plugin attack event for thrown items */ | | /* Lauwenmark: Handling plugin attack event for thrown items */ |
if ((evt = find_event(op, EVENT_ATTACK)) != NULL) | | if (execute_event(op, EVENT_ATTACK,hitter,victim,NULL,SCRIPT_FIX_ALL) == 0) |
{ | | |
CFParm CFP; | | |
CFParm* CFR; | | |
int k, l; | | |
uint32 n; | | |
k = EVENT_ATTACK; | | |
l = SCRIPT_FIX_ALL; | | |
n = 0; | | |
CFP.Value[0] = &k; | | |
CFP.Value[1] = hitter; | | |
CFP.Value[2] = op; | | |
CFP.Value[3] = victim; | | |
CFP.Value[4] = NULL; | | |
CFP.Value[5] = &n; | | |
CFP.Value[6] = &(op->stats.dam); | | |
CFP.Value[7] = &(op->stats.wc); | | |
CFP.Value[8] = &l; | | |
CFP.Value[9] = (void*)evt->hook; | | |
CFP.Value[10]= (void*)evt->options; | | |
if (findPlugin(evt->plugin)>=0) | | |
{ | | |
CFR = (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); | | |
sretval = *(int *)(CFR->Value[0]); | | |
} | | |
} | | |
else | | |
hit_something = attack_ob_simple (victim, hitter, op->stats.dam, | | hit_something = attack_ob_simple (victim, hitter, op->stats.dam, |
op->stats.wc); | | op->stats.wc); |
| | |
| | |
int pk=0; /* true if op and what controls hitter are both players*/ | | int pk=0; /* true if op and what controls hitter are both players*/ |
int killed_script_rtn = 0; | | int killed_script_rtn = 0; |
object *owner=NULL; | | object *owner=NULL; |
int evtid; | | |
CFParm CFP; | | |
object *skop=NULL; | | object *skop=NULL; |
event *evt; | | |
| | |
if (op->stats.hp>=0) | | if (op->stats.hp>=0) |
return -1; | | return -1; |
| | |
/* GROS: Handle for plugin death event */ | | /* Lauwenmark: Handle for plugin death event */ |
if ((evt = find_event(op, EVENT_DEATH)) != NULL) | | if (execute_event(op, EVENT_DEATH,hitter,NULL,NULL,SCRIPT_FIX_ALL)!=0) |
{ | | |
CFParm* CFR; | | |
int k, l, m; | | |
uint32 n; | | |
k = EVENT_DEATH; | | |
l = SCRIPT_FIX_ALL; | | |
m = 0; | | |
n = type; | | |
CFP.Value[0] = &k; | | |
CFP.Value[1] = hitter; | | |
CFP.Value[2] = op; | | |
CFP.Value[3] = NULL; | | |
CFP.Value[4] = NULL; | | |
CFP.Value[5] = &n; | | |
CFP.Value[6] = &m; | | |
CFP.Value[7] = &m; | | |
CFP.Value[8] = &l; | | |
CFP.Value[9] = (void*)evt->hook; | | |
CFP.Value[10]= (void*)evt->options; | | |
if (findPlugin(evt->plugin)>=0) | | |
{ | | |
CFR =(PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); | | |
killed_script_rtn = *(int *)(CFR->Value[0]); | | |
if (killed_script_rtn) | | |
return 0; | | return 0; |
} | | /* Lauwenmark: Handle for the global kill event */ |
} | | execute_global_event(EVENT_GKILL, op, hitter); |
/* GROS: Handle for the global kill event */ | | |
evtid = EVENT_GKILL; | | |
CFP.Value[0] = (void *)(&evtid); | | |
CFP.Value[1] = (void *)(hitter); | | |
CFP.Value[2] = (void *)(op); | | |
GlobalEvent(&CFP); | | |
/* maxdam needs to be the amount of damage it took to kill | | /* maxdam needs to be the amount of damage it took to kill |
* this creature. The function(s) that call us have already | | * this creature. The function(s) that call us have already |
* adjusted the creatures HP total, so that is negative. | | * adjusted the creatures HP total, so that is negative. |