141 |
} |
} |
142 |
void dispose() { delete this; } |
void dispose() { delete this; } |
143 |
|
|
|
void message(const string &msg, const Value &) { |
|
|
if (msg == "ignite" || msg == "expl") { |
|
|
if (is_kind("st-rock3_move")) { |
|
|
// oxyd1 behavior: |
|
|
KillStone(get_pos()); |
|
|
// @@@ FIXME: stone should break |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
144 |
string sound; |
string sound; |
145 |
}; |
}; |
146 |
} |
} |
300 |
|
|
301 |
/** \page st-block Block Stone |
/** \page st-block Block Stone |
302 |
|
|
303 |
This stone can is movable. |
This stone is movable. |
304 |
If moved into water it will disappear and |
If moved into water it will disappear and |
305 |
build new water floor at this place. |
build new water floor at this place. |
306 |
|
|
389 |
// BreakableStone |
// BreakableStone |
390 |
// ----------------------- |
// ----------------------- |
391 |
// base class for Stone_break, Break_acwhite and Break_acblack |
// base class for Stone_break, Break_acwhite and Break_acblack |
392 |
|
// |
393 |
|
// breakable stones can be destroyed using |
394 |
|
// hammer, laser, dynamite, bombs or bombstones |
395 |
|
|
396 |
namespace { |
namespace { |
397 |
class BreakableStone : public Stone { |
class BreakableStone : public Stone { |
408 |
private: |
private: |
409 |
const char *collision_sound() { return "st-stone"; } |
const char *collision_sound() { return "st-stone"; } |
410 |
|
|
411 |
void actor_hit(const StoneContact &sc) { |
virtual void actor_hit(const StoneContact &sc) { |
412 |
if (may_be_broken_by(sc.actor)) |
if (may_be_broken_by(sc.actor)) |
413 |
break_me(); |
break_me(); |
414 |
} |
} |
419 |
void animcb() { |
void animcb() { |
420 |
KillStone(get_pos()); |
KillStone(get_pos()); |
421 |
} |
} |
422 |
|
virtual void message(const string &msg, const Value &) { |
423 |
|
if (msg =="ignite" || msg == "expl" || msg == "bombstone") |
424 |
|
break_me(); |
425 |
|
} |
426 |
|
|
427 |
virtual const char *get_break_anim() const = 0; |
virtual string get_break_anim() const { |
428 |
|
return string(get_kind())+"-anim"; |
429 |
|
} |
430 |
virtual bool may_be_broken_by(Actor *a) const = 0; |
virtual bool may_be_broken_by(Actor *a) const = 0; |
431 |
|
|
432 |
// variables: |
// variables: |
443 |
/** \page st-stone_break Breakable Stone |
/** \page st-stone_break Breakable Stone |
444 |
|
|
445 |
This stone can be destroyed by an actor having a |
This stone can be destroyed by an actor having a |
446 |
hammer. |
hammer and by laser, dynamite, bombs and bombstones. |
447 |
|
|
448 |
\subsection stone_breake Example |
\subsection stone_breake Example |
449 |
\verbatim |
\verbatim |
457 |
class Stone_break : public BreakableStone { |
class Stone_break : public BreakableStone { |
458 |
CLONEOBJ(Stone_break); |
CLONEOBJ(Stone_break); |
459 |
public: |
public: |
460 |
Stone_break() : BreakableStone("st-stone_break") {} |
Stone_break(const char *kind) : BreakableStone(kind) { } |
461 |
private: |
private: |
462 |
|
bool may_be_broken_by(Actor *a) const { |
463 |
|
return wielded_item_is(a, "it-hammer"); |
464 |
|
} |
465 |
|
}; |
466 |
|
} |
467 |
|
|
468 |
|
//---------------------------------------- |
469 |
|
// Stone_movebreak |
470 |
|
//---------------------------------------- |
471 |
|
|
472 |
|
/** \page st-rock3_movebreak Breakable Movable Stone |
473 |
|
|
474 |
|
This stone can be destroyed by an actor having a |
475 |
|
hammer and by laser, dynamite, bombs and bombstones. |
476 |
|
|
477 |
|
\subsection stone_breake Example |
478 |
|
\verbatim |
479 |
|
set_stone("st-rock3_movebreak", 10,10) |
480 |
|
\endverbatim |
481 |
|
|
482 |
const char *get_break_anim() const { |
\image html st-rock3.png |
483 |
return "st-stone_break-anim"; |
*/ |
484 |
|
namespace |
485 |
|
{ |
486 |
|
class Stone_movebreak : public BreakableStone { |
487 |
|
CLONEOBJ(Stone_movebreak); |
488 |
|
public: |
489 |
|
Stone_movebreak() : BreakableStone("st-rock3_movebreak") {} |
490 |
|
private: |
491 |
|
|
492 |
|
string get_break_anim() const { |
493 |
|
return "st-rock3_break-anim"; |
494 |
} |
} |
495 |
bool may_be_broken_by(Actor *a) const { |
bool may_be_broken_by(Actor *a) const { |
496 |
return wielded_item_is(a, "it-hammer"); |
return wielded_item_is(a, "it-hammer"); |
497 |
} |
} |
498 |
void message(const string &msg, const Value &) { |
|
499 |
if (msg =="ignite" || msg == "expl" || msg == "bombstone") |
bool is_movable() { return true; } |
500 |
|
void actor_inside (Actor *a) { SendMessage(a, "shatter"); } |
501 |
|
|
502 |
|
void actor_hit(const StoneContact &sc) { |
503 |
|
if (may_be_broken_by(sc.actor)) |
504 |
break_me(); |
break_me(); |
505 |
|
else |
506 |
|
maybe_push_stone (sc); |
507 |
|
} |
508 |
|
void on_impulse(const Impulse& impulse) { |
509 |
|
move_stone(impulse.dir); |
510 |
} |
} |
|
}; |
|
511 |
|
|
512 |
|
}; |
513 |
} |
} |
514 |
|
|
515 |
//---------------------------------------- |
//---------------------------------------- |
519 |
/** \page st-break_acwhite Breakable Stone |
/** \page st-break_acwhite Breakable Stone |
520 |
|
|
521 |
This stone can be destroyed by actor (whiteball) having a |
This stone can be destroyed by actor (whiteball) having a |
522 |
hammer. |
hammer and by laser, dynamite, bombs and bombstones. |
523 |
|
|
524 |
\subsection break_acwhite Example |
\subsection break_acwhite Example |
525 |
\verbatim |
\verbatim |
535 |
public: |
public: |
536 |
Break_acwhite() : BreakableStone("st-break_acwhite") {} |
Break_acwhite() : BreakableStone("st-break_acwhite") {} |
537 |
private: |
private: |
|
const char *get_break_anim() const { |
|
|
return "st-break_acwhite-anim"; |
|
|
} |
|
538 |
bool may_be_broken_by(Actor *a) const { |
bool may_be_broken_by(Actor *a) const { |
539 |
return a->get_attrib("whiteball") && |
return a->get_attrib("whiteball") && |
540 |
wielded_item_is(a, "it-hammer"); |
wielded_item_is(a, "it-hammer"); |
541 |
} |
} |
|
void message(const string &msg, const Value &) { |
|
|
if (msg =="ignite" || msg == "expl" || msg == "bombstone") |
|
|
break_me(); |
|
|
} |
|
542 |
}; |
}; |
543 |
} |
} |
544 |
|
|
565 |
public: |
public: |
566 |
Break_acblack() : BreakableStone("st-break_acblack") {} |
Break_acblack() : BreakableStone("st-break_acblack") {} |
567 |
private: |
private: |
|
const char *get_break_anim() const { |
|
|
return "st-break_acblack-anim"; |
|
|
} |
|
568 |
bool may_be_broken_by(Actor *a) const { |
bool may_be_broken_by(Actor *a) const { |
569 |
return a->get_attrib("blackball") && |
return a->get_attrib("blackball") && |
570 |
wielded_item_is(a, "it-hammer"); |
wielded_item_is(a, "it-hammer"); |
571 |
} |
} |
|
void message(const string &msg, const Value &) { |
|
|
if (msg =="ignite" || msg == "expl" || msg == "bombstone") |
|
|
break_me(); |
|
|
} |
|
572 |
}; |
}; |
573 |
} |
} |
574 |
|
|
2008 |
Register(new MagicStone); |
Register(new MagicStone); |
2009 |
Register(new RubberBandStone); |
Register(new RubberBandStone); |
2010 |
Register(new ScissorsStone); |
Register(new ScissorsStone); |
2011 |
Register(new Stone_break); |
Register(new Stone_break("st-stone_break")); |
2012 |
|
Register(new Stone_break("st-rock3_break")); |
2013 |
|
Register(new Stone_movebreak); |
2014 |
Register(new Stonebrush); |
Register(new Stonebrush); |
2015 |
Register(new SwapStone); |
Register(new SwapStone); |
2016 |
|
|