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"
30 scene::EMD2_ANIMATION_TYPE
31 scm_to_md2_animation_type (SCM md2_animation_type)
33 char* flag = scm_to_utf8_stringn (scm_symbol_to_string (md2_animation_type), NULL);
34 if (!strcmp (flag, "stand"))
36 return scene::EMAT_STAND;
38 else if (!strcmp (flag, "run"))
40 return scene::EMAT_RUN;
42 else if (!strcmp (flag, "attack"))
44 return scene::EMAT_ATTACK;
46 else if (!strcmp (flag, "pain-a"))
48 return scene::EMAT_PAIN_A;
50 else if (!strcmp (flag, "pain-b"))
52 return scene::EMAT_PAIN_B;
54 else if (!strcmp (flag, "pain-c"))
56 return scene::EMAT_PAIN_C;
58 else if (!strcmp (flag, "jump"))
60 return scene::EMAT_JUMP;
62 else if (!strcmp (flag, "flip"))
64 return scene::EMAT_FLIP;
66 else if (!strcmp (flag, "salute"))
68 return scene::EMAT_SALUTE;
70 else if (!strcmp (flag, "fallback"))
72 return scene::EMAT_FALLBACK;
74 else if (!strcmp (flag, "wave"))
76 return scene::EMAT_WAVE;
78 else if (!strcmp (flag, "point"))
80 return scene::EMAT_POINT;
82 else if (!strcmp (flag, "crouch-stand"))
84 return scene::EMAT_CROUCH_STAND;
86 else if (!strcmp (flag, "crouch-walk"))
88 return scene::EMAT_CROUCH_WALK;
90 else if (!strcmp (flag, "crouch-attack"))
92 return scene::EMAT_CROUCH_ATTACK;
94 else if (!strcmp (flag, "crouch-pain"))
96 return scene::EMAT_CROUCH_PAIN;
98 else if (!strcmp (flag, "crouch-death"))
100 return scene::EMAT_CROUCH_DEATH;
102 else if (!strcmp (flag, "death-fallback"))
104 return scene::EMAT_DEATH_FALLBACK;
106 else if (!strcmp (flag, "death-fallforward"))
108 return scene::EMAT_DEATH_FALLFORWARD;
110 else if (!strcmp (flag, "death-fallbackslow"))
112 return scene::EMAT_DEATH_FALLBACKSLOW;
114 else if (!strcmp (flag, "boom"))
116 return scene::EMAT_BOOM;
120 scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S",
121 scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type));