… | |
… | |
92 | |
92 | |
93 | static SV |
93 | static SV |
94 | *cv_cf_do_invoke, |
94 | *cv_cf_do_invoke, |
95 | *cv_cf__can_merge, |
95 | *cv_cf__can_merge, |
96 | *cv_cf_client_send_msg, |
96 | *cv_cf_client_send_msg, |
|
|
97 | *cv_cf_ix, |
97 | *cv_cf_tick, |
98 | *cv_cf_tick, |
98 | *cv_cf_match_match; |
99 | *cv_cf_match_match; |
99 | |
100 | |
100 | #ifndef newSVpv_utf8 |
101 | #ifndef newSVpv_utf8 |
101 | static SV * |
102 | static SV * |
… | |
… | |
1157 | CALL_ARG (originator); |
1158 | CALL_ARG (originator); |
1158 | CALL_CALL ("cf::mapscript::activate", G_VOID); |
1159 | CALL_CALL ("cf::mapscript::activate", G_VOID); |
1159 | CALL_END; |
1160 | CALL_END; |
1160 | } |
1161 | } |
1161 | |
1162 | |
|
|
1163 | void cfperl_ix (client *ns, int set, faceidx idx, int pri) |
|
|
1164 | { |
|
|
1165 | CALL_BEGIN (3); |
|
|
1166 | CALL_ARG (ns); |
|
|
1167 | CALL_ARG (set); |
|
|
1168 | CALL_ARG (idx); |
|
|
1169 | CALL_ARG (pri); |
|
|
1170 | CALL_CALL (cv_cf_ix, G_VOID); |
|
|
1171 | CALL_END; |
|
|
1172 | } |
|
|
1173 | |
1162 | player * |
1174 | player * |
1163 | player::find (const_utf8_string name) |
1175 | player::find (const_utf8_string name) |
1164 | { |
1176 | { |
1165 | CALL_BEGIN (1); |
1177 | CALL_BEGIN (1); |
1166 | CALL_ARG (name); |
1178 | CALL_ARG (name); |
… | |
… | |
1436 | _connect_to_perl_2 () |
1448 | _connect_to_perl_2 () |
1437 | { |
1449 | { |
1438 | cv_cf_do_invoke = (SV *)get_cv ("cf::do_invoke" , 0); assert (cv_cf_do_invoke); |
1450 | cv_cf_do_invoke = (SV *)get_cv ("cf::do_invoke" , 0); assert (cv_cf_do_invoke); |
1439 | cv_cf__can_merge = (SV *)get_cv ("cf::_can_merge" , 0); assert (cv_cf__can_merge); |
1451 | cv_cf__can_merge = (SV *)get_cv ("cf::_can_merge" , 0); assert (cv_cf__can_merge); |
1440 | cv_cf_client_send_msg = (SV *)get_cv ("cf::client::send_msg", 0); assert (cv_cf_client_send_msg); |
1452 | cv_cf_client_send_msg = (SV *)get_cv ("cf::client::send_msg", 0); assert (cv_cf_client_send_msg); |
|
|
1453 | cv_cf_ix = (SV *)get_cv ("cf::face::ix" , 0); assert (cv_cf_ix); |
1441 | cv_cf_tick = (SV *)get_cv ("cf::tick" , 0); assert (cv_cf_tick); |
1454 | cv_cf_tick = (SV *)get_cv ("cf::tick" , 0); assert (cv_cf_tick); |
1442 | cv_cf_match_match = (SV *)get_cv ("cf::match::match" , 0); assert (cv_cf_match_match); |
1455 | cv_cf_match_match = (SV *)get_cv ("cf::match::match" , 0); assert (cv_cf_match_match); |
1443 | } |
1456 | } |
1444 | |
1457 | |
1445 | MODULE = cf PACKAGE = cf PREFIX = cf_ |
1458 | MODULE = cf PACKAGE = cf PREFIX = cf_ |
… | |
… | |
1450 | I_CORO_API (PACKAGE); coroapi::GCoroAPI = GCoroAPI; |
1463 | I_CORO_API (PACKAGE); coroapi::GCoroAPI = GCoroAPI; |
1451 | |
1464 | |
1452 | _connect_to_perl_1 (); |
1465 | _connect_to_perl_1 (); |
1453 | |
1466 | |
1454 | newCONSTSUB (stash_cf, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1467 | newCONSTSUB (stash_cf, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1455 | |
|
|
1456 | //{ |
|
|
1457 | // require_pv ("Time::HiRes"); |
|
|
1458 | // |
|
|
1459 | // SV **svp = hv_fetch (PL_modglobal, "Time::NVtime", 12, 0); |
|
|
1460 | // if (!svp) croak ("Time::HiRes is required"); |
|
|
1461 | // if (!SvIOK(*svp)) croak ("Time::NVtime isn’t a function pointer"); |
|
|
1462 | // coroapi::time = INT2PTR (double(*)(), SvIV(*svp)); |
|
|
1463 | //} |
|
|
1464 | |
1468 | |
1465 | static const struct { |
1469 | static const struct { |
1466 | const char *name; |
1470 | const char *name; |
1467 | IV iv; |
1471 | IV iv; |
1468 | } *civ, const_iv[] = { |
1472 | } *civ, const_iv[] = { |
… | |
… | |
1579 | |
1583 | |
1580 | void init_dynamic () |
1584 | void init_dynamic () |
1581 | |
1585 | |
1582 | void load_settings () |
1586 | void load_settings () |
1583 | |
1587 | |
1584 | void reload_exp_table () |
1588 | void _reload_exp_table () |
1585 | |
1589 | |
1586 | void reload_materials () |
1590 | void _reload_materials () |
1587 | |
1591 | |
1588 | void init_uuid () |
1592 | void init_uuid () |
1589 | CODE: |
1593 | CODE: |
1590 | UUID::init (); |
1594 | UUID::init (); |
1591 | |
1595 | |
… | |
… | |
1800 | |
1804 | |
1801 | int exp_to_level (val64 exp) |
1805 | int exp_to_level (val64 exp) |
1802 | |
1806 | |
1803 | val64 level_to_min_exp (int level) |
1807 | val64 level_to_min_exp (int level) |
1804 | |
1808 | |
|
|
1809 | const_utf8_string |
|
|
1810 | spellpathnames (int idx) |
|
|
1811 | CODE: |
|
|
1812 | RETVAL = spellpathnames [idx]; |
|
|
1813 | OUTPUT: RETVAL |
|
|
1814 | |
1805 | SV * |
1815 | SV * |
1806 | attacktype_name (int atnr) |
1816 | attacktype_name (int atnr) |
1807 | CODE: |
1817 | CODE: |
1808 | RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) |
1818 | RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) |
1809 | ? newSVpv (attacktype_name [atnr], 0) |
1819 | ? newSVpv (attacktype_name [atnr], 0) |
… | |
… | |
2391 | croak ("maptile::add_underlay: palette must be arrayref"); |
2401 | croak ("maptile::add_underlay: palette must be arrayref"); |
2392 | |
2402 | |
2393 | palette = SvRV (palette); |
2403 | palette = SvRV (palette); |
2394 | |
2404 | |
2395 | STRLEN idxlen; |
2405 | STRLEN idxlen; |
2396 | const uint8_t *idx = (const uint8_t *)SvPVbyte (data, idxlen); |
2406 | const uint8 *idx = (const uint8 *)SvPVbyte (data, idxlen); |
2397 | |
2407 | |
2398 | for (int x = 0; x < THIS->width; ++x) |
2408 | for (int x = 0; x < THIS->width; ++x) |
2399 | for (int y = 0; y < THIS->height; ++y) |
2409 | for (int y = 0; y < THIS->height; ++y) |
2400 | { |
2410 | { |
2401 | for (object *op = THIS->at (x, y).bot; op; op = op->above) |
2411 | for (object *op = THIS->at (x, y).bot; op; op = op->above) |
… | |
… | |
2441 | croak ("maptile::set_regiondata: palette must be arrayref"); |
2451 | croak ("maptile::set_regiondata: palette must be arrayref"); |
2442 | |
2452 | |
2443 | palette = SvRV (palette); |
2453 | palette = SvRV (palette); |
2444 | |
2454 | |
2445 | STRLEN idxlen; |
2455 | STRLEN idxlen; |
2446 | const uint8_t *idx = (const uint8_t *)SvPVbyte (data, idxlen); |
2456 | const uint8 *idx = (const uint8 *)SvPVbyte (data, idxlen); |
2447 | |
2457 | |
2448 | region_ptr *regionmap = new region_ptr [av_len ((AV *)palette) + 1]; |
2458 | region_ptr *regionmap = new region_ptr [av_len ((AV *)palette) + 1]; |
2449 | uint8_t *regions = salloc<uint8_t> (THIS->size ()); |
2459 | uint8 *regions = salloc<uint8_t> (THIS->size ()); |
2450 | |
2460 | |
2451 | for (int i = av_len ((AV *)palette) + 1; i--; ) |
2461 | for (int i = av_len ((AV *)palette) + 1; i--; ) |
2452 | regionmap [i] = region::find (cfSvPVutf8_nolen (*av_fetch ((AV *)palette, i, 1))); |
2462 | regionmap [i] = region::find (cfSvPVutf8_nolen (*av_fetch ((AV *)palette, i, 1))); |
2453 | |
2463 | |
2454 | for (int y = 0; y < THIS->height; ++y) |
2464 | for (int y = 0; y < THIS->height; ++y) |
… | |
… | |
2580 | archetype *archetypes (U32 index) |
2590 | archetype *archetypes (U32 index) |
2581 | CODE: |
2591 | CODE: |
2582 | RETVAL = index < archetypes.size () ? archetypes [index] : 0; |
2592 | RETVAL = index < archetypes.size () ? archetypes [index] : 0; |
2583 | OUTPUT: RETVAL |
2593 | OUTPUT: RETVAL |
2584 | |
2594 | |
|
|
2595 | int skillvec_size () |
|
|
2596 | CODE: |
|
|
2597 | RETVAL = skillvec.size (); |
|
|
2598 | OUTPUT: RETVAL |
|
|
2599 | |
|
|
2600 | archetype *skillvec (U32 index) |
|
|
2601 | CODE: |
|
|
2602 | RETVAL = index < skillvec.size () ? (archetype *)(object *)skillvec [index] : 0; |
|
|
2603 | OUTPUT: RETVAL |
|
|
2604 | |
2585 | INCLUDE: $PERL $srcdir/genacc archetype $srcdir/../include/object.h | |
2605 | INCLUDE: $PERL $srcdir/genacc archetype $srcdir/../include/object.h | |
2586 | |
2606 | |
2587 | MODULE = cf PACKAGE = cf::party |
2607 | MODULE = cf PACKAGE = cf::party |
2588 | |
2608 | |
2589 | partylist *first () |
2609 | partylist *first () |
… | |
… | |
2753 | case 2: f->magicmap = value; break; |
2773 | case 2: f->magicmap = value; break; |
2754 | case 3: f->smooth = value; break; |
2774 | case 3: f->smooth = value; break; |
2755 | case 4: f->smoothlevel = value; break; |
2775 | case 4: f->smoothlevel = value; break; |
2756 | } |
2776 | } |
2757 | |
2777 | |
2758 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2778 | void set_csum (faceidx idx, int faceset, SV *chksum) |
2759 | CODE: |
2779 | CODE: |
2760 | { |
2780 | { |
2761 | faceinfo *f = face_info (idx); assert (f); |
2781 | faceinfo *f = face_info (idx); assert (f); |
2762 | facedata *d = f->face + faceset; |
2782 | facedata *d = f->face + faceset; |
2763 | sv_to (data, d->data); |
|
|
2764 | STRLEN clen; |
2783 | STRLEN clen; |
2765 | char *cdata = SvPVbyte (chksum, clen); |
2784 | char *cdata = SvPVbyte (chksum, clen); |
2766 | clen = min (CHKSUM_MAXLEN, clen); |
|
|
2767 | |
2785 | |
|
|
2786 | assert (("cf::face::set_data called with too long checksum", clen <= CHKSUM_MAXLEN)); |
2768 | assert (("cf::face::set_data must be called with a non-empty checksum", clen)); |
2787 | assert (("cf::face::set_data must be called with a non-empty checksum", clen)); |
2769 | |
2788 | |
2770 | if (clen != d->chksum_len || memcmp (d->chksum, cdata, clen)) |
2789 | if (clen != d->chksum_len || memcmp (d->chksum, cdata, clen)) |
2771 | { |
2790 | { |
2772 | d->chksum_len = clen; |
2791 | d->chksum_len = clen; |
2773 | memcpy (d->chksum, cdata, clen); |
2792 | memcpy (d->chksum, cdata, clen); |
2774 | |
2793 | |
2775 | // invalidate existing client face info |
2794 | // invalidate existing client face info |
2776 | for_all_clients (ns) |
2795 | for_all_clients (ns) |
2777 | if (ns->faceset == faceset) |
2796 | ns->invalidate_face (idx); |
2778 | { |
|
|
2779 | ns->faces_sent [idx] = false; |
|
|
2780 | ns->force_newmap = true; |
|
|
2781 | } |
|
|
2782 | } |
2797 | } |
2783 | } |
2798 | } |
2784 | |
2799 | |
2785 | int get_data_size (faceidx idx, int faceset = 0) |
2800 | SV *mangle_csum (SV *chksum) |
2786 | CODE: |
2801 | CODE: |
2787 | facedata *d = face_data (idx, faceset); |
2802 | STRLEN len; |
2788 | if (!d) XSRETURN_UNDEF; |
2803 | char *data = SvPVbyte (chksum, len); |
2789 | RETVAL = d->data.size (); |
2804 | RETVAL = newSVpvn (data, min (len, CHKSUM_MAXLEN)); |
2790 | OUTPUT: |
2805 | OUTPUT: |
2791 | RETVAL |
2806 | RETVAL |
2792 | |
2807 | |
2793 | void set_meta (faceidx idx, SV *sv) |
|
|
2794 | CODE: |
|
|
2795 | { |
|
|
2796 | faceinfo *f = face_info (idx); assert (f); |
|
|
2797 | SvREFCNT_dec (f->meta_hv); |
|
|
2798 | f->meta_hv = SvOK (sv) ? (HV *)SvREFCNT_inc (SvRV (sv)) : 0; |
|
|
2799 | } |
|
|
2800 | |
|
|
2801 | SV *get_chksum (faceidx idx, int faceset = 0) |
2808 | SV *get_csum (faceidx idx, int faceset = 0) |
2802 | CODE: |
2809 | CODE: |
2803 | facedata *d = face_data (idx, faceset); |
2810 | facedata *d = face_data (idx, faceset); |
2804 | if (!d) XSRETURN_UNDEF; |
2811 | if (!d) XSRETURN_UNDEF; |
2805 | RETVAL = newSVpvn ((char *)d->chksum, d->chksum_len); |
2812 | RETVAL = newSVpvn ((char *)d->chksum, d->chksum_len); |
2806 | OUTPUT: |
2813 | OUTPUT: |
… | |
… | |
2812 | if (!f) XSRETURN_UNDEF; |
2819 | if (!f) XSRETURN_UNDEF; |
2813 | RETVAL = f->type; |
2820 | RETVAL = f->type; |
2814 | OUTPUT: |
2821 | OUTPUT: |
2815 | RETVAL |
2822 | RETVAL |
2816 | |
2823 | |
2817 | SV *get_data (faceidx idx, int faceset = 0) |
2824 | SV *get_name (faceidx idx) |
2818 | CODE: |
2825 | CODE: |
2819 | facedata *d = face_data (idx, faceset); |
2826 | faceinfo *f = face_info (idx); |
2820 | if (!d) XSRETURN_UNDEF; |
2827 | if (!f) XSRETURN_UNDEF; |
2821 | RETVAL = newSVpvn (d->data, d->data.size ()); |
2828 | RETVAL = to_sv (f->name); |
2822 | OUTPUT: |
|
|
2823 | RETVAL |
|
|
2824 | |
|
|
2825 | SV *get_meta (faceidx idx) |
|
|
2826 | CODE: |
|
|
2827 | faceinfo *f = face_info (idx); assert (f); |
|
|
2828 | if (!f || !f->meta_hv) XSRETURN_UNDEF; |
|
|
2829 | RETVAL = newRV_inc ((SV *)f->meta_hv); |
|
|
2830 | OUTPUT: |
2829 | OUTPUT: |
2831 | RETVAL |
2830 | RETVAL |
2832 | |
2831 | |
2833 | void invalidate (faceidx idx) |
2832 | void invalidate (faceidx idx) |
2834 | CODE: |
2833 | CODE: |