1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2006,2007,2008,2009,2010,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
625 | STRLEN len; |
625 | STRLEN len; |
626 | char *data = SvPVbyte (sv, len); |
626 | char *data = SvPVbyte (sv, len); |
627 | v.assign (data, len); |
627 | v.assign (data, len); |
628 | } |
628 | } |
629 | |
629 | |
|
|
630 | static inline void sv_to (SV *sv, refcnt_buf &v) |
|
|
631 | { |
|
|
632 | STRLEN len; |
|
|
633 | char *data = SvPVbyte (sv, len); |
|
|
634 | refcnt_buf buf (data, len); |
|
|
635 | v = buf; |
|
|
636 | } |
|
|
637 | |
630 | static inline void sv_to (SV *sv, UUID &v) |
638 | static inline void sv_to (SV *sv, UUID &v) |
631 | { |
639 | { |
632 | if (!v.parse (SvPV_nolen (sv))) |
640 | if (!v.parse (SvPV_nolen (sv))) |
633 | croak ("unparsable uuid: %s", SvPV_nolen (sv)); |
641 | croak ("unparsable uuid: %s", SvPV_nolen (sv)); |
634 | } |
642 | } |
… | |
… | |
2692 | faceidx face_find (utf8_string name, faceidx defidx = 0) |
2700 | faceidx face_find (utf8_string name, faceidx defidx = 0) |
2693 | |
2701 | |
2694 | faceidx alloc (utf8_string name) |
2702 | faceidx alloc (utf8_string name) |
2695 | CODE: |
2703 | CODE: |
2696 | { |
2704 | { |
2697 | do |
2705 | RETVAL = face_alloc (); |
2698 | { |
|
|
2699 | RETVAL = faces.size (); |
|
|
2700 | faces.resize (RETVAL + 1); |
|
|
2701 | } |
|
|
2702 | while (!RETVAL); // crude way to leave index 0 |
|
|
2703 | |
2706 | |
2704 | faces [RETVAL].name = name; |
2707 | faces [RETVAL].name = name; |
2705 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2708 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2706 | |
2709 | |
2707 | if (!strcmp (name, BLANK_FACE_NAME )) blank_face = RETVAL; |
2710 | if (!strcmp (name, BLANK_FACE_NAME )) blank_face = RETVAL; |
… | |
… | |
2773 | |
2776 | |
2774 | SV *get_data (faceidx idx, int faceset = 0) |
2777 | SV *get_data (faceidx idx, int faceset = 0) |
2775 | CODE: |
2778 | CODE: |
2776 | facedata *d = face_data (idx, faceset); |
2779 | facedata *d = face_data (idx, faceset); |
2777 | if (!d) XSRETURN_UNDEF; |
2780 | if (!d) XSRETURN_UNDEF; |
2778 | RETVAL = newSVpvn (d->data.data (), d->data.length ()); |
2781 | RETVAL = newSVpvn (d->data, d->data.size ()); |
2779 | OUTPUT: |
2782 | OUTPUT: |
2780 | RETVAL |
2783 | RETVAL |
2781 | |
2784 | |
2782 | void invalidate (faceidx idx) |
2785 | void invalidate (faceidx idx) |
2783 | CODE: |
2786 | CODE: |
2784 | for_all_clients (ns) |
2787 | for_all_clients (ns) |
2785 | { |
2788 | ns->invalidate_face (idx); |
2786 | ns->faces_sent [idx] = false; |
|
|
2787 | ns->force_newmap = true; |
|
|
2788 | } |
|
|
2789 | |
2789 | |
2790 | void invalidate_all () |
2790 | void invalidate_all () |
2791 | CODE: |
2791 | CODE: |
2792 | for_all_clients (ns) |
2792 | for_all_clients (ns) |
2793 | { |
2793 | ns->invalidate_all_faces (); |
2794 | ns->faces_sent.reset (); |
|
|
2795 | ns->force_newmap = true; |
|
|
2796 | } |
|
|
2797 | |
2794 | |
2798 | MODULE = cf PACKAGE = cf::anim PREFIX = anim_ |
2795 | MODULE = cf PACKAGE = cf::anim PREFIX = anim_ |
2799 | |
2796 | |
2800 | #INCLUDE: $PERL $srcdir/genacc faceset $srcdir/../include/anim.h | |
2797 | #INCLUDE: $PERL $srcdir/genacc faceset $srcdir/../include/anim.h | |
2801 | |
2798 | |