Ejemplo n.º 1
0
array*
array_append(array* a, void* e)
{
    _array* _a = a ? reveal(a) : reveal(array_new());

    _a = ensure(_a, _a->size + 2);

    _a->elements[_a->size++] = e;
    _a->elements[_a->size] = NULL;

    return hide(_a);
}
Ejemplo n.º 2
0
void DlgPlayers::init(int width, int height)
{
    frame = new puFrame(0, 0, width, height);

    slider = new puSlider(width-30, 40, height-60, TRUE, 20);
    slider->setValue(1.0f);
    slider->setSliderFraction(0.2f) ;
    slider->setCBMode(PUSLIDER_DELTA);
  
    list_box = new puListBox(10, 40, width-40, height-20, NULL);
    list_box->setLabel("Players");
    list_box->setLabelPlace(PUPLACE_TOP_CENTERED);
    list_box->setStyle(-PUSTYLE_SMALL_SHADED);
    list_box->setUserData(this);
    list_box->setCallback(handle_select);

    slider->setUserData(list_box);
    slider->setCallback(handle_slider);

    if (enableKick)
    {
	kick_button = new puOneShot(10, 10, "Kick");
	kick_button->setSize(buttonWidth, buttonHeight);
	kick_button->makeReturnDefault (TRUE);
	kick_button->setUserData(this);
	kick_button->setCallback(kick_cb);
    }

    close(); // close the group
#if 0
    reveal();
#endif
}
Ejemplo n.º 3
0
void QuizFrame::askTerm( const Term& term ) {
    hideAnswers();
    controller->initRevealingSequence();
    setTerm( term );
    reveal();
    setButtonsEnabled( true );
}
Ejemplo n.º 4
0
void
array_free(array* a)
{
    if (a)
    {
        free(reveal(a));
    }
}
Ejemplo n.º 5
0
void Trap::playerTrySpotHidden() {
  if(isHidden_) {
    const int PLAYER_SKILL = eng.player->getData().abilityVals.getVal(
                               ability_searching, true, *(eng.player));

    if(eng.abilityRoll->roll(PLAYER_SKILL) >= successSmall) {
      reveal(true);
    }
  }
}
Ejemplo n.º 6
0
void Door::playerTrySpotHidden() {
  if(isSecret_) {
    if(eng->mapTests->isCellsNeighbours(coord(pos_.x, pos_.y), eng->player->pos, false)) {
      const Abilities_t abilityUsed = ability_searching;
      const int PLAYER_SKILL = eng->player->getDef()->abilityVals.getVal(abilityUsed, true, *(eng->player));
      if(eng->abilityRoll->roll(PLAYER_SKILL) >= successSmall) {
        reveal(true);
      }
    }
  }
}
Ejemplo n.º 7
0
void Trap::triggerTrap(Actor& actor) {
  trace << "Trap::trigger()..." << endl;

  trace << "Trap: Specific trap is ";
  trace << specificTrap_->getTitle() << endl;

  const ActorData& d = actor.getData();

  trace << "Trap: Actor triggering is ";
  trace << d.name_a << endl;

  const int DODGE_SKILL =
    d.abilityVals.getVal(ability_dodgeTrap, true, actor);

  trace << "Trap: Actor dodge skill is ";
  trace << DODGE_SKILL << endl;

  if(&actor == eng.player) {
    traceVerbose << "Trap: Player triggering trap" << endl;
    const AbilityRollResult DODGE_RESULT =
      eng.abilityRoll->roll(DODGE_SKILL);
    reveal(false);
    traceVerbose << "Trap: Calling trigger" << endl;
    specificTrap_->trigger(actor, DODGE_RESULT);
  } else {
    traceVerbose << "Trap: Monster triggering trap" << endl;
    const bool IS_ACTOR_SEEN_BY_PLAYER =
      eng.player->isSeeingActor(actor, NULL);
    const AbilityRollResult dodgeResult = eng.abilityRoll->roll(DODGE_SKILL);
    if(IS_ACTOR_SEEN_BY_PLAYER) {
      reveal(false);
    }
    traceVerbose << "Trap: Calling trigger" << endl;
    specificTrap_->trigger(actor, dodgeResult);
  }

  trace << "Trap::trigger() [DONE]" << endl;
}
Ejemplo n.º 8
0
static int build_dictionary(void)
{
	ucell lfa = 0;
	unsigned int i;

	/* we need a temporary place for latest outside the dictionary */
	latest = &lfa;

	/* starting a new dictionary: clear dicthead */
	dicthead = 0;

#ifdef CONFIG_DEBUG_DICTIONARY
	printk("building dictionary, %d primitives.\nbuilt words:",
	       sizeof(wordnames) / sizeof(void *));
#endif

	for (i = 0; i < sizeof(wordnames) / sizeof(void *); i++) {
		if (strlen(wordnames[i]) != 0) {
			fcreate((char *) wordnames[i], i);
#ifdef CONFIG_DEBUG_DICTIONARY
			printk(" %s", wordnames[i]);
#endif
		}
	}
#ifdef CONFIG_DEBUG_DICTIONARY
	printk(".\n");
#endif

	/* get last/latest and state */
	state = buildvariable("state", 0);
	last = buildvariable("forth-last", 0);
	latest = buildvariable("latest", 0);

	*latest = target_ucell(pointer2cell(latest)-2*sizeof(cell));

	base=buildvariable("base", 10);

	buildconstant("/c", sizeof(u8));
	buildconstant("/w", sizeof(u16));
	buildconstant("/l", sizeof(u32));
	buildconstant("/n", sizeof(ucell));
	buildconstant("/x", sizeof(u64));

	reveal();
        if (verbose) {
                printk("Dictionary initialization finished.\n");
        }
	return 0;
}
Ejemplo n.º 9
0
void CGUIMain::doQuitDialog()
{
  reveal();
  if (options_changed())
  {
    CGUIMsgBox *msg = new CGUIMsgBox(_("Configuration has changed, save?"), 
                                      CRRC_DIALOG_OK | CRRC_DIALOG_CANCEL,
                                      quitDialogCallback);
    msg->setOKButtonLegend(_("Yes"));
    msg->setCancelButtonLegend(_("No"));
  }
  else
  {
    Global::Simulation->quit();
  }
}
Ejemplo n.º 10
0
array*
array_dup(array* a)
{
    if (!a)
    {
        return a;
    }
    else
    {
        _array* _a = reveal(a);
        unsigned long size = sizeof(_array) + sizeof(void*) * _a->capacity;
        _array* _b = xmalloc(size);
        memcpy(_b, _a, size);

        return hide(_b);
    }
}
Ejemplo n.º 11
0
/**
 * \brief Do one iteration in the progression of the item.
 */
void
ptb::hideout_revealing::progress( bear::universe::time_type elapsed_time )
{
  super::progress(elapsed_time);

  bool player_in_zone = false;

  if ( !m_current_revealed && !m_hideout_found )
    {
      search_players();

      if ( m_first_player != NULL )
        player_in_zone =
          m_first_player.get_bounding_box().intersects(get_bounding_box());

      if ( !player_in_zone && (m_second_player != NULL) )
        player_in_zone =
          m_second_player.get_bounding_box().intersects(get_bounding_box());

      if ( player_in_zone )
        {
          if ( !m_last_revealed )
            m_last_modification = 0;
          m_current_revealed = true;
          m_hideout_found = m_definitive_disclosure;
        }
    }

  if ( !m_hideout_found )
    {
      if ( !m_current_revealed && m_last_revealed )
        m_last_modification = 0;

      m_last_revealed = m_current_revealed;
      m_current_revealed = false;
    }

  if ( m_last_modification <= m_revelation_duration )
    {
       m_last_modification += elapsed_time;
       if ( player_in_zone || m_hideout_found  )
        reveal();
      else
        hide();
    }
} // hideout_revealing::progress()
Ejemplo n.º 12
0
bool overmapbuffer::reveal_route( const tripoint &source, const tripoint &dest, int radius )
{
    static const int RADIUS = 4;            // Maximal radius of search (in overmaps)
    static const int OX = RADIUS * OMAPX;   // half-width of the area to search in
    static const int OY = RADIUS * OMAPY;   // half-height of the area to search in

    const tripoint start( OX, OY, source.z );   // Local source - center of the local area
    const tripoint base( source - start );      // To convert local coordinates to global ones
    const tripoint finish( dest - base );       // Local destination - relative to source

    const auto estimate = [ this, &base, &finish ]( const pf::node &, const pf::node &cur ) {
        int res = 0;
        int omx = base.x + cur.x;
        int omy = base.y + cur.y;

        const auto &oter = get_om_global( omx, omy ).get_ter( omx, omy, base.z );

        if( !is_ot_type( "road", oter ) && !is_ot_type ( "bridge", oter ) && !is_ot_type( "hiway", oter ) ) {
            if( is_river( oter ) ) {
                return -1; // Can't walk on water
            }
            // Allow going slightly off-road to overcome small obstacles (e.g. craters),
            // but heavily penalize that to make roads preferable
            res += 250;
        }

        res += std::abs( finish.x - cur.x ) +
               std::abs( finish.y - cur.y );

        return res;
    };

    const auto path = pf::find_path( start, finish, 2*OX, 2*OY, estimate );

    if( path.empty() ) {
        return false;
    }

    for( const auto &node : path ) {
        reveal( base + tripoint( node.x, node.y, base.z ), radius );
    }

    return true;
}
Ejemplo n.º 13
0
// 下一手棋
void play()
{

	int ret;
	int ply, turn, time_limit;
	int chsbrd[BOARD_SIZE];
	int score;
	int r, move_type;
	int MaxDepth;
	clock_t t;
	printf("inputting board\n");
	ret = load_game("board.txt", piece_num, chsbrd, &turn, &time_limit);
	transform_board(board, chsbrd);
	dark_num = get_dark_num(board);
	red_num = get_piece_num(RED, piece_num);
	black_num = get_piece_num(BLACK, piece_num);
	best_src = 0;
	best_dest = 0;
	if(dark_num == PIECE_NUM)
		move_type = REVEAL_PIECE;
	else
		move_type = MOVE_PIECE;

	if(move_type == MOVE_PIECE){
		printf("searching\n");
		clock_limit = clock() + time_limit * CLK_TCK;
		if(time_limit < 20)
			max_depth = 6;
		else
			max_depth = (int) (log(time_limit / 20) / log(3)) * 2 + 6;
		score = search(board, piece_num, dark_num, red_num, black_num, turn, 1, max_depth, clock_limit);
	}
	move_type = (best_dest == -1) ? 1 : 0;
	if(best_src == 0){
		move_type = REVEAL_PIECE;
		printf("revealing\n");
		reveal(board);
	}
	best_src = translate_position(board, best_src);
	best_dest = translate_position(board, best_dest);
	printf("outputing\n\n");
	output_move("move.txt", move_type, best_src, best_dest, score);
}
Ejemplo n.º 14
0
/** \brief The GUI's key press event handler.
 *
 *  This function should be called from the SDL event loop. It takes a keyboard event
 *  as an argument, translates it to PUI syntax and passes it to the
 *  PUI-internal keyboard function. If there's no active widget which could
 *  use the key event the function will return false, giving the caller
 *  the opportunity to use the event for other purposes.
 *  \param key A key symbol generated by an SDL keyboard event.
 *  \return true if PUI was able to handle the event
 */
bool CGUIMain::keyDownEventHandler(SDL_keysym& key)
{
  int tkey;
  bool ret;

  tkey = translateKey(key);
  ret = puKeyboard(tkey, PU_DOWN);
  
  // ESC key handling
  // note: translateKey() does not affect the ESC keysym,
  // so it is safe to test the SDL key value here
  if (!ret && (tkey == SDLK_ESCAPE))
  {
    if (isVisible())
    {
      CRRCDialog* top = CRRCDialog::getToplevel();
      if (top != NULL)
      {
        if (top->hasCancelButton())
        {
          //std::cout << "Invoking CANCEL for toplevel dialog" << std::endl;
          top->setValue(CRRC_DIALOG_CANCEL);
          top->invokeCallback();
        }
      }
      else
      {
        //std::cout << "No active dialog, hiding GUI" << std::endl;
        hide();
      }
    }
    else
    {
      reveal();
    }
    ret = true;
  }

  return ret;
}
Ejemplo n.º 15
0
/*! \brief Activate the special skill
 *
 * This function activates the special skill for a hero,
 * including targetting etc. if required.
 *
 * \param   attack_fighter_index Hero to process
 * \returns 1 if the skill was used, otherwise 0
 */
int skill_use(size_t attack_fighter_index)
{
	int tgt, found_item, a, b, c, p, cts, tx, ty, next_target = 0, nn[NUM_FIGHTERS];
	size_t enemy_index;
	size_t fighter_index;
	std::unique_ptr<Raster> temp;
	tempa = Magic.status_adjust(attack_fighter_index);
	switch (pidx[attack_fighter_index])
	{
	case SENSAR:
		tgt = select_enemy(attack_fighter_index, TGT_ENEMY_ONE);
		if (tgt == -1)
		{
			return 0;
		}
		enemy_index = (unsigned int)tgt;
		temp = std::unique_ptr<Raster>(new Raster(320, 240));
		blit(Combat.backart, temp.get(), 0, 0, 0, 0, 320, 240);
		Draw.color_scale(temp.get(), Combat.backart, 16, 31);
		b = fighter[attack_fighter_index].mhp / 20;
		strcpy(attack_string, _("Rage"));
		display_attack_string = 1;
		tempa.stats[eStat::Attack] = fighter[attack_fighter_index].stats[eStat::Attack];
		tempa.stats[eStat::Hit] = fighter[attack_fighter_index].stats[eStat::Hit];
		if (fighter[enemy_index].crit == 1)
		{
			tempa.stats[eStat::Attack] += b;
			tempa.stats[eStat::Hit] += b;
		}
		Combat.fight(attack_fighter_index, enemy_index, 1);
		if (fighter[enemy_index].IsDead())
		{
			for (fighter_index = PSIZE; fighter_index < PSIZE + Combat.GetNumEnemies(); fighter_index++)
			{
				if (fighter[fighter_index].IsAlive())
				{
					nn[next_target] = fighter_index;
					next_target++;
				}
			}
			if (next_target > 0)
			{
				enemy_index = nn[kqrandom->random_range_exclusive(0, next_target)];
				Combat.fight(attack_fighter_index, enemy_index, 1);
			}
		}

		fighter[attack_fighter_index].hp -= (b * 2);
		Combat.AdjustHealth(attack_fighter_index, b * 2);
		display_attack_string = 0;
		blit(temp.get(), Combat.backart, 0, 0, 0, 0, 320, 240);
		Effects.display_amount(attack_fighter_index, FONT_DECIDE, 0);
		if (fighter[attack_fighter_index].IsAlive() && fighter[attack_fighter_index].hp <= 0)
		{
			Combat.fkill(attack_fighter_index);
			Effects.death_animation(attack_fighter_index, 0);
		}
		break;

	case SARINA:
		fighter[attack_fighter_index].ctmem = 1000;
		strcpy(attack_string, _("Sweep"));
		display_attack_string = 1;
		tempa.stats[eStat::Attack] = tempa.stats[eStat::Attack] * 75 / 100;
		fighter[attack_fighter_index].aframe = 6;
		Combat.UnsetDatafileImageCoords();
		Combat.battle_render(0, 0, 0);
		Draw.blit2screen(0, 0);
		kq_wait(150);
		Combat.multi_fight(attack_fighter_index);
		display_attack_string = 0;
		break;

	case CORIN:
		strcpy(attack_string, _("Elemental Infusion"));
		display_attack_string = 1;
		fighter[attack_fighter_index].aux = 2;
		if (combat_spell_menu(attack_fighter_index) == 1)
		{
			Effects.draw_castersprite(
				attack_fighter_index,
				eff[magic[fighter[attack_fighter_index].csmem].eff].kolor);
			Combat.UnsetDatafileImageCoords();
			play_effect(22, 128);
			Draw.convert_cframes(
				attack_fighter_index,
				eff[magic[fighter[attack_fighter_index].csmem].eff].kolor - 3,
				eff[magic[fighter[attack_fighter_index].csmem].eff].kolor + 3, 0);
			Combat.battle_render(0, 0, 0);
			fullblit(double_buffer, back);
			for (p = 0; p < 2; p++)
			{
				for (a = 0; a < 16; a++)
				{
					tx = fighter[attack_fighter_index].cx +
						(fighter[attack_fighter_index].cw / 2);
					ty = fighter[attack_fighter_index].cy +
						(fighter[attack_fighter_index].cl / 2);
					if (p == 0)
					{
						circlefill(
							double_buffer, tx, ty, a,
							eff[magic[fighter[attack_fighter_index].csmem].eff].kolor);
					}
					else
					{
						circlefill(
							double_buffer, tx, ty, 15 - a,
							eff[magic[fighter[attack_fighter_index].csmem].eff].kolor);
						Combat.draw_fighter(attack_fighter_index, 0);
					}
					Draw.blit2screen(0, 0);
					kq_wait(50);
					fullblit(back, double_buffer);
				}
			}
			Draw.revert_cframes(attack_fighter_index, 0);
			Combat.battle_render(0, 0, 0);
			Draw.blit2screen(0, 0);
			infusion(attack_fighter_index, fighter[attack_fighter_index].csmem);
			c = Magic.mp_needed(attack_fighter_index, fighter[attack_fighter_index].csmem);
			if (c < 1)
			{
				c = 1;
			}
			fighter[attack_fighter_index].mp -= c;
			Combat.SetEtherEffectActive(attack_fighter_index, false);
			fighter[attack_fighter_index].aux = 1;
		}
		else
		{
			fighter[attack_fighter_index].aux = 0;
			display_attack_string = 0;
			return 0;
		}
		display_attack_string = 0;
		fighter[attack_fighter_index].SetInfuse(magic[fighter[attack_fighter_index].csmem].elem);
		break;

	case AJATHAR:
		if (fighter[attack_fighter_index].unl > 0)
		{
			strcpy(attack_string, _("Dispel Undead"));
			display_attack_string = 1;
			fullblit(double_buffer, back);
			for (a = 0; a < 14/*MagicNumber*/; a++)
			{
				Draw.convert_cframes(PSIZE, 1 + a, 15, 1);
				for (fighter_index = PSIZE; fighter_index < PSIZE + Combat.GetNumEnemies(); fighter_index++)
				{
					if (Effects.is_active(fighter_index))
					{
						Combat.draw_fighter(fighter_index, 0);
					}
				}
				Draw.blit2screen(0, 0);
				kq_wait(50);
				fullblit(back, double_buffer);
			}
			Draw.revert_cframes(PSIZE, 1);
			display_attack_string = 0;
			b = fighter[attack_fighter_index].lvl * 15;
			for (fighter_index = PSIZE; fighter_index < PSIZE + Combat.GetNumEnemies(); fighter_index++)
			{
				if (fighter[fighter_index].IsAlive() && fighter[fighter_index].mhp > 0)
				{
					if (fighter[fighter_index].unl == 99 || fighter[fighter_index].unl == 0)
					{
						cts = 0;
					}
					else
					{
						a = (fighter[attack_fighter_index].lvl + 5) - fighter[fighter_index].unl;
						if (a > 0)
						{
							cts = a * 8;
						}
						else
						{
							cts = 0;
						}
					}
					if (kqrandom->random_range_exclusive(0, 100) < cts)
					{
						if (b >= fighter[fighter_index].hp)
						{
							b -= fighter[fighter_index].hp;
							Combat.SetShowDeathEffectAnimation(fighter_index, true);
							Combat.fkill(fighter_index);
						}
					}
				}
			}
			Effects.death_animation(PSIZE, 1);
			Combat.UnsetDatafileImageCoords();
			Combat.battle_render(attack_fighter_index, attack_fighter_index, 0);
		}
		else
		{
			a = kqrandom->random_range_exclusive(0, 100);
			c = fighter[attack_fighter_index].lvl / 10 + 1;
			if (a < 25)
			{
				b = kqrandom->random_range_exclusive(0, 5 * c) + 1;
			}
			else
			{
				if (a < 90)
				{
					b = kqrandom->random_range_exclusive(0, 10 * c) + (20 * c);
				}
				else
				{
					b = kqrandom->random_range_exclusive(0, 25 * c) + (50 * c);
				}
			}
			strcpy(attack_string, _("Divine Cure"));
			display_attack_string = 1;
			Effects.draw_spellsprite(0, 1, 15, 1);
			display_attack_string = 0;
			for (fighter_index = 0; fighter_index < numchrs; fighter_index++)
			{
				if (!fighter[fighter_index].IsStone() && fighter[fighter_index].IsAlive())
				{
					int amount = Magic.do_shell_check(fighter_index, b);
					Combat.AdjustHealth(fighter_index, amount);
				}
			}
			Effects.display_amount(0, FONT_YELLOW, 1);
			for (fighter_index = 0; fighter_index < numchrs; fighter_index++)
			{
				if (!fighter[fighter_index].IsStone() && fighter[fighter_index].IsAlive())
				{
					Magic.adjust_hp(fighter_index, Combat.GetHealthAdjust(fighter_index));
				}
			}
		}
		break;

	case CASANDRA:
		fighter[attack_fighter_index].atrack[0] = fighter[attack_fighter_index].stats[eStat::Aura];
		fighter[attack_fighter_index].atrack[1] = fighter[attack_fighter_index].stats[eStat::Spirit];
		fighter[attack_fighter_index].stats[eStat::Aura] = fighter[attack_fighter_index].stats[eStat::Aura] * 15 / 10;
		fighter[attack_fighter_index].stats[eStat::Spirit] = fighter[attack_fighter_index].stats[eStat::Spirit] * 15 / 10;
		fighter[attack_fighter_index].atrack[2] = fighter[attack_fighter_index].mrp;
		fighter[attack_fighter_index].mrp = fighter[attack_fighter_index].mrp * 15 / 10;
		if (combat_spell_menu(attack_fighter_index) == 1)
		{
			Combat.SetEtherEffectActive(attack_fighter_index, false);
			fighter[attack_fighter_index].aux = 1;
			fighter[attack_fighter_index].stats[eStat::Aura] = fighter[attack_fighter_index].atrack[0];
			fighter[attack_fighter_index].stats[eStat::Spirit] = fighter[attack_fighter_index].atrack[1];
			fighter[attack_fighter_index].mrp = fighter[attack_fighter_index].atrack[2];
		}
		else
		{
			fighter[attack_fighter_index].stats[eStat::Aura] = fighter[attack_fighter_index].atrack[0];
			fighter[attack_fighter_index].stats[eStat::Spirit] = fighter[attack_fighter_index].atrack[1];
			fighter[attack_fighter_index].mrp = fighter[attack_fighter_index].atrack[2];
			return 0;
		}
		break;

	case TEMMIN:
		fighter[attack_fighter_index].aux = 1;
		fighter[attack_fighter_index].defend = 1;
		break;

	case AYLA:
		tgt = select_enemy(attack_fighter_index, TGT_ENEMY_ONE);
		if (tgt == -1)
		{
			return 0;
		}
		enemy_index = (uint32_t)tgt;
		tx = fighter[attack_fighter_index].cx;
		ty = fighter[attack_fighter_index].cy;
		fighter[attack_fighter_index].cx = fighter[enemy_index].cx - 16;
		fighter[attack_fighter_index].cy = fighter[enemy_index].cy + fighter[enemy_index].cl - 40;
		fighter[attack_fighter_index].facing = 1;
		strcpy(attack_string, _("Steal"));
		display_attack_string = 1;
		Combat.battle_render(0, attack_fighter_index + 1, 0);
		Draw.blit2screen(0, 0);
		kq_wait(100);
		play_effect(SND_MENU, 128);
		kq_wait(500);
		display_attack_string = 0;
		Combat.battle_render(attack_fighter_index, attack_fighter_index, 0);
		found_item = 0;
#ifdef DEBUGMODE
		if (debugging > 2)
		{
			if (fighter[enemy_index].steal_item_rare > 0)
			{
				/* This steals a rare item from monster, if there is one */
				found_item = fighter[enemy_index].steal_item_rare;
				fighter[enemy_index].steal_item_rare = 0;
			}
			else if (fighter[enemy_index].steal_item_common > 0)
			{
				/* This steals a common item from a monster, if there is one */
				found_item = fighter[enemy_index].steal_item_common;
				fighter[enemy_index].steal_item_common = 0;
			}
			if (found_item > 0)
			{
				if (check_inventory(found_item, 1) != 0)
				{
					sprintf(strbuf, _("%s taken!"), items[found_item].name);
					Draw.message(strbuf, items[found_item].icon, 0, 0, 0);
				}
			}
			else
			{
				if (fighter[enemy_index].steal_item_common == 0 && fighter[enemy_index].steal_item_rare == 0)
				{
					Draw.message(_("Nothing to steal!"), 255, 0, 0, 0);
				}
				else
				{
					Draw.message(_("Couldn't steal!"), 255, 0, 0, 0);
				}
			}
		}
#else
		cts = party[pidx[attack_fighter_index]].lvl * 2 + 35;
		if (cts > 95)
		{
			cts = 95;
		}
		if (kqrandom->random_range_exclusive(0, 100) < cts)
		{
			if (fighter[enemy_index].steal_item_rare > 0 && (kqrandom->random_range_exclusive(0, 100) < 5))
			{
				/* This steals a rare item from monster, if there is one */
				found_item = fighter[enemy_index].steal_item_rare;
				fighter[enemy_index].steal_item_rare = 0;
			}
			else if (fighter[enemy_index].steal_item_common > 0 && (kqrandom->random_range_exclusive(0, 100) < 95))
			{
				/* This steals a common item from a monster, if there is one */
				found_item = fighter[enemy_index].steal_item_common;
				fighter[enemy_index].steal_item_common = 0;
			}
			if (found_item > 0)
			{
				if (check_inventory(found_item, 1) != 0)
				{
					sprintf(strbuf, _("%s taken!"), items[found_item].name);
					Draw.message(strbuf, items[found_item].icon, 0, 0, 0);
				}
			}
			else
			{
				if (fighter[enemy_index].steal_item_common == 0 && fighter[enemy_index].steal_item_rare == 0)
				{
					Draw.message(_("Nothing to steal!"), 255, 0, 0, 0);
				}
				else
				{
					Draw.message(_("Couldn't steal!"), 255, 0, 0, 0);
				}
			}
		}
		else
		{
			Draw.message(_("Couldn't steal!"), 255, 0, 0, 0);
		}
#endif
		fighter[attack_fighter_index].cx = tx;
		fighter[attack_fighter_index].cy = ty;
		display_attack_string = 0;
		fighter[attack_fighter_index].facing = 0;
		Combat.battle_render(attack_fighter_index, attack_fighter_index, 0);
		Draw.blit2screen(0, 0);
		break;

	case NOSLOM:
		tgt = select_enemy(attack_fighter_index, TGT_ENEMY_ONE);
		if (tgt == -1)
		{
			return 0;
		}
		enemy_index = (uint32_t)tgt;
		reveal(enemy_index);
		break;
	default:
		break;
	}
	return 1;
}
Ejemplo n.º 16
0
bool overmapbuffer::reveal(const point &center, int radius, int z)
{
    return reveal( tripoint( center, z ), radius );
}
Ejemplo n.º 17
0
 void ShGcInt::reveal(u64 partyIdx)
 {
     std::array<u64, 1> p{ partyIdx };
     reveal(p);
 }
Ejemplo n.º 18
0
CGUIViewWindDialog::CGUIViewWindDialog()
  : CRRCDialog()
{ 
  std::vector<std::string> lWindStringsGUI(2);
  lWindStringsGUI[0]  = _("Mode 1 (geom based)");
  lWindStringsGUI[1]  = _("Mode 2 (CFD based)");
  WindStringsGUI = T_GUI_Util::loadnames(lWindStringsGUI, nWindStringsGUI);

  std::vector<std::string> lColorStringsGUI(2);
  lColorStringsGUI[0]  = _("In-plane velocity");
  lColorStringsGUI[1]  = _("Vertical velocity");
  ColorStringsGUI = T_GUI_Util::loadnames(lColorStringsGUI, nColorStringsGUI);

  // Create widgets
  //
  
  //inital values
  position = 0;
  direction = cfg->wind->getDirection();
  width = 1000;
  hoffs = 0;
  voffs = 0;
  wind_mode = Global::wind_mode;
  color_mode = 2;

  int ypos = BUTTON_BOX_HEIGHT;
  int xpos = LABEL_W + DLG_DEF_SPACE + SLIDER_W;

  //slider voffs
  slider_voffs = new crrcSlider(LABEL_W + DLG_DEF_SPACE, ypos,
                                LABEL_W + DLG_DEF_SPACE + SLIDER_W,  ypos + SLIDER_H,
                                NUM_W);
  ypos += (SLIDER_H + DLG_DEF_SPACE);
  slider_voffs->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_voffs->setLabel(_("Vert. offset"));
  slider_voffs->setSliderFraction(SLIDER_FRACTION);
  slider_voffs->setMinValue(-2000);
  slider_voffs->setMaxValue(+2000);
  slider_voffs->setStepSize(50);
  slider_voffs->setValue(voffs);
  slider_voffs->setCallback(CGUIViewWindSliderCallback);
  slider_voffs->setUserData(this);

  //slider hoffs
  slider_hoffs = new crrcSlider(LABEL_W + DLG_DEF_SPACE, ypos,
                                LABEL_W + DLG_DEF_SPACE + SLIDER_W,  ypos + SLIDER_H,
                                NUM_W);
  ypos += (SLIDER_H + DLG_DEF_SPACE);
  slider_hoffs->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_hoffs->setLabel(_("Horiz. offset"));
  slider_hoffs->setSliderFraction(SLIDER_FRACTION);
  slider_hoffs->setMinValue(-5000);
  slider_hoffs->setMaxValue(+5000);
  slider_hoffs->setStepSize(100);
  slider_hoffs->setValue(hoffs);
  slider_hoffs->setCallback(CGUIViewWindSliderCallback);
  slider_hoffs->setUserData(this);

  //slider width
  slider_width = new crrcSlider(LABEL_W + DLG_DEF_SPACE, ypos,
                                LABEL_W + DLG_DEF_SPACE + SLIDER_W,  ypos + SLIDER_H,
                                NUM_W);
  ypos += (SLIDER_H + DLG_DEF_SPACE);
  slider_width->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_width->setLabel(_("Zoom width"));
  slider_width->setSliderFraction(SLIDER_FRACTION);
  slider_width->setMinValue(200);
  slider_width->setMaxValue(+10000);
  slider_width->setStepSize(100);
  slider_width->setValue(width);
  slider_width->setCallback(CGUIViewWindSliderCallback);
  slider_width->setUserData(this);

  //slider position
  slider_position = new crrcSlider(LABEL_W + DLG_DEF_SPACE, ypos,
                                   LABEL_W + DLG_DEF_SPACE + SLIDER_W,  ypos + SLIDER_H,
                                   NUM_W);
  ypos += (SLIDER_H + DLG_DEF_SPACE);
  slider_position->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_position->setLabel(_("Position (left<->right)"));
  slider_position->setSliderFraction(SLIDER_FRACTION);
  slider_position->setMinValue(-1000);
  slider_position->setMaxValue(+1000);
  slider_position->setStepSize(10);
  slider_position->setValue(position);
  slider_position->setCallback(CGUIViewWindSliderCallback);
  slider_position->setUserData(this);
  
  //slider direction
  slider_direction = new crrcSlider(LABEL_W + DLG_DEF_SPACE, ypos,
                                    LABEL_W + DLG_DEF_SPACE + SLIDER_W, ypos + SLIDER_H,
                                    NUM_W);
  ypos += (SLIDER_H + DLG_DEF_SPACE);
  slider_direction->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_direction->setLabel(_("Direction (degrees)"));
  slider_direction->setSliderFraction(SLIDER_FRACTION);
  slider_direction->setMinValue(0);
  slider_direction->setMaxValue(360);
  slider_direction->setStepSize(1);
  slider_direction->setValue(direction);
  slider_direction->setCallback(CGUIViewWindSliderCallback);
  slider_direction->setUserData(this);

  //wind vectors color mode
  buttonbox_color = new puButtonBox(xpos + LABEL_W + DLG_DEF_SPACE,
                                    ypos - 2*BUT_BOX_H - 2*DLG_DEF_SPACE,
                                    xpos + LABEL_W + DLG_DEF_SPACE + BUT_BOX_W,
                                    ypos - BUT_BOX_H - 2*DLG_DEF_SPACE,
                                    (char**)ColorStringsGUI, 1);
  buttonbox_color->setLabelPlace(PUPLACE_CENTERED_LEFT);
  buttonbox_color->setLabel(_("Color mode"));
  buttonbox_color->setValue(color_mode-1);
  buttonbox_color->setCallback(CGUIViewWindButtonBoxCallback);
  buttonbox_color->setUserData(this);
  
  //wind computation mode
  buttonbox_wind = new puButtonBox(xpos + LABEL_W + DLG_DEF_SPACE,
                                   ypos - BUT_BOX_H - DLG_DEF_SPACE,
                                   xpos + LABEL_W + DLG_DEF_SPACE + BUT_BOX_W,
                                   ypos - DLG_DEF_SPACE,
                                   (char**)WindStringsGUI, 1);
  xpos += (BUT_BOX_W + DLG_DEF_SPACE);
  buttonbox_wind->setLabelPlace(PUPLACE_CENTERED_LEFT);
  buttonbox_wind->setLabel(_("Wind mode"));
  buttonbox_wind->setValue(wind_mode-1);
  buttonbox_wind->setCallback(CGUIViewWindButtonBoxCallback);
  buttonbox_wind->setUserData(this);
  
  //graphical frame
  graphe = new puFrame(DLG_DEF_SPACE, ypos, 
                       DLG_DEF_SPACE + GRAPHE_W, ypos + GRAPHE_H);
  ypos += (GRAPHE_H + DLG_DEF_SPACE);
  graphe->setRenderCallback(draw_wind, this);

  close();
  //size
  int sizew = GRAPHE_W + DLG_DEF_SPACE;
  if(sizew < xpos) sizew = xpos ;
  setSize(sizew + DLG_DEF_SPACE, ypos);
  setCallback(CGUIViewWindDialogCallback);

  // center the dialog on screen
  int wwidth, wheight;
  int current_width = getABox()->max[0] - getABox()->min[0];
  int current_height = getABox()->max[1] - getABox()->min[1];
  puGetWindowSize(&wwidth, &wheight);
  setPosition(wwidth/2 - current_width/2, wheight/2 - current_height/2);

  reveal();
}
Ejemplo n.º 19
0
void Door::tryOpen(Actor* actorTrying) {
  tracer << "Door::tryOpen()" << endl;
  const bool IS_PLAYER = actorTrying == eng->player;
  const bool TRYER_IS_BLIND = actorTrying->getStatusEffectsHandler()->allowSee() == false;
  const bool PLAYER_SEE_DOOR = eng->map->playerVision[pos_.x][pos_.y];
  bool blockers[MAP_X_CELLS][MAP_Y_CELLS];
  eng->mapTests->makeVisionBlockerArray(eng->player->pos, blockers);

  const bool PLAYER_SEE_TRYER = IS_PLAYER ? true : eng->player->checkIfSeeActor(*actorTrying, blockers);

  if(isOpenedAndClosedExternally_) {
    if(IS_PLAYER) {
      eng->log->addMessage("I see no way to open this door, perhaps it is opened elsewhere?");
      eng->renderer->drawMapAndInterface();
    }
    return;
  }

  if(isStuck_) {
    tracer << "Door: Is stuck" << endl;

    if(IS_PLAYER) {
      eng->log->addMessage("The door seems to be stuck.");
    }

  } else {
    tracer << "Door: Is not stuck" << endl;
    if(TRYER_IS_BLIND == false) {
      tracer << "Door: Tryer can see, opening" << endl;
      isOpen_ = true;
      if(IS_PLAYER) {
        eng->log->addMessage("I open the door.");
        eng->soundEmitter->emitSound(Sound("", true, coord(pos_.x, pos_.y), false, IS_PLAYER));
      } else {
        if(PLAYER_SEE_TRYER) {
          eng->log->addMessage(actorTrying->getNameThe() + " opens a door.");
        } else if(PLAYER_SEE_DOOR) {
          eng->log->addMessage("I see a door opening.");
        }
        eng->soundEmitter->emitSound(Sound("I hear a door open.", true, coord(pos_.x, pos_.y), false, IS_PLAYER));
      }
    } else {
      if(eng->dice.percentile() < 50) {
        tracer << "Door: Tryer is blind, but open succeeded anyway" << endl;
        isOpen_ = true;
        if(IS_PLAYER) {
          eng->log->addMessage("I fumble with a door and succeed to open it.");
          eng->soundEmitter->emitSound(Sound("", true, pos_, false, IS_PLAYER));
        } else {
          if(PLAYER_SEE_TRYER) {
            eng->log->addMessage(actorTrying->getNameThe() + "fumbles about and succeeds to open a door.");
          } else if(PLAYER_SEE_DOOR) {
            eng->log->addMessage("I see a door open clumsily.");
          }
          eng->soundEmitter->emitSound(Sound("I hear something open a door clumsily.", true, pos_, false, IS_PLAYER));
        }
      } else {
        tracer << "Door: Tryer is blind, and open failed" << endl;
        if(IS_PLAYER) {
          eng->log->addMessage("I fumble blindly with a door and fail to open it.");
          eng->soundEmitter->emitSound(Sound("", true, pos_, false, IS_PLAYER));
        } else {
          if(PLAYER_SEE_TRYER) {
            eng->log->addMessage(actorTrying->getNameThe() + " fumbles blindly and fails to open a door.");
          }
          //(emitting the sound from the actor instead of the door here, beacause the sound should
          //be heard even if the door is seen, and the parameter for muting messages from seen sounds
          //should be off)
          eng->soundEmitter->emitSound(Sound("I hear something attempting to open a door.", true, actorTrying->pos, false, IS_PLAYER));
        }
      }
    }
  }

  if(isOpen_) {
    tracer << "Door: Open was successful" << endl;
    if(isSecret_) {
      tracer << "Door: Was secret, now revealing" << endl;
      reveal(true);
    }
    tracer << "Door: Calling GameTime::endTurnOfCurrentActor()" << endl;
    eng->gameTime->endTurnOfCurrentActor();
  }
}
Ejemplo n.º 20
0
CGUILoadRobotDialog::CGUILoadRobotDialog() 
            : CRRCDialog()
{
  // height of a text label
  int msg_height  = puGetDefaultLegendFont().getStringHeight("jX")
                  + puGetDefaultLegendFont().getStringDescender()
                  + PUSTR_TGAP + PUSTR_BGAP;
  
  int ymax = LIST_WIDGET_H + DESCRIPTION_H + 1*msg_height + 2*DLG_DEF_SPACE + BUTTON_BOX_HEIGHT;
  int yleft = ymax;
  int yright= ymax;
  int HELP_H = LIST_WIDGET_H + msg_height - DLG_CHECK_H - DLG_DEF_SPACE;
  

  // demo or robot checkbox
  yright -= DLG_DEF_SPACE + DLG_CHECK_H;
  check_demo = new puButton(2*DLG_DEF_SPACE + LIST_WIDGET_W,
                            yright,
                            2*DLG_DEF_SPACE + LIST_WIDGET_W + DLG_CHECK_W,
                            yright + DLG_CHECK_H);
  check_demo->setButtonType(PUBUTTON_VCHECK);
  check_demo->setLabelPlace(PUPLACE_CENTERED_RIGHT);
  check_demo->setLabel(_("Load as demo, replacing user input"));
  check_demo->setValue(0);
  
  // the description box
  yright -= HELP_H + DLG_DEF_SPACE;  
  puaLargeInput* help = new puaLargeInput(2*DLG_DEF_SPACE + LIST_WIDGET_W, yright,
                                          DESCRIPTION_W - LIST_WIDGET_W - DLG_DEF_SPACE, HELP_H,
                                          1,    // num of arrow pairs
                                          SCROLL_W,   // slider width
                                          1);   // wrap text
  help->setText(_("In case you check the box above, this robot will replace your manually controlled airplane.\n"
                "Load an airplane to regain manual control."));
  help->disableInput();
    
  // file selection list
  yleft -=  LIST_WIDGET_H + DLG_DEF_SPACE + msg_height;
  files = new puaFileBox(DLG_DEF_SPACE,
                         yleft,
                         LIST_WIDGET_W,
                         LIST_WIDGET_H, 
                         FileSysTools::getHomePath().c_str(), "crrclog", true);
  files->setLabelPlace(PUPLACE_TOP_LEFT);
  files->setLabel(_("Select file:"));
  files->setUserData(this);
  files->setCallback(CGUIRobotSelPlaneListCallback);
  
  // the description box
  yleft -= DESCRIPTION_H + DLG_DEF_SPACE;
  description = new puaLargeInput(DLG_DEF_SPACE,
                                  yleft,
                                  DESCRIPTION_W,
                                  DESCRIPTION_H,
                                  1,    // num of arrow pairs
                                  16,   // slider width
                                  0);   // wrap text
  description->disableInput();
  description->setText(_("This is a short description of the selected record."));


  // finalize the dialog
  close();
  setSize(DESCRIPTION_W+2*DLG_DEF_SPACE, ymax);
  setCallback(CGUIRobotSelCallback);
  
  // center the dialog on screen
  int wwidth, wheight;
  int current_width = getABox()->max[0] - getABox()->min[0];
  int current_height = getABox()->max[1] - getABox()->min[1];
  puGetWindowSize(&wwidth, &wheight);
  setPosition(wwidth/2 - current_width/2, (wheight - current_height)/2);

  reveal();
}
Ejemplo n.º 21
0
void QuizFrame::init() {
    Preferences& prefs = controller->getPreferences();
    QFont largeFont = prefs.getLargeFont();
    QFont mediumFont = prefs.getMediumFont();
    QFont labelsFont = prefs.getLabelsFont();
    QString firstLang( controller->getQuizFirstLanguage() );
    QString testLang( controller->getQuizTestLanguage() );

    topPanel = new QWidget();
    topPanelLayout = new QHBoxLayout();
    topPanel->setLayout( topPanelLayout );

    topLeftPanel = new QWidget();
    topLeftPanel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); 
    topLeftPanelLayout = new QVBoxLayout();
    topLeftPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    topLeftPanel->setLayout( topLeftPanelLayout );
    topPanelLayout->addWidget( topLeftPanel, 1 );

    firstLangPanel = new QWidget();
    firstLangPanelLayout = new QBoxLayout( QBoxLayout::TopToBottom );
    firstLangPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    firstLangPanel->setLayout( firstLangPanelLayout );
    topLeftPanelLayout->addWidget( firstLangPanel );

    testLangPanel = new QWidget();
    testLangPanelLayout = new QBoxLayout( QBoxLayout::TopToBottom );
    testLangPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    testLangPanel->setLayout( testLangPanelLayout );
    topLeftPanelLayout->addWidget( testLangPanel );

    controlPanel = new QWidget();
    controlPanelLayout = new QVBoxLayout();
    controlPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    controlPanel->setLayout( controlPanelLayout );

    answerControlPanel = new QWidget();
    answerControlPanelLayout = new QVBoxLayout();
    answerControlPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    answerControlPanel->setLayout( answerControlPanelLayout );
    controlPanelLayout->addWidget( answerControlPanel );

    revealAllDataButton = new QPushButton( /*tr( "Reveal" )*/ );
    revealAllDataButton->setIcon( QIcon( ZPIXMAP( eye_xpm ) ) );
    revealAllDataButton->setIconSize( QSize( 32, 32 ) );
    revealAllDataButton->setEnabled( false );
    //revealAllDataButton->setToolTip( tr( "Reveal" ) );
    connect( revealAllDataButton, SIGNAL( clicked() ), this, SLOT( reveal() ) );

    rightAnswerButton = new QPushButton( /*tr( "RightAnswer" )*/ );
    rightAnswerButton->setIcon( QIcon( ZPIXMAP( goodAns_xpm ) ) ); 
    rightAnswerButton->setIconSize( QSize( 32, 32 ) );
    rightAnswerButton->setEnabled( false );
    //rightAnswerButton->setToolTip( tr( "RightAnswer" ) );
    connect( rightAnswerButton, SIGNAL( clicked() ), this, SLOT( rightAnswer() ) );

    wrongAnswerButton = new QPushButton( /*tr( "WrongAnswer" )*/ );
    wrongAnswerButton->setIcon( QIcon( ZPIXMAP( badAns_xpm ) ) );
    wrongAnswerButton->setIconSize( QSize( 32, 32 ) );
    wrongAnswerButton->setEnabled( false );
    //wrongAnswerButton->setToolTip( tr( "WrongAnswer" ) );
    connect( wrongAnswerButton, SIGNAL( clicked() ), this, SLOT( wrongAnswer() ) );

    answerControlPanelLayout->addWidget( revealAllDataButton );
    answerControlPanelLayout->addWidget( rightAnswerButton );
    answerControlPanelLayout->addWidget( wrongAnswerButton );

    editionButton = new QPushButton( /*tr( "EditWord" )*/ );
    editionButton->setIcon( QIcon( ZPIXMAP( editTerm_xpm ) ) ); 
    editionButton->setIconSize( QSize( 32, 32 ) );
    editionButton->setMinimumWidth( 100 );
    editionButton->setEnabled( false );
    //editionButton->setToolTip( tr( "EditWord" ) );
    connect( editionButton, SIGNAL( clicked() ), this, SLOT( editCurrentTerm() ) );

    controlPanelLayout->addWidget( answerControlPanel, 1 );
    controlPanelLayout->addWidget( editionButton, 0 );
    
    firstLangTermPanel = new QWidget();
    firstLangTermPanelLayout = new QHBoxLayout();
    firstLangTermPanel->setLayout( firstLangTermPanelLayout );

    firstLangPanelLabel = new QLabel( QApplication::translate( "QObject", firstLang.toLatin1().data() ) );
    firstLangPanelLayout->addWidget( firstLangPanelLabel );
    firstLangPanelLayout->addWidget( firstLangTermPanel );

    firstLangTermLabel = new QLabel( tr( "Word/Expr." ) );

    firstLangTermStack = new QStackedWidget();
    firstLangTermLineEdit = new ScrollableLineEdit();
    firstLangTermLineEdit->setReadOnly( true );
    firstLangTermButton = new QPushButton( tr( "???" ) );
    //firstLangTermButton->setToolTip( tr( "Reveal" ) );
    connect( firstLangTermButton, SIGNAL( clicked() ), this, SLOT( revealFirstLangTerm() ) );  
    firstLangTermStack->addWidget( firstLangTermLineEdit );
    firstLangTermStack->addWidget( firstLangTermButton );

    firstLangTermPanelLayout->addWidget( firstLangTermLabel, 0 );
    firstLangTermPanelLayout->addWidget( firstLangTermStack, 1 );
    
    testLangPanelLabel = new QLabel( QApplication::translate( "QObject", testLang.toLatin1().data() ) );
    testLangPanelLayout->addWidget( testLangPanelLabel );

    testLangTopPanel = new QWidget();
    testLangPanelLayout->addWidget( testLangTopPanel );
    testLangTopPanelLayout = new QHBoxLayout();
    testLangTopPanel->setLayout( testLangTopPanelLayout );

    testLangLabelsPanel = new QWidget();
    testLangLabelsPanelLayout = new QVBoxLayout();
    testLangLabelsPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    testLangLabelsPanel->setLayout( testLangLabelsPanelLayout );

    testLangTermAltLabel = new QLabel( tr( "Alt./Phon." ) );
    testLangLabelsPanelLayout->addWidget( testLangTermAltLabel );
    testLangTermLabel = new QLabel( tr( "Word/Expr." ) );
    testLangLabelsPanelLayout->addWidget( testLangTermLabel );

    testLangFieldsPanel = new QWidget();
    testLangFieldsPanelLayout = new QVBoxLayout();
    testLangFieldsPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    testLangFieldsPanel->setLayout( testLangFieldsPanelLayout );
    testLangTermAltStack = new QStackedWidget();
    testLangFieldsPanelLayout->addWidget( testLangTermAltStack );
    testLangTermAltLineEdit = new ScrollableLineEdit();
    testLangTermAltLineEdit->setReadOnly( true );
    testLangTermAltButton = new QPushButton( tr( "???" ) );
    //testLangTermAltButton->setToolTip( tr( "Reveal" ) );
    connect( testLangTermAltButton, SIGNAL( clicked() ), this, SLOT( revealAltTerm() ) );  
    testLangTermAltStack->addWidget( testLangTermAltLineEdit );
    testLangTermAltStack->addWidget( testLangTermAltButton );

    testLangTermStack = new QStackedWidget();
    testLangFieldsPanelLayout->addWidget( testLangTermStack );
    testLangTermLineEdit = new ScrollableLineEdit();
    testLangTermLineEdit->setReadOnly( true );
    testLangTermButton = new QPushButton( tr( "???" ) );
    //testLangTermButton->setToolTip( tr( "Reveal" ) );
    connect( testLangTermButton, SIGNAL( clicked() ), this, SLOT( revealTestLangTerm() ) );  

    testLangTermStack->addWidget( testLangTermLineEdit );
    testLangTermStack->addWidget( testLangTermButton );

    testLangTopPanelLayout->addWidget( testLangLabelsPanel );
    testLangTopPanelLayout->addWidget( testLangFieldsPanel, 1 );

    commentBox = new QWidget();
    commentBoxLayout = new QVBoxLayout();
    commentBoxLayout->setContentsMargins( 0, 0, 0, 0 );
    commentBox->setLayout( commentBoxLayout );

    commentLabelPanel = new QWidget();
    commentLabelPanelLayout = new QHBoxLayout();
    commentLabelPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    commentLabelPanel->setLayout( commentLabelPanelLayout );
    commentBoxLayout->addWidget( commentLabelPanel );
    commentLabel = new QLabel( tr( "Examples/Comments" ) );
    maximizeCommentButton = new QPushButton();
    maximizeCommentButton->setIcon( QIcon( ZPIXMAP( maximize_xpm ) ) );
    maximizeCommentButton->setIconSize( QSize( 32, 32 ) );
    maximizeCommentButton->setCheckable( true );
    maximizeCommentButton->setMaximumHeight( commentLabel->sizeHint().height() > 24 ? commentLabel->sizeHint().height() : 24 );
    maximizeCommentButton->setMaximumWidth( maximizeCommentButton->maximumHeight() );
    //maximizeCommentButton->setToolTip( tr( "MaximizeComment" ) );
    connect( maximizeCommentButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleMaximizeComment( bool ) ) );
    commentLabelPanelLayout->addWidget( commentLabel );
    commentLabelPanelLayout->addStretch();
    commentLabelPanelLayout->addWidget( maximizeCommentButton );

    commentStack = new QStackedWidget();
    commentBoxLayout->addWidget( commentStack );

    commentMultiLineEdit = new ScrollableMultiLineEdit();
    commentMultiLineEdit->setReadOnly( true );
    commentButton = new QPushButton( tr( "???" ) );
    //commentButton->setToolTip( tr( "Reveal" ) );
    connect( commentButton, SIGNAL( clicked() ), this, SLOT( revealComment() ) );  
    commentStack->addWidget( commentMultiLineEdit );
    commentStack->addWidget( commentButton );

    imageBox = new QWidget();
    imageBoxLayout = new QBoxLayout( QBoxLayout::TopToBottom );
    imageBox->setLayout( imageBoxLayout );

    imageBoxLabel = new QLabel( tr( "Image" ) ); 
    imageBoxLayout->addWidget( imageBoxLabel );

    imageStack = new QStackedWidget();
    imageBoxLayout->addWidget( imageStack );
    imageButton = new QPushButton( tr( "???" ) );
    //imageButton->setToolTip( tr( "Reveal" ) );
    connect( imageButton, SIGNAL( clicked() ), this, SLOT( revealImage() ) );
    image = new QLabel();
    imageStack->addWidget( image );
    imageStack->addWidget( imageButton );

    topPanelLayout->addWidget( imageBox );

    scrollLeftAction = new QAction( this );
    scrollLeftAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousChar ) );
    connect( scrollLeftAction, SIGNAL( triggered() ), this, SLOT( scrollLeft() ) );
    addAction( scrollLeftAction );

    scrollRightAction = new QAction( this );
    scrollRightAction->setShortcut( QKeySequence( QKeySequence::MoveToNextChar ) );
    connect( scrollRightAction, SIGNAL( triggered() ), this, SLOT( scrollRight() ) );
    addAction( scrollRightAction );

    scrollUpAction = new QAction( this );
    scrollUpAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousLine ) );
    connect( scrollUpAction, SIGNAL( triggered() ), this, SLOT( scrollUp() ) );
    addAction( scrollUpAction );

    scrollDownAction = new QAction( this );
    scrollDownAction->setShortcut( QKeySequence( QKeySequence::MoveToNextLine ) );
    connect( scrollDownAction, SIGNAL( triggered() ), this, SLOT( scrollDown() ) );
    addAction( scrollDownAction );

    scrollPageUpAction = new QAction( this );
    scrollPageUpAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousPage ) );
    connect( scrollPageUpAction, SIGNAL( triggered() ), this, SLOT( scrollPageUp() ) );
    addAction( scrollPageUpAction );

    scrollPageDownAction = new QAction( this );
    scrollPageDownAction->setShortcut( QKeySequence( QKeySequence::MoveToNextPage ) );
    connect( scrollPageDownAction, SIGNAL( triggered() ), this, SLOT( scrollPageDown() ) );
    addAction( scrollPageDownAction );

    mainLayout = new QHBoxLayout( this );

    body = new QWidget();
    bodyLayout = new QVBoxLayout();
    bodyLayout->setContentsMargins( 0, 0, 0, 0 );
    body->setLayout( bodyLayout );
 
    bodyLayout->addWidget( topPanel );
    bodyLayout->addWidget( commentBox, 1 );

    bodyWrapper = new QScrollArea();
    bodyWrapper->setWidget( body );

    mainLayout->addWidget( bodyWrapper, 1 );
    mainLayout->addWidget( controlPanel );
    setLayout( mainLayout );
    mainLayout->activate();

    updateFonts();

    setButtonsHidden( prefs.areQuizButtonsHidden() );
}
Ejemplo n.º 22
0
int revealReverse() {
    return reveal(img->height, 0, img->width, 0 );
}
Ejemplo n.º 23
0
bool overmapbuffer::reveal_route( const tripoint &source, const tripoint &dest, int radius,
                                  bool road_only )
{
    static const int RADIUS = 4;            // Maximal radius of search (in overmaps)
    static const int OX = RADIUS * OMAPX;   // half-width of the area to search in
    static const int OY = RADIUS * OMAPY;   // half-height of the area to search in

    if( source == overmap::invalid_tripoint || dest == overmap::invalid_tripoint ) {
        return false;
    }

    const tripoint start( OX, OY, source.z );   // Local source - center of the local area
    const tripoint base( source - start );      // To convert local coordinates to global ones
    const tripoint finish( dest - base );       // Local destination - relative to source

    const auto get_ter_at = [&]( int x, int y ) {
        x += base.x;
        y += base.y;
        const overmap &om = get_om_global( x, y );
        return om.get_ter( x, y, source.z );
    };

    const auto oter = get_ter_at( start.x, start.y ) ;
    const auto connection = overmap_connections::guess_for( oter );

    if( !connection ) {
        return false;
    }

    const auto estimate = [&]( const pf::node & cur, const pf::node * ) {
        int res = 0;

        const auto oter = get_ter_at( cur.x, cur.y );

        if( !connection->has( oter ) ) {
            if( road_only ) {
                return pf::rejected;
            }

            if( is_river( oter ) ) {
                return pf::rejected; // Can't walk on water
            }
            // Allow going slightly off-road to overcome small obstacles (e.g. craters),
            // but heavily penalize that to make roads preferable
            res += 250;
        }

        res += std::abs( finish.x - cur.x ) +
               std::abs( finish.y - cur.y );

        return res;
    };

    const auto path = pf::find_path( point( start.x, start.y ), point( finish.x, finish.y ), 2 * OX,
                                     2 * OY, estimate );

    for( const auto &node : path.nodes ) {
        reveal( base + tripoint( node.x, node.y, base.z ), radius );
    }

    return !path.nodes.empty();
}
Ejemplo n.º 24
0
CGUICalibMapDialog::CGUICalibMapDialog()
  : CRRCDialog(0, 0, CRRC_DIALOG_OK), state(0), numaxis(0)
{
  // activate the test mode to see the movements of the model
  activate_test_mode();
  
  //activate verbosity
  sVerbosity = Global::nVerbosity;
  Global::nVerbosity  =1;
  
  // create some label strings from scratch
  // ("0", "1", ...)
  for (int i = 0; i < TX_MAXAXIS; i++)
  {
    // attention: only works for TX_MAXAXIS < 10
    axislabel[i] = new char[2];
    *(axislabel[i]) = 0x30 + i;
    *(axislabel[i] + 1) = '\0';
  }
  axislabel[TX_MAXAXIS] = NULL;
  
  // Create the selection list for the SelectBoxes.
  // Contains as many axis as the interface features,
  // plus "-" (deactivate) and NULL (terminate).
  // The number of axis will be stored to make sure
  // it doesn't change until the dialog is closed.
  numaxis = Global::TXInterface->getNumAxes();
  
  if (numaxis > TX_MAXAXIS)
  {
    numaxis = TX_MAXAXIS;
  }
  for (int i = 0; i < numaxis; i++)
  {
    selectlist[i] = axislabel[i];
  }
  selectlist[numaxis]   = mapped_to_keyboard;
  selectlist[numaxis+1] = NULL;

  // The "mapping group" (left part of the dialog).
  // The combo box on top is not part of the group
  // because it controls hiding and revealing of the
  // other widgets.
  mapgroup = new puGroup(LABEL_W + DLG_DEF_SPACE,
                         BUTTON_BOX_HEIGHT);
  for (int i = 0; i < NUM_FUNCTIONS; i++)
  {
    int index = NUM_FUNCTIONS - 1;
    axismapping[i] = new puaSelectBox(0,
                                     (index-i)* DLG_DEF_SPACE + (index-i) * INPUT_H,
                                     INPUT_W,
                                     (index-i)* DLG_DEF_SPACE + (index+1-i) * INPUT_H,
                                     (char **)selectlist
                                    );
    axismapping[i]->setLabelPlace(PUPLACE_CENTERED_LEFT);
    axismapping[i]->setLabel(Global::inputDev->AxisStringsGUI[i+1]);
    int item = Global::TXInterface->map->func[i+1];
    if (item < 0)
    {
      // disable (set to "K")
      item = numaxis;
    }
    axismapping[i]->setCurrentItem(item);
    axismapping[i]->setUserData(this);
    axismapping[i]->setCallback(CGUIMapCallback);

    invert[i] = new puButton(DLG_DEF_SPACE + INPUT_W,
                             4 + (index-i)* DLG_DEF_SPACE + (index-i) * INPUT_H,
                             DLG_DEF_SPACE + INPUT_W + DLG_CHECK_W,
                             4 + (index-i)* DLG_DEF_SPACE + (index-i) * INPUT_H + DLG_CHECK_H);
    invert[i]->setButtonType(PUBUTTON_VCHECK);
    invert[i]->setLabelPlace(PUPLACE_CENTERED_RIGHT);
    invert[i]->setLabel(_("Inv"));
    if (Global::TXInterface->map->inv[i+1] > 0)
    {
      invert[i]->setValue(0);
    }
    else
    {
      invert[i]->setValue(1);
    }
    invert[i]->setUserData(this);
    invert[i]->setCallback(CGUIMapCallback);
  }
  mapgroup->close();
  mapgroup->hide();

  // The combo box above the "mapping group"
  combo_radiotype = new puaComboBox(LABEL_W + DLG_DEF_SPACE,
                                   BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS)* DLG_DEF_SPACE + (NUM_FUNCTIONS) * INPUT_H,
                                   LABEL_W + DLG_DEF_SPACE + COMBO_W,
                                   BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS)* DLG_DEF_SPACE + (NUM_FUNCTIONS + 1) * INPUT_H,
                                   NULL, false);
  combo_radiotype->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]);
  combo_radiotype->newList(radioTypes);
  combo_radiotype->setLabelPlace(PUPLACE_CENTERED_LEFT);
  combo_radiotype->setLabel(_("Radio type"));
  combo_radiotype->setUserData(this);
  combo_radiotype->setCurrentItem(Global::TXInterface->map->radioType());
  combo_radiotype->setCallback(CGUIComboCallback);

  if (combo_radiotype->getCurrentItem() == T_AxisMapper::CUSTOM)
  {
    mapgroup->reveal();
  }

  if ((Global::TXInterface->inputMethod() == T_TX_Interface::eIM_mouse)
        ||
      (Global::TXInterface->inputMethod() == T_TX_Interface::eIM_joystick))
  {
    Global::TXInterface->map->setRadioType(T_AxisMapper::CUSTOM);
    combo_radiotype->setCurrentItem(Global::TXInterface->map->radioType());
    combo_radiotype->hide();
  }
  else
  {
    combo_radiotype->reveal();
  }
  
  // The "calibration group" (right part of the dialog).
  calibgroup = new puGroup(LABEL_W + 3*DLG_DEF_SPACE + DLG_CHECK_W + INPUT_W + HORIZ_SPACER,
                           BUTTON_BOX_HEIGHT + DLG_DEF_SPACE);
  
  for (int i = 0; i < TX_MAXAXIS; i++)
  {
    axis[i] = new puSlider( i*SLIDER_SP + i * SLIDER_W,
                            LABEL_H + DLG_DEF_SPACE + DLG_DEF_BUTTON_HEIGHT,
                            SLIDER_SZ,
                            TRUE,
                            SLIDER_W);
    axis[i]->setLabelPlace(PUPLACE_BOTTOM_CENTERED);
    axis[i]->setLabel(axislabel[i]);
    axis[i]->setValue((float)0.5);
    
    // set min and max to some excessive values
    minval[i] = 1.0e30;
    maxval[i] = -1.0e30;
  }
  
  butCalibrate = new puOneShot( 0,
                                0,
                                DLG_DEF_BUTTON_WIDTH + 10,
                                DLG_DEF_BUTTON_HEIGHT);
  butCalibrate->setLegend(_("Calibrate"));
  butCalibrate->setLabelPlace(PUPLACE_BOTTOM_LEFT);
  butCalibrate->setLabel("");
  butCalibrate->setUserData(this);
  butCalibrate->setCallback(CGUICalibButtonCallback);
  
  if (Global::TXInterface->usesCalibration())
  {
    butCalibrate->reveal();
  }
  else
  {
    butCalibrate->hide();
  }

  calibgroup->close();

  // finalize the dialog
  close();
  setSize(LABEL_W + (TX_MAXAXIS -1)*SLIDER_SP + DLG_DEF_SPACE+ DLG_CHECK_W + INPUT_W + 2*HORIZ_SPACER + TX_MAXAXIS * SLIDER_W,
          BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS+3) * DLG_DEF_SPACE + (NUM_FUNCTIONS+1) * INPUT_H);  
  setCallback(CGUICalibMapCallback);
  centerOnScreen();
  
  //set the dialogue transparent and hide the others dialogues to better see the model
  setTransparency(.3);
  hideOthers();
  
  reveal();
}
Ejemplo n.º 25
0
size_t
array_size(array* a)
{
    return a ? reveal(a)->size : 0;
}
Ejemplo n.º 26
0
CGUIAudioDialog::CGUIAudioDialog() 
            : CRRCDialog()
{
  // Create Widgets
  comboSampleRate = new puaComboBox(LABEL_W + DLG_DEF_SPACE,
                                    BUTTON_BOX_HEIGHT + 4 * DLG_DEF_SPACE + 2 * SLIDER_H + COMBO_H,
                                    LABEL_W + COMBO_W,
                                    BUTTON_BOX_HEIGHT + 4 * DLG_DEF_SPACE + 2 * SLIDER_H + 2 * COMBO_H,
                                    NULL, false);
  comboSampleRate->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]);
  comboSampleRate->newList((char**) samplerates);
  comboSampleRate->setLabelPlace(PUPLACE_CENTERED_LEFT);
  comboSampleRate->setLabel(_("Sample Rate"));
  {
    int         nIdx = 0;
    std::string cr   = cfgfile->getString("sound.samplerate");
    std::string tmp;
    
    for (int n=0; n<3; n++)
    {
      tmp = samplerates[n];
      if (tmp.find(cr) == 0)
        nIdx = n;
    }
    comboSampleRate->setCurrentItem(nIdx);
  }
  comboSampleRate->reveal();
  
  comboEngine = new puaComboBox(LABEL_W + DLG_DEF_SPACE, 
                                BUTTON_BOX_HEIGHT + 3 * DLG_DEF_SPACE + 2 * SLIDER_H,
                                LABEL_W + COMBO_W,
                                BUTTON_BOX_HEIGHT + 3 * DLG_DEF_SPACE + 2 * SLIDER_H + COMBO_H,
                                NULL, false);
  comboEngine->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]);
  comboEngine->newList((char**) enginesound);
  comboEngine->setLabelPlace(PUPLACE_CENTERED_LEFT);
  comboEngine->setLabel(_("Engine sound"));
  comboEngine->setCurrentItem(cfgfile->getInt("sound.throttle.mode", 1));
  comboEngine->hide();
  
  slider_variovol = new puSlider(LABEL_W + DLG_DEF_SPACE,
                                 BUTTON_BOX_HEIGHT + 2 * DLG_DEF_SPACE + 1 * SLIDER_H,
                                 SLIDER_W,
                                 FALSE, 
                                 SLIDER_H);
  slider_variovol->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_variovol->setLabel(_("Variometer volume"));
  slider_variovol->setSliderFraction(0.05);
  slider_variovol->setMinValue(0);
  slider_variovol->setMaxValue(16);
  slider_variovol->setStepSize(1);
  slider_variovol->setValue(cfgfile->getInt("sound.variometer.vol"));
  
  slider_modelvol = new puSlider(LABEL_W + DLG_DEF_SPACE,
                                 BUTTON_BOX_HEIGHT + 1 * DLG_DEF_SPACE + 0* SLIDER_H,
                                 SLIDER_W,
                                 FALSE, 
                                 SLIDER_H);
  slider_modelvol->setLabelPlace(PUPLACE_CENTERED_LEFT);
  slider_modelvol->setLabel(_("Model volume"));
  slider_modelvol->setSliderFraction(0.05);
  slider_modelvol->setMinValue(0);
  slider_modelvol->setMaxValue(1.0);
  slider_modelvol->setStepSize(0.05);
  slider_modelvol->setValue((float)Global::soundserver->getModelVolume() / (float)SDL_MIX_MAXVOLUME);
  
  // finalize the dialog
  close();
  setSize(SLIDER_W + LABEL_W + 2*DLG_DEF_SPACE, 
          2*SLIDER_H + 5*DLG_DEF_SPACE + 2 * COMBO_H + BUTTON_BOX_HEIGHT);
  setCallback(CGUIAudioCallback);
  centerOnScreen();
  reveal();
}
Ejemplo n.º 27
0
static int interpret_source(char *fil)
{
	FILE *f;
	char tib[160];
        cell num;
	char *test;

	const ucell SEMIS = (ucell)findword("(semis)");
	const ucell LIT = (ucell)findword("(lit)");
	const ucell DOBRANCH = (ucell)findword("dobranch");

	if ((f = fopen_include(fil)) == NULL) {
		printk("error while loading source file '%s'\n", fil);
		errors++;
		exit(1);
	}

	/* FIXME: We should read this file at
	 * once. No need to get it char by char
	 */

	while (!feof(f)) {
		xt_t res;
		parse_word(f, tib);

		/* if there is actually no word, we continue right away */
		if (strlen(tib) == 0) {
			continue;
		}

		/* Checking for builtin words that are needed to
		 * bootstrap the forth base dictionary.
		 */

		if (!strcmp(tib, "(")) {
			parse(f, tib, ')');
			continue;
		}

		if (!strcmp(tib, "\\")) {
			parse(f, tib, '\n');
			continue;
		}

		if (!strcmp(tib, ":")) {
			parse_word(f, tib);

#ifdef CONFIG_DEBUG_INTERPRETER
			printk("create colon word %s\n\n", tib);
#endif
			fcreate(tib, DOCOL);	/* see dict.h for DOCOL and other CFA ids */
			*state = (ucell) (-1);
			continue;
		}

		if (!strcmp(tib, ";")) {
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("finish colon definition\n\n");
#endif
			writecell((cell)SEMIS);
			*state = (ucell) 0;
			reveal();
			continue;
		}

		if (!strcasecmp(tib, "variable")) {
			parse_word(f, tib);
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("defining variable %s\n\n", tib);
#endif
			buildvariable(tib, 0);
			reveal();
			continue;
		}

		if (!strcasecmp(tib, "constant")) {
			parse_word(f, tib);
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("defining constant %s\n\n", tib);
#endif
			buildconstant(tib, POP());
			reveal();
			continue;
		}

		if (!strcasecmp(tib, "value")) {
			parse_word(f, tib);
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("defining value %s\n\n", tib);
#endif
			buildconstant(tib, POP());
			reveal();
			continue;
		}

		if (!strcasecmp(tib, "defer")) {
			parse_word(f, tib);
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("defining defer word %s\n\n", tib);
#endif
			builddefer(tib);
			reveal();
			continue;
		}

		if (!strcasecmp(tib, "include")) {
			parse_word(f, tib);
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("including file %s\n\n", tib);
#endif
			interpret_source(tib);
			continue;
		}

		if (!strcmp(tib, "[']")) {
			xt_t xt;
			parse_word(f, tib);
			xt = findword(tib);
			if (*state == 0) {
#ifdef CONFIG_DEBUG_INTERPRETER
				printk
				    ("writing address of %s to stack\n\n",
				     tib);
#endif
				PUSH_xt(xt);
			} else {
#ifdef CONFIG_DEBUG_INTERPRETER
				printk("writing lit, addr(%s) to dict\n\n",
				       tib);
#endif
				writecell(LIT);	/* lit */
				writecell((cell)xt);
			}
			continue;
			/* we have no error detection here */
		}

		if (!strcasecmp(tib, "s\"")) {
			int cnt;
			cell loco;

			cnt = parse(f, tib, '"');
#ifdef CONFIG_DEBUG_INTERPRETER
			printk("compiling string %s\n", tib);
#endif
			loco = dicthead + (6 * sizeof(cell));
			writecell(LIT);
			writecell(pointer2cell(dict) + loco);
			writecell(LIT);
                        writecell((ucell)cnt);
			writecell(DOBRANCH);
			loco = cnt + sizeof(cell) - 1;
			loco &= ~(sizeof(cell) - 1);
			writecell(loco);
			memcpy(dict + dicthead, tib, cnt);
			dicthead += cnt;
			paddict(sizeof(cell));
			continue;
		}

		/* look if tib is in dictionary. */
		/* should the dictionary be searched before the builtins ? */
		res = findword(tib);
		if (res) {
			u8 flags = read_byte((u8*)cell2pointer(res) -
						sizeof(cell) - 1);
#ifdef CONFIG_DEBUG_INTERPRETER
                        printk("%s is 0x%" FMT_CELL_x "\n", tib, (ucell) res);
#endif
			if (!(*state) || (flags & 3)) {
#ifdef CONFIG_DEBUG_INTERPRETER
                                printk("executing %s, %" FMT_CELL_d
                                       " (flags: %s %s)\n",
				       tib, res,
				       (flags & 1) ? "immediate" : "",
				       (flags & 2) ? "compile-only" : "");
#endif
				PC = (ucell)res;
				enterforth(res);
			} else {
#ifdef CONFIG_DEBUG_INTERPRETER
				printk("writing %s to dict\n\n", tib);
#endif
				writecell((cell)res);
			}
			continue;
		}

		/* if not look if it's a number */
		if (tib[0] == '-')
			num = strtoll(tib, &test, read_ucell(base));
		else
			num = strtoull(tib, &test, read_ucell(base));


		if (*test != 0) {
			/* what is it?? */
			printk("%s:%d: %s is not defined.\n\n", srcfilenames[cursrc - 1], srclines[cursrc - 1], tib);
			errors++;
#ifdef CONFIG_DEBUG_INTERPRETER
			continue;
#else
			return -1;
#endif
		}

		if (*state == 0) {
#ifdef CONFIG_DEBUG_INTERPRETER
                        printk("pushed %" FMT_CELL_x " to stack\n\n", num);
#endif
			PUSH(num);
		} else {
#ifdef CONFIG_DEBUG_INTERPRETER
                        printk("writing lit, %" FMT_CELL_x " to dict\n\n", num);
#endif
			writecell(LIT);	/* lit */
			writecell(num);
		}
	}

	fclose(f);
	cursrc--;

	return 0;
}