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