예제 #1
0
void die ( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 6); 

}
예제 #2
0
void die( void )
{
if (get_sprite_with_this_brain(9, &current_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(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 6); 



&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);
external("emake","xlarge");

}
예제 #3
0
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);
}
예제 #4
0
void die( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 6); 

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);


 external("emake","xlarge");


}
예제 #5
0
void touch( void )
{
int &mcrap = random(10,2);
&gold += &mcrap;
say("I found &mcrap gold.",1);
sp_brain_parm(&current_sprite, 10);
sp_brain(&current_sprite, 12);
sp_touch_damage(&current_sprite, 0);
sp_timing(&current_sprite, 0);

  //kill this item so it doesn't show up again for this player
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 1); 

}
예제 #6
0
void touch(void)
{
//dink touched this sprite
Playsound(10,22050,0,0,0);
sp_brain_parm(&current_sprite, 10);
sp_brain(&current_sprite, 12);
sp_touch_damage(&current_sprite, 0);
sp_timing(&current_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(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 1); 

}
예제 #7
0
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));
}
예제 #8
0
void hit ( void )
 {
  //play noise
  int &hold = sp_editor_num(&current_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(&current_sprite, -1);
  &save_y = sp_y(&current_sprite, -1);
  external("make", "gheart");

  sp_seq(&current_sprite, 177);
  sp_script(&current_sprite, "");
  sp_notouch(&current_sprite, 1);
  sp_nohit(&current_sprite, 1);
  kill_this_task();
 }
예제 #9
0
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);
}