+++ /dev/null
-/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
-
- Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
-
- This file is part of guile-irrlicht.
-
- guile-irrlicht is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 3 of the
- License, or (at your option) any later version.
-
- guile-irrlicht is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with guile-irrlicht. If not, see
- <http://www.gnu.org/licenses/>.
-*/
-
-#include <irrlicht/irrlicht.h>
-#include <libguile.h>
-#include "animated-mesh-md2.h"
-
-using namespace irr;
-
-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;
-}