149 |
|
|
150 |
HillHollow(const char *name, Type t) : Item(name), m_type(t) {} |
HillHollow(const char *name, Type t) : Item(name), m_type(t) {} |
151 |
|
|
152 |
void transmute(const char *newkind); |
void transmute(Type newtype); |
153 |
V3 vec_to_center (V3 v); |
V3 vec_to_center (V3 v); |
154 |
double get_radius() const { return m_radius[m_type]; } |
double get_radius() const { return m_radius[m_type]; } |
155 |
private: |
private: |
174 |
void HillHollow::message(const string &m, const Value &) |
void HillHollow::message(const string &m, const Value &) |
175 |
{ |
{ |
176 |
if (m=="trigger") { |
if (m=="trigger") { |
177 |
char *flippedkind[] = {"it-hollow","it-hill","it-tinyhollow","it-tinyhill"}; |
Type flippedkind[] = {HOLLOW,HILL, TINYHOLLOW,TINYHILL}; |
178 |
transmute(flippedkind[m_type]); |
transmute(flippedkind[m_type]); |
179 |
} |
} |
180 |
else if (m=="shovel") { |
else if (m=="shovel") { |
181 |
if (m_type==HOLLOW) transmute("it-tinyhollow"); |
if (m_type==HOLLOW) transmute(TINYHOLLOW); |
182 |
else if (m_type==HILL) transmute("it-tinyhill"); |
else if (m_type==HILL) transmute(TINYHILL); |
183 |
else |
else |
184 |
KillItem(get_pos()); |
KillItem(get_pos()); |
185 |
} |
} |
200 |
return px::V3(); |
return px::V3(); |
201 |
} |
} |
202 |
|
|
203 |
void HillHollow::transmute(const char *newkind) |
void HillHollow::transmute(Type newtype) |
204 |
{ |
{ |
205 |
|
#if 0 |
206 |
string name; |
string name; |
207 |
Item *newitem = MakeItem(newkind); |
Item *newitem = MakeItem(newkind); |
208 |
if (string_attrib("name", &name)) { |
if (string_attrib("name", &name)) { |
212 |
} else { |
} else { |
213 |
SetItem(get_pos(), newitem); |
SetItem(get_pos(), newitem); |
214 |
} |
} |
215 |
|
#else |
216 |
|
m_type = newtype; |
217 |
|
static char *modelname[] = { "it-hill", "it-hollow", |
218 |
|
"it-tinyhill", "it-tinyhollow" }; |
219 |
|
set_model(modelname[m_type]); |
220 |
|
#endif |
221 |
} |
} |
222 |
|
|
223 |
namespace |
namespace |