1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3 Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
5 This file is part of guile-irrlicht.
7 guile-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 guile-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <irrlicht/irrlicht.h>
24 #include "animated-mesh-md2.h"
28 irr::scene::EMD2_ANIMATION_TYPE
29 scm_to_md2_animation_type (SCM md2_animation_type)
31 char* flag = scm_to_utf8_stringn (scm_symbol_to_string (md2_animation_type), NULL);
32 if (!strcmp (flag, "stand"))
34 return irr::scene::EMAT_STAND;
36 else if (!strcmp (flag, "run"))
38 return irr::scene::EMAT_RUN;
40 else if (!strcmp (flag, "attack"))
42 return irr::scene::EMAT_ATTACK;
44 else if (!strcmp (flag, "pain-a"))
46 return irr::scene::EMAT_PAIN_A;
48 else if (!strcmp (flag, "pain-b"))
50 return irr::scene::EMAT_PAIN_B;
52 else if (!strcmp (flag, "pain-c"))
54 return irr::scene::EMAT_PAIN_C;
56 else if (!strcmp (flag, "jump"))
58 return irr::scene::EMAT_JUMP;
60 else if (!strcmp (flag, "flip"))
62 return irr::scene::EMAT_FLIP;
64 else if (!strcmp (flag, "salute"))
66 return irr::scene::EMAT_SALUTE;
68 else if (!strcmp (flag, "fallback"))
70 return irr::scene::EMAT_FALLBACK;
72 else if (!strcmp (flag, "wave"))
74 return irr::scene::EMAT_WAVE;
76 else if (!strcmp (flag, "point"))
78 return irr::scene::EMAT_POINT;
80 else if (!strcmp (flag, "crouch-stand"))
82 return irr::scene::EMAT_CROUCH_STAND;
84 else if (!strcmp (flag, "crouch-walk"))
86 return irr::scene::EMAT_CROUCH_WALK;
88 else if (!strcmp (flag, "crouch-attack"))
90 return irr::scene::EMAT_CROUCH_ATTACK;
92 else if (!strcmp (flag, "crouch-pain"))
94 return irr::scene::EMAT_CROUCH_PAIN;
96 else if (!strcmp (flag, "crouch-death"))
98 return irr::scene::EMAT_CROUCH_DEATH;
100 else if (!strcmp (flag, "death-fallback"))
102 return irr::scene::EMAT_DEATH_FALLBACK;
104 else if (!strcmp (flag, "death-fallforward"))
106 return irr::scene::EMAT_DEATH_FALLFORWARD;
108 else if (!strcmp (flag, "death-fallbackslow"))
110 return irr::scene::EMAT_DEATH_FALLBACKSLOW;
112 else if (!strcmp (flag, "boom"))
114 return irr::scene::EMAT_BOOM;
118 scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S",
119 scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type));