StarfieldBackgroundStars::StarfieldBackgroundStars (Type type) : sur(), x_pos(), y_pos(), x_add(), y_add() { switch (type) { case SMALL_STAR: sur = Sprite("game/stars/small_star"); break; case MIDDLE_STAR: sur = Sprite("game/stars/middle_star"); break; case LARGE_STAR: sur = Sprite("game/stars/large_star"); break; } x_pos = float(rand() % WorldObj::get_world()->get_width()); y_pos = float(rand() % WorldObj::get_world()->get_height()); x_add = static_cast<float>(rand() % 5) + 1.0f; y_add = 0.0f; }
void EditorApplication::OnStarted() { PushScopeEnterOnStack enterScope; o2Application.SetWindowCaption("o2 Editor"); mUIRoot = mnew UIRoot(); mBackground = mnew Sprite("ui/UI_Background.png"); mBackSign = mnew Sprite("ui/UI_o2_sign.png"); mConfig = mnew EditorConfig(); mConfig->LoadConfigs(); LoadUIStyle(); mProperties = mnew Properties(); mWindowsManager = mnew WindowsManager(); mMenuPanel = mnew MenuPanel(); mToolsPanel = mnew ToolsPanel(); if (mConfig->mProjectConfig.mMaximized) { o2Application.Maximize(); } else { Vec2I pos = mConfig->mProjectConfig.mWindowPosition; o2Application.SetWindowSize(mConfig->mProjectConfig.mWindowSize); o2Application.SetWindowPosition(pos); mConfig->mProjectConfig.mWindowPosition = pos; } OnResizing(); }
PlayerUI::PlayerUI(const std::unique_ptr<Player>& player) : m_Player(player) { m_PlayerHealth = Sprite(glm::vec3(20, Settings::Instance().PROJECTION_HEIGHT - 40, 0), glm::vec2(200, 20), glm::vec4(1, 0, 0, 1)); m_Stamina = Sprite(glm::vec3(m_PlayerHealth.getPosition().x, m_PlayerHealth.getPosition().y - 30, 0), glm::vec2(200, 20), glm::vec4(0, 1, 0, 1)); m_Crosshair = Sprite(glm::vec3(0, 0, 0), glm::vec2(32, 32), TextureManager::get("Textures/Player/crosshair.png")); }
Pause_Menu::Pause_Menu(bool* keys0, ALLEGRO_EVENT_QUEUE* event_queue0): State(keys0, event_queue0) { //************************ // VARIABLES //************************ selection = PAUSE_RESUME; //set keys ENTER and ESCAPE to false so no over-flow of information keys[KEY_ENTER] = false; keys[KEY_ESCAPE] = false; // these bools track keep track of when the up or down keys are actually being pressed key_up_still_pressed = false; key_down_still_pressed = false; // SPRITES //************ pause_title = al_load_bitmap("images/pause_title.png"); pause_resume = al_load_bitmap("images/pause_resume.png"); pause_exit = al_load_bitmap("images/pause_exit.png"); Pause_Title = Sprite(pause_title, 1, 1, 0, PAUSE_BUTTON_WIDTH, PAUSE_BUTTON_HEIGHT, PAUSE_BUTTON_X, PAUSE_TITLE_Y, 0, 0); Pause_Resume = Sprite(pause_resume, 1, 2, 0, PAUSE_BUTTON_WIDTH, PAUSE_BUTTON_HEIGHT, PAUSE_BUTTON_X, PAUSE_RESUME_Y, 0, 0); Pause_Exit = Sprite(pause_exit, 1, 2, 0, PAUSE_BUTTON_WIDTH, PAUSE_BUTTON_HEIGHT, PAUSE_BUTTON_X, PAUSE_EXIT_Y, 0, 0); }
void PlayerEntity::Load(MetadataObject &metadata, SceneNode *sprites) { SpriteEntity::Load(metadata, sprites); pSprite->SetZ(-10); if (this->GetClassName() == "OptimistPlayer") pText = sdNew(Sprite(*static_cast<Sprite *>(sprites->GetChildByName("BallonOptimist")))); else if (this->GetClassName() == "RealistPlayer") pText = sdNew(Sprite(*static_cast<Sprite *>(sprites->GetChildByName("BallonRealist")))); else pText = sdNew(Sprite(*static_cast<Sprite *>(sprites->GetChildByName("BallonPessimist")))); pText->SetPosition(0, 0); pText->SetVisible(false); gScene->Add(pText); b2Vec2 customSize(32, 32); pBody = gPhysics->CreateBody(pSprite, &customSize); pBody->SetFixedRotation(true); pBody->GetFixtureList()->SetUserData(this); pInput->AddKeyboardListener(this); //fVelocity = 2.0f; vPlayerVectorDirection = VECTOR_ZERO; }
Sprite Resource::load_thumb_sprite(const std::string& name) { Pathname thumb_path("thumbnails/" + name + ".png", Pathname::DATA_PATH); if (thumb_path.exist()) { log_info("Loading thumb from: %1%", thumb_path.str()); return Sprite(thumb_path); } else { Surface surface = load_surface(name); if (!surface) { return Sprite(); } else { Size thumb_size; if (surface.get_width() <= 48) thumb_size.width = surface.get_width(); else thumb_size.width = 48; if (surface.get_height() <= 48) thumb_size.height = surface.get_height(); else thumb_size.height = 48; Sprite sprite(surface.scale(thumb_size.width, thumb_size.height)); sprite.set_hotspot(origin_top_left, (48 - sprite.get_width())/2, (48 - sprite.get_height())/2); return sprite; } } }
void GameStateOptions::draw(const double dt) { m_game.getGraphics().clear(sf::Color::Black); m_game.getGraphics().draw(&Sprite(m_background), BACKGROUND); m_game.getGraphics().draw(&Sprite(m_overlay), OVERLAY); m_gui.drawBuffer(GUI); m_game.getGraphics().display(); }
FullScreen::FullScreen() { #ifdef WIN32 clan::D3DTarget::set_current(); #else clan::OpenGLTarget::set_current(); #endif DisplayWindowDescription window_description; window_description.set_title("ClanLib FullScreen Example"); window_description.set_size(Size(700, 600), true); window_description.set_allow_resize(true); window = DisplayWindow(window_description); sc.connect(window.sig_window_close(), clan::bind_member(this, &FullScreen::on_window_close)); sc.connect(window.get_keyboard().sig_key_down(), clan::bind_member(this, &FullScreen::on_input_down)); canvas = Canvas(window); spr_logo = Sprite(canvas, "../Basic2D/Resources/logo.png"); spr_background = Sprite(canvas, "../../Display/Path/Resources/lobby_background2.png"); font = clan::Font("tahoma", 24); game_time.reset(); }
Jumper::Jumper (Pingu* p) : PinguAction(p), sprite() { sprite.load(Direction::LEFT, Sprite("pingus/player" + pingu->get_owner_str() + "/jumper/left")); sprite.load(Direction::RIGHT, Sprite("pingus/player" + pingu->get_owner_str() + "/jumper/right")); }
AddOnMenu::AddOnMenu() : background(), ok_button() { //background("core/menu/wood"), //blackboard("core/menu/blackboard"), background = Sprite("core/menu/blackboard"); ok_button = Sprite("core/start/ok"); }
void Sprite2DView::next_image(int i) { if (directory.size() > 1) { if (new_sprite) { sprite = new_sprite; sprite.set_alpha(1.0f); new_sprite = Sprite(); offset = 0; display_time = 0; } index = static_cast<unsigned int>(index + i) % directory.size(); std::vector<Pathname> dir; if (shuffle) dir = shuffle_directory; else dir = directory; bool retry = false; do { try { new_sprite = Sprite(dir[index]); retry = false; } catch(std::exception& e) { // FIXME: won't work in combination with shuffle std::cout << "Error: " << e.what() << std::endl; std::cout << "Removing '" << directory[index] << "' from the list" << std::endl; directory.erase(directory.begin() + index); index = static_cast<unsigned int>(index) % directory.size(); retry = true; } } while (retry); ignore_delta = true; fadein = 0.0f; prepare_sprite(new_sprite); ConsoleLog << index << ": " << directory[index] << std::endl; } SpriteManager::current()->cleanup(); SurfaceManager::current()->cleanup(); }
ConveyorBelt::ConveyorBelt(const FileReader& reader) : left_sur (Sprite ("worldobjs/conveyorbelt_left")), right_sur (Sprite ("worldobjs/conveyorbelt_right")), middle_sur(Sprite ("worldobjs/conveyorbelt_middle")), pos(), width(), speed(), counter() { reader.read_vector("position", pos); reader.read_int ("width", width); reader.read_float ("speed", speed); }
void Champignon::Create(glm::vec2 newPos, glm::vec2 newSpeed, std::vector<float> params) { hurtTimer = 0.0f; pos = newPos; speed = newSpeed; startPos = pos.y; startSpeed = speed.x; if((int)params.size() < 1) throw Error("Error in champignon.cpp, line " + std::to_string(__LINE__)); mode = params[0]; exist = true; health = 1600 + 1280*mode; maxHealth = health; size = glm::vec2(64,80); body = Sprite(128,128); shootTimer = 60.0f + (float)(rand() % 120); mouthTimer = 0.0f; meteorTimer1 = 60.0f + (float)(rand() % 240); meteorTimer2 = 60.0f + (float)(rand() % 240); targetSpeed = glm::vec2(); isBoss = true; deathTimer = 240.0f; isBeaten = false; power = 3; shieldPos1 = glm::vec2(-128,-64); shieldPos2 = glm::vec2(-128,-64); shieldSpeed1 = (rand() % 100)/100.0f + 0.5f; shieldSpeed2 = (rand() % 100)/100.0f + 0.5f; propeller = Sprite(128,128); thing = Sprite(128,128); thing.centerX = 64; thing.centerY = 64; shieldShootTimer1 = 60.0f + (float)(rand() % 60); shieldShootTimer2 = 60.0f + (float)(rand() % 60); phase = 0; }
//////////////////////////////////////////////////////////// /// Populate all the required game sprites //////////////////////////////////////////////////////////// void MainClient::_populateSprites(void) { //Weapon loading { std::string path; size_t sz = WeaponList.size(); //resize texture vectors gs.bulletTex.resize(sz); gs.weaponTex.resize(sz); //Generate Textures glGenTextures(sz, &gs.bulletTex[0]); glGenTextures(sz, &gs.weaponTex[0]); //Populate sprites for(size_t k = 0; k < sz; k++){ //Bullet { path = WeaponList[k] + "/bullet.png"; if(!LoadTex(gs.bulletTex[k], path.c_str())) throw "Could not load bullet texture..."; path = WeaponList[k] + "/bullet.sprh"; gs.Bullet.push_back(Sprite(path.c_str(), gs.bulletTex[k])); } //Weapon { path = WeaponList[k] + "/weapon.png"; if(!LoadTex(gs.weaponTex[k], path.c_str())) throw "Could not load weapon texture..."; path = WeaponList[k] + "/weapon.sprh"; gs.Weapon.push_back(Sprite(path.c_str(), gs.weaponTex[k])); } } } //Bullet, Hits, Explosions Sprites { gs.HitTexture.resize(2, 0); glGenTextures(2, &gs.HitTexture[0]); LoadTex(gs.HitTexture[1], "assets/explosions/default.png"); gs.BulletHit.push_back(Sprite()); gs.BulletHit.push_back(Sprite("assets/explosions/default.sprh", gs.HitTexture[1])); } }
FullScreen::FullScreen() { // We support all display targets, in order listed here clan::D3DTarget::enable(); clan::OpenGLTarget::enable(); create_window(); spr_logo = Sprite(canvas, "../Basic2D/Resources/logo.png"); spr_background = Sprite(canvas, "../../Display/Path/Resources/lobby_background2.png"); font = clan::Font("tahoma", 24); game_time.reset(); }
void SpawnPointSpriteManager::update() { if (m_spawnPoint->isFree() && m_currentSprite.getImage() == Sprite::SPAWN_POINT_OCCUPIED) { m_currentSprite = Sprite(Sprite::SPAWN_POINT_FREE, m_spawnPoint->getShape()); clearSprites(); addSprite(m_currentSprite); } else if (!m_spawnPoint->isFree() && m_currentSprite.getImage() == Sprite::SPAWN_POINT_FREE) { clearSprites(); m_currentSprite = Sprite(Sprite::SPAWN_POINT_OCCUPIED, m_spawnPoint->getShape()); addSprite(m_currentSprite); } WorldSpriteManager::update(); }
void Level::setLevelSprite(float w, float h) { GLuint tex_2d = SOIL_load_OGL_texture ( "sky.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); levelSprite = Sprite(); levelSprite.initializeSprite(tex_2d, 0, 0, w, h); if( 0 == tex_2d ) { printf( "SOIL loading error: '%s'\n", SOIL_last_result() ); } tex_2d = SOIL_load_OGL_texture ( "grass.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); levelSpriteGroundTop = Sprite(); levelSpriteGroundTop.initializeSprite(tex_2d, 0, 0, 68, 9); if( 0 == tex_2d ) { printf( "SOIL loading error: '%s'\n", SOIL_last_result() ); } tex_2d = SOIL_load_OGL_texture ( "ground.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); levelSpriteGroundBottom = Sprite(); levelSpriteGroundBottom.initializeSprite(tex_2d, 0, 0, 68, 15); if( 0 == tex_2d ) { printf( "SOIL loading error: '%s'\n", SOIL_last_result() ); } }
Inventory::Inventory() : impl(new InventoryImpl()) { impl->slot = Sprite("images/inventory/slot.sprite"); impl->slothighlight = Sprite("images/inventory/slothighlight.sprite"); impl->moving = false; impl->add_angle = 0.0f; impl->current_item = 0; impl->items.push_back(InventoryItem("Flashlight", "images/inventory/flashlight.sprite")); impl->items.push_back(InventoryItem("Stone", "images/inventory/stone.sprite")); impl->items.push_back(InventoryItem("PDA", "images/inventory/pda.sprite")); impl->items.push_back(InventoryItem("5x Granates", "images/inventory/granate.sprite")); impl->items.push_back(InventoryItem("Lv1 Keycard", "images/inventory/keycard.sprite")); }
SpriteSeq SpriteUtil::process(const char * filename, ALLEGRO_COLOR delimiterColor) { #ifndef _AL_INIT_IMAGE_ADDON #define _AL_INIT_IMAGE_ADDON al_init_image_addon(); #endif ALLEGRO_BITMAP *bitmap = al_load_bitmap(filename); SpriteSeq spriteSeq(bitmap, 0, 0); ALLEGRO_COLOR pixel, lastPixel; int lastSource = 0; for(int i = 0; i <al_get_bitmap_width(bitmap); i++) { pixel = al_get_pixel(bitmap, i, 0); if (memcmp(&pixel, &lastPixel, sizeof(ALLEGRO_COLOR))) { if (!memcmp(&pixel, &delimiterColor, sizeof(ALLEGRO_COLOR))) { i++; // current pixel is the red one, so, advance to next pixel if (spriteSeq.empty()) { spriteSeq.add(Sprite(bitmap, 0, 0, i, al_get_bitmap_height(bitmap))); } else { spriteSeq.add(Sprite(bitmap, lastSource, 0, i - lastSource, al_get_bitmap_height(bitmap))); } lastSource = i; } } else if(i == al_get_bitmap_width(bitmap) - 1) { spriteSeq.add(Sprite(bitmap, lastSource, 0, i - lastSource, al_get_bitmap_height(bitmap))); } lastPixel = pixel; } al_convert_mask_to_alpha(bitmap, al_map_rgba(255, 0, 0, 255)); return spriteSeq; }
Sprite TextureAtlas::get(std::string key) const { auto it = images_.find(key); if (it != images_.end()) { return it->second; } return Sprite(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); scene = new QGraphicsScene(); shipItem = new QGraphicsPixmapItem(); shipSprite = Sprite(":/ship/Resources/Graphics/Ship"); shipItem->setPixmap(shipSprite.getCurrentFrame()); scene->addItem(shipItem); ui->view->setScene(scene); QTimer* timer = new QTimer(this); connect(timer, QTimer::timeout, this, MainWindow::timerFire); timer->start(5); this->setFocus(); //-------------test bullshit, please ignore int width = shipSprite.getCurrentFrame().width(); int height = shipSprite.getCurrentFrame().height(); level = Level(100000, 20000, "player", height*scale, width*scale, 0, 0, 0, QPair<int,int>(0,0), 0, 0, "player"); level.createBody("enemy", 1000, 1000, 1000, 1000, 0, QPair<int,int>(0, 0), 0, 0, "enemy"); }
Smashed::Smashed (Pingu* p) : PinguAction(p), sound_played(false), sprite() { sprite = Sprite("pingus/player" + pingu->get_owner_str() + "/bomber"); }
Sprite TextureAtlas::add(SDL_Surface* image, int border, std::string key) { auto it = images_.find(key); if (key.empty() || it == images_.end()) { std::shared_ptr<Node> node = nullptr; if (texture_.isValid()) { if (root_) { node = root_->insert(image, border); } else { node = Node::createRoot(root_, width_, height_, image, border); } if (node) { // Only when atlas is not full. SDL_Rect rect = node->getRect(); rect.w -= 2 * border; rect.h -= 2 * border; rect.x += border; rect.y += border; uploadSdlSurfaceToTexture(image, rect, texture_); // If key is empty, then the default sprite is overridden. Sprite& sprite = images_[key]; sprite = Sprite(texture_, (float) rect.x, (float) (texture_.getHeight() - rect.y - image->h), (float) image->w, (float) image->h); return sprite; } else { std::cerr << "\nTextureAtlas: Not enough image space to insert image." << std::endl; return mw::Sprite(); } } else { return mw::Sprite(); } } return it->second; // Return already loaded sprite. }
void inittitle() { menu = Sprite("tiles/ui/title.bmp",1,0); menuoverlayD = SDL_GetTicks(); /* This is the music to play. */ music = Mix_LoadMUS("sound/1.mid"); Mix_PlayMusic(music, -1); }
void World::CreateParticle(const Position &pos, const Position &dir, int damage, bool isEmittedFromHero) { std::shared_ptr<TransformComponent> particleTransform = std::make_shared<TransformComponent>(pos, pos, dir); std::shared_ptr<StatComponent> particleStat = std::make_shared<StatComponent>(1, 0, damage, 1); std::shared_ptr<CollidableComponent> particleCollidable = std::make_shared<CollidableComponent>(); particleCollidable->collisionInfo[INFOTYPE_LOGICAL_SPRITE] = TILE_PARTICLE; particleCollidable->collisionInfo[INFOTYPE_SPRITE] = TILE_PARTICLE; particleCollidable->SetOnCollision(Floyd::ScriptParticle_OnCollision, "particle"); std::shared_ptr<AIComponent> particleAI = std::make_shared<AIComponent>(); particleAI->SetOnUpdateAI(Floyd::ScriptParticle_OnUpdateAI, "particle"); particleAI->aiType = AITYPE_PARTICLE; std::shared_ptr<DrawableComponent> particleDrawable = std::make_shared<DrawableComponent>(); particleDrawable->sprite = Sprite(1, 1); particleDrawable->sprite.LoadTexture(ResolveFileName("particle_sprite", DIR_ENTITIES)); std::shared_ptr<ParticleComponent> particleParticle = std::make_shared<ParticleComponent>(isEmittedFromHero); std::shared_ptr<Entity> particleEnt = std::make_shared<Entity>(); particleEnt->AddComponent(particleTransform); particleEnt->AddComponent(particleCollidable); particleEnt->AddComponent(particleAI); particleEnt->AddComponent(particleDrawable); particleEnt->AddComponent(particleParticle); particleEnt->AddComponent(particleStat); entities.push_back(particleEnt); }
ButtonPanel::ButtonPanel(Server* s, const Vector2i& pos) : RectComponent(Rect()), server(s), background("core/buttons/buttonbackground"), highlight("core/buttons/buttonbackgroundhl"), buttons(), current_button(0), show_tip(false), tip_button(0) { ActionHolder* aholder = server->get_action_holder(); std::vector<ActionName::Enum> actions = aholder->get_available_actions(); set_rect(Rect(Vector2i(pos.x, pos.y - (actions.size() * 38)/2), Size(60, actions.size() * 38))); // Sort the action so that they always have the same order in the panel std::sort(actions.begin(), actions.end()); for(std::vector<ActionName::Enum>::size_type i = 0; i < actions.size(); ++i) { ActionButton button; button.name = actions[i]; button.sprite = Sprite("pingus/player0/" + ActionName::to_string(button.name) + "/right"); button.sprite.set_hotspot(origin_center, 0, 0); button.sprite.set_play_loop(true); buttons.push_back(button); } }
void SpriteManager::addSpriteSheet(const std::string &key, const char *fname, SDL_Rect r, int w, int h, int border,unsigned transp) { if (fileExists(fname)) { SDL_Surface * image = IMG_Load(fname); int iw = image->w; int ih = image->h; SDL_Surface * tmp = SDL_CreateRGBSurface(0, w, h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); Uint32 *pixels = (Uint32 *)tmp->pixels; Uint32 *origpixels = (Uint32 *)image->pixels; int c = 0; for (int i = border; i < iw-w; i += w + border) { for (int j = border; j < ih-h; j += h + border) { for (int x = 0; x < w; ++x) { for (int y = 0; y < h; ++y) { if ((origpixels[(j + y)*iw + (i + x)] ^ transp) == 0) pixels[x + y*w] = 0; else pixels[x + y*w] = origpixels[(j + y)*iw + (i + x)]; } } std::string tmpkey = key + std::to_string(c); ++c; if (!keyExists(tmpkey)) { list[tmpkey] = Sprite(SDL_CreateTextureFromSurface(renderer, tmp), r, w, h); log(VERBOSE_LOAD, "LOADED SPRITESHEET %s FROM %s", tmpkey.c_str(), fname); } else { log(VERBOSE_ERRORS, "Repeated sprite key %s", tmpkey.c_str()); } } } } else { log(VERBOSE_ERRORS, "File not found %s", fname); } }
int main() { Initialize(1024,720,false,"Game"); ////////takes in 1-9,A,B,C,D,E,F Sprite Player = Sprite("./rescources/Diva_Saya.jpg",640,480,"1.0f","1.0f","1.0f","1.0f"); std::vector<Sprite> ex; ex.push_back(Player); ex.reserve(ex.size() +1); while (update()){ _update_fps_counter (window); ClearScreen(); ex[0].Input(); ex[0].Draw(); //Player.Input(); //Player.Draw(); double Delta = GetDeltaTime(); } ShutDown(); return 0; }
Sprite::Sprite(Canvas &canvas, const std::string &fullname, const ImageImportDescription &import_desc) { std::string path = PathHelp::get_fullpath(fullname, PathHelp::path_type_file); std::string filename = PathHelp::get_filename(fullname, PathHelp::path_type_file); FileSystem vfs(path); *this = Sprite(canvas, filename, vfs, import_desc); }
Game::Game() : M(100, 100), dsp(1024, 768), out("log.txt") { out << "Welcome to Morphling. Walk around using the arrow keys. Press the space bar to generate a new map. Press Enter for command entry.\n"; // currently we default to in-game state = GS_GAME; // Set up player -- SHOULD BE WRITTEN IN DATA FILE LATER INSTEAD OF HARDCODED P.setMaxHP(100); P.setHP(100); P.setPosition(50, 50); // Consistent with death (instead of (20,20)) P.setSprite(Sprite(Sprite::TAR_IMP, Sprite::FACING_SOUTH)); P.setType(Entity::PLAYER); P_dx = 0; P_dy = 0; P_movespeed = 100; P_nextmove = 0; tick_count = 0; P_skip = 0; keys_down = SDL_GetKeyState(NULL); entering_text = false; // initialize map with delicious perlin noise, regenerating when map is inadequate do { M.generate_perlin(); } while(!M.safe(P.getX(), P.getY()) || !M.passable(P.getX(), P.getY())); M.tileAt(P.getX(), P.getY())->occupant = &P; redraw(); }