ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/cfperl.xs
(Generate patch)

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.232 by elmex, Mon Jul 16 14:49:01 2007 UTC vs.
Revision 1.244 by root, Sat Aug 25 22:19:26 2007 UTC

964} 964}
965 965
966SV * 966SV *
967cfperl_result (int idx) 967cfperl_result (int idx)
968{ 968{
969 AV *av = get_av ("cf::invoke_results", 0); 969 AV *av = get_av ("cf::INVOKE_RESULTS", 0);
970 if (!av) 970 if (!av)
971 return &PL_sv_undef; 971 return &PL_sv_undef;
972 972
973 SV **sv = av_fetch (av, idx, 0); 973 SV **sv = av_fetch (av, idx, 0);
974 if (!sv) 974 if (!sv)
1021void 1021void
1022cfperl_send_msg (client *ns, int color, const char *type, const char *msg) 1022cfperl_send_msg (client *ns, int color, const char *type, const char *msg)
1023{ 1023{
1024 CALL_BEGIN (4); 1024 CALL_BEGIN (4);
1025 CALL_ARG (ns); 1025 CALL_ARG (ns);
1026 CALL_ARG (color);
1027 CALL_ARG (type); 1026 CALL_ARG (type);
1028 CALL_ARG_SV (newSVpv_utf8 (msg)); 1027 CALL_ARG_SV (newSVpv_utf8 (msg));
1028 CALL_ARG (color);
1029 CALL_CALL ("cf::client::send_msg", G_VOID); 1029 CALL_CALL ("cf::client::send_msg", G_VOID);
1030 CALL_END; 1030 CALL_END;
1031}
1032
1033int
1034cfperl_can_merge (object *ob1, object *ob2)
1035{
1036 int can;
1037
1038 CALL_BEGIN (2);
1039 CALL_ARG (ob1);
1040 CALL_ARG (ob2);
1041 CALL_CALL ("cf::_can_merge", G_SCALAR);
1042 can = count && SvTRUE (TOPs);
1043 CALL_END;
1044
1045 return can;
1046}
1047
1048player *
1049player::find (const char *name)
1050{
1051 CALL_BEGIN (1);
1052 CALL_ARG (name);
1053 CALL_CALL ("cf::player::find", G_SCALAR);
1054
1055 player *retval;
1056
1057 if (count)
1058 sv_to (POPs, retval);
1059 else
1060 retval = 0;
1061
1062 CALL_END;
1063
1064 return retval;
1031} 1065}
1032 1066
1033maptile * 1067maptile *
1034maptile::find_sync (const char *path, maptile *origin) 1068maptile::find_sync (const char *path, maptile *origin)
1035{ 1069{
1049 1083
1050 return retval; 1084 return retval;
1051} 1085}
1052 1086
1053maptile * 1087maptile *
1054maptile::find_async (const char *path, maptile *origin) 1088maptile::find_async (const char *path, maptile *origin, bool load)
1055{ 1089{
1056 CALL_BEGIN (2); 1090 CALL_BEGIN (3);
1057 CALL_ARG (path); 1091 CALL_ARG (path);
1058 CALL_ARG (origin); 1092 CALL_ARG (origin);
1093 CALL_ARG (load);
1059 CALL_CALL ("cf::map::find_async", G_SCALAR); 1094 CALL_CALL ("cf::map::find_async", G_SCALAR);
1060 1095
1061 maptile *retval; 1096 maptile *retval;
1062 1097
1063 if (count) 1098 if (count)
1369 1404
1370 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED) 1405 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED)
1371 const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN) 1406 const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN)
1372 const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD) 1407 const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD)
1373 const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE) 1408 const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE)
1409 const_iv (NDI_ALL) const_iv (NDI_DEF) const_iv (NDI_REPLY) const_iv (NDI_CLIENT_MASK)
1374 const_iv (NDI_ALL) 1410 const_iv (NDI_NOCREATE)
1375 1411
1376 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) 1412 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE)
1377 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) 1413 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF)
1378 1414
1379 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) 1415 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE)
1506 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY) 1542 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY)
1507 1543
1508 const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP) 1544 const_iv (GT_ENVIRONMENT) const_iv (GT_INVISIBLE) const_iv (GT_STARTEQUIP)
1509 const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_UPDATE_INV) 1545 const_iv (GT_APPLY) const_iv (GT_ONLY_GOOD) const_iv (GT_UPDATE_INV)
1510 const_iv (GT_MINIMAL) 1546 const_iv (GT_MINIMAL)
1547
1548 const_iv (FT_FACE) const_iv (FT_MUSIC) const_iv (FT_SOUND)
1549 const_iv (FT_RSRC) const_iv (FT_NUM)
1511 }; 1550 };
1512 1551
1513 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1552 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1514 newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv)); 1553 newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv));
1515 1554
1549 1588
1550 for_all_objects (op) 1589 for_all_objects (op)
1551 op->reattach (); 1590 op->reattach ();
1552} 1591}
1553 1592
1554void _post_tick ()
1555 CODE:
1556 coroapi::next_cede = SvNV (sv_next_tick) - TICK * (1. - 1. / CEDES_PER_TICK);
1557
1558# support function for map-world.ext 1593# support function for map-world.ext
1559void _quantise (SV *data_sv, SV *plt_sv) 1594void _quantise (SV *data_sv, SV *plt_sv)
1560 CODE: 1595 CODE:
1561{ 1596{
1562 if (!SvROK (plt_sv) || SvTYPE (SvRV (plt_sv)) != SVt_PVAV) 1597 if (!SvROK (plt_sv) || SvTYPE (SvRV (plt_sv)) != SVt_PVAV)
1594 len -= 3; 1629 len -= 3;
1595 } 1630 }
1596 1631
1597 SvCUR_set (data_sv, dst - SvPVX (data_sv)); 1632 SvCUR_set (data_sv, dst - SvPVX (data_sv));
1598} 1633}
1634
1635void _post_tick ()
1636 CODE:
1637 coroapi::next_cede = SvNV (sv_next_tick) - TICK * (1. - 1. / CEDES_PER_TICK);
1638
1639NV till_cede ()
1640 CODE:
1641 RETVAL = coroapi::next_cede - now ();
1642 OUTPUT:
1643 RETVAL
1644
1645NV till_tick ()
1646 CODE:
1647 RETVAL = SvNV (sv_next_tick) - now ();
1648 OUTPUT:
1649 RETVAL
1599 1650
1600NV floor (NV x) 1651NV floor (NV x)
1601 1652
1602NV ceil (NV x) 1653NV ceil (NV x)
1603 1654
1646octet_string path_combine (octet_string base, octet_string path) 1697octet_string path_combine (octet_string base, octet_string path)
1647 PROTOTYPE: $$ 1698 PROTOTYPE: $$
1648 1699
1649octet_string path_combine_and_normalize (octet_string base, octet_string path) 1700octet_string path_combine_and_normalize (octet_string base, octet_string path)
1650 PROTOTYPE: $$ 1701 PROTOTYPE: $$
1651
1652const_octet_string
1653get_maps_directory (octet_string path)
1654 PROTOTYPE: $
1655 ALIAS: maps_directory = 0
1656 CODE:
1657 RETVAL = create_pathname (path);
1658 OUTPUT: RETVAL
1659 1702
1660void 1703void
1661sub_generation_inc () 1704sub_generation_inc ()
1662 CODE: 1705 CODE:
1663 PL_sub_generation++; 1706 PL_sub_generation++;
1785#object *mortals (U32 index) 1828#object *mortals (U32 index)
1786# CODE: 1829# CODE:
1787# RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0; 1830# RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0;
1788# OUTPUT: RETVAL 1831# OUTPUT: RETVAL
1789 1832
1790INCLUDE: $PERL $srcdir/genacc attachable ../include/cfperl.h | 1833INCLUDE: $PERL $srcdir/genacc attachable ../include/util.h ../include/cfperl.h |
1791 1834
1792MODULE = cf PACKAGE = cf::global 1835MODULE = cf PACKAGE = cf::global
1793 1836
1794int invoke (SV *klass, int event, ...) 1837int invoke (SV *klass, int event, ...)
1795 CODE: 1838 CODE:
2121 pl->orig_stats = pl->ob->stats; 2164 pl->orig_stats = pl->ob->stats;
2122 2165
2123void clear_los (player *pl) 2166void clear_los (player *pl)
2124 2167
2125void cf_player_move (player *pl, int dir) 2168void cf_player_move (player *pl, int dir)
2126
2127void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0);
2128 2169
2129bool 2170bool
2130cell_visible (player *pl, int dx, int dy) 2171cell_visible (player *pl, int dx, int dy)
2131 CODE: 2172 CODE:
2132 RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2 2173 RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2
2311 } 2352 }
2312 } 2353 }
2313 2354
2314 op->destroy (); 2355 op->destroy ();
2315} 2356}
2316
2317void play_sound_map (maptile *map, int x, int y, int sound_num)
2318 2357
2319int out_of_map (maptile *map, int x, int y) 2358int out_of_map (maptile *map, int x, int y)
2320 2359
2321void 2360void
2322trigger (maptile *map, long connection, bool state = true) 2361trigger (maptile *map, long connection, bool state = true)
2594 char *buf = SvPVbyte (packet, len); 2633 char *buf = SvPVbyte (packet, len);
2595 2634
2596 THIS->send_packet (buf, len); 2635 THIS->send_packet (buf, len);
2597} 2636}
2598 2637
2638faceidx
2639client::need_face (utf8_string name, int pri = 0)
2640 CODE:
2641 RETVAL = face_find (name, 0);
2642 if (RETVAL)
2643 {
2644 THIS->send_face (RETVAL, pri);
2645 THIS->flush_fx ();
2646 }
2647 OUTPUT:
2648 RETVAL
2649
2650int
2651client::fx_want (int idx, int value = -1)
2652 CODE:
2653 if (0 < idx && idx < FT_NUM)
2654 {
2655 RETVAL = THIS->fx_want [idx];
2656 if (items > 2)
2657 THIS->fx_want [idx] = value;
2658 }
2659 else
2660 RETVAL = 0;
2661 OUTPUT:
2662 RETVAL
2663
2664MODULE = cf PACKAGE = cf::sound PREFIX = sound_
2665
2666faceidx sound_find (utf8_string name)
2667
2668void sound_set (utf8_string str, faceidx face)
2669
2670# dire hack
2671void old_sound_index (int idx, faceidx face)
2672 CODE:
2673 extern faceidx old_sound_index [SOUND_CAST_SPELL_0];
2674 old_sound_index [idx] = face;
2675
2599MODULE = cf PACKAGE = cf::face PREFIX = face_ 2676MODULE = cf PACKAGE = cf::face PREFIX = face_
2600 2677
2601#INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | 2678#INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h |
2602 2679
2603faceidx face_find (utf8_string name, faceidx defidx = 0) 2680faceidx face_find (utf8_string name, faceidx defidx = 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines