478 |
- \ref st-brick_magic |
- \ref st-brick_magic |
479 |
- \ref st-stonebrush |
- \ref st-stonebrush |
480 |
- \ref st-invisible_magic |
- \ref st-invisible_magic |
481 |
|
- \ref st-break_invisible |
482 |
|
|
483 |
Lasers and Mirrors: |
Lasers and Mirrors: |
484 |
- \ref st-laser |
- \ref st-laser |
992 |
CLONEOBJ(Stone_break); |
CLONEOBJ(Stone_break); |
993 |
const char *collision_sound() {return "st-stone";} |
const char *collision_sound() {return "st-stone";} |
994 |
public: |
public: |
995 |
Stone_break() : Stone("st-stone_break") {} |
Stone_break() : Stone("st-stone_break"), state(IDLE) {} |
996 |
|
private: |
997 |
void actor_hit(const StoneContact &sc) { |
enum State { IDLE, BREAK }; |
998 |
if (wielded_item_is(sc.actor, "it-hammer")) { |
State state; |
999 |
KillStone(get_pos()); |
void actor_hit(const StoneContact &sc) |
1000 |
} |
{ |
1001 |
} |
if( state == IDLE) |
1002 |
}; |
{ |
1003 |
|
if (wielded_item_is(sc.actor, "it-hammer")) { |
1004 |
|
play_sound("explosion1"); |
1005 |
|
state = BREAK; |
1006 |
|
set_anim("st-break-anim"); |
1007 |
|
} |
1008 |
|
} |
1009 |
|
} |
1010 |
|
void animcb() { |
1011 |
|
if (state == BREAK) { |
1012 |
|
KillStone(get_pos()); |
1013 |
|
} |
1014 |
|
} |
1015 |
|
}; |
1016 |
} |
} |
1017 |
|
|
1018 |
//---------------------------------------- |
//---------------------------------------- |
1123 |
} |
} |
1124 |
|
|
1125 |
//---------------------------------------- |
//---------------------------------------- |
1126 |
|
// Break_invisible |
1127 |
|
//---------------------------------------- |
1128 |
|
|
1129 |
|
/** \page st-break_invisible Brush Stone |
1130 |
|
|
1131 |
|
This stone is initially invisible. If touched by an actor |
1132 |
|
having a brush it will be painted an become a "st_stone_break". |
1133 |
|
This stone can be destroyed by an actor having a hammer. |
1134 |
|
|
1135 |
|
\subsection break_invisible Example |
1136 |
|
\verbatim |
1137 |
|
set_stone("st-break_invisible", 10,10) |
1138 |
|
\endverbatim |
1139 |
|
|
1140 |
|
\image html st-stone_break.png |
1141 |
|
*/ |
1142 |
|
namespace |
1143 |
|
{ |
1144 |
|
class Break_invisible : public Stone { |
1145 |
|
CLONEOBJ(Break_invisible); |
1146 |
|
const char *collision_sound() {return "st-stone";} |
1147 |
|
public: |
1148 |
|
Break_invisible() : Stone("st-break_invisible"), state(INVISIBLE) {} |
1149 |
|
private: |
1150 |
|
enum State { INVISIBLE, BRUSH }; |
1151 |
|
State state; |
1152 |
|
void actor_hit(const StoneContact &sc) |
1153 |
|
{ |
1154 |
|
if( state == INVISIBLE) |
1155 |
|
{ |
1156 |
|
if (wielded_item_is(sc.actor, "it-brush")) { |
1157 |
|
play_sound("st-magic"); |
1158 |
|
state = BRUSH; |
1159 |
|
set_model("st-stone_break"); |
1160 |
|
} |
1161 |
|
} |
1162 |
|
{ |
1163 |
|
if( state == BRUSH) |
1164 |
|
{ |
1165 |
|
if (wielded_item_is(sc.actor, "it-hammer")) { |
1166 |
|
play_sound("explosion1"); |
1167 |
|
set_anim("st-break_invisible-anim"); |
1168 |
|
} |
1169 |
|
} |
1170 |
|
} |
1171 |
|
} |
1172 |
|
void animcb() { |
1173 |
|
if (state == BRUSH) { |
1174 |
|
KillStone(get_pos()); |
1175 |
|
} |
1176 |
|
|
1177 |
|
} |
1178 |
|
}; |
1179 |
|
} |
1180 |
|
|
1181 |
|
//---------------------------------------- |
1182 |
// Invisible Magic |
// Invisible Magic |
1183 |
//---------------------------------------- |
//---------------------------------------- |
1184 |
|
|
3413 |
add_templ(new Rock3_hole); |
add_templ(new Rock3_hole); |
3414 |
add_templ(new Rock3_move); |
add_templ(new Rock3_move); |
3415 |
add_templ(new Stonebrush); |
add_templ(new Stonebrush); |
3416 |
|
add_templ(new Break_invisible); |
3417 |
} |
} |
3418 |
|
|
3419 |
ObjectRepos::~ObjectRepos() |
ObjectRepos::~ObjectRepos() |