… | |
… | |
136 | inline SV *to_sv (unsigned long v) { return newSVuv (v); } |
136 | inline SV *to_sv (unsigned long v) { return newSVuv (v); } |
137 | inline SV *to_sv ( signed long long v) { return newSVval64 (v); } |
137 | inline SV *to_sv ( signed long long v) { return newSVval64 (v); } |
138 | inline SV *to_sv (unsigned long long v) { return newSVval64 (v); } |
138 | inline SV *to_sv (unsigned long long v) { return newSVval64 (v); } |
139 | inline SV *to_sv (float v) { return newSVnv (v); } |
139 | inline SV *to_sv (float v) { return newSVnv (v); } |
140 | inline SV *to_sv (double v) { return newSVnv (v); } |
140 | inline SV *to_sv (double v) { return newSVnv (v); } |
|
|
141 | inline SV *to_sv (client * v) { return newSVattachable (v, "cf::client::wrap"); } |
141 | inline SV *to_sv (player * v) { return newSVattachable (v, "cf::player::wrap"); } |
142 | inline SV *to_sv (player * v) { return newSVattachable (v, "cf::player::wrap"); } |
142 | inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? "cf::object::player::wrap" : "cf::object::wrap"); } |
143 | inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? "cf::object::player::wrap" : "cf::object::wrap"); } |
143 | inline SV *to_sv (maptile * v) { return newSVattachable (v, "cf::map::wrap"); } |
144 | inline SV *to_sv (maptile * v) { return newSVattachable (v, "cf::map::wrap"); } |
144 | inline SV *to_sv (archetype * v) { return newSVptr (v, "cf::arch::wrap"); } |
145 | inline SV *to_sv (archetype * v) { return newSVptr (v, "cf::arch::wrap"); } |
145 | inline SV *to_sv (partylist * v) { return newSVptr (v, "cf::party::wrap"); } |
146 | inline SV *to_sv (partylist * v) { return newSVptr (v, "cf::party::wrap"); } |
… | |
… | |
173 | inline void sv_to (SV *sv, unsigned long &v) { v = SvUV (sv); } |
174 | inline void sv_to (SV *sv, unsigned long &v) { v = SvUV (sv); } |
174 | inline void sv_to (SV *sv, signed long long &v) { v = ( signed long long)SvVAL64 (sv); } |
175 | inline void sv_to (SV *sv, signed long long &v) { v = ( signed long long)SvVAL64 (sv); } |
175 | inline void sv_to (SV *sv, unsigned long long &v) { v = (unsigned long long)SvVAL64 (sv); } |
176 | inline void sv_to (SV *sv, unsigned long long &v) { v = (unsigned long long)SvVAL64 (sv); } |
176 | inline void sv_to (SV *sv, float &v) { v = SvNV (sv); } |
177 | inline void sv_to (SV *sv, float &v) { v = SvNV (sv); } |
177 | inline void sv_to (SV *sv, double &v) { v = SvNV (sv); } |
178 | inline void sv_to (SV *sv, double &v) { v = SvNV (sv); } |
|
|
179 | inline void sv_to (SV *sv, client * &v) { v = (client *)SvPTR_ornull (sv, "cf::client"); } |
178 | inline void sv_to (SV *sv, player * &v) { v = (player *)SvPTR_ornull (sv, "cf::player"); } |
180 | inline void sv_to (SV *sv, player * &v) { v = (player *)SvPTR_ornull (sv, "cf::player"); } |
179 | inline void sv_to (SV *sv, object * &v) { v = (object *)SvPTR_ornull (sv, "cf::object"); } |
181 | inline void sv_to (SV *sv, object * &v) { v = (object *)SvPTR_ornull (sv, "cf::object"); } |
180 | inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)SvPTR_ornull (sv, "cf::arch"); } |
182 | inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)SvPTR_ornull (sv, "cf::arch"); } |
181 | inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)SvPTR_ornull (sv, "cf::map"); } |
183 | inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)SvPTR_ornull (sv, "cf::map"); } |
182 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
184 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
… | |
… | |
239 | break; |
241 | break; |
240 | |
242 | |
241 | case DT_MAP: |
243 | case DT_MAP: |
242 | // va_arg (object *) when void * is passed is an XSI extension |
244 | // va_arg (object *) when void * is passed is an XSI extension |
243 | sv = to_sv (va_arg (ap, maptile *)); |
245 | sv = to_sv (va_arg (ap, maptile *)); |
|
|
246 | break; |
|
|
247 | |
|
|
248 | case DT_SOCKET: |
|
|
249 | sv = to_sv (va_arg (ap, client *)); |
244 | break; |
250 | break; |
245 | |
251 | |
246 | case DT_PLAYER: |
252 | case DT_PLAYER: |
247 | sv = to_sv (va_arg (ap, player *)); |
253 | sv = to_sv (va_arg (ap, player *)); |
248 | break; |
254 | break; |
… | |
… | |
309 | } |
315 | } |
310 | |
316 | |
311 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
317 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
312 | |
318 | |
313 | SV * |
319 | SV * |
314 | registry_of (attachable_base *ext) |
320 | registry (attachable_base *ext) |
315 | { |
321 | { |
316 | if (!ext->cb) |
322 | if (!ext->cb) |
317 | ext->cb = newAV (); |
323 | ext->cb = newAV (); |
318 | |
324 | |
319 | return newRV_inc ((SV *)ext->cb); |
325 | return newRV_inc ((SV *)ext->cb); |
… | |
… | |
828 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
834 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
829 | |
835 | |
830 | char *argv[] = { |
836 | char *argv[] = { |
831 | "", |
837 | "", |
832 | "-e" |
838 | "-e" |
833 | "cf->bootstrap;" |
839 | "use Event;" // required for bootstrap |
|
|
840 | "cf->bootstrap;" // required for datadir :*> |
834 | "unshift @INC, cf::datadir ();" |
841 | "unshift @INC, cf::datadir ();" |
835 | "require cf;" |
842 | "require cf;" |
836 | }; |
843 | }; |
837 | |
844 | |
838 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
845 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
… | |
… | |
1043 | cfperl_result_INT (int idx) |
1050 | cfperl_result_INT (int idx) |
1044 | { |
1051 | { |
1045 | return SvIV (cfperl_result (idx)); |
1052 | return SvIV (cfperl_result (idx)); |
1046 | } |
1053 | } |
1047 | |
1054 | |
|
|
1055 | double |
|
|
1056 | cfperl_result_DOUBLE (int idx) |
|
|
1057 | { |
|
|
1058 | return SvNV (cfperl_result (idx)); |
|
|
1059 | } |
|
|
1060 | |
|
|
1061 | ///////////////////////////////////////////////////////////////////////////// |
|
|
1062 | |
|
|
1063 | struct EventAPI *watcher_base::GEventAPI; |
|
|
1064 | |
|
|
1065 | static void iw_dispatch (pe_event *ev) |
|
|
1066 | { |
|
|
1067 | iw *w = (iw *)ev->ext_data; |
|
|
1068 | w->call (*w); |
|
|
1069 | } |
|
|
1070 | |
|
|
1071 | void |
|
|
1072 | iw::alloc () |
|
|
1073 | { |
|
|
1074 | pe = GEventAPI->new_idle (0, 0); |
|
|
1075 | |
|
|
1076 | pe->base.callback = (void *)iw_dispatch; |
|
|
1077 | pe->base.ext_data = (void *)this; |
|
|
1078 | } |
|
|
1079 | |
|
|
1080 | static void iow_dispatch (pe_event *ev) |
|
|
1081 | { |
|
|
1082 | iow *w = (iow *)ev->ext_data; |
|
|
1083 | w->call (*w, ((pe_ioevent *)ev)->got); |
|
|
1084 | } |
|
|
1085 | |
|
|
1086 | void |
|
|
1087 | iow::alloc () |
|
|
1088 | { |
|
|
1089 | pe = GEventAPI->new_io (0, 0); |
|
|
1090 | |
|
|
1091 | pe->base.callback = (void *)iow_dispatch; |
|
|
1092 | pe->base.ext_data = (void *)this; |
|
|
1093 | |
|
|
1094 | pe->fd = -1; |
|
|
1095 | pe->poll = 0; |
|
|
1096 | } |
|
|
1097 | |
|
|
1098 | void |
|
|
1099 | iow::fd (int fd) |
|
|
1100 | { |
|
|
1101 | pe->fd = fd; |
|
|
1102 | } |
|
|
1103 | |
1048 | int |
1104 | int |
1049 | cfperl_result_DOUBLE (int idx) |
1105 | iow::poll () |
1050 | { |
1106 | { |
1051 | return SvNV (cfperl_result (idx)); |
1107 | return pe->poll; |
|
|
1108 | } |
|
|
1109 | |
|
|
1110 | void |
|
|
1111 | iow::poll (int events) |
|
|
1112 | { |
|
|
1113 | if (pe->poll != events) |
|
|
1114 | { |
|
|
1115 | if (pe->poll) stop (); |
|
|
1116 | pe->poll = events; |
|
|
1117 | if (pe->poll) start (); |
|
|
1118 | } |
1052 | } |
1119 | } |
1053 | |
1120 | |
1054 | MODULE = cf PACKAGE = cf PREFIX = cf_ |
1121 | MODULE = cf PACKAGE = cf PREFIX = cf_ |
1055 | |
1122 | |
1056 | BOOT: |
1123 | BOOT: |
1057 | { |
1124 | { |
1058 | HV *stash = gv_stashpv ("cf", 1); |
1125 | HV *stash = gv_stashpv ("cf", 1); |
|
|
1126 | |
|
|
1127 | I_EVENT_API (PACKAGE); |
|
|
1128 | watcher_base::GEventAPI = GEventAPI; |
1059 | |
1129 | |
1060 | newCONSTSUB (stash, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1130 | newCONSTSUB (stash, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1061 | |
1131 | |
1062 | static const struct { |
1132 | static const struct { |
1063 | const char *name; |
1133 | const char *name; |
… | |
… | |
1574 | av_push (event, newSVpv ((char *)eiv->name + eiv->skip, 0)); |
1644 | av_push (event, newSVpv ((char *)eiv->name + eiv->skip, 0)); |
1575 | av_push (event, newSViv (eiv->klass)); |
1645 | av_push (event, newSViv (eiv->klass)); |
1576 | av_store (av, eiv->iv, newRV_noinc ((SV *)event)); |
1646 | av_store (av, eiv->iv, newRV_noinc ((SV *)event)); |
1577 | newCONSTSUB (stash, (char *)eiv->name, newSViv (eiv->iv)); |
1647 | newCONSTSUB (stash, (char *)eiv->name, newSViv (eiv->iv)); |
1578 | } |
1648 | } |
1579 | |
|
|
1580 | //I_EVENT_API (PACKAGE); |
|
|
1581 | } |
1649 | } |
1582 | |
1650 | |
1583 | void _init_vars () |
1651 | void _init_vars () |
1584 | CODE: |
1652 | CODE: |
1585 | cb_global = get_av ("cf::CB_GLOBAL", 1); |
1653 | cb_global = get_av ("cf::CB_GLOBAL", 1); |
… | |
… | |
1599 | reattach (map); |
1667 | reattach (map); |
1600 | |
1668 | |
1601 | for (object *op = object::first; op; op = op->next) |
1669 | for (object *op = object::first; op; op = op->next) |
1602 | reattach (op); |
1670 | reattach (op); |
1603 | } |
1671 | } |
|
|
1672 | |
|
|
1673 | bool |
|
|
1674 | add_client (int fd, const char *peername) |
1604 | |
1675 | |
1605 | NV floor (NV x) |
1676 | NV floor (NV x) |
1606 | |
1677 | |
1607 | NV ceil (NV x) |
1678 | NV ceil (NV x) |
1608 | |
1679 | |
… | |
… | |
1656 | } |
1727 | } |
1657 | OUTPUT: RETVAL |
1728 | OUTPUT: RETVAL |
1658 | |
1729 | |
1659 | void _exit (int status = 0) |
1730 | void _exit (int status = 0) |
1660 | |
1731 | |
1661 | int cf_find_animation (char *text) |
1732 | int find_animation (char *text) |
1662 | PROTOTYPE: $ |
1733 | PROTOTYPE: $ |
1663 | |
1734 | |
1664 | int random_roll(int min, int max, object *op, int goodbad); |
1735 | int random_roll (int min, int max, object *op, int goodbad); |
1665 | |
1736 | |
1666 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1737 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1667 | |
1738 | |
1668 | int invoke (int event, ...) |
1739 | int invoke (int event, ...) |
1669 | CODE: |
1740 | CODE: |
… | |
… | |
1730 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
1801 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
1731 | RETVAL = INVOKE_((event_type)event, ARG_OBJECT (op), ARG_AV (av)); |
1802 | RETVAL = INVOKE_((event_type)event, ARG_OBJECT (op), ARG_AV (av)); |
1732 | OUTPUT: RETVAL |
1803 | OUTPUT: RETVAL |
1733 | |
1804 | |
1734 | SV *registry (object *op) |
1805 | SV *registry (object *op) |
1735 | CODE: |
|
|
1736 | RETVAL = registry_of (op); |
|
|
1737 | OUTPUT: |
|
|
1738 | RETVAL |
|
|
1739 | |
1806 | |
1740 | void mortals () |
1807 | void mortals () |
1741 | PPCODE: |
1808 | PPCODE: |
1742 | EXTEND (SP, object::mortals.size ()); |
1809 | EXTEND (SP, object::mortals.size ()); |
1743 | for (AUTODECL (i, object::mortals.begin ()); i != object::mortals.end (); ++i) |
1810 | for (AUTODECL (i, object::mortals.begin ()); i != object::mortals.end (); ++i) |
… | |
… | |
1785 | |
1852 | |
1786 | object *find_best_object_match (object *op, const char *match) |
1853 | object *find_best_object_match (object *op, const char *match) |
1787 | |
1854 | |
1788 | object *find_marked_object (object *op) |
1855 | object *find_marked_object (object *op) |
1789 | |
1856 | |
1790 | int cf_object_get_resistance (object *op, int rtype) |
1857 | int resistance (object *op, int rtype, int newval = 0) |
1791 | ALIAS: resistance = 0 |
1858 | CODE: |
|
|
1859 | if (rtype < 0 || rtype >= NROFATTACKS) |
|
|
1860 | croak ("resistance out of bounds"); |
|
|
1861 | RETVAL = op->resist [rtype]; |
|
|
1862 | if (items >= 3) |
|
|
1863 | op->resist [rtype] = newval; |
|
|
1864 | OUTPUT: RETVAL |
|
|
1865 | |
|
|
1866 | void set_resistance (object *op, int rtype, int val) |
|
|
1867 | CODE: |
|
|
1868 | if (rtype < 0 || rtype >= NROFATTACKS) |
|
|
1869 | op->resist[rtype] = val; |
1792 | |
1870 | |
1793 | int need_identify (const object *obj); |
1871 | int need_identify (const object *obj); |
1794 | |
1872 | |
1795 | int apply_shop_mat (object *shop_mat, object *op); |
1873 | int apply_shop_mat (object *shop_mat, object *op); |
1796 | |
1874 | |
… | |
… | |
1798 | CODE: |
1876 | CODE: |
1799 | RETVAL = move_ob (op, dir, originator); |
1877 | RETVAL = move_ob (op, dir, originator); |
1800 | OUTPUT: |
1878 | OUTPUT: |
1801 | RETVAL |
1879 | RETVAL |
1802 | |
1880 | |
1803 | void cf_object_apply (object *op, object *author, int flags = 0) |
1881 | void apply (object *applier, object *applied, int flags = 0) |
|
|
1882 | CODE: |
|
|
1883 | manual_apply (applied, applier, flags); |
1804 | |
1884 | |
1805 | void cf_object_apply_below (object *op) |
1885 | void apply_below (object *op) |
|
|
1886 | CODE: |
|
|
1887 | player_apply_below (op); |
1806 | |
1888 | |
1807 | void cf_object_remove (object *op) |
1889 | void remove (object *op) |
|
|
1890 | CODE: |
|
|
1891 | op->remove (); |
1808 | |
1892 | |
1809 | void cf_object_free (object *op) |
1893 | void destroy (object *op, int recursive = 0) |
|
|
1894 | CODE: |
|
|
1895 | op->destroy (recursive); |
1810 | |
1896 | |
1811 | object *cf_object_present_archname_inside (object *op, char *whatstr) |
1897 | object *cf_object_present_archname_inside (object *op, char *whatstr) |
1812 | |
1898 | |
1813 | int cf_object_transfer (object *op, int x, int y, int r = 0, object_ornull *orig = 0) |
1899 | int cf_object_transfer (object *op, int x, int y, int r = 0, object_ornull *orig = 0) |
1814 | |
1900 | |
1815 | int cf_object_change_map (object *op, int x, int y, maptile *map) |
1901 | int cf_object_change_map (object *op, int x, int y, maptile *map) |
1816 | |
1902 | |
1817 | object *cf_object_clone (object *op, int clonetype = 0) |
1903 | object *clone (object *op, int recursive = 0) |
|
|
1904 | CODE: |
|
|
1905 | if (recursive) |
|
|
1906 | RETVAL = object_create_clone (op); |
|
|
1907 | else |
|
|
1908 | { |
|
|
1909 | RETVAL = object::create (); |
|
|
1910 | op->copy_to (RETVAL); |
|
|
1911 | } |
|
|
1912 | OUTPUT: RETVAL |
1818 | |
1913 | |
1819 | int cf_object_pay_item (object *op, object *buyer) |
1914 | int pay_item (object *op, object *buyer) |
|
|
1915 | CODE: |
|
|
1916 | RETVAL = pay_for_item (op, buyer); |
|
|
1917 | OUTPUT: RETVAL |
1820 | |
1918 | |
1821 | int cf_object_pay_amount (object *op, uint64 amount) |
1919 | int pay_amount (object *op, uint64 amount) |
|
|
1920 | CODE: |
|
|
1921 | RETVAL = pay_for_amount (amount, op); |
|
|
1922 | OUTPUT: RETVAL |
1822 | |
1923 | |
1823 | void pay_player (object *op, uint64 amount) |
1924 | void pay_player (object *op, uint64 amount) |
1824 | |
1925 | |
1825 | val64 pay_player_arch (object *op, const char *arch, uint64 amount) |
1926 | val64 pay_player_arch (object *op, const char *arch, uint64 amount) |
1826 | |
1927 | |
1827 | int cf_object_cast_spell (object *caster, object *ctoo, int dir, object *spell_ob, char *stringarg = 0) |
1928 | int cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg = 0) |
1828 | |
1929 | |
1829 | int cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp_, char *stringarg = 0) |
1930 | void learn_spell (object *op, object *sp, int special_prayer = 0) |
|
|
1931 | CODE: |
|
|
1932 | do_learn_spell (op, sp, special_prayer); |
1830 | |
1933 | |
1831 | void cf_object_learn_spell (object *op, object *sp) |
|
|
1832 | |
|
|
1833 | void cf_object_forget_spell (object *op, object *sp) |
1934 | void forget_spell (object *op, object *sp) |
|
|
1935 | CODE: |
|
|
1936 | do_forget_spell (op, query_name (sp)); |
1834 | |
1937 | |
1835 | object *cf_object_check_for_spell (object *op, char *spellname) |
1938 | object *check_for_spell (object *op, char *spellname) |
|
|
1939 | CODE: |
|
|
1940 | RETVAL = check_spell_known (op, spellname); |
|
|
1941 | OUTPUT: RETVAL |
1836 | |
1942 | |
1837 | int cf_object_query_money (object *op) |
1943 | int query_money (object *op) |
1838 | ALIAS: money = 0 |
1944 | ALIAS: money = 0 |
1839 | |
1945 | |
1840 | int cf_object_query_cost (object *op, object *who, int flags) |
1946 | int query_cost (object *op, object *who, int flags) |
1841 | ALIAS: cost = 0 |
1947 | ALIAS: cost = 0 |
1842 | |
1948 | |
1843 | void cf_object_activate_rune (object *op , object *victim) |
1949 | void spring_trap (object *op, object *victim) |
1844 | |
1950 | |
1845 | int cf_object_check_trigger (object *op, object *cause) |
1951 | int check_trigger (object *op, object *cause) |
1846 | |
1952 | |
1847 | int cf_object_out_of_map (object *op, int x, int y) |
|
|
1848 | |
|
|
1849 | void cf_object_drop (object *op, object *author) |
1953 | void drop (object *who, object *op) |
1850 | |
1954 | |
1851 | void cf_object_take (object *op, object *author) |
1955 | void pick_up (object *who, object *op) |
1852 | |
1956 | |
1853 | object *cf_object_insert_object (object *op, object *container) |
1957 | object *cf_object_insert_object (object *op, object *container) |
1854 | |
1958 | |
1855 | object *cf_object_insert_in_ob (object *ob, object *where) |
1959 | object *cf_object_insert_in_ob (object *ob, object *where) |
1856 | |
1960 | |
1857 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1961 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1858 | |
1962 | |
1859 | void cf_object_update (object *op, int flags) |
1963 | void update (object *op, int action) |
1860 | |
1964 | CODE: |
1861 | void cf_object_pickup (object *op, object *what) |
1965 | update_object (op, action); |
1862 | |
1966 | |
1863 | object *cf_create_object_by_name (const char *name) |
1967 | object *cf_create_object_by_name (const char *name) |
1864 | |
1968 | |
1865 | void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) |
1969 | void change_exp (object *op, uint64 exp, const char *skill_name = 0, int flag = 0) |
1866 | |
1970 | |
… | |
… | |
1875 | void use_trigger (object *op); |
1979 | void use_trigger (object *op); |
1876 | |
1980 | |
1877 | void add_button_link (object *button, maptile *map, int connected); |
1981 | void add_button_link (object *button, maptile *map, int connected); |
1878 | |
1982 | |
1879 | void remove_button_link (object *op); |
1983 | void remove_button_link (object *op); |
1880 | |
|
|
1881 | void |
|
|
1882 | cf_object_set_resistance (object *op, int rtype, int val) |
|
|
1883 | CODE: |
|
|
1884 | if (rtype >= 0 && rtype < NROFATTACKS) |
|
|
1885 | op->resist[rtype] = val; |
|
|
1886 | |
1984 | |
1887 | |
1985 | |
1888 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
1986 | MODULE = cf PACKAGE = cf::object PREFIX = cf_ |
1889 | |
1987 | |
1890 | void cf_fix_object (object *pl) |
1988 | void cf_fix_object (object *pl) |
… | |
… | |
2000 | int command_banish (object *op, char *params) |
2098 | int command_banish (object *op, char *params) |
2001 | |
2099 | |
2002 | |
2100 | |
2003 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2101 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2004 | |
2102 | |
2005 | INCLUDE: $PERL genacc player ../include/newserver.h ../include/player.h | |
2103 | INCLUDE: $PERL genacc player ../include/player.h | |
2006 | |
|
|
2007 | char * |
|
|
2008 | client (player *pl) |
|
|
2009 | CODE: |
|
|
2010 | RETVAL = pl->socket.client; |
|
|
2011 | OUTPUT: |
|
|
2012 | RETVAL |
|
|
2013 | |
|
|
2014 | char * |
|
|
2015 | host (player *pl) |
|
|
2016 | CODE: |
|
|
2017 | RETVAL = pl->socket.host; |
|
|
2018 | OUTPUT: |
|
|
2019 | RETVAL |
|
|
2020 | |
2104 | |
2021 | int invoke (player *pl, int event, ...) |
2105 | int invoke (player *pl, int event, ...) |
2022 | CODE: |
2106 | CODE: |
2023 | if (KLASS_OF (event) != KLASS_PLAYER) croak ("event class must be PLAYER"); |
2107 | if (KLASS_OF (event) != KLASS_PLAYER) croak ("event class must be PLAYER"); |
2024 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
2108 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
2025 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
2109 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
2026 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
2110 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
2027 | OUTPUT: RETVAL |
2111 | OUTPUT: RETVAL |
2028 | |
2112 | |
2029 | SV *registry (player *pl) |
2113 | SV *registry (player *pl) |
|
|
2114 | |
|
|
2115 | player *cf_player_find (char *name) |
|
|
2116 | PROTOTYPE: $ |
|
|
2117 | |
|
|
2118 | void cf_player_move (player *pl, int dir) |
|
|
2119 | |
|
|
2120 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
|
|
2121 | |
|
|
2122 | player *first () |
2030 | CODE: |
2123 | CODE: |
2031 | RETVAL = registry_of (pl); |
2124 | RETVAL = first_player; |
|
|
2125 | OUTPUT: RETVAL |
|
|
2126 | |
|
|
2127 | player *next (player *pl) |
|
|
2128 | CODE: |
|
|
2129 | RETVAL = pl->next; |
|
|
2130 | OUTPUT: RETVAL |
|
|
2131 | |
|
|
2132 | bool |
|
|
2133 | cell_visible (player *pl, int dx, int dy) |
|
|
2134 | CODE: |
|
|
2135 | RETVAL = FABS (dx) <= pl->socket->mapx / 2 && FABS (dy) <= pl->socket->mapy / 2 |
|
|
2136 | && !pl->blocked_los [dx + pl->socket->mapx / 2][dy + pl->socket->mapy / 2]; |
2032 | OUTPUT: |
2137 | OUTPUT: |
2033 | RETVAL |
2138 | RETVAL |
2034 | |
2139 | |
2035 | player *cf_player_find (char *name) |
|
|
2036 | PROTOTYPE: $ |
|
|
2037 | |
|
|
2038 | void cf_player_move (player *pl, int dir) |
|
|
2039 | |
|
|
2040 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
|
|
2041 | |
|
|
2042 | player *first () |
|
|
2043 | CODE: |
|
|
2044 | RETVAL = first_player; |
|
|
2045 | OUTPUT: RETVAL |
|
|
2046 | |
|
|
2047 | player *next (player *pl) |
|
|
2048 | CODE: |
|
|
2049 | RETVAL = pl->next; |
|
|
2050 | OUTPUT: RETVAL |
|
|
2051 | |
|
|
2052 | bool |
|
|
2053 | cell_visible (player *pl, int dx, int dy) |
|
|
2054 | CODE: |
|
|
2055 | RETVAL = FABS (dx) <= pl->socket.mapx / 2 && FABS (dy) <= pl->socket.mapy / 2 |
|
|
2056 | && !pl->blocked_los [dx + pl->socket.mapx / 2][dy + pl->socket.mapy / 2]; |
|
|
2057 | OUTPUT: |
|
|
2058 | RETVAL |
|
|
2059 | |
|
|
2060 | void |
|
|
2061 | buggy_mapscroll (player *pl, int value = 1) |
|
|
2062 | CODE: |
|
|
2063 | pl->socket.buggy_mapscroll = value; |
|
|
2064 | |
|
|
2065 | void |
2140 | void |
2066 | send (player *pl, SV *packet) |
2141 | send (player *pl, SV *packet) |
2067 | CODE: |
2142 | CODE: |
2068 | { |
2143 | { |
2069 | STRLEN len; |
2144 | STRLEN len; |
2070 | char *buf = SvPVbyte (packet, len); |
2145 | char *buf = SvPVbyte (packet, len); |
2071 | |
2146 | |
2072 | Write_String_To_Socket (&pl->socket, buf, len); |
2147 | pl->socket->send_packet (buf, len); |
2073 | } |
2148 | } |
2074 | |
2149 | |
2075 | int |
2150 | int |
2076 | listening (player *pl, int new_value = -1) |
2151 | listening (player *pl, int new_value = -1) |
2077 | CODE: |
2152 | CODE: |
… | |
… | |
2142 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
2217 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
2143 | RETVAL = INVOKE_((event_type)event, ARG_MAP (map), ARG_AV (av)); |
2218 | RETVAL = INVOKE_((event_type)event, ARG_MAP (map), ARG_AV (av)); |
2144 | OUTPUT: RETVAL |
2219 | OUTPUT: RETVAL |
2145 | |
2220 | |
2146 | SV *registry (maptile *map) |
2221 | SV *registry (maptile *map) |
2147 | CODE: |
|
|
2148 | RETVAL = registry_of (map); |
|
|
2149 | OUTPUT: |
|
|
2150 | RETVAL |
|
|
2151 | |
2222 | |
2152 | INCLUDE: $PERL genacc maptile ../include/map.h | |
2223 | INCLUDE: $PERL genacc maptile ../include/map.h | |
2153 | |
2224 | |
2154 | maptile *new (int width, int height) |
2225 | maptile *new (int width, int height) |
2155 | PROTOTYPE: |
2226 | PROTOTYPE: |
… | |
… | |
2163 | void delete_map (maptile *map) |
2234 | void delete_map (maptile *map) |
2164 | |
2235 | |
2165 | void clean_tmp_map (maptile *map) |
2236 | void clean_tmp_map (maptile *map) |
2166 | |
2237 | |
2167 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
2238 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
|
|
2239 | |
|
|
2240 | int out_of_map (maptile *map, int x, int y) |
2168 | |
2241 | |
2169 | maptile *tile_map (maptile *map, unsigned int dir) |
2242 | maptile *tile_map (maptile *map, unsigned int dir) |
2170 | CODE: |
2243 | CODE: |
2171 | RETVAL = dir < 4 ? map->tile_map [dir] : 0; |
2244 | RETVAL = dir < 4 ? map->tile_map [dir] : 0; |
2172 | OUTPUT: |
2245 | OUTPUT: |
… | |
… | |
2356 | |
2429 | |
2357 | MODULE = cf PACKAGE = cf::living |
2430 | MODULE = cf PACKAGE = cf::living |
2358 | |
2431 | |
2359 | INCLUDE: $PERL genacc living ../include/living.h | |
2432 | INCLUDE: $PERL genacc living ../include/living.h | |
2360 | |
2433 | |
|
|
2434 | MODULE = cf PACKAGE = cf::settings |
|
|
2435 | |
|
|
2436 | INCLUDE: $PERL genacc Settings ../include/global.h | |
|
|
2437 | |
|
|
2438 | MODULE = cf PACKAGE = cf::client |
|
|
2439 | |
|
|
2440 | INCLUDE: $PERL genacc client ../include/client.h | |
|
|
2441 | |
|
|
2442 | int invoke (client *ns, int event, ...) |
|
|
2443 | CODE: |
|
|
2444 | if (KLASS_OF (event) != KLASS_SOCKET) croak ("event class must be SOCKET"); |
|
|
2445 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
2446 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
|
|
2447 | RETVAL = INVOKE_((event_type)event, ARG_SOCKET (ns), ARG_AV (av)); |
|
|
2448 | OUTPUT: RETVAL |
|
|
2449 | |
|
|
2450 | SV *registry (client *ns) |
|
|
2451 | |