static int header_map_key(void *ctx, const unsigned char *stringval, size_t stringlen) { if (CHECK_KEY("version")) { current_key = KEY_VERSION; } else if (CHECK_KEY("stop_signal")) { current_key = KEY_STOP_SIGNAL; } else if (CHECK_KEY("cont_signal")) { current_key = KEY_CONT_SIGNAL; } else if (CHECK_KEY("click_events")) { current_key = KEY_CLICK_EVENTS; } return 1; }
bool Tile::affect(Object* obj, DWORD key, TileType collisLevel) { if ((this->isWater() && !CHECK_KEY(key, KEY_WATER_COLLIS)) || _type < collisLevel) return false; if (CHECK_KEY(key, KEY_MOVEABLE)) { double time = 0; Direction direct = Direction::NONE; if (isTouchable()) time = Collision::checkCollision(obj, this, &direct); if (direct != Direction::NONE) { // If the object touched this tile. if (getType() >= TouchLevel::FOUR_FACE || direct == Direction::UP) // If tile is touchable at any direction or the touch side is top of tile if (time <= Timer::getRoundTime() && time >= 0) // If this collision happened sooner than current result, replace it, then. { if (time == 0) { switch (direct) { case UP: if (obj->getRect().bottom < this->getRect().top) return false; break; case DOWN: if (obj->getRect().top > this->getRect().bottom) return false; break; case LEFT: if (obj->getRect().right > this->getRect().left) return false; break; case RIGHT: if (obj->getRect().left < this->getRect().right) return false; break; default: break; } } MoveObject *moveObject = dynamic_cast<MoveObject *>(obj); moveObject->pushCollisEvent(new CollisEvent(this, direct, time)); return true; } } } return false; }