… | |
… | |
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 "EventAPI.h" |
50 | #include "perlxsi.c" |
51 | #include "perlxsi.c" |
51 | |
52 | |
52 | typedef object object_ornull; |
53 | typedef object object_ornull; |
53 | typedef mapstruct mapstruct_ornull; |
54 | typedef mapstruct mapstruct_ornull; |
54 | |
55 | |
… | |
… | |
488 | if (sv) |
489 | if (sv) |
489 | clearSVptr (sv); |
490 | clearSVptr (sv); |
490 | |
491 | |
491 | rv = 0; |
492 | rv = 0; |
492 | } |
493 | } |
|
|
494 | else if (event_code == EVENT_CLOCK) |
|
|
495 | { |
|
|
496 | dSP; |
|
|
497 | int i, count; |
|
|
498 | |
|
|
499 | clean_obj_cache (); |
|
|
500 | |
|
|
501 | ENTER; |
|
|
502 | SAVETMPS; |
|
|
503 | |
|
|
504 | // service up to 8 events per tick better would be |
|
|
505 | // to check for elapsed time and stop processing after |
|
|
506 | // 0.25 * server_tick or so |
|
|
507 | for (i = 9; --i; ) |
|
|
508 | { |
|
|
509 | PUSHMARK (SP); |
|
|
510 | XPUSHs (sv_2mortal (newSViv (0))); |
|
|
511 | PUTBACK; |
|
|
512 | count = call_pv ("Event::one_event", G_SCALAR | G_EVAL); |
|
|
513 | SPAGAIN; |
|
|
514 | |
|
|
515 | if (!count || !POPi) |
|
|
516 | break; |
|
|
517 | } |
|
|
518 | |
|
|
519 | FREETMPS; |
|
|
520 | LEAVE; |
|
|
521 | } |
493 | else |
522 | else |
494 | { |
523 | { |
495 | dSP; |
524 | dSP; |
496 | |
525 | |
497 | ENTER; |
526 | ENTER; |
… | |
… | |
552 | { |
581 | { |
553 | char *buf = va_arg (args, char *); |
582 | char *buf = va_arg (args, char *); |
554 | int len = va_arg (args, int); |
583 | int len = va_arg (args, int); |
555 | PUSHs (sv_2mortal (newSVpvn (buf, len))); |
584 | PUSHs (sv_2mortal (newSVpvn (buf, len))); |
556 | } |
585 | } |
557 | break; |
|
|
558 | |
|
|
559 | case EVENT_CLOCK: |
|
|
560 | clean_obj_cache (); |
|
|
561 | break; |
586 | break; |
562 | |
587 | |
563 | case EVENT_TELL: |
588 | case EVENT_TELL: |
564 | break; |
589 | break; |
565 | } |
590 | } |
… | |
… | |
1166 | const_event (CLOSE) |
1191 | const_event (CLOSE) |
1167 | const_event (TIMER) |
1192 | const_event (TIMER) |
1168 | const_event (MOVE) |
1193 | const_event (MOVE) |
1169 | |
1194 | |
1170 | const_event (BORN) |
1195 | const_event (BORN) |
1171 | const_event (CLOCK) |
1196 | //const_event (CLOCK) |
1172 | const_event (CRASH) |
1197 | const_event (CRASH) |
1173 | const_event (PLAYER_DEATH) |
1198 | const_event (PLAYER_DEATH) |
1174 | const_event (PLAYER_LOAD) |
1199 | const_event (PLAYER_LOAD) |
1175 | const_event (PLAYER_SAVE) |
1200 | const_event (PLAYER_SAVE) |
1176 | const_event (GKILL) |
1201 | const_event (GKILL) |
… | |
… | |
1330 | for (cprop = prop_table + sizeof (prop_table) / sizeof (prop_table [0]); cprop-- > prop_table; ) |
1355 | for (cprop = prop_table + sizeof (prop_table) / sizeof (prop_table [0]); cprop-- > prop_table; ) |
1331 | { |
1356 | { |
1332 | hv_store (prop_type, cprop->name, strlen (cprop->name), newSViv (cprop->dtype), 0); |
1357 | hv_store (prop_type, cprop->name, strlen (cprop->name), newSViv (cprop->dtype), 0); |
1333 | hv_store (prop_idx, cprop->name, strlen (cprop->name), newSViv (cprop->idx ), 0); |
1358 | hv_store (prop_idx, cprop->name, strlen (cprop->name), newSViv (cprop->idx ), 0); |
1334 | } |
1359 | } |
|
|
1360 | |
|
|
1361 | //I_EVENT_API (PACKAGE); |
1335 | } |
1362 | } |
1336 | |
1363 | |
1337 | void |
1364 | void |
1338 | LOG (int level, char *msg) |
1365 | LOG (int level, char *msg) |
1339 | PROTOTYPE: $$ |
1366 | PROTOTYPE: $$ |
… | |
… | |
1772 | void delete_map (mapstruct *map) |
1799 | void delete_map (mapstruct *map) |
1773 | |
1800 | |
1774 | void clean_tmp_map (mapstruct *map) |
1801 | void clean_tmp_map (mapstruct *map) |
1775 | |
1802 | |
1776 | void play_sound_map (mapstruct *map, int x, int y, int sound_num) |
1803 | void play_sound_map (mapstruct *map, int x, int y, int sound_num) |
|
|
1804 | |
|
|
1805 | mapstruct *tile_map (mapstruct *map, unsigned int dir) |
|
|
1806 | CODE: |
|
|
1807 | RETVAL = dir < 4 ? map->tile_map [dir] : 0; |
|
|
1808 | OUTPUT: |
|
|
1809 | RETVAL |
|
|
1810 | |
|
|
1811 | char *tile_path (mapstruct *map, unsigned int dir) |
|
|
1812 | CODE: |
|
|
1813 | if (dir >= 4) |
|
|
1814 | XSRETURN_UNDEF; |
|
|
1815 | RETVAL = map->tile_path [dir]; |
|
|
1816 | OUTPUT: |
|
|
1817 | RETVAL |
1777 | |
1818 | |
1778 | mapstruct *cf_map_get_map (char *name) |
1819 | mapstruct *cf_map_get_map (char *name) |
1779 | PROTOTYPE: $ |
1820 | PROTOTYPE: $ |
1780 | ALIAS: map = 0 |
1821 | ALIAS: map = 0 |
1781 | |
1822 | |