]> git.jsancho.org Git - guile-irrlicht.git/blob - src/animated-mesh-md2.cpp
animated-mesh-md2
[guile-irrlicht.git] / src / animated-mesh-md2.cpp
1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
2
3    Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
4
5    This file is part of guile-irrlicht.
6
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.
11
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.
16
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/>.
20 */
21
22 #include <irrlicht/irrlicht.h>
23 #include <libguile.h>
24 #include "animated-mesh-md2.h"
25
26 irr::scene::EMD2_ANIMATION_TYPE
27 scm_to_md2_animation_type (SCM md2_animation_type)
28 {
29   char* flag = scm_to_utf8_stringn (scm_symbol_to_string (md2_animation_type), NULL);
30   if (!strcmp (flag, "stand"))
31     {
32       return irr::scene::EMAT_STAND;
33     }
34   else if (!strcmp (flag, "run"))
35     {
36       return irr::scene::EMAT_RUN;
37     }
38   else if (!strcmp (flag, "attack"))
39     {
40       return irr::scene::EMAT_ATTACK;
41     }
42   else if (!strcmp (flag, "pain-a"))
43     {
44       return irr::scene::EMAT_PAIN_A;
45     }
46   else if (!strcmp (flag, "pain-b"))
47     {
48       return irr::scene::EMAT_PAIN_B;
49     }
50   else if (!strcmp (flag, "pain-c"))
51     {
52       return irr::scene::EMAT_PAIN_C;
53     }
54   else if (!strcmp (flag, "jump"))
55     {
56       return irr::scene::EMAT_JUMP;
57     }
58   else if (!strcmp (flag, "flip"))
59     {
60       return irr::scene::EMAT_FLIP;
61     }
62   else if (!strcmp (flag, "salute"))
63     {
64       return irr::scene::EMAT_SALUTE;
65     }
66   else if (!strcmp (flag, "fallback"))
67     {
68       return irr::scene::EMAT_FALLBACK;
69     }
70   else if (!strcmp (flag, "wave"))
71     {
72       return irr::scene::EMAT_WAVE;
73     }
74   else if (!strcmp (flag, "point"))
75     {
76       return irr::scene::EMAT_POINT;
77     }
78   else if (!strcmp (flag, "crouch-stand"))
79     {
80       return irr::scene::EMAT_CROUCH_STAND;
81     }
82   else if (!strcmp (flag, "crouch-walk"))
83     {
84       return irr::scene::EMAT_CROUCH_WALK;
85     }
86   else if (!strcmp (flag, "crouch-attack"))
87     {
88       return irr::scene::EMAT_CROUCH_ATTACK;
89     }
90   else if (!strcmp (flag, "crouch-pain"))
91     {
92       return irr::scene::EMAT_CROUCH_PAIN;
93     }
94   else if (!strcmp (flag, "crouch-death"))
95     {
96       return irr::scene::EMAT_CROUCH_DEATH;
97     }
98   else if (!strcmp (flag, "death-fallback"))
99     {
100       return irr::scene::EMAT_DEATH_FALLBACK;
101     }
102   else if (!strcmp (flag, "death-fallforward"))
103     {
104       return irr::scene::EMAT_DEATH_FALLFORWARD;
105     }
106   else if (!strcmp (flag, "death-fallbackslow"))
107     {
108       return irr::scene::EMAT_DEATH_FALLBACKSLOW;
109     }
110   else if (!strcmp (flag, "boom"))
111     {
112       return irr::scene::EMAT_BOOM;
113     }
114   else
115     {
116       scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S",
117                  scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type));
118     }
119 }