… | |
… | |
45 | #include <plugin_common.h> |
45 | #include <plugin_common.h> |
46 | #include <sounds.h> |
46 | #include <sounds.h> |
47 | |
47 | |
48 | #include <stdarg.h> |
48 | #include <stdarg.h> |
49 | |
49 | |
|
|
50 | #include <sproto.h> |
|
|
51 | |
|
|
52 | //#include "EventAPI.h" |
50 | #include "perlxsi.c" |
53 | #include "perlxsi.c" |
|
|
54 | |
|
|
55 | extern sint64 *levels; // the experience table |
51 | |
56 | |
52 | typedef object object_ornull; |
57 | typedef object object_ornull; |
53 | typedef mapstruct mapstruct_ornull; |
58 | typedef mapstruct mapstruct_ornull; |
|
|
59 | |
|
|
60 | typedef double val64; |
|
|
61 | #define newSVval64 newSVnv |
|
|
62 | #define SvVAL64 SvNV |
54 | |
63 | |
55 | static f_plug_api gethook; |
64 | static f_plug_api gethook; |
56 | static f_plug_api registerGlobalEvent; |
65 | static f_plug_api registerGlobalEvent; |
57 | static f_plug_api unregisterGlobalEvent; |
66 | static f_plug_api unregisterGlobalEvent; |
58 | static f_plug_api systemDirectory; |
67 | static f_plug_api systemDirectory; |
… | |
… | |
225 | case CFAPI_INT: |
234 | case CFAPI_INT: |
226 | sv = newSViv (*va_arg (args, int *)); |
235 | sv = newSViv (*va_arg (args, int *)); |
227 | break; |
236 | break; |
228 | |
237 | |
229 | case CFAPI_LONG: |
238 | case CFAPI_LONG: |
230 | sv = newSVnv ((double)*va_arg (args, sint64 *)); /* oh, the humanity! */ |
239 | sv = newSVval64 ((val64)*va_arg (args, sint64 *)); |
231 | break; |
240 | break; |
232 | |
241 | |
233 | case CFAPI_DOUBLE: |
242 | case CFAPI_DOUBLE: |
234 | sv = newSVnv (*va_arg (args, double *)); |
243 | sv = newSVnv (*va_arg (args, double *)); |
235 | break; |
244 | break; |
… | |
… | |
249 | sv = &PL_sv_undef; |
258 | sv = &PL_sv_undef; |
250 | else |
259 | else |
251 | switch (obj->type) |
260 | switch (obj->type) |
252 | { |
261 | { |
253 | case MAP: |
262 | case MAP: |
254 | sv = newSVptr_cached (obj, "cf::object::map"); |
263 | sv = newSVptr_cached (obj, "cf::object::map::wrap"); |
255 | break; |
264 | break; |
256 | |
265 | |
257 | case PLAYER: |
266 | case PLAYER: |
258 | sv = newSVptr_cached (obj, "cf::object::player"); |
267 | sv = newSVptr_cached (obj, "cf::object::player::wrap"); |
259 | break; |
268 | break; |
260 | |
269 | |
261 | default: |
270 | default: |
262 | sv = newSVptr_cached (obj, "cf::object"); |
271 | sv = newSVptr_cached (obj, "cf::object::wrap"); |
263 | break; |
272 | break; |
264 | } |
273 | } |
265 | } |
274 | } |
266 | break; |
275 | break; |
267 | |
276 | |
268 | case CFAPI_PMAP: |
277 | case CFAPI_PMAP: |
269 | sv = newSVptr (va_arg (args, mapstruct *), "cf::map"); |
278 | sv = newSVptr (va_arg (args, mapstruct *), "cf::map::wrap"); |
270 | break; |
279 | break; |
271 | |
280 | |
272 | case CFAPI_PPLAYER: |
281 | case CFAPI_PPLAYER: |
273 | sv = newSVptr (va_arg (args, player *), "cf::player"); |
282 | sv = newSVptr (va_arg (args, player *), "cf::player::wrap"); |
274 | break; |
283 | break; |
275 | |
284 | |
276 | case CFAPI_PARCH: |
285 | case CFAPI_PARCH: |
277 | sv = newSVptr (va_arg (args, archetype *), "cf::arch"); |
286 | sv = newSVptr (va_arg (args, archetype *), "cf::arch::wrap"); |
278 | break; |
287 | break; |
279 | |
288 | |
280 | case CFAPI_PPARTY: |
289 | case CFAPI_PPARTY: |
281 | sv = newSVptr (va_arg (args, partylist *), "cf::party"); |
290 | sv = newSVptr (va_arg (args, partylist *), "cf::party::wrap"); |
282 | break; |
291 | break; |
283 | |
292 | |
284 | case CFAPI_PREGION: |
293 | case CFAPI_PREGION: |
285 | sv = newSVptr (va_arg (args, region *), "cf::region"); |
294 | sv = newSVptr (va_arg (args, region *), "cf::region::wrap"); |
286 | break; |
295 | break; |
287 | |
296 | |
288 | default: |
297 | default: |
289 | assert (("unhandled type in newSVcfapi", 0)); |
298 | assert (("unhandled type in newSVcfapi", 0)); |
290 | } |
299 | } |
… | |
… | |
294 | return sv; |
303 | return sv; |
295 | } |
304 | } |
296 | |
305 | |
297 | ///////////////////////////////////////////////////////////////////////////// |
306 | ///////////////////////////////////////////////////////////////////////////// |
298 | |
307 | |
299 | int |
|
|
300 | initPlugin (const char *iversion, f_plug_api gethooksptr) |
308 | extern "C" int initPlugin (const char *iversion, f_plug_api gethooksptr) |
301 | { |
309 | { |
302 | gethook = gethooksptr; |
310 | gethook = gethooksptr; |
303 | printf (PLUGIN_VERSION " init\n"); |
311 | printf (PLUGIN_VERSION " init\n"); |
304 | |
312 | |
305 | return 0; |
313 | return 0; |
… | |
… | |
338 | LEAVE; |
346 | LEAVE; |
339 | |
347 | |
340 | return returnvalue; |
348 | return returnvalue; |
341 | } |
349 | } |
342 | |
350 | |
343 | void * |
|
|
344 | getPluginProperty (int *type, ...) |
351 | extern "C" void *getPluginProperty (int *type, ...) |
345 | { |
352 | { |
346 | va_list args; |
353 | va_list args; |
347 | char *propname; |
354 | char *propname; |
348 | int i; |
355 | int i; |
349 | va_start (args, type); |
356 | va_start (args, type); |
… | |
… | |
372 | } |
379 | } |
373 | } |
380 | } |
374 | else if (!strcmp (propname, "Identification")) |
381 | else if (!strcmp (propname, "Identification")) |
375 | { |
382 | { |
376 | va_end (args); |
383 | va_end (args); |
377 | return PLUGIN_NAME; |
384 | return (void*) PLUGIN_NAME; |
378 | } |
385 | } |
379 | else if (!strcmp (propname, "FullName")) |
386 | else if (!strcmp (propname, "FullName")) |
380 | { |
387 | { |
381 | va_end (args); |
388 | va_end (args); |
382 | return PLUGIN_VERSION; |
389 | return (void*) PLUGIN_VERSION; |
383 | } |
390 | } |
384 | else |
391 | else |
385 | va_end (args); |
392 | va_end (args); |
386 | |
393 | |
387 | return NULL; |
394 | return NULL; |
388 | } |
395 | } |
389 | |
396 | |
390 | void *globalEventListener (int *type, ...); |
397 | void *globalEventListener (int *type, ...); |
391 | |
398 | |
392 | int |
399 | extern "C" int postInitPlugin () |
393 | postInitPlugin () |
|
|
394 | { |
400 | { |
395 | int hooktype = 1; |
401 | int hooktype = 1; |
396 | int rtype = 0; |
402 | int rtype = 0; |
397 | |
403 | |
398 | printf (PLUGIN_VERSION " post init\n"); |
404 | printf (PLUGIN_VERSION " post init\n"); |
399 | |
405 | |
400 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
406 | registerGlobalEvent = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
401 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
407 | unregisterGlobalEvent = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
402 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
408 | systemDirectory = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_system_directory"); |
403 | object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property"); |
409 | object_set_property = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_object_set_property"); |
404 | map_get_map = gethook (&rtype, hooktype, "cfapi_map_get_map"); |
410 | map_get_map = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_map_get_map"); |
405 | object_insert = gethook (&rtype, hooktype, "cfapi_object_insert"); |
411 | object_insert = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_object_insert"); |
406 | |
412 | |
407 | cf_init_plugin (gethook); |
413 | cf_init_plugin (gethook); |
408 | |
414 | |
409 | /* Pick the global events you want to monitor from this plugin */ |
415 | /* Pick the global events you want to monitor from this plugin */ |
410 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
416 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
411 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
417 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
412 | //registerGlobalEvent (NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener); |
418 | //registerGlobalEvent (NULL, EVENT_CRASH, PLUGIN_NAME, globalEventListener); |
|
|
419 | registerGlobalEvent (NULL, EVENT_FIND_UNARMED_SKILL, PLUGIN_NAME, globalEventListener); |
|
|
420 | registerGlobalEvent (NULL, EVENT_PLAYER_USE_SKILL, PLUGIN_NAME, globalEventListener); |
|
|
421 | registerGlobalEvent (NULL, EVENT_CAST_SPELL, PLUGIN_NAME, globalEventListener); |
|
|
422 | registerGlobalEvent (NULL, EVENT_MONSTER_USE_SKILL, PLUGIN_NAME, globalEventListener); |
413 | registerGlobalEvent (NULL, EVENT_PLAYER_DEATH, PLUGIN_NAME, globalEventListener); |
423 | registerGlobalEvent (NULL, EVENT_PLAYER_DEATH, PLUGIN_NAME, globalEventListener); |
414 | registerGlobalEvent (NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener); |
424 | registerGlobalEvent (NULL, EVENT_GKILL, PLUGIN_NAME, globalEventListener); |
415 | registerGlobalEvent (NULL, EVENT_LOGIN, PLUGIN_NAME, globalEventListener); |
425 | registerGlobalEvent (NULL, EVENT_LOGIN, PLUGIN_NAME, globalEventListener); |
416 | registerGlobalEvent (NULL, EVENT_LOGOUT, PLUGIN_NAME, globalEventListener); |
426 | registerGlobalEvent (NULL, EVENT_LOGOUT, PLUGIN_NAME, globalEventListener); |
417 | registerGlobalEvent (NULL, EVENT_MAPENTER, PLUGIN_NAME, globalEventListener); |
427 | registerGlobalEvent (NULL, EVENT_MAPENTER, PLUGIN_NAME, globalEventListener); |
… | |
… | |
427 | registerGlobalEvent (NULL, EVENT_MUZZLE, PLUGIN_NAME, globalEventListener); |
437 | registerGlobalEvent (NULL, EVENT_MUZZLE, PLUGIN_NAME, globalEventListener); |
428 | registerGlobalEvent (NULL, EVENT_KICK, PLUGIN_NAME, globalEventListener); |
438 | registerGlobalEvent (NULL, EVENT_KICK, PLUGIN_NAME, globalEventListener); |
429 | registerGlobalEvent (NULL, EVENT_FREE_OB, PLUGIN_NAME, globalEventListener); |
439 | registerGlobalEvent (NULL, EVENT_FREE_OB, PLUGIN_NAME, globalEventListener); |
430 | registerGlobalEvent (NULL, EVENT_PLAYER_LOAD, PLUGIN_NAME, globalEventListener); |
440 | registerGlobalEvent (NULL, EVENT_PLAYER_LOAD, PLUGIN_NAME, globalEventListener); |
431 | registerGlobalEvent (NULL, EVENT_PLAYER_SAVE, PLUGIN_NAME, globalEventListener); |
441 | registerGlobalEvent (NULL, EVENT_PLAYER_SAVE, PLUGIN_NAME, globalEventListener); |
|
|
442 | registerGlobalEvent (NULL, EVENT_EXTCMD, PLUGIN_NAME, globalEventListener); |
432 | |
443 | |
433 | char *argv[] = { |
444 | char *argv[] = { |
434 | "", |
445 | "", |
435 | "-e" |
446 | "-e" |
436 | "BEGIN {" |
447 | "BEGIN {" |
… | |
… | |
442 | }; |
453 | }; |
443 | |
454 | |
444 | perl = perl_alloc (); |
455 | perl = perl_alloc (); |
445 | perl_construct (perl); |
456 | perl_construct (perl); |
446 | |
457 | |
|
|
458 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
|
|
459 | |
447 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
460 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
448 | { |
461 | { |
449 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
462 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
450 | |
463 | |
451 | perl_destruct (perl); |
464 | perl_destruct (perl); |
… | |
… | |
466 | va_list args; |
479 | va_list args; |
467 | static int rv; |
480 | static int rv; |
468 | int event_code; |
481 | int event_code; |
469 | |
482 | |
470 | if (!perl) |
483 | if (!perl) |
471 | return; |
484 | return NULL; |
472 | |
485 | |
473 | va_start (args, type); |
486 | va_start (args, type); |
474 | event_code = va_arg (args, int); |
487 | event_code = va_arg (args, int); |
475 | |
488 | |
476 | if (event_code == EVENT_FREE_OB) |
489 | if (event_code == EVENT_FREE_OB) |
… | |
… | |
484 | |
497 | |
485 | if (sv) |
498 | if (sv) |
486 | clearSVptr (sv); |
499 | clearSVptr (sv); |
487 | |
500 | |
488 | rv = 0; |
501 | rv = 0; |
|
|
502 | } |
|
|
503 | else if (event_code == EVENT_CLOCK) |
|
|
504 | { |
|
|
505 | dSP; |
|
|
506 | int i, count; |
|
|
507 | |
|
|
508 | clean_obj_cache (); |
|
|
509 | |
|
|
510 | ENTER; |
|
|
511 | SAVETMPS; |
|
|
512 | |
|
|
513 | // service up to 8 events per tick better would be |
|
|
514 | // to check for elapsed time and stop processing after |
|
|
515 | // 0.25 * server_tick or so |
|
|
516 | for (i = 9; --i; ) |
|
|
517 | { |
|
|
518 | PUSHMARK (SP); |
|
|
519 | XPUSHs (sv_2mortal (newSViv (0))); |
|
|
520 | PUTBACK; |
|
|
521 | count = call_pv ("Event::one_event", G_SCALAR | G_EVAL); |
|
|
522 | SPAGAIN; |
|
|
523 | |
|
|
524 | if (!count || !POPi) |
|
|
525 | break; |
|
|
526 | } |
|
|
527 | |
|
|
528 | FREETMPS; |
|
|
529 | LEAVE; |
489 | } |
530 | } |
490 | else |
531 | else |
491 | { |
532 | { |
492 | dSP; |
533 | dSP; |
493 | |
534 | |
… | |
… | |
542 | case EVENT_KICK: |
583 | case EVENT_KICK: |
543 | PUSH_OB; |
584 | PUSH_OB; |
544 | PUSH_PV; |
585 | PUSH_PV; |
545 | break; |
586 | break; |
546 | |
587 | |
|
|
588 | case EVENT_FIND_UNARMED_SKILL: |
|
|
589 | PUSH_OB; |
|
|
590 | break; |
|
|
591 | |
|
|
592 | case EVENT_PLAYER_USE_SKILL: |
|
|
593 | case EVENT_MONSTER_USE_SKILL: |
|
|
594 | case EVENT_CAST_SPELL: |
|
|
595 | PUSH_OB; |
|
|
596 | PUSH_OB; |
|
|
597 | PUSH_OB; |
|
|
598 | PUSH_IV; |
|
|
599 | PUSH_PV; |
|
|
600 | break; |
|
|
601 | |
547 | case EVENT_CLOCK: |
602 | case EVENT_EXTCMD: |
548 | clean_obj_cache (); |
603 | PUSH_PL; |
|
|
604 | { |
|
|
605 | char *buf = va_arg (args, char *); |
|
|
606 | int len = va_arg (args, int); |
|
|
607 | PUSHs (sv_2mortal (newSVpvn (buf, len))); |
|
|
608 | } |
549 | break; |
609 | break; |
550 | |
610 | |
551 | case EVENT_TELL: |
611 | case EVENT_TELL: |
552 | break; |
612 | break; |
553 | } |
613 | } |
… | |
… | |
569 | } |
629 | } |
570 | |
630 | |
571 | return &rv; |
631 | return &rv; |
572 | } |
632 | } |
573 | |
633 | |
574 | void * |
|
|
575 | eventListener (int *type, ...) |
634 | extern "C" void * eventListener (int *type, ...) |
576 | { |
635 | { |
577 | static int rv; |
636 | static int rv; |
578 | va_list args; |
637 | va_list args; |
579 | int event_code; |
638 | int event_code; |
580 | object *who, *activator, *third, *event; |
639 | object *who, *activator, *third, *event; |
581 | char *message, *extension, *options; |
640 | char *message, *extension, *options; |
582 | |
641 | |
583 | if (!perl) |
642 | if (!perl) |
584 | return; |
643 | return NULL; |
585 | |
644 | |
586 | va_start (args, type); |
645 | va_start (args, type); |
587 | who = va_arg (args, object *); |
646 | who = va_arg (args, object *); |
588 | event_code = va_arg (args, int); |
647 | event_code = va_arg (args, int); |
589 | activator = va_arg (args, object *); |
648 | activator = va_arg (args, object *); |
… | |
… | |
615 | case EVENT_STOP: // $ob (e.g. arrow) |
674 | case EVENT_STOP: // $ob (e.g. arrow) |
616 | case EVENT_TIME: // $ob |
675 | case EVENT_TIME: // $ob |
617 | case EVENT_TIMER: // $ob |
676 | case EVENT_TIMER: // $ob |
618 | break; |
677 | break; |
619 | |
678 | |
620 | case EVENT_APPLY: // $ob, $who |
679 | case EVENT_APPLY: // $ob, $who |
621 | case EVENT_DROP: // $ob, $who |
680 | case EVENT_DROP: // $ob, $who |
622 | case EVENT_CLOSE: // $ob, $who |
681 | case EVENT_CLOSE: // $ob, $who |
623 | case EVENT_DEATH: // $ob[, $killer] |
682 | case EVENT_DEATH: // $ob[, $killer] |
624 | case EVENT_MOVE: // $ob, $enemy |
683 | case EVENT_MOVE: // $ob, $enemy |
625 | case EVENT_THROW: // $ob, $thrower |
684 | case EVENT_THROW: // $ob, $thrower |
626 | PUSHcfapi (POBJECT, activator); |
685 | PUSHcfapi (POBJECT, activator); |
627 | break; |
686 | break; |
628 | |
687 | |
|
|
688 | case EVENT_DROP_ON: // $ob, $who, $what |
629 | case EVENT_ATTACK: // $ob, $who, $victim (?? please god enlighten me) |
689 | case EVENT_ATTACK: // $ob, $who, $victim (?? please god enlighten me) |
630 | PUSHcfapi (POBJECT, activator); |
690 | PUSHcfapi (POBJECT, activator); |
631 | PUSHcfapi (POBJECT, third); |
691 | PUSHcfapi (POBJECT, third); |
632 | break; |
692 | break; |
633 | |
693 | |
… | |
… | |
662 | } |
722 | } |
663 | |
723 | |
664 | return &rv; |
724 | return &rv; |
665 | } |
725 | } |
666 | |
726 | |
667 | int |
727 | extern "C" int closePlugin () |
668 | closePlugin () |
|
|
669 | { |
728 | { |
670 | printf (PLUGIN_VERSION " closing\n"); |
729 | printf (PLUGIN_VERSION " closing\n"); |
671 | |
730 | |
672 | if (perl) |
731 | if (perl) |
673 | { |
732 | { |
… | |
… | |
1001 | const_iv (F_DAMNED) |
1060 | const_iv (F_DAMNED) |
1002 | const_iv (F_OPEN) |
1061 | const_iv (F_OPEN) |
1003 | const_iv (F_NOPICK) |
1062 | const_iv (F_NOPICK) |
1004 | const_iv (F_LOCKED) |
1063 | const_iv (F_LOCKED) |
1005 | |
1064 | |
|
|
1065 | const_iv (F_BUY) |
|
|
1066 | const_iv (F_SHOP) |
|
|
1067 | const_iv (F_SELL) |
|
|
1068 | |
1006 | const_iv (P_BLOCKSVIEW) |
1069 | const_iv (P_BLOCKSVIEW) |
1007 | const_iv (P_NO_MAGIC) |
1070 | const_iv (P_NO_MAGIC) |
1008 | const_iv (P_IS_ALIVE) |
1071 | const_iv (P_IS_ALIVE) |
1009 | const_iv (P_NO_CLERIC) |
1072 | const_iv (P_NO_CLERIC) |
1010 | const_iv (P_NEED_UPDATE) |
1073 | const_iv (P_NEED_UPDATE) |
… | |
… | |
1117 | const_iv (SOUND_CLOCK) |
1180 | const_iv (SOUND_CLOCK) |
1118 | const_iv (SOUND_TURN_HANDLE) |
1181 | const_iv (SOUND_TURN_HANDLE) |
1119 | const_iv (SOUND_FALL_HOLE) |
1182 | const_iv (SOUND_FALL_HOLE) |
1120 | const_iv (SOUND_DRINK_POISON) |
1183 | const_iv (SOUND_DRINK_POISON) |
1121 | const_iv (SOUND_CAST_SPELL_0) |
1184 | const_iv (SOUND_CAST_SPELL_0) |
|
|
1185 | |
|
|
1186 | const_iv (PREFER_LOW) |
|
|
1187 | const_iv (PREFER_HIGH) |
|
|
1188 | |
|
|
1189 | const_iv (ATNR_PHYSICAL) |
|
|
1190 | const_iv (ATNR_MAGIC) |
|
|
1191 | const_iv (ATNR_FIRE) |
|
|
1192 | const_iv (ATNR_ELECTRICITY) |
|
|
1193 | const_iv (ATNR_COLD) |
|
|
1194 | const_iv (ATNR_CONFUSION) |
|
|
1195 | const_iv (ATNR_ACID) |
|
|
1196 | const_iv (ATNR_DRAIN) |
|
|
1197 | const_iv (ATNR_WEAPONMAGIC) |
|
|
1198 | const_iv (ATNR_GHOSTHIT) |
|
|
1199 | const_iv (ATNR_POISON) |
|
|
1200 | const_iv (ATNR_SLOW) |
|
|
1201 | const_iv (ATNR_PARALYZE) |
|
|
1202 | const_iv (ATNR_TURN_UNDEAD) |
|
|
1203 | const_iv (ATNR_FEAR) |
|
|
1204 | const_iv (ATNR_CANCELLATION) |
|
|
1205 | const_iv (ATNR_DEPLETE) |
|
|
1206 | const_iv (ATNR_DEATH) |
|
|
1207 | const_iv (ATNR_CHAOS) |
|
|
1208 | const_iv (ATNR_COUNTERSPELL) |
|
|
1209 | const_iv (ATNR_GODPOWER) |
|
|
1210 | const_iv (ATNR_HOLYWORD) |
|
|
1211 | const_iv (ATNR_BLIND) |
|
|
1212 | const_iv (ATNR_INTERNAL) |
|
|
1213 | const_iv (ATNR_LIFE_STEALING) |
|
|
1214 | const_iv (ATNR_DISEASE) |
|
|
1215 | |
|
|
1216 | const_iv (MAP_FLUSH) |
|
|
1217 | const_iv (MAP_PLAYER_UNIQUE) |
|
|
1218 | const_iv (MAP_BLOCK) |
|
|
1219 | const_iv (MAP_STYLE) |
|
|
1220 | const_iv (MAP_OVERLAY) |
|
|
1221 | |
|
|
1222 | const_iv (MAP_IN_MEMORY) |
|
|
1223 | const_iv (MAP_SWAPPED) |
|
|
1224 | const_iv (MAP_LOADING) |
|
|
1225 | const_iv (MAP_SAVING) |
1122 | }; |
1226 | }; |
1123 | |
1227 | |
1124 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1228 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1125 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1229 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1126 | |
1230 | |
… | |
… | |
1132 | const_event (NONE) |
1236 | const_event (NONE) |
1133 | const_event (APPLY) |
1237 | const_event (APPLY) |
1134 | const_event (ATTACK) |
1238 | const_event (ATTACK) |
1135 | const_event (DEATH) |
1239 | const_event (DEATH) |
1136 | const_event (DROP) |
1240 | const_event (DROP) |
|
|
1241 | const_event (DROP_ON) |
1137 | const_event (PICKUP) |
1242 | const_event (PICKUP) |
1138 | const_event (SAY) |
1243 | const_event (SAY) |
1139 | const_event (STOP) |
1244 | const_event (STOP) |
1140 | const_event (TIME) |
1245 | const_event (TIME) |
1141 | const_event (THROW) |
1246 | const_event (THROW) |
… | |
… | |
1143 | const_event (CLOSE) |
1248 | const_event (CLOSE) |
1144 | const_event (TIMER) |
1249 | const_event (TIMER) |
1145 | const_event (MOVE) |
1250 | const_event (MOVE) |
1146 | |
1251 | |
1147 | const_event (BORN) |
1252 | const_event (BORN) |
1148 | const_event (CLOCK) |
1253 | //const_event (CLOCK) |
1149 | const_event (CRASH) |
1254 | const_event (CRASH) |
1150 | const_event (PLAYER_DEATH) |
1255 | const_event (PLAYER_DEATH) |
1151 | const_event (PLAYER_LOAD) |
1256 | const_event (PLAYER_LOAD) |
1152 | const_event (PLAYER_SAVE) |
1257 | const_event (PLAYER_SAVE) |
1153 | const_event (GKILL) |
1258 | const_event (GKILL) |
… | |
… | |
1163 | const_event (REMOVE) |
1268 | const_event (REMOVE) |
1164 | const_event (SHOUT) |
1269 | const_event (SHOUT) |
1165 | const_event (TELL) |
1270 | const_event (TELL) |
1166 | const_event (MUZZLE) |
1271 | const_event (MUZZLE) |
1167 | const_event (KICK) |
1272 | const_event (KICK) |
|
|
1273 | const_event (PLAYER_USE_SKILL) |
|
|
1274 | const_event (MONSTER_USE_SKILL) |
|
|
1275 | const_event (CAST_SPELL) |
|
|
1276 | const_event (FIND_UNARMED_SKILL) |
|
|
1277 | const_event (EXTCMD) |
1168 | //const_event (FREE_OB) |
1278 | //const_event (FREE_OB) |
1169 | }; |
1279 | }; |
1170 | |
1280 | |
1171 | AV *av = get_av ("cf::EVENT", 1); |
1281 | AV *av = get_av ("cf::EVENT", 1); |
1172 | |
1282 | |
… | |
… | |
1306 | for (cprop = prop_table + sizeof (prop_table) / sizeof (prop_table [0]); cprop-- > prop_table; ) |
1416 | for (cprop = prop_table + sizeof (prop_table) / sizeof (prop_table [0]); cprop-- > prop_table; ) |
1307 | { |
1417 | { |
1308 | hv_store (prop_type, cprop->name, strlen (cprop->name), newSViv (cprop->dtype), 0); |
1418 | hv_store (prop_type, cprop->name, strlen (cprop->name), newSViv (cprop->dtype), 0); |
1309 | hv_store (prop_idx, cprop->name, strlen (cprop->name), newSViv (cprop->idx ), 0); |
1419 | hv_store (prop_idx, cprop->name, strlen (cprop->name), newSViv (cprop->idx ), 0); |
1310 | } |
1420 | } |
|
|
1421 | |
|
|
1422 | //I_EVENT_API (PACKAGE); |
1311 | } |
1423 | } |
|
|
1424 | |
|
|
1425 | NV floor (NV x) |
|
|
1426 | |
|
|
1427 | NV ceil (NV x) |
1312 | |
1428 | |
1313 | void |
1429 | void |
1314 | LOG (int level, char *msg) |
1430 | LOG (int level, char *msg) |
1315 | PROTOTYPE: $$ |
1431 | PROTOTYPE: $$ |
1316 | C_ARGS: level, "%s", msg |
1432 | C_ARGS: (LogLevel)level, "%s", msg |
|
|
1433 | |
|
|
1434 | char *path_combine (char *base, char *path) |
|
|
1435 | PROTOTYPE: $$ |
|
|
1436 | |
|
|
1437 | char *path_combine_and_normalize (char *base, char *path) |
|
|
1438 | PROTOTYPE: $$ |
1317 | |
1439 | |
1318 | char * |
1440 | char * |
1319 | cf_get_maps_directory (char *path) |
1441 | cf_get_maps_directory (char *path) |
1320 | PROTOTYPE: $ |
1442 | PROTOTYPE: $ |
1321 | ALIAS: maps_directory = 0 |
1443 | ALIAS: maps_directory = 0 |
|
|
1444 | |
|
|
1445 | void |
|
|
1446 | sub_generation_inc () |
|
|
1447 | CODE: |
|
|
1448 | PL_sub_generation++; |
1322 | |
1449 | |
1323 | char * |
1450 | char * |
1324 | mapdir () |
1451 | mapdir () |
1325 | PROTOTYPE: |
1452 | PROTOTYPE: |
1326 | ALIAS: |
1453 | ALIAS: |
… | |
… | |
1340 | |
1467 | |
1341 | int |
1468 | int |
1342 | cf_find_animation (char *text) |
1469 | cf_find_animation (char *text) |
1343 | PROTOTYPE: $ |
1470 | PROTOTYPE: $ |
1344 | |
1471 | |
|
|
1472 | int random_roll(int min, int max, object *op, int goodbad); |
|
|
1473 | |
|
|
1474 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
|
|
1475 | |
|
|
1476 | int |
|
|
1477 | exp_to_level (val64 exp) |
|
|
1478 | CODE: |
|
|
1479 | { |
|
|
1480 | int i = 0; |
|
|
1481 | |
|
|
1482 | RETVAL = settings.max_level; |
|
|
1483 | |
|
|
1484 | for (i = 1; i <= settings.max_level; i++) |
|
|
1485 | { |
|
|
1486 | if (levels[i] > exp) |
|
|
1487 | { |
|
|
1488 | RETVAL = i - 1; |
|
|
1489 | break; |
|
|
1490 | } |
|
|
1491 | } |
|
|
1492 | } |
|
|
1493 | OUTPUT: RETVAL |
|
|
1494 | |
|
|
1495 | val64 |
|
|
1496 | level_to_min_exp (int level) |
|
|
1497 | CODE: |
|
|
1498 | if (level > settings.max_level) |
|
|
1499 | RETVAL = levels[settings.max_level]; |
|
|
1500 | else if (level < 1) |
|
|
1501 | RETVAL = 0; |
|
|
1502 | else |
|
|
1503 | RETVAL = levels[level]; |
|
|
1504 | OUTPUT: RETVAL |
|
|
1505 | |
|
|
1506 | SV * |
|
|
1507 | resistance_to_string (int atnr) |
|
|
1508 | CODE: |
|
|
1509 | if (atnr >= 0 && atnr < NROFATTACKS) |
|
|
1510 | RETVAL = newSVpv (resist_plus[atnr], 0); |
|
|
1511 | else |
|
|
1512 | XSRETURN_UNDEF; |
|
|
1513 | OUTPUT: RETVAL |
|
|
1514 | |
1345 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1515 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1346 | |
1516 | |
1347 | SV * |
1517 | SV * |
1348 | get_property (object *obj, int type, int idx) |
1518 | get_property (object *obj, int type, int idx) |
1349 | CODE: |
1519 | CODE: |
… | |
… | |
1357 | { |
1527 | { |
1358 | case CFAPI_INT: |
1528 | case CFAPI_INT: |
1359 | cf_object_set_int_property (obj, idx, SvIV (newval)); |
1529 | cf_object_set_int_property (obj, idx, SvIV (newval)); |
1360 | break; |
1530 | break; |
1361 | case CFAPI_LONG: |
1531 | case CFAPI_LONG: |
1362 | cf_object_set_long_property (obj, idx, SvNV (newval)); |
1532 | cf_object_set_long_property (obj, idx, (long) SvVAL64 (newval)); |
1363 | break; |
1533 | break; |
1364 | case CFAPI_DOUBLE: |
1534 | case CFAPI_DOUBLE: |
1365 | { |
1535 | { |
1366 | int unused_type; |
1536 | int unused_type; |
1367 | object_set_property (&unused_type, obj, idx, (double)SvNV (newval)); |
1537 | object_set_property (&unused_type, obj, idx, (double)SvNV (newval)); |
… | |
… | |
1445 | |
1615 | |
1446 | object *cf_object_clone (object *op, int clonetype = 0) |
1616 | object *cf_object_clone (object *op, int clonetype = 0) |
1447 | |
1617 | |
1448 | int cf_object_pay_item (object *op, object *buyer) |
1618 | int cf_object_pay_item (object *op, object *buyer) |
1449 | |
1619 | |
1450 | int cf_object_pay_amount (object *op, double amount) |
1620 | int cf_object_pay_amount (object *op, uint64 amount) |
|
|
1621 | |
|
|
1622 | void pay_player (object *op, uint64 amount) |
|
|
1623 | |
|
|
1624 | val64 pay_player_arch (object *op, const char *arch, uint64 amount) |
1451 | |
1625 | |
1452 | int cf_object_cast_spell (object *caster, object *ctoo, int dir, object *spell_ob, char *stringarg = 0) |
1626 | int cf_object_cast_spell (object *caster, object *ctoo, int dir, object *spell_ob, char *stringarg = 0) |
1453 | |
1627 | |
1454 | int cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp_, char *stringarg = 0) |
1628 | int cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp_, char *stringarg = 0) |
1455 | |
1629 | |
… | |
… | |
1490 | |
1664 | |
1491 | void cf_object_update (object *op, int flags) |
1665 | void cf_object_update (object *op, int flags) |
1492 | |
1666 | |
1493 | void cf_object_pickup (object *op, object *what) |
1667 | void cf_object_pickup (object *op, object *what) |
1494 | |
1668 | |
1495 | char *cf_object_get_key (object *op, char *keyname) |
|
|
1496 | ALIAS: key = 0 |
|
|
1497 | |
|
|
1498 | void cf_object_set_key (object *op, char *keyname, char *value) |
|
|
1499 | |
|
|
1500 | object *cf_create_object_by_name (const char *name) |
1669 | object *cf_create_object_by_name (const char *name) |
1501 | |
1670 | |
1502 | void change_exp (object *op, double exp, const char *skill_name = 0, int flag = 0) |
1671 | void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) |
1503 | |
1672 | |
1504 | void player_lvl_adj (object *who, object *skill = 0) |
1673 | void player_lvl_adj (object *who, object *skill = 0) |
1505 | |
1674 | |
1506 | int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) |
1675 | int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) |
|
|
1676 | |
|
|
1677 | int calc_skill_exp (object *who, object *op, object *skill); |
|
|
1678 | |
|
|
1679 | void push_button (object *op); |
|
|
1680 | |
|
|
1681 | void use_trigger (object *op); |
|
|
1682 | |
|
|
1683 | void add_button_link (object *button, mapstruct *map, int connected); |
|
|
1684 | |
|
|
1685 | void remove_button_link (object *op); |
|
|
1686 | |
|
|
1687 | void |
|
|
1688 | cf_object_set_resistance (object *op, int rtype, int val) |
|
|
1689 | CODE: |
|
|
1690 | if (rtype >= 0 && rtype < NROFATTACKS) |
|
|
1691 | op->resist[rtype] = val; |
|
|
1692 | |
1507 | |
1693 | |
1508 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
1694 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
1509 | |
1695 | |
1510 | void cf_fix_object (object *pl) |
1696 | void cf_fix_object (object *pl) |
1511 | ALIAS: fix = 0 |
1697 | ALIAS: fix = 0 |
… | |
… | |
1534 | const char *options (object *op) |
1720 | const char *options (object *op) |
1535 | CODE: |
1721 | CODE: |
1536 | RETVAL = op->name; |
1722 | RETVAL = op->name; |
1537 | OUTPUT: |
1723 | OUTPUT: |
1538 | RETVAL |
1724 | RETVAL |
|
|
1725 | |
|
|
1726 | player *contr (object *op) |
|
|
1727 | CODE: |
|
|
1728 | RETVAL = op->contr; |
|
|
1729 | OUTPUT: RETVAL |
1539 | |
1730 | |
1540 | const char *get_ob_key_value (object *op, const char *key) |
1731 | const char *get_ob_key_value (object *op, const char *key) |
1541 | |
1732 | |
1542 | bool set_ob_key_value (object *op, const char *key, const char *value = 0, int add_key = 1) |
1733 | bool set_ob_key_value (object *op, const char *key, const char *value = 0, int add_key = 1) |
1543 | |
1734 | |
… | |
… | |
1587 | |
1778 | |
1588 | void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
1779 | void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
1589 | |
1780 | |
1590 | object *cf_player_send_inventory (object *op) |
1781 | object *cf_player_send_inventory (object *op) |
1591 | |
1782 | |
1592 | player *contr (object *op) |
|
|
1593 | CODE: |
|
|
1594 | RETVAL = op->contr; |
|
|
1595 | OUTPUT: RETVAL |
|
|
1596 | |
|
|
1597 | char *cf_player_get_ip (object *op) |
1783 | char *cf_player_get_ip (object *op) |
1598 | ALIAS: ip = 0 |
1784 | ALIAS: ip = 0 |
1599 | |
1785 | |
1600 | object *cf_player_get_marked_item (object *op) |
1786 | object *cf_player_get_marked_item (object *op) |
1601 | ALIAS: marked_item = 0 |
1787 | ALIAS: marked_item = 0 |
… | |
… | |
1605 | partylist *cf_player_get_party (object *op) |
1791 | partylist *cf_player_get_party (object *op) |
1606 | ALIAS: party = 0 |
1792 | ALIAS: party = 0 |
1607 | |
1793 | |
1608 | void cf_player_set_party (object *op, partylist *party) |
1794 | void cf_player_set_party (object *op, partylist *party) |
1609 | |
1795 | |
1610 | void change_skill (object *op, double exp, char *skill_name = 0, int flag = 0) |
|
|
1611 | |
|
|
1612 | void kill_player (object *op) |
1796 | void kill_player (object *op) |
1613 | |
1797 | |
1614 | MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ |
1798 | MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ |
1615 | |
1799 | |
1616 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
1800 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
… | |
… | |
1637 | |
1821 | |
1638 | player *next (player *pl) |
1822 | player *next (player *pl) |
1639 | CODE: |
1823 | CODE: |
1640 | RETVAL = pl->next; |
1824 | RETVAL = pl->next; |
1641 | OUTPUT: RETVAL |
1825 | OUTPUT: RETVAL |
|
|
1826 | |
|
|
1827 | bool |
|
|
1828 | cell_visible (player *pl, int dx, int dy) |
|
|
1829 | CODE: |
|
|
1830 | RETVAL = FABS (dx) <= pl->socket.mapx / 2 && FABS (dy) <= pl->socket.mapy / 2 |
|
|
1831 | && !pl->blocked_los [dx + pl->socket.mapx / 2][dy + pl->socket.mapy / 2]; |
|
|
1832 | OUTPUT: |
|
|
1833 | RETVAL |
|
|
1834 | |
|
|
1835 | void |
|
|
1836 | send (player *pl, SV *packet) |
|
|
1837 | CODE: |
|
|
1838 | { |
|
|
1839 | STRLEN len; |
|
|
1840 | char *buf = SvPVbyte (packet, len); |
|
|
1841 | |
|
|
1842 | Write_String_To_Socket (&pl->socket, buf, len); |
|
|
1843 | } |
|
|
1844 | |
|
|
1845 | int |
|
|
1846 | listening (player *pl, int new_value = -1) |
|
|
1847 | CODE: |
|
|
1848 | RETVAL = pl->listening; |
|
|
1849 | if (new_value >= 0) |
|
|
1850 | pl->listening = new_value; |
|
|
1851 | OUTPUT: |
|
|
1852 | RETVAL |
1642 | |
1853 | |
1643 | void get_savebed (player *pl) |
1854 | void get_savebed (player *pl) |
1644 | ALIAS: |
1855 | ALIAS: |
1645 | savebed = 0 |
1856 | savebed = 0 |
1646 | PPCODE: |
1857 | PPCODE: |
… | |
… | |
1710 | mapstruct *new (int width, int height) |
1921 | mapstruct *new (int width, int height) |
1711 | PROTOTYPE: |
1922 | PROTOTYPE: |
1712 | CODE: |
1923 | CODE: |
1713 | { |
1924 | { |
1714 | int unused_type; |
1925 | int unused_type; |
1715 | RETVAL = map_get_map (&unused_type, 0, width, height); |
1926 | RETVAL = (mapstruct*) map_get_map (&unused_type, 0, width, height); |
1716 | } |
1927 | } |
1717 | OUTPUT: |
1928 | OUTPUT: |
1718 | RETVAL |
1929 | RETVAL |
1719 | |
1930 | |
1720 | void delete_map (mapstruct *map) |
1931 | void delete_map (mapstruct *map) |
1721 | |
1932 | |
1722 | void clean_tmp_map (mapstruct *map) |
1933 | void clean_tmp_map (mapstruct *map) |
1723 | |
1934 | |
1724 | void play_sound_map (mapstruct *map, int x, int y, int sound_num) |
1935 | void play_sound_map (mapstruct *map, int x, int y, int sound_num) |
|
|
1936 | |
|
|
1937 | mapstruct *tile_map (mapstruct *map, unsigned int dir) |
|
|
1938 | CODE: |
|
|
1939 | RETVAL = dir < 4 ? map->tile_map [dir] : 0; |
|
|
1940 | OUTPUT: |
|
|
1941 | RETVAL |
|
|
1942 | |
|
|
1943 | char *tile_path (mapstruct *map, unsigned int dir) |
|
|
1944 | CODE: |
|
|
1945 | if (dir >= 4) |
|
|
1946 | XSRETURN_UNDEF; |
|
|
1947 | RETVAL = map->tile_path [dir]; |
|
|
1948 | OUTPUT: |
|
|
1949 | RETVAL |
1725 | |
1950 | |
1726 | mapstruct *cf_map_get_map (char *name) |
1951 | mapstruct *cf_map_get_map (char *name) |
1727 | PROTOTYPE: $ |
1952 | PROTOTYPE: $ |
1728 | ALIAS: map = 0 |
1953 | ALIAS: map = 0 |
1729 | |
1954 | |
|
|
1955 | mapstruct *has_been_loaded (char *name) |
|
|
1956 | PROTOTYPE: $ |
|
|
1957 | |
1730 | mapstruct *cf_map_get_first () |
1958 | mapstruct *cf_map_get_first () |
1731 | PROTOTYPE: |
1959 | PROTOTYPE: |
1732 | ALIAS: first = 0 |
1960 | ALIAS: first = 0 |
1733 | |
1961 | |
1734 | # whoever "designed" the plug-in api should have wasted |
1962 | # whoever "designed" the plug-in api should have wasted |
1735 | # his/her time with staying away form the project - would have |
1963 | # his/her time with staying away from the project - would have |
1736 | # saved others a lot of time, without doubt. |
1964 | # saved others a lot of time, without doubt. |
1737 | void set_path (mapstruct *where, char *path) |
1965 | void set_path (mapstruct *where, char *path) |
1738 | CODE: |
1966 | CODE: |
1739 | strcpy (where->path, path); |
1967 | strcpy (where->path, path); |
|
|
1968 | |
|
|
1969 | int in_memory (mapstruct *map) |
|
|
1970 | CODE: |
|
|
1971 | RETVAL = map->in_memory; |
|
|
1972 | OUTPUT: |
|
|
1973 | RETVAL |
1740 | |
1974 | |
1741 | bool unique (mapstruct *map) |
1975 | bool unique (mapstruct *map) |
1742 | CODE: |
1976 | CODE: |
1743 | RETVAL = map->unique; |
1977 | RETVAL = map->unique; |
1744 | OUTPUT: |
1978 | OUTPUT: |
… | |
… | |
1753 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
1987 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
1754 | |
1988 | |
1755 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1989 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1756 | C_ARGS: str, map, nx, ny |
1990 | C_ARGS: str, map, nx, ny |
1757 | |
1991 | |
1758 | #int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
|
|
1759 | |
|
|
1760 | void |
1992 | void |
|
|
1993 | cf_map_normalise (mapstruct *map, int x, int y) |
|
|
1994 | PPCODE: |
|
|
1995 | { |
|
|
1996 | mapstruct *nmap = 0; |
|
|
1997 | I16 nx = 0, ny = 0; |
|
|
1998 | int flags = cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
|
|
1999 | |
|
|
2000 | EXTEND (SP, 4); |
|
|
2001 | PUSHs (sv_2mortal (newSViv (flags))); |
|
|
2002 | |
|
|
2003 | if (GIMME_V == G_ARRAY) |
|
|
2004 | { |
|
|
2005 | PUSHs (sv_2mortal (newSVcfapi (CFAPI_PMAP, nmap))); |
|
|
2006 | PUSHs (sv_2mortal (newSViv (nx))); |
|
|
2007 | PUSHs (sv_2mortal (newSViv (ny))); |
|
|
2008 | } |
|
|
2009 | } |
|
|
2010 | |
|
|
2011 | void |
1761 | at (mapstruct *obj, unsigned int x, unsigned int y) |
2012 | at (mapstruct *map, unsigned int x, unsigned int y) |
1762 | PROTOTYPE: $$$ |
2013 | PROTOTYPE: $$$ |
1763 | INIT: |
|
|
1764 | if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_EMPTY; |
|
|
1765 | PPCODE: |
2014 | PPCODE: |
1766 | { |
2015 | { |
1767 | object *o; |
2016 | object *o; |
1768 | |
2017 | mapstruct *nmap = 0; |
|
|
2018 | I16 nx, ny; |
|
|
2019 | |
|
|
2020 | cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2021 | |
|
|
2022 | if (nmap) |
1769 | for (o = GET_MAP_OB (obj, x, y); o; o = o->above) |
2023 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
1770 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2024 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
1771 | } |
2025 | } |
1772 | |
2026 | |
1773 | SV * |
2027 | SV * |
1774 | bot_at (mapstruct *obj, unsigned int x, unsigned int y) |
2028 | bot_at (mapstruct *obj, unsigned int x, unsigned int y) |
1775 | PROTOTYPE: $$$ |
2029 | PROTOTYPE: $$$ |
… | |
… | |
1887 | ALIAS: more = 0 |
2141 | ALIAS: more = 0 |
1888 | |
2142 | |
1889 | const char *cf_archetype_get_name (archetype *arch) |
2143 | const char *cf_archetype_get_name (archetype *arch) |
1890 | ALIAS: name = 0 |
2144 | ALIAS: name = 0 |
1891 | |
2145 | |
|
|
2146 | object *cf_archetype_get_clone (archetype *arch) |
|
|
2147 | ALIAS: clone = 0 |
|
|
2148 | |
1892 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
2149 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
1893 | |
2150 | |
1894 | partylist *cf_party_get_first () |
2151 | partylist *cf_party_get_first () |
1895 | PROTOTYPE: |
2152 | PROTOTYPE: |
1896 | ALIAS: first = 0 |
2153 | ALIAS: first = 0 |
… | |
… | |
1932 | ALIAS: message = 0 |
2189 | ALIAS: message = 0 |
1933 | |
2190 | |
1934 | |
2191 | |
1935 | MODULE = cf PACKAGE = cf::living PREFIX = cf_living_ |
2192 | MODULE = cf PACKAGE = cf::living PREFIX = cf_living_ |
1936 | |
2193 | |
1937 | double |
2194 | val64 |
1938 | exp (living *liv, double new_val = 0.) |
2195 | exp (living *liv, val64 new_val = 0) |
1939 | PROTOTYPE: $;$ |
2196 | PROTOTYPE: $;$ |
1940 | ALIAS: |
2197 | ALIAS: |
1941 | Str = 1 |
2198 | Str = 1 |
1942 | Dex = 2 |
2199 | Dex = 2 |
1943 | Con = 3 |
2200 | Con = 3 |
… | |
… | |
1955 | maxgrace = 15 |
2212 | maxgrace = 15 |
1956 | food = 16 |
2213 | food = 16 |
1957 | dam = 17 |
2214 | dam = 17 |
1958 | luck = 18 |
2215 | luck = 18 |
1959 | CODE: |
2216 | CODE: |
1960 | # define LIVING_ACC(acc,idx) case idx: RETVAL = liv->acc; if (items > 1) liv->acc = new_val; break |
2217 | # define LIVING_ACC(acc,idx) case idx: RETVAL = liv->acc; if (items > 1) liv->acc = (sint64)new_val; break |
1961 | switch (ix) |
2218 | switch (ix) |
1962 | { |
2219 | { |
1963 | LIVING_ACC (exp , 0); |
2220 | LIVING_ACC (exp , 0); |
1964 | LIVING_ACC (Str , 1); |
2221 | LIVING_ACC (Str , 1); |
1965 | LIVING_ACC (Dex , 2); |
2222 | LIVING_ACC (Dex , 2); |