182 |
//====================================================================== |
//====================================================================== |
183 |
|
|
184 |
Floor::Floor(const char *kind, double friction, double mfactor) |
Floor::Floor(const char *kind, double friction, double mfactor) |
185 |
: TGridObject<GRID_FLOOR>(kind) , _friction(friction) |
: TGridObject<GRID_FLOOR>(kind), |
186 |
|
traits (kind, friction, mfactor, FLOOR_Normal) |
187 |
{ |
{ |
|
_mousefactor = mfactor; |
|
188 |
} |
} |
189 |
|
|
190 |
|
Floor::Floor (const FloorTraits &tr) |
191 |
|
: TGridObject<GRID_FLOOR>(tr.name), traits (tr) |
192 |
|
{ |
193 |
|
} |
194 |
|
|
195 |
|
|
196 |
Floor *Floor::clone() { |
Floor *Floor::clone() { |
197 |
return this; |
return this; |
198 |
} |
} |
204 |
void |
void |
205 |
Floor::message(const string& msg, const Value &val) |
Floor::message(const string& msg, const Value &val) |
206 |
{ |
{ |
|
if (msg == "explode") |
|
|
SetFloor(get_pos(), MakeFloor("fl-abyss")); |
|
207 |
} |
} |
208 |
|
|
209 |
//---------------------------------------- |
//---------------------------------------- |
4077 |
}; |
}; |
4078 |
|
|
4079 |
const DirectionBits neededArm[2][8] = { |
const DirectionBits neededArm[2][8] = { |
4080 |
{ WESTBIT, NORTHBIT, NORTHBIT, EASTBIT, EASTBIT, SOUTHBIT, SOUTHBIT, WESTBIT }, // anticlockwise |
// anticlockwise |
4081 |
{ NORTHBIT, NORTHBIT, EASTBIT, EASTBIT, SOUTHBIT, SOUTHBIT, WESTBIT, WESTBIT } // clockwise |
{ WESTBIT, NORTHBIT, NORTHBIT, EASTBIT, EASTBIT, SOUTHBIT, SOUTHBIT, WESTBIT }, |
4082 |
|
// clockwise |
4083 |
|
{ NORTHBIT, NORTHBIT, EASTBIT, EASTBIT, SOUTHBIT, SOUTHBIT, WESTBIT, WESTBIT } |
4084 |
}; |
}; |
4085 |
|
|
4086 |
DirectionBits arms = arms_present(); // already the rotated state |
DirectionBits arms = arms_present(); // already the rotated state |
4097 |
bool shatter = true; |
bool shatter = true; |
4098 |
|
|
4099 |
if (arm) { // if stone is turnstile arm -> hit it! |
if (arm) { // if stone is turnstile arm -> hit it! |
4100 |
const DirectionBits impulse_dir[2][8] = { |
const int impulse_dir[2][8] = { |
4101 |
{ DirectionBits(SOUTHBIT|WESTBIT), WESTBIT, DirectionBits(NORTHBIT|WESTBIT), NORTHBIT, |
// anticlockwise |
4102 |
DirectionBits(NORTHBIT|EASTBIT), EASTBIT, DirectionBits(SOUTHBIT|EASTBIT), SOUTHBIT }, // anticlockwise |
{ SOUTHBIT|WESTBIT, WESTBIT, NORTHBIT|WESTBIT, NORTHBIT, |
4103 |
{ DirectionBits(NORTHBIT|EASTBIT), EASTBIT, DirectionBits(SOUTHBIT|EASTBIT), SOUTHBIT, |
NORTHBIT|EASTBIT, EASTBIT, SOUTHBIT|EASTBIT, SOUTHBIT }, |
4104 |
DirectionBits(SOUTHBIT|WESTBIT), WESTBIT, DirectionBits(NORTHBIT|WESTBIT), NORTHBIT } // clockwise |
// clockwise |
4105 |
|
{ NORTHBIT|EASTBIT, EASTBIT, SOUTHBIT|EASTBIT, SOUTHBIT, |
4106 |
|
SOUTHBIT|WESTBIT, WESTBIT, NORTHBIT|WESTBIT, NORTHBIT } |
4107 |
}; |
}; |
4108 |
|
|
4109 |
DirectionBits possible_impulses = impulse_dir[clockwise][idx_target]; |
DirectionBits possible_impulses = |
4110 |
|
static_cast<DirectionBits>(impulse_dir[clockwise][idx_target]); |
4111 |
|
|
4112 |
for (int d = 0; d<4; ++d) { |
for (int d = 0; d<4; ++d) { |
4113 |
if (has_dir(possible_impulses, Direction(d))) { |
if (has_dir(possible_impulses, Direction(d))) { |