29 |
|
|
30 |
#include <cassert> |
#include <cassert> |
31 |
#include <algorithm> |
#include <algorithm> |
32 |
|
#include <vector> |
33 |
|
|
34 |
using namespace std; |
using namespace std; |
35 |
using namespace world; |
using namespace world; |
1892 |
DirectionBits arms_present() const; |
DirectionBits arms_present() const; |
1893 |
bool no_stone (int xoff, int yoff) const; |
bool no_stone (int xoff, int yoff) const; |
1894 |
|
|
1895 |
void set_arm (Direction dir); |
void set_arm (Direction dir, RBI_vector &rubs); |
|
void set_arms (DirectionBits arms); |
|
1896 |
void remove_arms (DirectionBits arms); |
void remove_arms (DirectionBits arms); |
1897 |
|
void rotate_arms (DirectionBits arms, bool clockwise); |
1898 |
|
|
1899 |
void animcb() { set_model(model()); } |
void animcb() { set_model(model()); } |
1900 |
|
|
2064 |
} |
} |
2065 |
|
|
2066 |
void |
void |
2067 |
Turnstile_Pivot_Base::set_arms (DirectionBits arms) |
Turnstile_Pivot_Base::rotate_arms (DirectionBits arms, bool clockwise) |
2068 |
{ |
{ |
2069 |
if (arms & NORTHBIT) set_arm(NORTH); |
GridPos p = get_pos(); |
2070 |
if (arms & EASTBIT) set_arm(EAST); |
|
2071 |
if (arms & SOUTHBIT) set_arm(SOUTH); |
RBI_vector Nrubs; |
2072 |
if (arms & WESTBIT) set_arm(WEST); |
RBI_vector Erubs; |
2073 |
|
RBI_vector Srubs; |
2074 |
|
RBI_vector Wrubs; |
2075 |
|
|
2076 |
|
if (arms & NORTHBIT) GiveRubberBands(GetStone(move (p, NORTH)), Nrubs); |
2077 |
|
if (arms & EASTBIT) GiveRubberBands(GetStone(move (p, EAST)), Erubs); |
2078 |
|
if (arms & SOUTHBIT) GiveRubberBands(GetStone(move (p, SOUTH)), Srubs); |
2079 |
|
if (arms & WESTBIT) GiveRubberBands(GetStone(move (p, WEST)), Wrubs); |
2080 |
|
|
2081 |
|
remove_arms(arms); |
2082 |
|
|
2083 |
|
if (clockwise) { |
2084 |
|
if (arms & NORTHBIT) set_arm(EAST, Nrubs); |
2085 |
|
if (arms & EASTBIT) set_arm(SOUTH, Erubs); |
2086 |
|
if (arms & SOUTHBIT) set_arm(WEST, Srubs); |
2087 |
|
if (arms & WESTBIT) set_arm(NORTH, Wrubs); |
2088 |
|
} |
2089 |
|
else { |
2090 |
|
if (arms & NORTHBIT) set_arm(WEST, Nrubs); |
2091 |
|
if (arms & EASTBIT) set_arm(NORTH, Erubs); |
2092 |
|
if (arms & SOUTHBIT) set_arm(EAST, Srubs); |
2093 |
|
if (arms & WESTBIT) set_arm(SOUTH, Wrubs); |
2094 |
|
} |
2095 |
} |
} |
2096 |
|
|
2097 |
void |
void |
2098 |
Turnstile_Pivot_Base::set_arm (Direction dir) |
Turnstile_Pivot_Base::set_arm (Direction dir, RBI_vector &rubs) |
2099 |
{ |
{ |
2100 |
const char *names[4] = { "st-turnstile-w", "st-turnstile-s", |
const char *names[4] = { "st-turnstile-w", "st-turnstile-s", |
2101 |
"st-turnstile-e", "st-turnstile-n" }; |
"st-turnstile-e", "st-turnstile-n" }; |
2106 |
if (Item *it = GetItem(newp)) |
if (Item *it = GetItem(newp)) |
2107 |
it->on_stonehit(st); |
it->on_stonehit(st); |
2108 |
|
|
2109 |
|
if (!rubs.empty()) |
2110 |
|
for (RBI_vector::iterator it = rubs.begin(); it != rubs.end(); ++it) |
2111 |
|
AddRubberBand(it->act, st, it->strength, it->length); |
2112 |
} |
} |
2113 |
|
|
2114 |
bool |
bool |
2161 |
|
|
2162 |
set_anim(anim()); |
set_anim(anim()); |
2163 |
|
|
2164 |
remove_arms(arms); |
rotate_arms(arms, clockwise); |
|
set_arms(enigma::rotate(arms, clockwise)); |
|
2165 |
handleActorsAndItems(clockwise, impulse_sender); |
handleActorsAndItems(clockwise, impulse_sender); |
2166 |
|
|
2167 |
player::IncMoveCounter(); |
player::IncMoveCounter(); |