910 |
|
|
911 |
/** \page st-window Breakable Stone |
/** \page st-window Breakable Stone |
912 |
|
|
913 |
This stone can be destroyed by an actor |
Hit this window heavily with your marble to blast it into smithereens. |
|
|
|
|
\subsection window Example |
|
|
\verbatim |
|
|
set_stone("st-window", 10,10) |
|
|
\endverbatim |
|
914 |
|
|
915 |
\image html st-window.png |
\image html st-window.png |
916 |
*/ |
*/ |
2219 |
class FourSwitch : public OnOffStone { |
class FourSwitch : public OnOffStone { |
2220 |
CLONEOBJ(FourSwitch); |
CLONEOBJ(FourSwitch); |
2221 |
public: |
public: |
2222 |
FourSwitch() : OnOffStone("st-fourswitch"), state(NORTH) {} |
FourSwitch() : OnOffStone("st-fourswitch"), m_direction(NORTH) {} |
2223 |
private: |
private: |
2224 |
enum State { NORTH, EAST, SOUTH, WEST }; State state; |
Direction m_direction; |
2225 |
|
|
2226 |
void init_model() { |
void init_model() { |
2227 |
switch (state) { |
switch (m_direction) { |
2228 |
case NORTH: set_model("st-fourswitch"); break; |
case NORTH: set_model("st-fourswitch"); break; |
2229 |
case EAST: set_model("st-fourswitch_e"); break; |
case EAST: set_model("st-fourswitch_e"); break; |
2230 |
case SOUTH: set_model("st-fourswitch_s"); break; |
case SOUTH: set_model("st-fourswitch_s"); break; |
2231 |
case WEST: set_model("st-fourswitch_w"); break; |
case WEST: set_model("st-fourswitch_w"); break; |
2232 |
|
case NODIR: assert(0); |
2233 |
} |
} |
2234 |
} |
} |
2235 |
|
|
2236 |
void actor_hit(const StoneContact &sc) |
void actor_hit(const StoneContact &sc) |
2237 |
{ |
{ |
2238 |
set_on(!is_on()); |
set_on(!is_on()); |
2239 |
PerformAction(this, is_on()); |
PerformAction(this, is_on()); |
2240 |
play_sound("st-switch"); |
play_sound("st-switch"); |
2241 |
|
|
2242 |
{ if (state==NORTH) { |
switch (m_direction) { |
2243 |
if (sc.actor) { |
case NORTH: m_direction = EAST; break; |
2244 |
state = EAST; |
case EAST: m_direction = SOUTH; break; |
2245 |
init_model(); return; |
case SOUTH: m_direction = WEST; break; |
2246 |
} |
case WEST: m_direction = NORTH; break; |
2247 |
} |
case NODIR: assert(0); |
2248 |
{ if (state==EAST) { |
} |
2249 |
if (sc.actor) { |
init_model(); |
2250 |
state = SOUTH; |
} |
|
init_model(); return; |
|
|
} |
|
|
} |
|
|
{ if (state==SOUTH) { |
|
|
if (sc.actor) { |
|
|
state = WEST; |
|
|
init_model(); return; |
|
|
} |
|
|
} |
|
|
{ if (state==WEST) { |
|
|
if (sc.actor) { |
|
|
state = NORTH; |
|
|
init_model(); return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
2251 |
const char *collision_sound() { return "st-metal"; } |
const char *collision_sound() { return "st-metal"; } |
2252 |
}; |
}; |
2253 |
} |
} |
2254 |
|
|
2255 |
//---------------------------------------- |
//---------------------------------------- |
2349 |
{ |
{ |
2350 |
if (is_on()) |
if (is_on()) |
2351 |
{ |
{ |
2352 |
inv->add_item(MakeItem("it-floppy")); |
if (!inv->is_full()) { |
2353 |
set_on(false); |
inv->add_item(MakeItem("it-floppy")); |
2354 |
PerformAction(this, is_on()); |
set_on(false); |
2355 |
|
PerformAction(this, is_on()); |
2356 |
|
} |
2357 |
} |
} |
2358 |
else if (wielded_item_is(sc.actor, "it-floppy")) |
else if (wielded_item_is(sc.actor, "it-floppy")) |
2359 |
{ |
{ |
2379 |
class ShogunStone : public MovableStone { |
class ShogunStone : public MovableStone { |
2380 |
CLONEOBJ(ShogunStone); |
CLONEOBJ(ShogunStone); |
2381 |
public: |
public: |
2382 |
ShogunStone() : MovableStone("st-shogun") { |
ShogunStone(const char *kind="st-shogun") : MovableStone(kind) { |
2383 |
set_holes(SMALL); |
set_holes(SMALL); |
2384 |
} |
} |
2385 |
private: |
protected: |
2386 |
enum Holes { SMALL = 1, MEDIUM = 2, LARGE = 4}; |
enum Holes { SMALL = 1, MEDIUM = 2, LARGE = 4}; |
2387 |
|
|
2388 |
void set_holes(Holes h) { set_attrib("holes", h); } |
void set_holes(Holes h) { set_attrib("holes", h); } |
2389 |
|
private: |
2390 |
Holes get_holes() const; |
Holes get_holes() const; |
2391 |
void notify_item(bool disappearing); |
void notify_item(bool disappearing); |
2392 |
|
|
2412 |
Holes transfer_smallest_hole(GridPos p); |
Holes transfer_smallest_hole(GridPos p); |
2413 |
void actor_hit(const StoneContact &sc); |
void actor_hit(const StoneContact &sc); |
2414 |
}; |
}; |
2415 |
|
|
2416 |
|
#define DEFSHOGUN(CLASSNAME, KIND, HOLES) \ |
2417 |
|
class CLASSNAME : public ShogunStone { \ |
2418 |
|
CLONEOBJ(CLASSNAME); \ |
2419 |
|
public: \ |
2420 |
|
CLASSNAME() : ShogunStone(KIND) { \ |
2421 |
|
set_holes (static_cast<Holes>(HOLES)); \ |
2422 |
|
} \ |
2423 |
|
}; |
2424 |
|
|
2425 |
|
DEFSHOGUN(Shogun_S, "st-shogun-s", 1); |
2426 |
|
DEFSHOGUN(Shogun_M, "st-shogun-m", 2); |
2427 |
|
DEFSHOGUN(Shogun_SM, "st-shogun-sm", 3); |
2428 |
|
DEFSHOGUN(Shogun_L, "st-shogun-l", 4); |
2429 |
|
DEFSHOGUN(Shogun_SL, "st-shogun-sl", 5); |
2430 |
|
DEFSHOGUN(Shogun_ML, "st-shogun-ml", 6); |
2431 |
|
DEFSHOGUN(Shogun_SML, "st-shogun-sml", 7); |
2432 |
} |
} |
2433 |
|
|
2434 |
ShogunStone::Holes |
ShogunStone::Holes |
2708 |
init_model(); |
init_model(); |
2709 |
} |
} |
2710 |
} |
} |
|
|
|
|
//void init_model() { |
|
|
// if( state == IDLE) |
|
|
// set_model("invisible"); |
|
|
//} |
|
2711 |
}; |
}; |
2712 |
} |
} |
2713 |
|
|
3451 |
if (msg =="ignite") |
if (msg =="ignite") |
3452 |
change_state(BREAK); |
change_state(BREAK); |
3453 |
} |
} |
3454 |
}; |
}; |
3455 |
} |
} |
3456 |
void BombStone::actor_hit(const StoneContact &sc) |
void |
3457 |
{ |
BombStone::actor_hit(const StoneContact &sc) |
3458 |
if (player::Inventory *inv = get_inventory(sc.actor)) |
{ |
3459 |
{ |
if (player::Inventory *inv = get_inventory(sc.actor)) |
3460 |
if (!inv->is_full()) |
{ |
3461 |
|
if (!inv->is_full()) |
3462 |
{ |
{ |
3463 |
Item *it = MakeItem("it-blackbomb"); |
Item *it = MakeItem("it-blackbomb"); |
3464 |
inv->add_item(it); |
inv->add_item(it); |
3497 |
if (msg =="expl") |
if (msg =="expl") |
3498 |
change_state(BREAK); |
change_state(BREAK); |
3499 |
} |
} |
3500 |
}; |
}; |
3501 |
} |
} |
3502 |
void BombStone_a::actor_hit(const StoneContact &sc) |
|
3503 |
{ |
void |
3504 |
if (player::Inventory *inv = get_inventory(sc.actor)) |
BombStone_a::actor_hit(const StoneContact &sc) |
3505 |
{ |
{ |
3506 |
if (!inv->is_full()) |
if (player::Inventory *inv = get_inventory(sc.actor)) |
3507 |
|
{ |
3508 |
|
if (!inv->is_full()) |
3509 |
{ |
{ |
3510 |
Item *it = MakeItem("it-blackbomb"); |
Item *it = MakeItem("it-blackbomb"); |
3511 |
inv->add_item(it); |
inv->add_item(it); |
3751 |
//---------------------------------------- |
//---------------------------------------- |
3752 |
namespace |
namespace |
3753 |
{ |
{ |
3754 |
|
/* |
3755 |
|
** The stone at the center of a turnstile |
3756 |
|
*/ |
3757 |
class Turnstile_Pivot : public Stone { |
class Turnstile_Pivot : public Stone { |
3758 |
CLONEOBJ(Turnstile_Pivot); |
CLONEOBJ(Turnstile_Pivot); |
3759 |
|
|
3761 |
bool no_stone (int xoff, int yoff); |
bool no_stone (int xoff, int yoff); |
3762 |
void remove_arms (DirectionBits arms); |
void remove_arms (DirectionBits arms); |
3763 |
void set_arm (Direction dir); |
void set_arm (Direction dir); |
3764 |
|
// void animcb(); |
3765 |
public: |
public: |
3766 |
Turnstile_Pivot() : Stone ("st-turnstile") {} |
Turnstile_Pivot() : Stone ("st-turnstile") {} |
3767 |
bool rotate_right(); |
bool rotate_right(); |
3775 |
} |
} |
3776 |
}; |
}; |
3777 |
|
|
3778 |
|
/* |
3779 |
|
** The base class for any of the four arms of the turnstile |
3780 |
|
*/ |
3781 |
class Turnstile_Arm : public Stone { |
class Turnstile_Arm : public Stone { |
3782 |
virtual Direction get_dir() const = 0; |
virtual Direction get_dir() const = 0; |
3783 |
|
|
3791 |
protected: |
protected: |
3792 |
Turnstile_Arm (const char *kind) : Stone(kind) |
Turnstile_Arm (const char *kind) : Stone(kind) |
3793 |
{} |
{} |
|
|
|
3794 |
}; |
}; |
3795 |
|
|
3796 |
class Turnstile_N : public Turnstile_Arm { |
class Turnstile_N : public Turnstile_Arm { |
3821 |
Turnstile_W(): Turnstile_Arm("st-turnstile-w") {} |
Turnstile_W(): Turnstile_Arm("st-turnstile-w") {} |
3822 |
}; |
}; |
3823 |
|
|
3824 |
|
/* |
3825 |
|
** |
3826 |
|
*/ |
3827 |
|
class Turnstile_Corner : public Stone { |
3828 |
|
CLONEOBJ(Turnstile_Corner); |
3829 |
|
|
3830 |
|
void init_model() { |
3831 |
|
set_anim ("st-turnstile-corner"); |
3832 |
|
} |
3833 |
|
void animcb() { |
3834 |
|
KillStone(get_pos()); |
3835 |
|
} |
3836 |
|
public: |
3837 |
|
Turnstile_Corner() : Stone("st-turnstile-corner") |
3838 |
|
{} |
3839 |
|
}; |
3840 |
} |
} |
3841 |
|
|
3842 |
void |
void |
3877 |
} |
} |
3878 |
|
|
3879 |
|
|
3880 |
|
// void |
3881 |
|
// Turnstile_Pivot::animcb() |
3882 |
|
// { |
3883 |
|
// Stone::init_model(); |
3884 |
|
// } |
3885 |
|
|
3886 |
|
|
3887 |
DirectionBits |
DirectionBits |
3888 |
Turnstile_Pivot::arms_present() |
Turnstile_Pivot::arms_present() |
3889 |
{ |
{ |
3933 |
bool |
bool |
3934 |
Turnstile_Pivot::rotate_left() |
Turnstile_Pivot::rotate_left() |
3935 |
{ |
{ |
|
cout << "rotating left\n"; |
|
3936 |
DirectionBits arms = arms_present(); |
DirectionBits arms = arms_present(); |
3937 |
bool can_rotate = true; |
bool can_rotate = true; |
3938 |
|
|
3973 |
bool |
bool |
3974 |
Turnstile_Pivot::rotate_right() |
Turnstile_Pivot::rotate_right() |
3975 |
{ |
{ |
|
cout << "rotating right\n"; |
|
3976 |
DirectionBits arms = arms_present(); |
DirectionBits arms = arms_present(); |
3977 |
bool can_rotate = true; |
bool can_rotate = true; |
3978 |
|
|
4101 |
add_templ(new OxydStone); |
add_templ(new OxydStone); |
4102 |
add_templ(new PuzzleStone); |
add_templ(new PuzzleStone); |
4103 |
add_templ(new RubberBandStone); |
add_templ(new RubberBandStone); |
4104 |
|
|
4105 |
add_templ(new ShogunStone); |
add_templ(new ShogunStone); |
4106 |
|
add_templ(new Shogun_S); |
4107 |
|
add_templ(new Shogun_M); |
4108 |
|
add_templ(new Shogun_SM); |
4109 |
|
add_templ(new Shogun_L); |
4110 |
|
add_templ(new Shogun_SL); |
4111 |
|
add_templ(new Shogun_ML); |
4112 |
|
add_templ(new Shogun_SML); |
4113 |
|
|
4114 |
add_templ(new ActorImpulseStone); |
add_templ(new ActorImpulseStone); |
4115 |
add_templ(new ActorImpulseStoneInvisible); |
add_templ(new ActorImpulseStoneInvisible); |
4116 |
add_templ(new StoneImpulseStone); |
add_templ(new StoneImpulseStone); |