From 94fc9a0c82559b6d42b696a4685edea1e88c5ff2 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Thu, 7 May 2020 12:03:46 +0200 Subject: [PATCH] animated-mesh-md2 --- src/animated-mesh-md2.cpp | 190 +++++++++++++++++++------------------- src/animated-mesh-md2.h | 8 +- 2 files changed, 95 insertions(+), 103 deletions(-) diff --git a/src/animated-mesh-md2.cpp b/src/animated-mesh-md2.cpp index 70e7473..83d6aaf 100644 --- a/src/animated-mesh-md2.cpp +++ b/src/animated-mesh-md2.cpp @@ -23,101 +23,97 @@ #include #include "animated-mesh-md2.h" -extern "C" { - - 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)); - } - } - +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)); + } } diff --git a/src/animated-mesh-md2.h b/src/animated-mesh-md2.h index c37a61b..3998030 100644 --- a/src/animated-mesh-md2.h +++ b/src/animated-mesh-md2.h @@ -25,11 +25,7 @@ #include #include -extern "C" { - - irr::scene::EMD2_ANIMATION_TYPE - scm_to_md2_animation_type (SCM md2_animation_type); - -} +irr::scene::EMD2_ANIMATION_TYPE +scm_to_md2_animation_type (SCM md2_animation_type); #endif -- 2.39.5