version 1.88 | | version 1.89 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.88 2003/06/16 05:15:35 mwedel Exp $"; | | * "$Id: attack.c,v 1.89 2003/06/26 11:27:43 gros Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
uint32 type; | | uint32 type; |
char *op_name = NULL; | | char *op_name = NULL; |
tag_t op_tag, hitter_tag; | | tag_t op_tag, hitter_tag; |
| | event *evt; |
| | |
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 */ | | /* GROS: Handle for plugin attack event */ |
if(op->event_hook[EVENT_ATTACK] != NULL) | | if ((evt = find_event(op, EVENT_ATTACK)) != NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
int k, l, m; | | int k, l, m; |
| | |
CFP.Value[6] = &base_dam; | | CFP.Value[6] = &base_dam; |
CFP.Value[7] = &base_wc; | | CFP.Value[7] = &base_wc; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = op->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= op->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(op->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
((PlugList[findPlugin(op->event_plugin[k])].eventfunc) (&CFP)); | | ((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); |
} | | } |
/* GROS: This is used to handle script_weapons with weapons. Only used for players */ | | /* 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 */ | | /* GROS: Handle for plugin attack event */ |
if(hitter->current_weapon->event_hook[EVENT_ATTACK] != NULL) | | if ((evt = find_event(hitter->current_weapon, EVENT_ATTACK)) != NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
int k, l, n; | | int k, l, n; |
| | |
CFP.Value[6] = &base_dam; | | CFP.Value[6] = &base_dam; |
CFP.Value[7] = &base_wc; | | CFP.Value[7] = &base_wc; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = hitter->current_weapon->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= hitter->current_weapon->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(hitter->current_weapon->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
(PlugList[findPlugin(hitter->current_weapon->event_plugin[k])].eventfunc) (&CFP); | | (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); |
} | | } |
}; | | }; |
}; | | }; |
| | |
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_tag = victim->count; | | victim_tag = victim->count; |
hitter_tag = hitter->count; | | hitter_tag = hitter->count; |
/* GROS: Handling plugin attack event for thrown items */ | | /* GROS: Handling plugin attack event for thrown items */ |
if(op->event_hook[EVENT_ATTACK] != NULL) | | if ((evt = find_event(op, EVENT_ATTACK)) != NULL) |
{ | | { |
CFParm CFP; | | CFParm CFP; |
CFParm* CFR; | | CFParm* CFR; |
| | |
CFP.Value[6] = &(op->stats.dam); | | CFP.Value[6] = &(op->stats.dam); |
CFP.Value[7] = &(op->stats.wc); | | CFP.Value[7] = &(op->stats.wc); |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = op->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= op->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(op->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
{ | | { |
CFR = (PlugList[findPlugin(op->event_plugin[k])].eventfunc) (&CFP); | | CFR = (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); |
sretval = *(int *)(CFR->Value[0]); | | sretval = *(int *)(CFR->Value[0]); |
} | | } |
} | | } |
| | |
object *owner=NULL, *old_skill; | | object *owner=NULL, *old_skill; |
int evtid; | | int evtid; |
CFParm CFP; | | CFParm CFP; |
| | event *evt; |
| | |
if (op->stats.hp>=0) | | if (op->stats.hp>=0) |
return -1; | | return -1; |
| | |
/* GROS: Handle for plugin death event */ | | /* GROS: Handle for plugin death event */ |
if(op->event_hook[EVENT_DEATH] != NULL) | | if ((evt = find_event(op, EVENT_DEATH)) != NULL) |
{ | | { |
CFParm* CFR; | | CFParm* CFR; |
int k, l, m; | | int k, l, m; |
| | |
CFP.Value[6] = &m; | | CFP.Value[6] = &m; |
CFP.Value[7] = &m; | | CFP.Value[7] = &m; |
CFP.Value[8] = &l; | | CFP.Value[8] = &l; |
CFP.Value[9] = op->event_hook[k]; | | CFP.Value[9] = evt->hook; |
CFP.Value[10]= op->event_options[k]; | | CFP.Value[10]= evt->options; |
if (findPlugin(op->event_plugin[k])>=0) | | if (findPlugin(evt->plugin)>=0) |
{ | | { |
CFR =(PlugList[findPlugin(op->event_plugin[k])].eventfunc) (&CFP); | | CFR =(PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); |
killed_script_rtn = *(int *)(CFR->Value[0]); | | killed_script_rtn = *(int *)(CFR->Value[0]); |
if (killed_script_rtn) | | if (killed_script_rtn) |
return 0; | | return 0; |