ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_util.c
(Generate patch)

Comparing deliantra/server/server/spell_util.c (file contents):
Revision 1.11 by elmex, Sat Aug 12 11:51:38 2006 UTC vs.
Revision 1.12 by elmex, Sat Aug 12 14:12:03 2006 UTC

1/* 1/*
2 * static char *rcsid_spell_util_c = 2 * static char *rcsid_spell_util_c =
3 * "$Id: spell_util.c,v 1.11 2006/08/12 11:51:38 elmex Exp $"; 3 * "$Id: spell_util.c,v 1.12 2006/08/12 14:12:03 elmex Exp $";
4 */ 4 */
5 5
6 6
7/* 7/*
8 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
1019 */ 1019 */
1020 1020
1021int cast_spell(object *op, object *caster,int dir,object *spell_ob, char *stringarg) { 1021int cast_spell(object *op, object *caster,int dir,object *spell_ob, char *stringarg) {
1022 1022
1023 const char *godname; 1023 const char *godname;
1024 int success=0,mflags, cast_level=0, old_shoottype, ev = 0; 1024 int success=0,mflags, cast_level=0, old_shoottype;
1025 object *skill=NULL; 1025 object *skill=NULL;
1026 1026
1027 old_shoottype = op->contr ? op->contr->shoottype : 0; 1027 old_shoottype = op->contr ? op->contr->shoottype : 0;
1028 1028
1029 if (!spell_ob) { 1029 if (!spell_ob) {
1219 return 0; 1219 return 0;
1220 } 1220 }
1221 change_skill(op, skill, 0); /* needed for proper exp credit */ 1221 change_skill(op, skill, 0); /* needed for proper exp credit */
1222 } 1222 }
1223 1223
1224 /* elmex: FIXME:
1225 * This is a little bit hacky, i needed a special field in spell objects
1226 * to identify that it triggers EVENT_CAST_SPELL events. So that only special
1227 * spells call out into the plugin (which might be very slow).
1228 * I choose custom_name because it's set by the loader and a player can't modify it
1229 * on the spell object.
1230 * I would more like a simple flag... but that can be done later.
1231 */
1232 LOG(llevError,"cast_spell: custom_name: %s\n", spell_ob->arch->clone.custom_name);
1233 if (spell_ob->arch->clone.custom_name)
1234 {
1235 ev = execute_global_event(EVENT_CAST_SPELL, op, caster, spell_ob, dir, stringarg ? stringarg : "");
1236 LOG(llevError,"cast_spell: EVENT!!!!\n");
1237 }
1238
1239 if (!ev)
1240 switch(spell_ob->subtype) 1224 switch(spell_ob->subtype)
1241 { 1225 {
1242 /* The order of case statements is same as the order they show up 1226 /* The order of case statements is same as the order they show up
1243 * in in spells.h. 1227 * in in spells.h.
1244 */ 1228 */
1457 1441
1458 case SP_PARTY_SPELL: 1442 case SP_PARTY_SPELL:
1459 success = cast_party_spell (op, caster, dir, spell_ob, stringarg); 1443 success = cast_party_spell (op, caster, dir, spell_ob, stringarg);
1460 break; 1444 break;
1461 1445
1446 case SP_PERL:
1447 execute_global_event(EVENT_CAST_SPELL, op, caster, spell_ob, dir, stringarg ? stringarg : "");
1448 break;
1449
1462 default: 1450 default:
1463 LOG(llevError,"cast_spell: Unhandled spell subtype %d\n", 1451 LOG(llevError,"cast_spell: Unhandled spell subtype %d\n",
1464 spell_ob->subtype); 1452 spell_ob->subtype);
1465
1466
1467 } 1453 }
1468 1454
1469 /* FIXME - we need some better sound suppport */ 1455 /* FIXME - we need some better sound suppport */
1470 // yes, for example, augment map info with the spell effect 1456 // yes, for example, augment map info with the spell effect
1471 // so clients can calculate the sounds themselves 1457 // so clients can calculate the sounds themselves

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines