… | |
… | |
442 | "use cf;" |
442 | "use cf;" |
443 | }; |
443 | }; |
444 | |
444 | |
445 | perl = perl_alloc (); |
445 | perl = perl_alloc (); |
446 | perl_construct (perl); |
446 | perl_construct (perl); |
|
|
447 | |
|
|
448 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
447 | |
449 | |
448 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
450 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
449 | { |
451 | { |
450 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
452 | printf ("unable to initialize perl-interpreter, continuing without.\n"); |
451 | |
453 | |
… | |
… | |
1127 | const_iv (SOUND_CLOCK) |
1129 | const_iv (SOUND_CLOCK) |
1128 | const_iv (SOUND_TURN_HANDLE) |
1130 | const_iv (SOUND_TURN_HANDLE) |
1129 | const_iv (SOUND_FALL_HOLE) |
1131 | const_iv (SOUND_FALL_HOLE) |
1130 | const_iv (SOUND_DRINK_POISON) |
1132 | const_iv (SOUND_DRINK_POISON) |
1131 | const_iv (SOUND_CAST_SPELL_0) |
1133 | const_iv (SOUND_CAST_SPELL_0) |
|
|
1134 | |
|
|
1135 | const_iv (MAP_FLUSH) |
|
|
1136 | const_iv (MAP_PLAYER_UNIQUE) |
|
|
1137 | const_iv (MAP_BLOCK) |
|
|
1138 | const_iv (MAP_STYLE) |
|
|
1139 | const_iv (MAP_OVERLAY) |
|
|
1140 | |
|
|
1141 | const_iv (MAP_IN_MEMORY) |
|
|
1142 | const_iv (MAP_SWAPPED) |
|
|
1143 | const_iv (MAP_LOADING) |
|
|
1144 | const_iv (MAP_SAVING) |
1132 | }; |
1145 | }; |
1133 | |
1146 | |
1134 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1147 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1135 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1148 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1136 | |
1149 | |
… | |
… | |
1324 | void |
1337 | void |
1325 | LOG (int level, char *msg) |
1338 | LOG (int level, char *msg) |
1326 | PROTOTYPE: $$ |
1339 | PROTOTYPE: $$ |
1327 | C_ARGS: level, "%s", msg |
1340 | C_ARGS: level, "%s", msg |
1328 | |
1341 | |
|
|
1342 | char *path_combine (char *base, char *path) |
|
|
1343 | PROTOTYPE: $$ |
|
|
1344 | |
|
|
1345 | char *path_combine_and_normalize (char *base, char *path) |
|
|
1346 | PROTOTYPE: $$ |
|
|
1347 | |
1329 | char * |
1348 | char * |
1330 | cf_get_maps_directory (char *path) |
1349 | cf_get_maps_directory (char *path) |
1331 | PROTOTYPE: $ |
1350 | PROTOTYPE: $ |
1332 | ALIAS: maps_directory = 0 |
1351 | ALIAS: maps_directory = 0 |
1333 | |
1352 | |
… | |
… | |
1644 | player *next (player *pl) |
1663 | player *next (player *pl) |
1645 | CODE: |
1664 | CODE: |
1646 | RETVAL = pl->next; |
1665 | RETVAL = pl->next; |
1647 | OUTPUT: RETVAL |
1666 | OUTPUT: RETVAL |
1648 | |
1667 | |
|
|
1668 | bool |
|
|
1669 | cell_visible (player *pl, int dx, int dy) |
|
|
1670 | CODE: |
|
|
1671 | RETVAL = FABS (dx) <= pl->socket.mapx / 2 && FABS (dy) <= pl->socket.mapy / 2 |
|
|
1672 | && !pl->blocked_los [dx + pl->socket.mapx / 2][dy + pl->socket.mapy / 2]; |
|
|
1673 | OUTPUT: |
|
|
1674 | RETVAL |
|
|
1675 | |
1649 | void |
1676 | void |
1650 | send (player *pl, SV *packet) |
1677 | send (player *pl, SV *packet) |
1651 | CODE: |
1678 | CODE: |
1652 | { |
1679 | { |
1653 | STRLEN len; |
1680 | STRLEN len; |
… | |
… | |
1750 | |
1777 | |
1751 | mapstruct *cf_map_get_map (char *name) |
1778 | mapstruct *cf_map_get_map (char *name) |
1752 | PROTOTYPE: $ |
1779 | PROTOTYPE: $ |
1753 | ALIAS: map = 0 |
1780 | ALIAS: map = 0 |
1754 | |
1781 | |
|
|
1782 | mapstruct *has_been_loaded (char *name) |
|
|
1783 | PROTOTYPE: $ |
|
|
1784 | |
1755 | mapstruct *cf_map_get_first () |
1785 | mapstruct *cf_map_get_first () |
1756 | PROTOTYPE: |
1786 | PROTOTYPE: |
1757 | ALIAS: first = 0 |
1787 | ALIAS: first = 0 |
1758 | |
1788 | |
1759 | # whoever "designed" the plug-in api should have wasted |
1789 | # whoever "designed" the plug-in api should have wasted |
1760 | # his/her time with staying away form the project - would have |
1790 | # his/her time with staying away from the project - would have |
1761 | # saved others a lot of time, without doubt. |
1791 | # saved others a lot of time, without doubt. |
1762 | void set_path (mapstruct *where, char *path) |
1792 | void set_path (mapstruct *where, char *path) |
1763 | CODE: |
1793 | CODE: |
1764 | strcpy (where->path, path); |
1794 | strcpy (where->path, path); |
|
|
1795 | |
|
|
1796 | int in_memory (mapstruct *map) |
|
|
1797 | CODE: |
|
|
1798 | RETVAL = map->in_memory; |
|
|
1799 | OUTPUT: |
|
|
1800 | RETVAL |
1765 | |
1801 | |
1766 | bool unique (mapstruct *map) |
1802 | bool unique (mapstruct *map) |
1767 | CODE: |
1803 | CODE: |
1768 | RETVAL = map->unique; |
1804 | RETVAL = map->unique; |
1769 | OUTPUT: |
1805 | OUTPUT: |
… | |
… | |
1778 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
1814 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
1779 | |
1815 | |
1780 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1816 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1781 | C_ARGS: str, map, nx, ny |
1817 | C_ARGS: str, map, nx, ny |
1782 | |
1818 | |
1783 | #int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
|
|
1784 | |
|
|
1785 | void |
1819 | void |
|
|
1820 | cf_map_normalise (mapstruct *map, int x, int y) |
|
|
1821 | PPCODE: |
|
|
1822 | { |
|
|
1823 | mapstruct *nmap = 0; |
|
|
1824 | I16 nx = 0, ny = 0; |
|
|
1825 | int flags = cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
|
|
1826 | |
|
|
1827 | EXTEND (SP, 4); |
|
|
1828 | PUSHs (sv_2mortal (newSViv (flags))); |
|
|
1829 | |
|
|
1830 | if (GIMME_V == G_ARRAY) |
|
|
1831 | { |
|
|
1832 | PUSHs (sv_2mortal (newSVcfapi (CFAPI_PMAP, nmap))); |
|
|
1833 | PUSHs (sv_2mortal (newSViv (nx))); |
|
|
1834 | PUSHs (sv_2mortal (newSViv (ny))); |
|
|
1835 | } |
|
|
1836 | } |
|
|
1837 | |
|
|
1838 | void |
1786 | at (mapstruct *obj, unsigned int x, unsigned int y) |
1839 | at (mapstruct *map, unsigned int x, unsigned int y) |
1787 | PROTOTYPE: $$$ |
1840 | PROTOTYPE: $$$ |
1788 | INIT: |
|
|
1789 | if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_EMPTY; |
|
|
1790 | PPCODE: |
1841 | PPCODE: |
1791 | { |
1842 | { |
1792 | object *o; |
1843 | object *o; |
1793 | |
1844 | mapstruct *nmap = 0; |
|
|
1845 | I16 nx, ny; |
|
|
1846 | |
|
|
1847 | cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
|
|
1848 | |
|
|
1849 | if (nmap) |
1794 | for (o = GET_MAP_OB (obj, x, y); o; o = o->above) |
1850 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
1795 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
1851 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
1796 | } |
1852 | } |
1797 | |
1853 | |
1798 | SV * |
1854 | SV * |
1799 | bot_at (mapstruct *obj, unsigned int x, unsigned int y) |
1855 | bot_at (mapstruct *obj, unsigned int x, unsigned int y) |
1800 | PROTOTYPE: $$$ |
1856 | PROTOTYPE: $$$ |