… | |
… | |
49 | |
49 | |
50 | extern sint64 *levels; // the experience table |
50 | extern sint64 *levels; // the experience table |
51 | |
51 | |
52 | typedef object object_ornull; |
52 | typedef object object_ornull; |
53 | typedef maptile maptile_ornull; |
53 | typedef maptile maptile_ornull; |
|
|
54 | |
|
|
55 | typedef char *octet_string; |
|
|
56 | typedef char *utf8_string; |
|
|
57 | typedef const char *const_octet_string; |
|
|
58 | typedef const char *const_utf8_string; |
54 | |
59 | |
55 | #if IVSIZE >= 8 |
60 | #if IVSIZE >= 8 |
56 | typedef IV val64; |
61 | typedef IV val64; |
57 | # define newSVval64 newSViv |
62 | # define newSVval64 newSViv |
58 | # define SvVAL64 SvIV |
63 | # define SvVAL64 SvIV |
… | |
… | |
386 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
391 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
387 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
392 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
388 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
393 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
389 | |
394 | |
390 | //inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
395 | //inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
391 | inline void sv_to (SV *sv, treasurelist * &v) { v = find_treasurelist (SvPV_nolen (sv)); } |
396 | inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } |
392 | |
397 | |
393 | template<class T> |
398 | template<class T> |
394 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
399 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
395 | |
400 | |
396 | template<int N> |
401 | template<int N> |
… | |
… | |
606 | perl = perl_alloc (); |
611 | perl = perl_alloc (); |
607 | perl_construct (perl); |
612 | perl_construct (perl); |
608 | |
613 | |
609 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
614 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
610 | |
615 | |
611 | char *argv[] = { |
616 | const char *argv[] = { |
612 | "", |
617 | "", |
613 | "-e" |
618 | "-e" |
614 | "use Event; use Coro;" // required for bootstrap |
619 | "use Event; use Coro;" // required for bootstrap |
615 | "cf->bootstrap;" // required for datadir :*> |
620 | "cf->bootstrap;" // required for datadir :*> |
616 | "unshift @INC, cf::datadir ();" |
621 | "unshift @INC, cf::datadir ();" |
617 | "require cf;" |
622 | "require cf;" |
618 | }; |
623 | }; |
619 | |
624 | |
620 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
625 | if (perl_parse (perl, xs_init, 2, (char **)argv, (char **)NULL) |
|
|
626 | || perl_run (perl)) |
621 | { |
627 | { |
622 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
628 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
623 | exit (EXIT_FAILURE); |
629 | exit (EXIT_FAILURE); |
624 | } |
630 | } |
625 | |
631 | |
… | |
… | |
945 | struct EventAPI *watcher_base::GEventAPI; |
951 | struct EventAPI *watcher_base::GEventAPI; |
946 | struct CoroAPI *coroapi::GCoroAPI; |
952 | struct CoroAPI *coroapi::GCoroAPI; |
947 | |
953 | |
948 | int coroapi::cede_counter; |
954 | int coroapi::cede_counter; |
949 | |
955 | |
|
|
956 | void |
|
|
957 | coroapi::wait_for_tick () |
|
|
958 | { |
|
|
959 | CALL_BEGIN (0); |
|
|
960 | CALL_CALL ("cf::wait_for_tick", G_DISCARD); |
|
|
961 | CALL_END; |
|
|
962 | } |
|
|
963 | |
|
|
964 | void |
|
|
965 | coroapi::wait_for_tick_begin () |
|
|
966 | { |
|
|
967 | CALL_BEGIN (0); |
|
|
968 | CALL_CALL ("cf::wait_for_tick_begin", G_DISCARD); |
|
|
969 | CALL_END; |
|
|
970 | } |
|
|
971 | |
|
|
972 | static void |
950 | static void iw_dispatch (pe_event *ev) |
973 | iw_dispatch (pe_event *ev) |
951 | { |
974 | { |
952 | iw *w = (iw *)ev->ext_data; |
975 | iw *w = (iw *)ev->ext_data; |
953 | w->call (*w); |
976 | w->call (*w); |
954 | } |
977 | } |
955 | |
978 | |
… | |
… | |
1050 | # define const_iv(name) { # name, (IV)name }, |
1073 | # define const_iv(name) { # name, (IV)name }, |
1051 | const_iv (llevError) |
1074 | const_iv (llevError) |
1052 | const_iv (llevInfo) |
1075 | const_iv (llevInfo) |
1053 | const_iv (llevDebug) |
1076 | const_iv (llevDebug) |
1054 | const_iv (llevMonster) |
1077 | const_iv (llevMonster) |
|
|
1078 | |
|
|
1079 | const_iv (Map0Cmd) |
|
|
1080 | const_iv (Map1Cmd) |
|
|
1081 | const_iv (Map1aCmd) |
|
|
1082 | |
|
|
1083 | const_iv (MAP_CLIENT_X) |
|
|
1084 | const_iv (MAP_CLIENT_Y) |
1055 | |
1085 | |
1056 | const_iv (MAX_TIME) |
1086 | const_iv (MAX_TIME) |
1057 | const_iv (PLAYER) |
1087 | const_iv (PLAYER) |
1058 | const_iv (TRANSPORT) |
1088 | const_iv (TRANSPORT) |
1059 | const_iv (ROD) |
1089 | const_iv (ROD) |
… | |
… | |
1620 | CODE: |
1650 | CODE: |
1621 | runtime = SvNVx (sv_runtime); |
1651 | runtime = SvNVx (sv_runtime); |
1622 | server_tick (); |
1652 | server_tick (); |
1623 | |
1653 | |
1624 | void |
1654 | void |
1625 | LOG (int level, char *msg) |
1655 | LOG (int level, utf8_string msg) |
1626 | PROTOTYPE: $$ |
1656 | PROTOTYPE: $$ |
1627 | C_ARGS: (LogLevel)level, "%s", msg |
1657 | C_ARGS: (LogLevel)level, "%s", msg |
1628 | |
1658 | |
1629 | char *path_combine (char *base, char *path) |
1659 | octet_string path_combine (octet_string base, octet_string path) |
1630 | PROTOTYPE: $$ |
1660 | PROTOTYPE: $$ |
1631 | |
1661 | |
1632 | char *path_combine_and_normalize (char *base, char *path) |
1662 | octet_string path_combine_and_normalize (octet_string base, octet_string path) |
1633 | PROTOTYPE: $$ |
1663 | PROTOTYPE: $$ |
1634 | |
1664 | |
1635 | const char * |
1665 | const_octet_string |
1636 | get_maps_directory (char *path) |
1666 | get_maps_directory (octet_string path) |
1637 | PROTOTYPE: $ |
1667 | PROTOTYPE: $ |
1638 | ALIAS: maps_directory = 0 |
1668 | ALIAS: maps_directory = 0 |
1639 | CODE: |
1669 | CODE: |
1640 | RETVAL = create_pathname (path); |
1670 | RETVAL = create_pathname (path); |
1641 | OUTPUT: RETVAL |
1671 | OUTPUT: RETVAL |
… | |
… | |
1643 | void |
1673 | void |
1644 | sub_generation_inc () |
1674 | sub_generation_inc () |
1645 | CODE: |
1675 | CODE: |
1646 | PL_sub_generation++; |
1676 | PL_sub_generation++; |
1647 | |
1677 | |
1648 | char * |
1678 | const_octet_string |
1649 | mapdir () |
1679 | mapdir () |
1650 | PROTOTYPE: |
1680 | PROTOTYPE: |
1651 | ALIAS: |
1681 | ALIAS: |
1652 | mapdir = 0 |
1682 | mapdir = 0 |
1653 | uniquedir = 1 |
1683 | uniquedir = 1 |
… | |
… | |
1669 | } |
1699 | } |
1670 | OUTPUT: RETVAL |
1700 | OUTPUT: RETVAL |
1671 | |
1701 | |
1672 | void abort () |
1702 | void abort () |
1673 | |
1703 | |
1674 | void fork_abort (char *cause = "cf::fork_abort") |
1704 | void fork_abort (octet_string cause = "cf::fork_abort") |
1675 | |
1705 | |
1676 | void cleanup (const char *cause, bool make_core = false) |
1706 | void cleanup (octet_string cause, bool make_core = false) |
1677 | |
1707 | |
1678 | void emergency_save () |
1708 | void emergency_save () |
1679 | |
1709 | |
1680 | void _exit (int status = EXIT_SUCCESS) |
1710 | void _exit (int status = EXIT_SUCCESS) |
1681 | |
1711 | |
… | |
… | |
1691 | |
1721 | |
1692 | int munlockall () |
1722 | int munlockall () |
1693 | |
1723 | |
1694 | #endif |
1724 | #endif |
1695 | |
1725 | |
1696 | int find_animation (char *text) |
1726 | int find_animation (utf8_string text) |
1697 | PROTOTYPE: $ |
1727 | PROTOTYPE: $ |
1698 | |
1728 | |
1699 | int random_roll (int min, int max, object *op, int goodbad); |
1729 | int random_roll (int min, int max, object *op, int goodbad); |
1700 | |
1730 | |
1701 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1731 | const_utf8_string cost_string_from_value(uint64 cost, int approx = 0) |
1702 | |
1732 | |
1703 | int |
1733 | int |
1704 | exp_to_level (val64 exp) |
1734 | exp_to_level (val64 exp) |
1705 | CODE: |
1735 | CODE: |
1706 | { |
1736 | { |
… | |
… | |
1738 | else |
1768 | else |
1739 | XSRETURN_UNDEF; |
1769 | XSRETURN_UNDEF; |
1740 | OUTPUT: RETVAL |
1770 | OUTPUT: RETVAL |
1741 | |
1771 | |
1742 | bool |
1772 | bool |
1743 | load_resource_file (const char *filename) |
1773 | load_resource_file (octet_string filename) |
|
|
1774 | |
|
|
1775 | bool |
|
|
1776 | load_archetype_file (octet_string filename) |
|
|
1777 | |
|
|
1778 | bool |
|
|
1779 | load_treasure_file (octet_string filename) |
1744 | |
1780 | |
1745 | MODULE = cf PACKAGE = cf::attachable |
1781 | MODULE = cf PACKAGE = cf::attachable |
1746 | |
1782 | |
1747 | int |
1783 | int |
1748 | valid (SV *obj) |
1784 | valid (SV *obj) |
… | |
… | |
1847 | num_animations (object *op) |
1883 | num_animations (object *op) |
1848 | CODE: |
1884 | CODE: |
1849 | RETVAL = NUM_ANIMATIONS (op); |
1885 | RETVAL = NUM_ANIMATIONS (op); |
1850 | OUTPUT: RETVAL |
1886 | OUTPUT: RETVAL |
1851 | |
1887 | |
1852 | object *find_best_object_match (object *op, const char *match) |
1888 | object *find_best_object_match (object *op, utf8_string match) |
1853 | |
1889 | |
1854 | object *find_marked_object (object *op) |
1890 | object *find_marked_object (object *op) |
1855 | |
1891 | |
1856 | int need_identify (object *obj); |
1892 | int need_identify (object *obj); |
1857 | |
1893 | |
… | |
… | |
1877 | CODE: |
1913 | CODE: |
1878 | player_apply_below (op); |
1914 | player_apply_below (op); |
1879 | |
1915 | |
1880 | int cast_heal (object *op, object *caster, object *spell, int dir = 0) |
1916 | int cast_heal (object *op, object *caster, object *spell, int dir = 0) |
1881 | |
1917 | |
1882 | object *cf_object_present_archname_inside (object *op, char *whatstr) |
1918 | object *cf_object_present_archname_inside (object *op, utf8_string whatstr) |
1883 | |
1919 | |
1884 | int cf_object_transfer (object *op, int x, int y, int r = 0, object_ornull *orig = 0) |
1920 | int cf_object_transfer (object *op, int x, int y, int r = 0, object_ornull *orig = 0) |
1885 | |
1921 | |
1886 | int cf_object_change_map (object *op, int x, int y, maptile *map) |
1922 | int cf_object_change_map (object *op, int x, int y, maptile *map) |
1887 | |
1923 | |
… | |
… | |
1907 | RETVAL = pay_for_amount (amount, op); |
1943 | RETVAL = pay_for_amount (amount, op); |
1908 | OUTPUT: RETVAL |
1944 | OUTPUT: RETVAL |
1909 | |
1945 | |
1910 | void pay_player (object *op, uint64 amount) |
1946 | void pay_player (object *op, uint64 amount) |
1911 | |
1947 | |
1912 | val64 pay_player_arch (object *op, const char *arch, uint64 amount) |
1948 | val64 pay_player_arch (object *op, utf8_string arch, uint64 amount) |
1913 | |
1949 | |
1914 | int cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg = 0) |
1950 | int cast_spell (object *op, object *caster, int dir, object *spell_ob, utf8_string stringarg = 0) |
1915 | |
1951 | |
1916 | void learn_spell (object *op, object *sp, int special_prayer = 0) |
1952 | void learn_spell (object *op, object *sp, int special_prayer = 0) |
1917 | CODE: |
1953 | CODE: |
1918 | do_learn_spell (op, sp, special_prayer); |
1954 | do_learn_spell (op, sp, special_prayer); |
1919 | |
1955 | |
1920 | void forget_spell (object *op, object *sp) |
1956 | void forget_spell (object *op, object *sp) |
1921 | CODE: |
1957 | CODE: |
1922 | do_forget_spell (op, query_name (sp)); |
1958 | do_forget_spell (op, query_name (sp)); |
1923 | |
1959 | |
1924 | object *check_for_spell (object *op, char *spellname) |
1960 | object *check_for_spell (object *op, utf8_string spellname) |
1925 | CODE: |
1961 | CODE: |
1926 | RETVAL = check_spell_known (op, spellname); |
1962 | RETVAL = check_spell_known (op, spellname); |
1927 | OUTPUT: RETVAL |
1963 | OUTPUT: RETVAL |
1928 | |
1964 | |
1929 | int query_money (object *op) |
1965 | int query_money (object *op) |
… | |
… | |
1942 | |
1978 | |
1943 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1979 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1944 | |
1980 | |
1945 | void update_object (object *op, int action) |
1981 | void update_object (object *op, int action) |
1946 | |
1982 | |
1947 | object *cf_create_object_by_name (const char *name) |
1983 | object *cf_create_object_by_name (utf8_string name) |
1948 | |
1984 | |
1949 | void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) |
1985 | void change_exp (object *op, uint64 exp, utf8_string skill_name = 0, int flag = 0) |
1950 | |
1986 | |
1951 | void player_lvl_adj (object *who, object *skill = 0) |
1987 | void player_lvl_adj (object *who, object *skill = 0) |
1952 | |
1988 | |
1953 | int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) |
1989 | int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) |
1954 | |
1990 | |
… | |
… | |
1968 | object *cf_insert_ob_in_ob (object *ob, object *where) |
2004 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1969 | |
2005 | |
1970 | # no clean way to get an object from an archetype - stupid idiotic |
2006 | # no clean way to get an object from an archetype - stupid idiotic |
1971 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
2007 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
1972 | |
2008 | |
1973 | object *new (const char *archetype = 0) |
2009 | object *new (utf8_string archetype = 0) |
1974 | PROTOTYPE: ;$ |
2010 | PROTOTYPE: ;$ |
1975 | CODE: |
2011 | CODE: |
1976 | RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); |
2012 | RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); |
1977 | OUTPUT: |
2013 | OUTPUT: |
1978 | RETVAL |
2014 | RETVAL |
… | |
… | |
1983 | { |
2019 | { |
1984 | int unused_type; |
2020 | int unused_type; |
1985 | RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); |
2021 | RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); |
1986 | } |
2022 | } |
1987 | |
2023 | |
1988 | # syntatic sugar for easier use in event callbacks. |
|
|
1989 | const char *options (object *op) |
|
|
1990 | CODE: |
|
|
1991 | RETVAL = op->name; |
|
|
1992 | OUTPUT: |
|
|
1993 | RETVAL |
|
|
1994 | |
|
|
1995 | player *contr (object *op) |
2024 | player *contr (object *op) |
1996 | CODE: |
2025 | CODE: |
1997 | RETVAL = op->contr; |
2026 | RETVAL = op->contr; |
1998 | OUTPUT: RETVAL |
2027 | OUTPUT: RETVAL |
1999 | |
2028 | |
2000 | const char *get_ob_key_value (object *op, const char *key) |
2029 | const_utf8_string get_ob_key_value (object *op, utf8_string key) |
2001 | |
2030 | |
2002 | bool set_ob_key_value (object *op, const char *key, const char *value = 0, int add_key = 1) |
2031 | bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) |
2003 | |
2032 | |
2004 | object *get_nearest_player (object *ob) |
2033 | object *get_nearest_player (object *ob) |
2005 | ALIAS: nearest_player = 0 |
2034 | ALIAS: nearest_player = 0 |
2006 | PREINIT: |
2035 | PREINIT: |
2007 | extern object *get_nearest_player (object *); |
2036 | extern object *get_nearest_player (object *); |
… | |
… | |
2023 | bool on_same_map_as (object *ob, object *other) |
2052 | bool on_same_map_as (object *ob, object *other) |
2024 | CODE: |
2053 | CODE: |
2025 | RETVAL = on_same_map (ob, other); |
2054 | RETVAL = on_same_map (ob, other); |
2026 | OUTPUT: RETVAL |
2055 | OUTPUT: RETVAL |
2027 | |
2056 | |
2028 | const char * |
2057 | const_utf8_string |
2029 | base_name (object *op, int plural = op->nrof > 1) |
2058 | base_name (object *op, int plural = op->nrof > 1) |
2030 | CODE: |
2059 | CODE: |
2031 | RETVAL = query_base_name (op, plural); |
2060 | RETVAL = query_base_name (op, plural); |
2032 | OUTPUT: RETVAL |
2061 | OUTPUT: RETVAL |
2033 | |
2062 | |
… | |
… | |
2040 | RETVAL = op->contr; |
2069 | RETVAL = op->contr; |
2041 | OUTPUT: RETVAL |
2070 | OUTPUT: RETVAL |
2042 | |
2071 | |
2043 | void check_score (object *op) |
2072 | void check_score (object *op) |
2044 | |
2073 | |
2045 | void message (object *op, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
2074 | void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE) |
2046 | CODE: |
2075 | CODE: |
2047 | new_draw_info (flags, 0, op, txt); |
2076 | new_draw_info (flags, 0, op, txt); |
2048 | |
2077 | |
2049 | object *cf_player_send_inventory (object *op) |
2078 | object *cf_player_send_inventory (object *op) |
2050 | |
2079 | |
2051 | char *cf_player_get_ip (object *op) |
2080 | octet_string cf_player_get_ip (object *op) |
2052 | ALIAS: ip = 0 |
2081 | ALIAS: ip = 0 |
2053 | |
2082 | |
2054 | object *cf_player_get_marked_item (object *op) |
2083 | object *cf_player_get_marked_item (object *op) |
2055 | ALIAS: marked_item = 0 |
2084 | ALIAS: marked_item = 0 |
2056 | |
2085 | |
… | |
… | |
2066 | void esrv_update_item (object *op, int what, object *item) |
2095 | void esrv_update_item (object *op, int what, object *item) |
2067 | C_ARGS: what, op, item |
2096 | C_ARGS: what, op, item |
2068 | |
2097 | |
2069 | void clear_los (object *op) |
2098 | void clear_los (object *op) |
2070 | |
2099 | |
2071 | int command_summon (object *op, char *params) |
2100 | int command_summon (object *op, utf8_string params) |
2072 | |
2101 | |
2073 | int command_arrest (object *op, char *params) |
2102 | int command_arrest (object *op, utf8_string params) |
2074 | |
2103 | |
2075 | |
2104 | |
2076 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2105 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2077 | |
2106 | |
2078 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
2107 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
… | |
… | |
2343 | |
2372 | |
2344 | # worst xs function of my life |
2373 | # worst xs function of my life |
2345 | bool |
2374 | bool |
2346 | _create_random_map (\ |
2375 | _create_random_map (\ |
2347 | maptile *self,\ |
2376 | maptile *self,\ |
2348 | char *wallstyle,\ |
2377 | utf8_string wallstyle,\ |
2349 | char *wall_name,\ |
2378 | utf8_string wall_name,\ |
2350 | char *floorstyle,\ |
2379 | utf8_string floorstyle,\ |
2351 | char *monsterstyle,\ |
2380 | utf8_string monsterstyle,\ |
2352 | char *treasurestyle,\ |
2381 | utf8_string treasurestyle,\ |
2353 | char *layoutstyle,\ |
2382 | utf8_string layoutstyle,\ |
2354 | char *doorstyle,\ |
2383 | utf8_string doorstyle,\ |
2355 | char *decorstyle,\ |
2384 | utf8_string decorstyle,\ |
2356 | char *origin_map,\ |
2385 | utf8_string origin_map,\ |
2357 | char *final_map,\ |
2386 | utf8_string final_map,\ |
2358 | char *exitstyle,\ |
2387 | utf8_string exitstyle,\ |
2359 | char *this_map,\ |
2388 | utf8_string this_map,\ |
2360 | char *exit_on_final_map,\ |
2389 | utf8_string exit_on_final_map,\ |
2361 | int xsize,\ |
2390 | int xsize,\ |
2362 | int ysize,\ |
2391 | int ysize,\ |
2363 | int expand2x,\ |
2392 | int expand2x,\ |
2364 | int layoutoptions1,\ |
2393 | int layoutoptions1,\ |
2365 | int layoutoptions2,\ |
2394 | int layoutoptions2,\ |
… | |
… | |
2378 | val64 total_map_hp,\ |
2407 | val64 total_map_hp,\ |
2379 | int map_layout_style,\ |
2408 | int map_layout_style,\ |
2380 | int treasureoptions,\ |
2409 | int treasureoptions,\ |
2381 | int symmetry_used,\ |
2410 | int symmetry_used,\ |
2382 | region *region,\ |
2411 | region *region,\ |
2383 | char *custom\ |
2412 | utf8_string custom\ |
2384 | ) |
2413 | ) |
2385 | CODE: |
2414 | CODE: |
2386 | { |
2415 | { |
2387 | random_map_params rmp; |
2416 | random_map_params rmp; |
2388 | |
2417 | |
… | |
… | |
2429 | OUTPUT: |
2458 | OUTPUT: |
2430 | RETVAL |
2459 | RETVAL |
2431 | |
2460 | |
2432 | MODULE = cf PACKAGE = cf::arch |
2461 | MODULE = cf PACKAGE = cf::arch |
2433 | |
2462 | |
2434 | archetype *find (const char *name) |
2463 | archetype *find (utf8_string name) |
2435 | CODE: |
2464 | CODE: |
2436 | RETVAL = archetype::find (name); |
2465 | RETVAL = archetype::find (name); |
2437 | OUTPUT: |
2466 | OUTPUT: |
2438 | RETVAL |
2467 | RETVAL |
2439 | |
2468 | |
… | |
… | |
2461 | list () |
2490 | list () |
2462 | PPCODE: |
2491 | PPCODE: |
2463 | for_all_regions (rgn) |
2492 | for_all_regions (rgn) |
2464 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2493 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2465 | |
2494 | |
2466 | region *find (char *name) |
2495 | region *find (utf8_string name) |
2467 | PROTOTYPE: $ |
2496 | PROTOTYPE: $ |
2468 | CODE: |
2497 | CODE: |
2469 | RETVAL = region::find (name); |
2498 | RETVAL = region::find (name); |
2470 | OUTPUT: RETVAL |
2499 | OUTPUT: RETVAL |
2471 | |
2500 | |
2472 | region *find_fuzzy (char *name) |
2501 | region *find_fuzzy (utf8_string name) |
2473 | PROTOTYPE: $ |
2502 | PROTOTYPE: $ |
2474 | CODE: |
2503 | CODE: |
2475 | RETVAL = region::find_fuzzy (name); |
2504 | RETVAL = region::find_fuzzy (name); |
|
|
2505 | OUTPUT: RETVAL |
|
|
2506 | |
|
|
2507 | int specificity (region *rgn) |
|
|
2508 | CODE: |
|
|
2509 | RETVAL = 0; |
|
|
2510 | while (rgn = rgn->parent) |
|
|
2511 | RETVAL++; |
2476 | OUTPUT: RETVAL |
2512 | OUTPUT: RETVAL |
2477 | |
2513 | |
2478 | INCLUDE: $PERL $srcdir/genacc region ../include/map.h | |
2514 | INCLUDE: $PERL $srcdir/genacc region ../include/map.h | |
2479 | |
2515 | |
2480 | MODULE = cf PACKAGE = cf::living |
2516 | MODULE = cf PACKAGE = cf::living |
… | |
… | |
2516 | THIS->send_packet (buf, len); |
2552 | THIS->send_packet (buf, len); |
2517 | } |
2553 | } |
2518 | |
2554 | |
2519 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2555 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2520 | |
2556 | |
2521 | INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2557 | #INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2522 | |
2558 | |
2523 | faceidx face_find (const char *name, faceidx defidx = 0) |
2559 | faceidx face_find (utf8_string name, faceidx defidx = 0) |
2524 | |
2560 | |
2525 | faceidx alloc (const char *name) |
2561 | faceidx alloc (utf8_string name) |
2526 | CODE: |
2562 | CODE: |
2527 | { |
2563 | { |
2528 | do |
2564 | do |
2529 | { |
2565 | { |
2530 | RETVAL = faces.size (); |
2566 | RETVAL = faces.size (); |
… | |
… | |
2545 | faceinfo *f = face_info (idx); |
2581 | faceinfo *f = face_info (idx); |
2546 | assert (f); |
2582 | assert (f); |
2547 | f->visibility = visibility; |
2583 | f->visibility = visibility; |
2548 | f->magicmap = magicmap; |
2584 | f->magicmap = magicmap; |
2549 | |
2585 | |
2550 | void set_smooth (faceidx idx, faceidx smooth) |
2586 | void set_smooth (faceidx idx, faceidx smooth, int smoothlevel) |
2551 | CODE: |
2587 | CODE: |
2552 | faceinfo *f = face_info (idx); |
2588 | faceinfo *f = face_info (idx); assert (f); |
2553 | assert (f); |
|
|
2554 | f->smooth = smooth; |
2589 | f->smooth = smooth; |
|
|
2590 | f->smoothlevel = smoothlevel; |
2555 | |
2591 | |
2556 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2592 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2557 | CODE: |
2593 | CODE: |
|
|
2594 | { |
2558 | facedata *d = face_data (idx, faceset); |
2595 | facedata *d = face_data (idx, faceset); |
2559 | assert (d); |
2596 | assert (d); |
2560 | assert (sv_len (chksum) == CHKSUM_SIZE); |
2597 | sv_to (data, d->data); |
2561 | sv_to (data, d->data); memcpy (d->chksum, SvPVbyte_nolen (chksum), CHKSUM_SIZE); |
2598 | STRLEN clen; |
|
|
2599 | char *cdata = SvPVbyte (chksum, clen); |
|
|
2600 | clen = min (CHKSUM_SIZE, clen); |
|
|
2601 | |
|
|
2602 | if (memcmp (d->chksum, cdata, clen)) |
|
|
2603 | { |
|
|
2604 | memcpy (d->chksum, cdata, clen); |
|
|
2605 | |
|
|
2606 | // invalidate existing client face info |
|
|
2607 | for_all_clients (ns) |
|
|
2608 | if (ns->faceset == faceset) |
|
|
2609 | { |
|
|
2610 | ns->faces_sent [idx] = false; |
|
|
2611 | ns->force_newmap = true; |
|
|
2612 | } |
|
|
2613 | } |
|
|
2614 | } |
2562 | |
2615 | |
2563 | void invalidate (faceidx idx) |
2616 | void invalidate (faceidx idx) |
2564 | CODE: |
2617 | CODE: |
2565 | for_all_clients (ns) |
2618 | for_all_clients (ns) |
|
|
2619 | { |
2566 | ns->faces_sent [idx] = 0; |
2620 | ns->faces_sent [idx] = false; |
|
|
2621 | ns->force_newmap = true; |
|
|
2622 | } |
2567 | |
2623 | |
2568 | void invalidate_all () |
2624 | void invalidate_all () |
2569 | CODE: |
2625 | CODE: |
2570 | for_all_clients (ns) |
2626 | for_all_clients (ns) |
2571 | memset (ns->faces_sent, 0, sizeof (ns->faces_sent)); |
2627 | { |
|
|
2628 | ns->faces_sent.reset (); |
|
|
2629 | ns->force_newmap = true; |
|
|
2630 | } |
2572 | |
2631 | |
|
|
2632 | MODULE = cf PACKAGE = cf::anim PREFIX = anim_ |
|
|
2633 | |
|
|
2634 | #INCLUDE: $PERL $srcdir/genacc faceset ../include/anim.h | |
|
|
2635 | |
|
|
2636 | animidx anim_find (utf8_string name) |
|
|
2637 | CODE: |
|
|
2638 | RETVAL = animation::find (name).number; |
|
|
2639 | OUTPUT: RETVAL |
|
|
2640 | |
|
|
2641 | animidx set (utf8_string name, SV *frames, int facings = 1) |
|
|
2642 | CODE: |
|
|
2643 | { |
|
|
2644 | if (!SvROK (frames) && SvTYPE (SvRV (frames)) != SVt_PVAV) |
|
|
2645 | croak ("frames must be an arrayref"); |
|
|
2646 | |
|
|
2647 | AV *av = (AV *)SvRV (frames); |
|
|
2648 | |
|
|
2649 | animation *anim = &animation::find (name); |
|
|
2650 | if (anim->number) |
|
|
2651 | { |
|
|
2652 | anim->resize (av_len (av) + 1); |
|
|
2653 | anim->facings = facings; |
|
|
2654 | } |
|
|
2655 | else |
|
|
2656 | anim = &animation::create (name, av_len (av) + 1, facings); |
|
|
2657 | |
|
|
2658 | for (int i = 0; i < anim->num_animations; ++i) |
|
|
2659 | anim->faces [i] = face_find (SvPVutf8_nolen (*av_fetch (av, i, 1))); |
|
|
2660 | } |
|
|
2661 | OUTPUT: RETVAL |
|
|
2662 | |
|
|
2663 | void invalidate_all () |
|
|
2664 | CODE: |
|
|
2665 | for_all_clients (ns) |
|
|
2666 | ns->anims_sent.reset (); |
|
|
2667 | |