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.227 by root, Tue Jul 10 16:24:00 2007 UTC vs.
Revision 1.245 by root, Thu Aug 30 05:24:14 2007 UTC

246 delete obj; 246 delete obj;
247 } 247 }
248 } 248 }
249} 249}
250 250
251void
252attachable::set_key (const char *key, const char *value)
253{
254 if (!self)
255 self = newHV ();
256
257 if (value)
258 hv_store (self, key, strlen (key), newSVpv (value, 0), 0);
259 else
260 hv_delete (self, key, strlen (key), G_DISCARD);
261}
262
251attachable & 263attachable &
252attachable::operator =(const attachable &src) 264attachable::operator =(const attachable &src)
253{ 265{
254 //if (self || cb) 266 //if (self || cb)
255 //INVOKE_OBJECT (CLONE, this, ARG_OBJECT (dst)); 267 //INVOKE_OBJECT (CLONE, this, ARG_OBJECT (dst));
330{ 342{
331 if (!obj) 343 if (!obj)
332 return &PL_sv_undef; 344 return &PL_sv_undef;
333 345
334 if (!obj->self) 346 if (!obj->self)
347 obj->self = newHV ();
348
349 if (!SvOBJECT (obj->self))
335 { 350 {
336 obj->self = newHV ();
337 sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0); 351 sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0);
338 352
339 // now bless the object _once_ 353 // now bless the object _once_
354 //TODO: create a class registry with c++ type<=>perl name<=>stash and use it here and elsewhere
340 return sv_bless (newRV_inc ((SV *)obj->self), stash); 355 return sv_bless (newRV_inc ((SV *)obj->self), stash);
341 } 356 }
342 else 357 else
343 { 358 {
344 SV *sv = newRV_inc ((SV *)obj->self); 359 SV *sv = newRV_inc ((SV *)obj->self);
417inline SV *to_sv (client * v) { return newSVattachable (v, stash_cf_client_wrap); } 432inline SV *to_sv (client * v) { return newSVattachable (v, stash_cf_client_wrap); }
418inline SV *to_sv (player * v) { return newSVattachable (v, stash_cf_player_wrap); } 433inline SV *to_sv (player * v) { return newSVattachable (v, stash_cf_player_wrap); }
419inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? stash_cf_object_player_wrap : stash_cf_object_wrap); } 434inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? stash_cf_object_player_wrap : stash_cf_object_wrap); }
420inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); } 435inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); }
421inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); } 436inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); }
437inline SV *to_sv (region * v) { return newSVattachable (v, stash_cf_region_wrap); }
422inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); } 438inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); }
423inline SV *to_sv (region * v) { return newSVptr (v, stash_cf_region_wrap); }
424inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } 439inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); }
425 440
426inline SV *to_sv (object & v) { return to_sv (&v); } 441inline SV *to_sv (object & v) { return to_sv (&v); }
427inline SV *to_sv (living & v) { return to_sv (&v); } 442inline SV *to_sv (living & v) { return to_sv (&v); }
428 443
454inline void sv_to (SV *sv, client * &v) { v = (client *)(attachable *)SvPTR_ornull (sv, "cf::client"); } 469inline void sv_to (SV *sv, client * &v) { v = (client *)(attachable *)SvPTR_ornull (sv, "cf::client"); }
455inline void sv_to (SV *sv, player * &v) { v = (player *)(attachable *)SvPTR_ornull (sv, "cf::player"); } 470inline void sv_to (SV *sv, player * &v) { v = (player *)(attachable *)SvPTR_ornull (sv, "cf::player"); }
456inline void sv_to (SV *sv, object * &v) { v = (object *)(attachable *)SvPTR_ornull (sv, "cf::object"); } 471inline void sv_to (SV *sv, object * &v) { v = (object *)(attachable *)SvPTR_ornull (sv, "cf::object"); }
457inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); } 472inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); }
458inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); } 473inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); }
474inline void sv_to (SV *sv, region * &v) { v = (region *)(attachable *)SvPTR_ornull (sv, "cf::region"); }
459inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } 475inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); }
460inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } 476inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); }
461inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); }
462inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } 477inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); }
463 478
464//inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } 479//inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; }
465inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } 480inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); }
466 481
949} 964}
950 965
951SV * 966SV *
952cfperl_result (int idx) 967cfperl_result (int idx)
953{ 968{
954 AV *av = get_av ("cfperl::invoke_results", 0); 969 AV *av = get_av ("cf::INVOKE_RESULTS", 0);
955 if (!av) 970 if (!av)
956 return &PL_sv_undef; 971 return &PL_sv_undef;
957 972
958 SV **sv = av_fetch (av, idx, 0); 973 SV **sv = av_fetch (av, idx, 0);
959 if (!sv) 974 if (!sv)
1006void 1021void
1007cfperl_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)
1008{ 1023{
1009 CALL_BEGIN (4); 1024 CALL_BEGIN (4);
1010 CALL_ARG (ns); 1025 CALL_ARG (ns);
1011 CALL_ARG (color);
1012 CALL_ARG (type); 1026 CALL_ARG (type);
1013 CALL_ARG_SV (newSVpv_utf8 (msg)); 1027 CALL_ARG_SV (newSVpv_utf8 (msg));
1028 CALL_ARG (color);
1014 CALL_CALL ("cf::client::send_msg", G_VOID); 1029 CALL_CALL ("cf::client::send_msg", G_VOID);
1015 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;
1016} 1065}
1017 1066
1018maptile * 1067maptile *
1019maptile::find_sync (const char *path, maptile *origin) 1068maptile::find_sync (const char *path, maptile *origin)
1020{ 1069{
1034 1083
1035 return retval; 1084 return retval;
1036} 1085}
1037 1086
1038maptile * 1087maptile *
1039maptile::find_async (const char *path, maptile *origin) 1088maptile::find_async (const char *path, maptile *origin, bool load)
1040{ 1089{
1041 CALL_BEGIN (2); 1090 CALL_BEGIN (3);
1042 CALL_ARG (path); 1091 CALL_ARG (path);
1043 CALL_ARG (origin); 1092 CALL_ARG (origin);
1093 CALL_ARG (load);
1044 CALL_CALL ("cf::map::find_async", G_SCALAR); 1094 CALL_CALL ("cf::map::find_async", G_SCALAR);
1045 1095
1046 maptile *retval; 1096 maptile *retval;
1047 1097
1048 if (count) 1098 if (count)
1346 const_iv (FLAG_USE_ROD) const_iv (FLAG_USE_HORN) const_iv (FLAG_MAKE_INVIS) const_iv (FLAG_INV_LOCKED) 1396 const_iv (FLAG_USE_ROD) const_iv (FLAG_USE_HORN) const_iv (FLAG_MAKE_INVIS) const_iv (FLAG_INV_LOCKED)
1347 const_iv (FLAG_IS_WOODED) const_iv (FLAG_IS_HILLY) const_iv (FLAG_READY_SKILL) const_iv (FLAG_READY_WEAPON) 1397 const_iv (FLAG_IS_WOODED) const_iv (FLAG_IS_HILLY) const_iv (FLAG_READY_SKILL) const_iv (FLAG_READY_WEAPON)
1348 const_iv (FLAG_NO_SKILL_IDENT) const_iv (FLAG_BLIND) const_iv (FLAG_SEE_IN_DARK) const_iv (FLAG_IS_CAULDRON) 1398 const_iv (FLAG_NO_SKILL_IDENT) const_iv (FLAG_BLIND) const_iv (FLAG_SEE_IN_DARK) const_iv (FLAG_IS_CAULDRON)
1349 const_iv (FLAG_NO_STEAL) const_iv (FLAG_ONE_HIT) const_iv (FLAG_CLIENT_SENT) const_iv (FLAG_BERSERK) 1399 const_iv (FLAG_NO_STEAL) const_iv (FLAG_ONE_HIT) const_iv (FLAG_CLIENT_SENT) const_iv (FLAG_BERSERK)
1350 const_iv (FLAG_NEUTRAL) const_iv (FLAG_NO_ATTACK) const_iv (FLAG_NO_DAMAGE) const_iv (FLAG_OBJ_ORIGINAL) 1400 const_iv (FLAG_NEUTRAL) const_iv (FLAG_NO_ATTACK) const_iv (FLAG_NO_DAMAGE) const_iv (FLAG_OBJ_ORIGINAL)
1351 const_iv (FLAG_OBJ_SAVE_ON_OVL) const_iv (FLAG_ACTIVATE_ON_PUSH) const_iv (FLAG_ACTIVATE_ON_RELEASE) const_iv (FLAG_IS_WATER) 1401 const_iv (FLAG_ACTIVATE_ON_PUSH) const_iv (FLAG_ACTIVATE_ON_RELEASE) const_iv (FLAG_IS_WATER)
1352 const_iv (FLAG_CONTENT_ON_GEN) const_iv (FLAG_IS_A_TEMPLATE) const_iv (FLAG_IS_BUILDABLE) 1402 const_iv (FLAG_CONTENT_ON_GEN) const_iv (FLAG_IS_A_TEMPLATE) const_iv (FLAG_IS_BUILDABLE)
1353 const_iv (FLAG_DESTROY_ON_DEATH) const_iv (FLAG_NO_MAP_SAVE) 1403 const_iv (FLAG_DESTROY_ON_DEATH) const_iv (FLAG_NO_MAP_SAVE)
1354 1404
1355 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)
1356 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)
1357 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)
1358 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)
1359 const_iv (NDI_ALL) 1410 const_iv (NDI_NOCREATE)
1360 1411
1361 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)
1362 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)
1363 1414
1364 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)
1491 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY) 1542 const_iv (SYMMETRY_Y) const_iv (SYMMETRY_XY)
1492 1543
1493 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)
1494 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)
1495 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)
1496 }; 1550 };
1497 1551
1498 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; )
1499 newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv)); 1553 newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv));
1500 1554
1534 1588
1535 for_all_objects (op) 1589 for_all_objects (op)
1536 op->reattach (); 1590 op->reattach ();
1537} 1591}
1538 1592
1539void _post_tick ()
1540 CODE:
1541 coroapi::next_cede = SvNV (sv_next_tick) - TICK * (1. - 1. / CEDES_PER_TICK);
1542
1543# support function for map-world.ext 1593# support function for map-world.ext
1544void _quantise (SV *data_sv, SV *plt_sv) 1594void _quantise (SV *data_sv, SV *plt_sv)
1545 CODE: 1595 CODE:
1546{ 1596{
1547 if (!SvROK (plt_sv) || SvTYPE (SvRV (plt_sv)) != SVt_PVAV) 1597 if (!SvROK (plt_sv) || SvTYPE (SvRV (plt_sv)) != SVt_PVAV)
1579 len -= 3; 1629 len -= 3;
1580 } 1630 }
1581 1631
1582 SvCUR_set (data_sv, dst - SvPVX (data_sv)); 1632 SvCUR_set (data_sv, dst - SvPVX (data_sv));
1583} 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
1584 1650
1585NV floor (NV x) 1651NV floor (NV x)
1586 1652
1587NV ceil (NV x) 1653NV ceil (NV x)
1588 1654
1631octet_string path_combine (octet_string base, octet_string path) 1697octet_string path_combine (octet_string base, octet_string path)
1632 PROTOTYPE: $$ 1698 PROTOTYPE: $$
1633 1699
1634octet_string path_combine_and_normalize (octet_string base, octet_string path) 1700octet_string path_combine_and_normalize (octet_string base, octet_string path)
1635 PROTOTYPE: $$ 1701 PROTOTYPE: $$
1636
1637const_octet_string
1638get_maps_directory (octet_string path)
1639 PROTOTYPE: $
1640 ALIAS: maps_directory = 0
1641 CODE:
1642 RETVAL = create_pathname (path);
1643 OUTPUT: RETVAL
1644 1702
1645void 1703void
1646sub_generation_inc () 1704sub_generation_inc ()
1647 CODE: 1705 CODE:
1648 PL_sub_generation++; 1706 PL_sub_generation++;
1770#object *mortals (U32 index) 1828#object *mortals (U32 index)
1771# CODE: 1829# CODE:
1772# RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0; 1830# RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0;
1773# OUTPUT: RETVAL 1831# OUTPUT: RETVAL
1774 1832
1775INCLUDE: $PERL $srcdir/genacc attachable ../include/cfperl.h | 1833INCLUDE: $PERL $srcdir/genacc attachable ../include/util.h ../include/cfperl.h |
1776 1834
1777MODULE = cf PACKAGE = cf::global 1835MODULE = cf PACKAGE = cf::global
1778 1836
1779int invoke (SV *klass, int event, ...) 1837int invoke (SV *klass, int event, ...)
1780 CODE: 1838 CODE:
1994 2052
1995void add_button_link (object *button, maptile *map, int connected); 2053void add_button_link (object *button, maptile *map, int connected);
1996 2054
1997void remove_button_link (object *op); 2055void remove_button_link (object *op);
1998 2056
2057void handle_apply_yield (object *op);
2058
1999 2059
2000MODULE = cf PACKAGE = cf::object PREFIX = cf_ 2060MODULE = cf PACKAGE = cf::object PREFIX = cf_
2001 2061
2002object *cf_insert_ob_in_ob (object *ob, object *where) 2062object *cf_insert_ob_in_ob (object *ob, object *where)
2003 2063
2104 pl->orig_stats = pl->ob->stats; 2164 pl->orig_stats = pl->ob->stats;
2105 2165
2106void clear_los (player *pl) 2166void clear_los (player *pl)
2107 2167
2108void cf_player_move (player *pl, int dir) 2168void cf_player_move (player *pl, int dir)
2109
2110void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0);
2111 2169
2112bool 2170bool
2113cell_visible (player *pl, int dx, int dy) 2171cell_visible (player *pl, int dx, int dy)
2114 CODE: 2172 CODE:
2115 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
2254 palette = SvRV (palette); 2312 palette = SvRV (palette);
2255 2313
2256 STRLEN idxlen; 2314 STRLEN idxlen;
2257 const uint8_t *idx = (const uint8_t *)SvPVbyte (data, idxlen); 2315 const uint8_t *idx = (const uint8_t *)SvPVbyte (data, idxlen);
2258 2316
2259 region **regionmap = (region **)malloc ( 2317 region_ptr *regionmap = new region_ptr [av_len ((AV *)palette) + 1];
2260 (av_len ((AV *)palette) + 1) * sizeof (region *));
2261 uint8_t *regions = salloc<uint8_t> (THIS->size ()); 2318 uint8_t *regions = salloc<uint8_t> (THIS->size ());
2262 2319
2263 for (int i = av_len ((AV *)palette) + 1; i--; ) 2320 for (int i = av_len ((AV *)palette) + 1; i--; )
2264 regionmap [i] = region::find ( 2321 regionmap [i] = region::find (SvPVutf8_nolen (*av_fetch ((AV *)palette, i, 1)));
2265 SvPVutf8_nolen (*av_fetch ((AV *)palette, i, 1)));
2266 2322
2267 for (int y = 0; y < THIS->height; ++y) 2323 for (int y = 0; y < THIS->height; ++y)
2268 memcpy (regions + y * THIS->width, idx + offset + y * stride, THIS->width); 2324 memcpy (regions + y * THIS->width, idx + offset + y * stride, THIS->width);
2269 2325
2270 sfree (THIS->regions, THIS->size ()); 2326 sfree (THIS->regions, THIS->size ());
2271 free (THIS->regionmap); 2327 delete [] THIS->regionmap;
2272 2328
2273 THIS->regions = regions; 2329 THIS->regions = regions;
2274 THIS->regionmap = regionmap; 2330 THIS->regionmap = regionmap;
2275} 2331}
2276 2332
2296 } 2352 }
2297 } 2353 }
2298 2354
2299 op->destroy (); 2355 op->destroy ();
2300} 2356}
2301
2302void play_sound_map (maptile *map, int x, int y, int sound_num)
2303 2357
2304int out_of_map (maptile *map, int x, int y) 2358int out_of_map (maptile *map, int x, int y)
2305 2359
2306void 2360void
2307trigger (maptile *map, long connection, bool state = true) 2361trigger (maptile *map, long connection, bool state = true)
2579 char *buf = SvPVbyte (packet, len); 2633 char *buf = SvPVbyte (packet, len);
2580 2634
2581 THIS->send_packet (buf, len); 2635 THIS->send_packet (buf, len);
2582} 2636}
2583 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
2584MODULE = cf PACKAGE = cf::face PREFIX = face_ 2676MODULE = cf PACKAGE = cf::face PREFIX = face_
2585 2677
2586#INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | 2678#INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h |
2587 2679
2588faceidx face_find (utf8_string name, faceidx defidx = 0) 2680faceidx face_find (utf8_string name, faceidx defidx = 0)
2611 set_visibility = 1 2703 set_visibility = 1
2612 set_magicmap = 2 2704 set_magicmap = 2
2613 set_smooth = 3 2705 set_smooth = 3
2614 set_smoothlevel = 4 2706 set_smoothlevel = 4
2615 CODE: 2707 CODE:
2616 faceinfo *f = face_info (idx); 2708 faceinfo *f = face_info (idx); assert (f);
2617 assert (f);
2618 switch (ix) 2709 switch (ix)
2619 { 2710 {
2620 case 0: f->type = value; break; 2711 case 0: f->type = value; break;
2621 case 1: f->visibility = value; break; 2712 case 1: f->visibility = value; break;
2622 case 2: f->magicmap = value; break; 2713 case 2: f->magicmap = value; break;
2625 } 2716 }
2626 2717
2627void set_data (faceidx idx, int faceset, SV *data, SV *chksum) 2718void set_data (faceidx idx, int faceset, SV *data, SV *chksum)
2628 CODE: 2719 CODE:
2629{ 2720{
2630 facedata *d = face_data (idx, faceset); 2721 faceinfo *f = face_info (idx); assert (f);
2631 assert (d); 2722 facedata *d = &(faceset ? f->data64 : f->data32);
2632 sv_to (data, d->data); 2723 sv_to (data, d->data);
2633 STRLEN clen; 2724 STRLEN clen;
2634 char *cdata = SvPVbyte (chksum, clen); 2725 char *cdata = SvPVbyte (chksum, clen);
2635 clen = min (CHKSUM_SIZE, clen); 2726 clen = min (CHKSUM_SIZE, clen);
2636 2727
2646 ns->force_newmap = true; 2737 ns->force_newmap = true;
2647 } 2738 }
2648 } 2739 }
2649} 2740}
2650 2741
2742int get_data_size (faceidx idx, int faceset = 0)
2743 CODE:
2744 facedata *d = face_data (idx, faceset); assert (d);
2745 RETVAL = d->data.size ();
2746 OUTPUT:
2747 RETVAL
2748
2749SV *get_chksum (faceidx idx, int faceset = 0)
2750 CODE:
2751 facedata *d = face_data (idx, faceset); assert (d);
2752 RETVAL = newSVpvn ((char *)d->chksum, CHKSUM_SIZE);
2753 OUTPUT:
2754 RETVAL
2755
2651void invalidate (faceidx idx) 2756void invalidate (faceidx idx)
2652 CODE: 2757 CODE:
2653 for_all_clients (ns) 2758 for_all_clients (ns)
2654 { 2759 {
2655 ns->faces_sent [idx] = false; 2760 ns->faces_sent [idx] = false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines