X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fanimated-mesh-md2.cpp;h=844665fad7dc0969e16185b4d6c70a095825c5ed;hb=43b3e4fbfc4a80af937ba223dfa15ee8b6b8e736;hp=70e74736cf002640c996079fe8093932d6bdaa01;hpb=8ff6816b98af584ca7670ad964d5f13f84e18044;p=guile-irrlicht.git diff --git a/src/animated-mesh-md2.cpp b/src/animated-mesh-md2.cpp index 70e7473..844665f 100644 --- a/src/animated-mesh-md2.cpp +++ b/src/animated-mesh-md2.cpp @@ -23,101 +23,104 @@ #include #include "animated-mesh-md2.h" -extern "C" { +using namespace irr; - irr::scene::EMD2_ANIMATION_TYPE - scm_to_md2_animation_type (SCM md2_animation_type) - { - char* flag = scm_to_utf8_stringn (scm_symbol_to_string (md2_animation_type), NULL); - if (!strcmp (flag, "stand")) - { - return irr::scene::EMAT_STAND; - } - else if (!strcmp (flag, "run")) - { - return irr::scene::EMAT_RUN; - } - else if (!strcmp (flag, "attack")) - { - return irr::scene::EMAT_ATTACK; - } - else if (!strcmp (flag, "pain-a")) - { - return irr::scene::EMAT_PAIN_A; - } - else if (!strcmp (flag, "pain-b")) - { - return irr::scene::EMAT_PAIN_B; - } - else if (!strcmp (flag, "pain-c")) - { - return irr::scene::EMAT_PAIN_C; - } - else if (!strcmp (flag, "jump")) - { - return irr::scene::EMAT_JUMP; - } - else if (!strcmp (flag, "flip")) - { - return irr::scene::EMAT_FLIP; - } - else if (!strcmp (flag, "salute")) - { - return irr::scene::EMAT_SALUTE; - } - else if (!strcmp (flag, "fallback")) - { - return irr::scene::EMAT_FALLBACK; - } - else if (!strcmp (flag, "wave")) - { - return irr::scene::EMAT_WAVE; - } - else if (!strcmp (flag, "point")) - { - return irr::scene::EMAT_POINT; - } - else if (!strcmp (flag, "crouch-stand")) - { - return irr::scene::EMAT_CROUCH_STAND; - } - else if (!strcmp (flag, "crouch-walk")) - { - return irr::scene::EMAT_CROUCH_WALK; - } - else if (!strcmp (flag, "crouch-attack")) - { - return irr::scene::EMAT_CROUCH_ATTACK; - } - else if (!strcmp (flag, "crouch-pain")) - { - return irr::scene::EMAT_CROUCH_PAIN; - } - else if (!strcmp (flag, "crouch-death")) - { - return irr::scene::EMAT_CROUCH_DEATH; - } - else if (!strcmp (flag, "death-fallback")) - { - return irr::scene::EMAT_DEATH_FALLBACK; - } - else if (!strcmp (flag, "death-fallforward")) - { - return irr::scene::EMAT_DEATH_FALLFORWARD; - } - else if (!strcmp (flag, "death-fallbackslow")) - { - return irr::scene::EMAT_DEATH_FALLBACKSLOW; - } - else if (!strcmp (flag, "boom")) - { - return irr::scene::EMAT_BOOM; - } - else - { - scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S", - scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type)); - } - } +scene::EMD2_ANIMATION_TYPE +scm_to_md2_animation_type (SCM md2_animation_type) +{ + char* type_name = scm_to_utf8_string (scm_symbol_to_string (md2_animation_type)); + scene::EMD2_ANIMATION_TYPE type; + if (!strcmp (type_name, "stand")) + { + type = scene::EMAT_STAND; + } + else if (!strcmp (type_name, "run")) + { + type = scene::EMAT_RUN; + } + else if (!strcmp (type_name, "attack")) + { + type = scene::EMAT_ATTACK; + } + else if (!strcmp (type_name, "pain-a")) + { + type = scene::EMAT_PAIN_A; + } + else if (!strcmp (type_name, "pain-b")) + { + type = scene::EMAT_PAIN_B; + } + else if (!strcmp (type_name, "pain-c")) + { + type = scene::EMAT_PAIN_C; + } + else if (!strcmp (type_name, "jump")) + { + type = scene::EMAT_JUMP; + } + else if (!strcmp (type_name, "flip")) + { + type = scene::EMAT_FLIP; + } + else if (!strcmp (type_name, "salute")) + { + type = scene::EMAT_SALUTE; + } + else if (!strcmp (type_name, "fallback")) + { + type = scene::EMAT_FALLBACK; + } + else if (!strcmp (type_name, "wave")) + { + type = scene::EMAT_WAVE; + } + else if (!strcmp (type_name, "point")) + { + type = scene::EMAT_POINT; + } + else if (!strcmp (type_name, "crouch-stand")) + { + type = scene::EMAT_CROUCH_STAND; + } + else if (!strcmp (type_name, "crouch-walk")) + { + type = scene::EMAT_CROUCH_WALK; + } + else if (!strcmp (type_name, "crouch-attack")) + { + type = scene::EMAT_CROUCH_ATTACK; + } + else if (!strcmp (type_name, "crouch-pain")) + { + type = scene::EMAT_CROUCH_PAIN; + } + else if (!strcmp (type_name, "crouch-death")) + { + type = scene::EMAT_CROUCH_DEATH; + } + else if (!strcmp (type_name, "death-fallback")) + { + type = scene::EMAT_DEATH_FALLBACK; + } + else if (!strcmp (type_name, "death-fallforward")) + { + type = scene::EMAT_DEATH_FALLFORWARD; + } + else if (!strcmp (type_name, "death-fallbackslow")) + { + type = scene::EMAT_DEATH_FALLBACKSLOW; + } + else if (!strcmp (type_name, "boom")) + { + type = scene::EMAT_BOOM; + } + else + { + scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S", + scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type)); + } + + free (type_name); + return type; }