]> git.jsancho.org Git - guile-irrlicht.git/blob - src/animated-mesh-md2.cpp
Some doc
[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 using namespace irr;
27
28 scene::EMD2_ANIMATION_TYPE
29 scm_to_md2_animation_type (SCM md2_animation_type)
30 {
31   char* type_name = scm_to_utf8_string (scm_symbol_to_string (md2_animation_type));
32   scene::EMD2_ANIMATION_TYPE type;
33
34   if (!strcmp (type_name, "stand"))
35     {
36       type = scene::EMAT_STAND;
37     }
38   else if (!strcmp (type_name, "run"))
39     {
40       type = scene::EMAT_RUN;
41     }
42   else if (!strcmp (type_name, "attack"))
43     {
44       type = scene::EMAT_ATTACK;
45     }
46   else if (!strcmp (type_name, "pain-a"))
47     {
48       type = scene::EMAT_PAIN_A;
49     }
50   else if (!strcmp (type_name, "pain-b"))
51     {
52       type = scene::EMAT_PAIN_B;
53     }
54   else if (!strcmp (type_name, "pain-c"))
55     {
56       type = scene::EMAT_PAIN_C;
57     }
58   else if (!strcmp (type_name, "jump"))
59     {
60       type = scene::EMAT_JUMP;
61     }
62   else if (!strcmp (type_name, "flip"))
63     {
64       type = scene::EMAT_FLIP;
65     }
66   else if (!strcmp (type_name, "salute"))
67     {
68       type = scene::EMAT_SALUTE;
69     }
70   else if (!strcmp (type_name, "fallback"))
71     {
72       type = scene::EMAT_FALLBACK;
73     }
74   else if (!strcmp (type_name, "wave"))
75     {
76       type = scene::EMAT_WAVE;
77     }
78   else if (!strcmp (type_name, "point"))
79     {
80       type = scene::EMAT_POINT;
81     }
82   else if (!strcmp (type_name, "crouch-stand"))
83     {
84       type = scene::EMAT_CROUCH_STAND;
85     }
86   else if (!strcmp (type_name, "crouch-walk"))
87     {
88       type = scene::EMAT_CROUCH_WALK;
89     }
90   else if (!strcmp (type_name, "crouch-attack"))
91     {
92       type = scene::EMAT_CROUCH_ATTACK;
93     }
94   else if (!strcmp (type_name, "crouch-pain"))
95     {
96       type = scene::EMAT_CROUCH_PAIN;
97     }
98   else if (!strcmp (type_name, "crouch-death"))
99     {
100       type = scene::EMAT_CROUCH_DEATH;
101     }
102   else if (!strcmp (type_name, "death-fallback"))
103     {
104       type = scene::EMAT_DEATH_FALLBACK;
105     }
106   else if (!strcmp (type_name, "death-fallforward"))
107     {
108       type = scene::EMAT_DEATH_FALLFORWARD;
109     }
110   else if (!strcmp (type_name, "death-fallbackslow"))
111     {
112       type = scene::EMAT_DEATH_FALLBACKSLOW;
113     }
114   else if (!strcmp (type_name, "boom"))
115     {
116       type = scene::EMAT_BOOM;
117     }
118   else
119     {
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));
122     }
123
124   free (type_name);
125   return type;
126 }