void die ( void ) { int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 6); }
void die( void ) { if (get_sprite_with_this_brain(9, ¤t_sprite) == 0) { //no more brain 9 monsters here, lets unlock the screen screenlock(0); playsound(43, 22050,0,0,0); } int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 6); &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_sprite, -1); external("emake","xlarge"); }
void EyedropperCommand::onExecute(Context* context) { Widget* widget = gui::Manager::getDefault()->getMouse(); if (!widget || widget->type != editor_type()) return; Editor* editor = static_cast<Editor*>(widget); Sprite* sprite = editor->getSprite(); if (!sprite) return; // pixel position to get int x, y; editor->screenToEditor(jmouse_x(0), jmouse_y(0), &x, &y); // get the color from the image Color color = Color::fromImage(sprite->getPixelFormat(), sprite->getPixel(x, y)); // TODO replace the color in the "context", not directly from the color-bar // set the color of the color-bar if (m_background) app_get_colorbar()->setBgColor(color); else app_get_colorbar()->setFgColor(color); }
void die( void ) { int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 6); &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_sprite, -1); external("emake","xlarge"); }
void touch( void ) { int &mcrap = random(10,2); &gold += &mcrap; say("I found &mcrap gold.",1); sp_brain_parm(¤t_sprite, 10); sp_brain(¤t_sprite, 12); sp_touch_damage(¤t_sprite, 0); sp_timing(¤t_sprite, 0); //kill this item so it doesn't show up again for this player int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 1); }
void touch(void) { //dink touched this sprite Playsound(10,22050,0,0,0); sp_brain_parm(¤t_sprite, 10); sp_brain(¤t_sprite, 12); sp_touch_damage(¤t_sprite, 0); sp_timing(¤t_sprite, 0); add_magic("item-fb",422, 7); say("I now have the hellfire magic!", 1); //kill this item so it doesn't show up again for this player int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 1); }
void ZoomCommand::onExecute(Context* context) { // Use the current editor by default. Editor* editor = current_editor; gfx::Point mousePos = ui::get_mouse_position(); // Try to use the editor above the mouse. ui::Widget* pick = ui::Manager::getDefault()->pick(mousePos); if (pick && pick->type() == editor_type()) editor = static_cast<Editor*>(pick); render::Zoom zoom = editor->zoom(); switch (m_action) { case Action::In: zoom.in(); break; case Action::Out: zoom.out(); break; case Action::Set: zoom = m_zoom; break; } Focus focus = m_focus; if (focus == Focus::Default) { if (Preferences::instance().editor.zoomFromCenterWithKeys()) { focus = Focus::Center; } else { focus = Focus::Mouse; } } editor->setZoomAndCenterInMouse( zoom, mousePos, (focus == Focus::Center ? Editor::ZoomBehavior::CENTER: Editor::ZoomBehavior::MOUSE)); }
void hit ( void ) { //play noise int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) { //this was placed by the editor, lets make the chest stay open editor_type(&hold, 4); editor_seq(&hold, 177); editor_frame(&hold, 6); //type means show this seq/frame combo as background in the future } &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_sprite, -1); external("make", "gheart"); sp_seq(¤t_sprite, 177); sp_script(¤t_sprite, ""); sp_notouch(¤t_sprite, 1); sp_nohit(¤t_sprite, 1); kill_this_task(); }
bool ColorButton::onProcessMessage(Message* msg) { switch (msg->type) { case JM_CLOSE: if (m_frame && m_frame->isVisible()) m_frame->closeWindow(NULL); break; case JM_MOUSEENTER: app_get_statusbar()->showColor(0, "", m_color, 255); break; case JM_MOUSELEAVE: app_get_statusbar()->clearText(); break; case JM_SIGNAL: if (msg->signal.num == JI_SIGNAL_BUTTON_SELECT) { // If the popup window was not created or shown yet.. if (m_frame == NULL || !m_frame->isVisible()) { // Open it openSelectorDialog(); } else if (!m_frame->is_moveable()) { // If it is visible, close it closeSelectorDialog(); } return true; } break; case JM_MOTION: if (hasCapture()) { Widget* picked = ji_get_default_manager()->pick(msg->mouse.x, msg->mouse.y); Color color = m_color; if (picked && picked != this) { // Pick a color from another color-button if (ColorButton* pickedColBut = dynamic_cast<ColorButton*>(picked)) { color = pickedColBut->getColor(); } // Pick a color from the color-bar else if (picked->type == palette_view_type()) { color = ((PaletteView*)picked)->getColorByPosition(msg->mouse.x, msg->mouse.y); } // Pick a color from a editor else if (picked->type == editor_type()) { Editor* editor = static_cast<Editor*>(picked); Sprite* sprite = editor->getSprite(); int x, y, imgcolor; if (sprite) { x = msg->mouse.x; y = msg->mouse.y; editor->screenToEditor(x, y, &x, &y); imgcolor = sprite->getPixel(x, y); color = Color::fromImage(sprite->getImgType(), imgcolor); } } } // Did the color change? if (color != m_color) { setColor(color); } } break; case JM_SETCURSOR: if (hasCapture()) { jmouse_set_cursor(JI_CURSOR_EYEDROPPER); return true; } break; } return ButtonBase::onProcessMessage(msg); }