… | |
… | |
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> |
… | |
… | |
946 | struct EventAPI *watcher_base::GEventAPI; |
951 | struct EventAPI *watcher_base::GEventAPI; |
947 | struct CoroAPI *coroapi::GCoroAPI; |
952 | struct CoroAPI *coroapi::GCoroAPI; |
948 | |
953 | |
949 | int coroapi::cede_counter; |
954 | int coroapi::cede_counter; |
950 | |
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 |
951 | static void iw_dispatch (pe_event *ev) |
973 | iw_dispatch (pe_event *ev) |
952 | { |
974 | { |
953 | iw *w = (iw *)ev->ext_data; |
975 | iw *w = (iw *)ev->ext_data; |
954 | w->call (*w); |
976 | w->call (*w); |
955 | } |
977 | } |
956 | |
978 | |
… | |
… | |
1628 | CODE: |
1650 | CODE: |
1629 | runtime = SvNVx (sv_runtime); |
1651 | runtime = SvNVx (sv_runtime); |
1630 | server_tick (); |
1652 | server_tick (); |
1631 | |
1653 | |
1632 | void |
1654 | void |
1633 | LOG (int level, char *msg) |
1655 | LOG (int level, utf8_string msg) |
1634 | PROTOTYPE: $$ |
1656 | PROTOTYPE: $$ |
1635 | C_ARGS: (LogLevel)level, "%s", msg |
1657 | C_ARGS: (LogLevel)level, "%s", msg |
1636 | |
1658 | |
1637 | char *path_combine (char *base, char *path) |
1659 | octet_string path_combine (octet_string base, octet_string path) |
1638 | PROTOTYPE: $$ |
1660 | PROTOTYPE: $$ |
1639 | |
1661 | |
1640 | char *path_combine_and_normalize (char *base, char *path) |
1662 | octet_string path_combine_and_normalize (octet_string base, octet_string path) |
1641 | PROTOTYPE: $$ |
1663 | PROTOTYPE: $$ |
1642 | |
1664 | |
1643 | const char * |
1665 | const_octet_string |
1644 | get_maps_directory (char *path) |
1666 | get_maps_directory (octet_string path) |
1645 | PROTOTYPE: $ |
1667 | PROTOTYPE: $ |
1646 | ALIAS: maps_directory = 0 |
1668 | ALIAS: maps_directory = 0 |
1647 | CODE: |
1669 | CODE: |
1648 | RETVAL = create_pathname (path); |
1670 | RETVAL = create_pathname (path); |
1649 | OUTPUT: RETVAL |
1671 | OUTPUT: RETVAL |
… | |
… | |
1651 | void |
1673 | void |
1652 | sub_generation_inc () |
1674 | sub_generation_inc () |
1653 | CODE: |
1675 | CODE: |
1654 | PL_sub_generation++; |
1676 | PL_sub_generation++; |
1655 | |
1677 | |
1656 | const char * |
1678 | const_octet_string |
1657 | mapdir () |
1679 | mapdir () |
1658 | PROTOTYPE: |
1680 | PROTOTYPE: |
1659 | ALIAS: |
1681 | ALIAS: |
1660 | mapdir = 0 |
1682 | mapdir = 0 |
1661 | uniquedir = 1 |
1683 | uniquedir = 1 |
… | |
… | |
1677 | } |
1699 | } |
1678 | OUTPUT: RETVAL |
1700 | OUTPUT: RETVAL |
1679 | |
1701 | |
1680 | void abort () |
1702 | void abort () |
1681 | |
1703 | |
1682 | void fork_abort (char *cause = "cf::fork_abort") |
1704 | void fork_abort (octet_string cause = "cf::fork_abort") |
1683 | |
1705 | |
1684 | void cleanup (const char *cause, bool make_core = false) |
1706 | void cleanup (octet_string cause, bool make_core = false) |
1685 | |
1707 | |
1686 | void emergency_save () |
1708 | void emergency_save () |
1687 | |
1709 | |
1688 | void _exit (int status = EXIT_SUCCESS) |
1710 | void _exit (int status = EXIT_SUCCESS) |
1689 | |
1711 | |
… | |
… | |
1699 | |
1721 | |
1700 | int munlockall () |
1722 | int munlockall () |
1701 | |
1723 | |
1702 | #endif |
1724 | #endif |
1703 | |
1725 | |
1704 | int find_animation (char *text) |
1726 | int find_animation (utf8_string text) |
1705 | PROTOTYPE: $ |
1727 | PROTOTYPE: $ |
1706 | |
1728 | |
1707 | int random_roll (int min, int max, object *op, int goodbad); |
1729 | int random_roll (int min, int max, object *op, int goodbad); |
1708 | |
1730 | |
1709 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1731 | const_utf8_string cost_string_from_value(uint64 cost, int approx = 0) |
1710 | |
1732 | |
1711 | int |
1733 | int |
1712 | exp_to_level (val64 exp) |
1734 | exp_to_level (val64 exp) |
1713 | CODE: |
1735 | CODE: |
1714 | { |
1736 | { |
… | |
… | |
1746 | else |
1768 | else |
1747 | XSRETURN_UNDEF; |
1769 | XSRETURN_UNDEF; |
1748 | OUTPUT: RETVAL |
1770 | OUTPUT: RETVAL |
1749 | |
1771 | |
1750 | bool |
1772 | bool |
1751 | 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) |
1752 | |
1780 | |
1753 | MODULE = cf PACKAGE = cf::attachable |
1781 | MODULE = cf PACKAGE = cf::attachable |
1754 | |
1782 | |
1755 | int |
1783 | int |
1756 | valid (SV *obj) |
1784 | valid (SV *obj) |
… | |
… | |
1855 | num_animations (object *op) |
1883 | num_animations (object *op) |
1856 | CODE: |
1884 | CODE: |
1857 | RETVAL = NUM_ANIMATIONS (op); |
1885 | RETVAL = NUM_ANIMATIONS (op); |
1858 | OUTPUT: RETVAL |
1886 | OUTPUT: RETVAL |
1859 | |
1887 | |
1860 | object *find_best_object_match (object *op, const char *match) |
1888 | object *find_best_object_match (object *op, utf8_string match) |
1861 | |
1889 | |
1862 | object *find_marked_object (object *op) |
1890 | object *find_marked_object (object *op) |
1863 | |
1891 | |
1864 | int need_identify (object *obj); |
1892 | int need_identify (object *obj); |
1865 | |
1893 | |
… | |
… | |
1885 | CODE: |
1913 | CODE: |
1886 | player_apply_below (op); |
1914 | player_apply_below (op); |
1887 | |
1915 | |
1888 | 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) |
1889 | |
1917 | |
1890 | object *cf_object_present_archname_inside (object *op, char *whatstr) |
1918 | object *cf_object_present_archname_inside (object *op, utf8_string whatstr) |
1891 | |
1919 | |
1892 | 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) |
1893 | |
1921 | |
1894 | 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) |
1895 | |
1923 | |
… | |
… | |
1915 | RETVAL = pay_for_amount (amount, op); |
1943 | RETVAL = pay_for_amount (amount, op); |
1916 | OUTPUT: RETVAL |
1944 | OUTPUT: RETVAL |
1917 | |
1945 | |
1918 | void pay_player (object *op, uint64 amount) |
1946 | void pay_player (object *op, uint64 amount) |
1919 | |
1947 | |
1920 | val64 pay_player_arch (object *op, const char *arch, uint64 amount) |
1948 | val64 pay_player_arch (object *op, utf8_string arch, uint64 amount) |
1921 | |
1949 | |
1922 | 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) |
1923 | |
1951 | |
1924 | void learn_spell (object *op, object *sp, int special_prayer = 0) |
1952 | void learn_spell (object *op, object *sp, int special_prayer = 0) |
1925 | CODE: |
1953 | CODE: |
1926 | do_learn_spell (op, sp, special_prayer); |
1954 | do_learn_spell (op, sp, special_prayer); |
1927 | |
1955 | |
1928 | void forget_spell (object *op, object *sp) |
1956 | void forget_spell (object *op, object *sp) |
1929 | CODE: |
1957 | CODE: |
1930 | do_forget_spell (op, query_name (sp)); |
1958 | do_forget_spell (op, query_name (sp)); |
1931 | |
1959 | |
1932 | object *check_for_spell (object *op, char *spellname) |
1960 | object *check_for_spell (object *op, utf8_string spellname) |
1933 | CODE: |
1961 | CODE: |
1934 | RETVAL = check_spell_known (op, spellname); |
1962 | RETVAL = check_spell_known (op, spellname); |
1935 | OUTPUT: RETVAL |
1963 | OUTPUT: RETVAL |
1936 | |
1964 | |
1937 | int query_money (object *op) |
1965 | int query_money (object *op) |
… | |
… | |
1950 | |
1978 | |
1951 | 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) |
1952 | |
1980 | |
1953 | void update_object (object *op, int action) |
1981 | void update_object (object *op, int action) |
1954 | |
1982 | |
1955 | object *cf_create_object_by_name (const char *name) |
1983 | object *cf_create_object_by_name (utf8_string name) |
1956 | |
1984 | |
1957 | 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) |
1958 | |
1986 | |
1959 | void player_lvl_adj (object *who, object *skill = 0) |
1987 | void player_lvl_adj (object *who, object *skill = 0) |
1960 | |
1988 | |
1961 | 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) |
1962 | |
1990 | |
… | |
… | |
1976 | object *cf_insert_ob_in_ob (object *ob, object *where) |
2004 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1977 | |
2005 | |
1978 | # 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 |
1979 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
2007 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
1980 | |
2008 | |
1981 | object *new (const char *archetype = 0) |
2009 | object *new (utf8_string archetype = 0) |
1982 | PROTOTYPE: ;$ |
2010 | PROTOTYPE: ;$ |
1983 | CODE: |
2011 | CODE: |
1984 | RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); |
2012 | RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); |
1985 | OUTPUT: |
2013 | OUTPUT: |
1986 | RETVAL |
2014 | RETVAL |
… | |
… | |
1991 | { |
2019 | { |
1992 | int unused_type; |
2020 | int unused_type; |
1993 | 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); |
1994 | } |
2022 | } |
1995 | |
2023 | |
1996 | # syntatic sugar for easier use in event callbacks. |
|
|
1997 | const char *options (object *op) |
|
|
1998 | CODE: |
|
|
1999 | RETVAL = op->name; |
|
|
2000 | OUTPUT: |
|
|
2001 | RETVAL |
|
|
2002 | |
|
|
2003 | player *contr (object *op) |
2024 | player *contr (object *op) |
2004 | CODE: |
2025 | CODE: |
2005 | RETVAL = op->contr; |
2026 | RETVAL = op->contr; |
2006 | OUTPUT: RETVAL |
2027 | OUTPUT: RETVAL |
2007 | |
2028 | |
2008 | const char *get_ob_key_value (object *op, const char *key) |
2029 | const_utf8_string get_ob_key_value (object *op, utf8_string key) |
2009 | |
2030 | |
2010 | 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) |
2011 | |
2032 | |
2012 | object *get_nearest_player (object *ob) |
2033 | object *get_nearest_player (object *ob) |
2013 | ALIAS: nearest_player = 0 |
2034 | ALIAS: nearest_player = 0 |
2014 | PREINIT: |
2035 | PREINIT: |
2015 | extern object *get_nearest_player (object *); |
2036 | extern object *get_nearest_player (object *); |
… | |
… | |
2031 | bool on_same_map_as (object *ob, object *other) |
2052 | bool on_same_map_as (object *ob, object *other) |
2032 | CODE: |
2053 | CODE: |
2033 | RETVAL = on_same_map (ob, other); |
2054 | RETVAL = on_same_map (ob, other); |
2034 | OUTPUT: RETVAL |
2055 | OUTPUT: RETVAL |
2035 | |
2056 | |
2036 | const char * |
2057 | const_utf8_string |
2037 | base_name (object *op, int plural = op->nrof > 1) |
2058 | base_name (object *op, int plural = op->nrof > 1) |
2038 | CODE: |
2059 | CODE: |
2039 | RETVAL = query_base_name (op, plural); |
2060 | RETVAL = query_base_name (op, plural); |
2040 | OUTPUT: RETVAL |
2061 | OUTPUT: RETVAL |
2041 | |
2062 | |
… | |
… | |
2048 | RETVAL = op->contr; |
2069 | RETVAL = op->contr; |
2049 | OUTPUT: RETVAL |
2070 | OUTPUT: RETVAL |
2050 | |
2071 | |
2051 | void check_score (object *op) |
2072 | void check_score (object *op) |
2052 | |
2073 | |
2053 | 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) |
2054 | CODE: |
2075 | CODE: |
2055 | new_draw_info (flags, 0, op, txt); |
2076 | new_draw_info (flags, 0, op, txt); |
2056 | |
2077 | |
2057 | object *cf_player_send_inventory (object *op) |
2078 | object *cf_player_send_inventory (object *op) |
2058 | |
2079 | |
2059 | char *cf_player_get_ip (object *op) |
2080 | octet_string cf_player_get_ip (object *op) |
2060 | ALIAS: ip = 0 |
2081 | ALIAS: ip = 0 |
2061 | |
2082 | |
2062 | object *cf_player_get_marked_item (object *op) |
2083 | object *cf_player_get_marked_item (object *op) |
2063 | ALIAS: marked_item = 0 |
2084 | ALIAS: marked_item = 0 |
2064 | |
2085 | |
… | |
… | |
2074 | void esrv_update_item (object *op, int what, object *item) |
2095 | void esrv_update_item (object *op, int what, object *item) |
2075 | C_ARGS: what, op, item |
2096 | C_ARGS: what, op, item |
2076 | |
2097 | |
2077 | void clear_los (object *op) |
2098 | void clear_los (object *op) |
2078 | |
2099 | |
2079 | int command_summon (object *op, char *params) |
2100 | int command_summon (object *op, utf8_string params) |
2080 | |
2101 | |
2081 | int command_arrest (object *op, char *params) |
2102 | int command_arrest (object *op, utf8_string params) |
2082 | |
2103 | |
2083 | |
2104 | |
2084 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2105 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2085 | |
2106 | |
2086 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
2107 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
… | |
… | |
2351 | |
2372 | |
2352 | # worst xs function of my life |
2373 | # worst xs function of my life |
2353 | bool |
2374 | bool |
2354 | _create_random_map (\ |
2375 | _create_random_map (\ |
2355 | maptile *self,\ |
2376 | maptile *self,\ |
2356 | char *wallstyle,\ |
2377 | utf8_string wallstyle,\ |
2357 | char *wall_name,\ |
2378 | utf8_string wall_name,\ |
2358 | char *floorstyle,\ |
2379 | utf8_string floorstyle,\ |
2359 | char *monsterstyle,\ |
2380 | utf8_string monsterstyle,\ |
2360 | char *treasurestyle,\ |
2381 | utf8_string treasurestyle,\ |
2361 | char *layoutstyle,\ |
2382 | utf8_string layoutstyle,\ |
2362 | char *doorstyle,\ |
2383 | utf8_string doorstyle,\ |
2363 | char *decorstyle,\ |
2384 | utf8_string decorstyle,\ |
2364 | char *origin_map,\ |
2385 | utf8_string origin_map,\ |
2365 | char *final_map,\ |
2386 | utf8_string final_map,\ |
2366 | char *exitstyle,\ |
2387 | utf8_string exitstyle,\ |
2367 | char *this_map,\ |
2388 | utf8_string this_map,\ |
2368 | char *exit_on_final_map,\ |
2389 | utf8_string exit_on_final_map,\ |
2369 | int xsize,\ |
2390 | int xsize,\ |
2370 | int ysize,\ |
2391 | int ysize,\ |
2371 | int expand2x,\ |
2392 | int expand2x,\ |
2372 | int layoutoptions1,\ |
2393 | int layoutoptions1,\ |
2373 | int layoutoptions2,\ |
2394 | int layoutoptions2,\ |
… | |
… | |
2386 | val64 total_map_hp,\ |
2407 | val64 total_map_hp,\ |
2387 | int map_layout_style,\ |
2408 | int map_layout_style,\ |
2388 | int treasureoptions,\ |
2409 | int treasureoptions,\ |
2389 | int symmetry_used,\ |
2410 | int symmetry_used,\ |
2390 | region *region,\ |
2411 | region *region,\ |
2391 | char *custom\ |
2412 | utf8_string custom\ |
2392 | ) |
2413 | ) |
2393 | CODE: |
2414 | CODE: |
2394 | { |
2415 | { |
2395 | random_map_params rmp; |
2416 | random_map_params rmp; |
2396 | |
2417 | |
… | |
… | |
2437 | OUTPUT: |
2458 | OUTPUT: |
2438 | RETVAL |
2459 | RETVAL |
2439 | |
2460 | |
2440 | MODULE = cf PACKAGE = cf::arch |
2461 | MODULE = cf PACKAGE = cf::arch |
2441 | |
2462 | |
2442 | archetype *find (const char *name) |
2463 | archetype *find (utf8_string name) |
2443 | CODE: |
2464 | CODE: |
2444 | RETVAL = archetype::find (name); |
2465 | RETVAL = archetype::find (name); |
2445 | OUTPUT: |
2466 | OUTPUT: |
2446 | RETVAL |
2467 | RETVAL |
2447 | |
2468 | |
… | |
… | |
2469 | list () |
2490 | list () |
2470 | PPCODE: |
2491 | PPCODE: |
2471 | for_all_regions (rgn) |
2492 | for_all_regions (rgn) |
2472 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2493 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2473 | |
2494 | |
2474 | region *find (char *name) |
2495 | region *find (utf8_string name) |
2475 | PROTOTYPE: $ |
2496 | PROTOTYPE: $ |
2476 | CODE: |
2497 | CODE: |
2477 | RETVAL = region::find (name); |
2498 | RETVAL = region::find (name); |
2478 | OUTPUT: RETVAL |
2499 | OUTPUT: RETVAL |
2479 | |
2500 | |
2480 | region *find_fuzzy (char *name) |
2501 | region *find_fuzzy (utf8_string name) |
2481 | PROTOTYPE: $ |
2502 | PROTOTYPE: $ |
2482 | CODE: |
2503 | CODE: |
2483 | 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++; |
2484 | OUTPUT: RETVAL |
2512 | OUTPUT: RETVAL |
2485 | |
2513 | |
2486 | INCLUDE: $PERL $srcdir/genacc region ../include/map.h | |
2514 | INCLUDE: $PERL $srcdir/genacc region ../include/map.h | |
2487 | |
2515 | |
2488 | MODULE = cf PACKAGE = cf::living |
2516 | MODULE = cf PACKAGE = cf::living |
… | |
… | |
2524 | THIS->send_packet (buf, len); |
2552 | THIS->send_packet (buf, len); |
2525 | } |
2553 | } |
2526 | |
2554 | |
2527 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2555 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2528 | |
2556 | |
2529 | INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2557 | #INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2530 | |
2558 | |
2531 | faceidx face_find (const char *name, faceidx defidx = 0) |
2559 | faceidx face_find (utf8_string name, faceidx defidx = 0) |
2532 | |
2560 | |
2533 | faceidx alloc (const char *name) |
2561 | faceidx alloc (utf8_string name) |
2534 | CODE: |
2562 | CODE: |
2535 | { |
2563 | { |
2536 | do |
2564 | do |
2537 | { |
2565 | { |
2538 | RETVAL = faces.size (); |
2566 | RETVAL = faces.size (); |
… | |
… | |
2553 | faceinfo *f = face_info (idx); |
2581 | faceinfo *f = face_info (idx); |
2554 | assert (f); |
2582 | assert (f); |
2555 | f->visibility = visibility; |
2583 | f->visibility = visibility; |
2556 | f->magicmap = magicmap; |
2584 | f->magicmap = magicmap; |
2557 | |
2585 | |
2558 | void set_smooth (faceidx idx, faceidx smooth) |
2586 | void set_smooth (faceidx idx, faceidx smooth, int smoothlevel) |
2559 | CODE: |
2587 | CODE: |
2560 | faceinfo *f = face_info (idx); |
2588 | faceinfo *f = face_info (idx); assert (f); |
2561 | assert (f); |
|
|
2562 | f->smooth = smooth; |
2589 | f->smooth = smooth; |
|
|
2590 | f->smoothlevel = smoothlevel; |
2563 | |
2591 | |
2564 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2592 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2565 | CODE: |
2593 | CODE: |
|
|
2594 | { |
2566 | facedata *d = face_data (idx, faceset); |
2595 | facedata *d = face_data (idx, faceset); |
2567 | assert (d); |
2596 | assert (d); |
2568 | sv_to (data, d->data); |
2597 | sv_to (data, d->data); |
2569 | STRLEN clen; |
2598 | STRLEN clen; |
2570 | char *cdata = SvPVbyte (chksum, clen); |
2599 | char *cdata = SvPVbyte (chksum, clen); |
|
|
2600 | clen = min (CHKSUM_SIZE, clen); |
|
|
2601 | |
|
|
2602 | if (memcmp (d->chksum, cdata, clen)) |
|
|
2603 | { |
2571 | memcpy (d->chksum, cdata, min (CHKSUM_SIZE, clen)); |
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 | } |
2572 | |
2615 | |
2573 | void invalidate (faceidx idx) |
2616 | void invalidate (faceidx idx) |
2574 | CODE: |
2617 | CODE: |
2575 | for_all_clients (ns) |
2618 | for_all_clients (ns) |
|
|
2619 | { |
2576 | ns->faces_sent [idx] = false; |
2620 | ns->faces_sent [idx] = false; |
|
|
2621 | ns->force_newmap = true; |
|
|
2622 | } |
2577 | |
2623 | |
2578 | void invalidate_all () |
2624 | void invalidate_all () |
2579 | CODE: |
2625 | CODE: |
2580 | for_all_clients (ns) |
2626 | for_all_clients (ns) |
|
|
2627 | { |
2581 | ns->faces_sent.reset (); |
2628 | ns->faces_sent.reset (); |
|
|
2629 | ns->force_newmap = true; |
|
|
2630 | } |
2582 | |
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 | |