Ejemplo n.º 1
0
void init_server(void)
{
	printf("Initializing Data. \n");
	check_dir(LOG_PATH);

	printf("Loading Items. \n");
	init_items();

	printf("Loading Maps. \n");
	init_maps();

	printf("Loading Npcs. \n");
	init_npcs();

	printf("Loading Shops. \n");
	init_shops();

	printf("Loading Spells. \n");
	init_spells();

	printf("Initializing Player Data. \n");
	init_players();

	printf("Initializing Temp Player Data. \n");
	init_temp_player_index();

	printf("Data Initialized. \n");
}
Ejemplo n.º 2
0
FileMenu::FileMenu(QWidget *parent) :
    QMenu(parent)
{
    init_items();
    add_action();
    patch_signal();
}
Ejemplo n.º 3
0
void find_pragmas(char * orig_buffer, char * buffer, items * pragmas)
{
  int lbegin, lend, index, n;
  char * token, * line;
  pragma_type ptype;

  n = strlen(buffer);

  token = Malloc((n + 10) * sizeof(char));

  line = Malloc((n + 10) * sizeof(char));

  init_items(pragmas, 10);

  index = 0;
  while (1)
    {
      index = get_line(orig_buffer, buffer, n, index, &lbegin, &lend, line);
      if (index < 0)
	break;

      ptype = extract_pragma_name(line);

      if (ptype == OTHER)
	continue;

      add_item(pragmas, lbegin, lend, ptype);
    }
}
Ejemplo n.º 4
0
void select_branch(char * orig_buffer, char * buffer, 
		   element * Pragmas, items * deleted, int * selectors)
{
  init_items(deleted, 10);

  select_branch_internal(orig_buffer, buffer, Pragmas, deleted, selectors, 0);
}
Download::Download(client *client, QWidget *parent) :   
    QDialog(parent),
    ui(new Ui::Download),
    m_client(client)
{
    ui->setupUi(this);  
    init_items();
    getItems();    
}
Ejemplo n.º 6
0
/* retreive a simple list (.pool, .client) and store it into items */
void get_items(const char *what)
{
   init_items();

   UA_sock->fsend("%s", what);
   while (UA_sock->recv() > 0) {
      strip_trailing_junk(UA_sock->msg);
      items->list.append(bstrdup(UA_sock->msg));
   }
}
Ejemplo n.º 7
0
Model::Model(){
    tf = new Tile_factory();
    peach = new Hero(6,2,tf->tile_vector(HERO), HERO, 53, 4);
    init_map();
    init_items();
    init_player_info();
    init_bonus();
    init_monsters();
    init_sounds();
    std::sort(elements.begin(), elements.end(), ElementCompare());
    end_message = new QGraphicsTextItem("Congratulations!");
    end_message->setFont(*peach_font);

}
Ejemplo n.º 8
0
ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container *container, const game_driver *driver) : ui_menu(machine, container)
{
	image_interface_iterator iter(machine.root_device());
	for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next())
	{
		if (image->filename())
		{
			m_list = strensure(image->software_list_name());
			m_short = strensure(image->software_entry()->shortname());
			m_long = strensure(image->software_entry()->longname());
			m_parent = strensure(image->software_entry()->parentname());
		}
	}
	m_driver = (driver == nullptr) ? &machine.system() : driver;

	init_items();
}
Ejemplo n.º 9
0
static void	init_game(s_game	**game,
			  int		nb_players,
			  char		*custom_music)
{
  s_game	*tmp = NULL;
  int		i = 0;

  tmp = malloc(sizeof (struct s_game));
  tmp->screen = SDL_SetVideoMode(LARGEUR, HAUTEUR, 32, SDL_HWSURFACE);
  tmp->bomb = IMG_Load("/u/all/peccau_s/public/data/bomb.png");
  tmp->fire[0] = IMG_Load("/u/all/peccau_s/public/data/node.png");
  tmp->fire[1] = IMG_Load("/u/all/peccau_s/public/data/fire_h.png");
  tmp->fire[2] = IMG_Load("/u/all/peccau_s/public/data/fire_v.png");
  tmp->fire[3] = IMG_Load("/u/all/peccau_s/public/data/fire_nend.png");
  tmp->fire[4] = IMG_Load("/u/all/peccau_s/public/data/fire_eend.png");
  tmp->fire[5] = IMG_Load("/u/all/peccau_s/public/data/fire_send.png");
  tmp->fire[6] = IMG_Load("/u/all/peccau_s/public/data/fire_wend.png");

  for (; i < MAX_CASE - 10; i++, tmp->l_bomb.ticks[i] = 0)
    ;
  tmp->help_s = IMG_Load("/u/all/peccau_s/public/data/help.png");
  tmp->help_r.x = 700;
  tmp->help_r.y = 325;
  tmp->pause = 0;
  tmp->trigger = 1;
  tmp->last_input = 0;
  tmp->current_time = 0;
  tmp->blink = 0;
  tmp->max_players = nb_players;
  tmp->custom_mus = custom_music;
  tmp->info = malloc(sizeof (s_game_info));
  tmp->info->sec = 0;
  tmp->info->min = 0;
  tmp->info->timer_sec_s = NULL;
  tmp->info->timer_sec_r = NULL;
  tmp->info->remain = END_GAME;
  for (i = 0; i < MAX_CASE; i++)
    tmp->l_bomb.p[i] = 0;
  for (i = 0; i < nb_players; i++)
      tmp->l_bomb.pnbb[i] = 1;
  init_font(tmp);
  init_items(tmp);
  *game = tmp;
  config_fonts(*game);
  (*game)->tab = create_grid(*game, nb_players);
}
Ejemplo n.º 10
0
Archivo: main.c Proyecto: Df458/Growgue
void init_game()
{
    WINDOW* map_win = newwin(24, 80, 0, 0);
    WINDOW* area_win = newwin(6, 10, 0, 80);
    WINDOW* stats_win = newwin(8, 10, 6, 80);
    WINDOW* examine_win = newwin(10, 10, 14, 80);
    WINDOW* hp_win = newwin(1, 90, 24, 0);
    WINDOW* log_win = newwin(10, 90, 25, 0);

    dead = false;

    init_log(log_win);
    init_map(map_win);
    init_items();
    world = calloc(LEVEL_COUNT, sizeof(map*));
    world[0] = load_map("data/maps/farm.map", 78, 22, false, true);
    for(int i = 1; i < 3; ++i)
        world[i] = load_map("data/maps/easy_cave.map", 80 + 10 * (i - 1), 24 + 4 * (i - 1), true, true);
    for(int i = 3; i < 5; ++i)
        world[i] = load_map("data/maps/mid_cave.map", 80 + 10 * (i - 1), 24 + 4 * (i - 1), true, true);
    for(int i = 5; i < 7; ++i)
        world[i] = load_map("data/maps/hard_cave.map", 80 + 15 * (i - 1), 24 + 6 * (i - 1), true, true);
    for(int i =7; i < 9; ++i)
        world[i] = load_map("data/maps/crazy_cave.map", 80 + 18 * (i - 1), 24 + 8 * (i - 1), true, true);
    world[LEVEL_COUNT - 1] = load_map("data/maps/final.map", 78, 22, true, false);
    init_player(map_win, stats_win, hp_win, area_win, examine_win, world[0]);
    int x, y;
    get_random_empty_tile(&x, &y, world[LEVEL_COUNT - 1]);
    spawn_item(x, y, "data/items/cat.item", world[LEVEL_COUNT - 1]);

    get_random_empty_tile(&x, &y, world[0]);
    player_set_position(x, y);
    draw_map(x, y, world[0]);
    add_message(COLOR_DEFAULT, "@ symbol, a brave young farmer, was out for a stroll on his farm when his cat Cuddles ran down into the gaping starcase to the deadly Caves of Consternation! @ symbol had been meaning to patch that up for a while, but hadn't gotten a chance yet. Don't judge.");
    if(ask_question(COLOR_SELECTION, "Will you help @ symbol retrieve his cat, Cuddles?"))
        add_message(COLOR_HP_GOOD, "Excellent! Get to it, then!");
    else {
        add_message(COLOR_HP_CRIT, "Well that was unexpected. Okay then, press q to quit to the main menu.");
        dead = true;
    }
    draw_log();
}
Ejemplo n.º 11
0
/**
* init_client(void)
*
* @brief Initializes client
* @param void
* @return void
*/
void init_client(void)
{
	printf("Initializing Data. \n");

	check_dir(LOG_PATH);
	check_tiles();
	check_sprites();
	check_items();
	check_spells();

	init_items();
	_sleep(100);
	init_maps();
	init_npcs();
	init_shops();
	init_spells();
	init_players();

	printf("Data Initialized. \n");
}
Ejemplo n.º 12
0
/* fill the items list with the output of the help command */
void get_arguments(const char *what)
{
   regex_t preg;
   POOLMEM *buf;
   int rc;
   init_items();

   rc = regcomp(&preg, "(([a-z_]+=)|([a-z]+)( |$))", REG_EXTENDED);
   if (rc != 0) {
      return;
   }

   buf = get_pool_memory(PM_MESSAGE);
   UA_sock->fsend(".help item=%s", what);
   while (UA_sock->recv() > 0) {
      strip_trailing_junk(UA_sock->msg);
      match_kw(&preg, UA_sock->msg, UA_sock->msglen, &buf);
   }
   free_pool_memory(buf);
   regfree(&preg);
}
Ejemplo n.º 13
0
void TSOFinder::on_itemadventurecheckBox_stateChanged(int is_checked)
{
    if(is_checked) config.useitems_adventure = true;
    else config.useitems_adventure = false;
    init_items();
}
Ejemplo n.º 14
0
void TSOFinder::on_itembasiccheckBox_stateChanged(int is_checked)
{
    if(is_checked) config.useitems_basic = true;
    else config.useitems_basic = false;
    init_items();
}
Ejemplo n.º 15
0
MENU* init_menu(char** menu_choices) {
	int c;				
	MENU *my_menu;
	my_menu = new_menu((ITEM **)init_items(menu_choices));
	return my_menu;
}
Ejemplo n.º 16
0
void TSOFinder::on_itemeventcomboBox_activated(int index)
{
    config.use_event = index;
    init_items();
}
Ejemplo n.º 17
0
Archivo: main.cpp Proyecto: opcow/Snake
int main( int argc, char* args[] )
{
    CSnake * snake;
    int snake_x, snake_y;
    unsigned char snake_hit;
    int k = 1, sb_toggle = 0;
    Uint32 delay = 10;
    bool bQuit = false;

    score = 0;

    srand((unsigned)time( NULL ));
    init();
    init_items();
    init_snake();
    init_score();

    theMap = new CSnakeMap(mapWidth, mapHeight, map_surface);
    theMap->AddTiles(map_tex, types_end);

    init_map(theMap);

    snake = new CSnake(mapWidth / 2, mapHeight / 2, 0, map_surface, snake_tex);
    snake->Grow(-1, 0);
    snake->Grow(-1, 0);
    snake->Draw();
    do_move(snake, RIGHT);

    place_food(theMap, 1);
    theMap->Draw();

    print_score();
    draw_screen();

    while (!quitcheck())
    {
        if (bQuit)
            break;
        k = getInput();
        if (k == QUIT)
            break;
        if (k >= LEFT && k <= DOWN)
            do_move(snake, k);
        if (collision(snake))
            break;
        if (!checkMap(snake))
            break;
        //theMap->Draw();
        draw_screen();
    }
    SDL_Rect r; r.x = 128; r.y = 256, r.w = 512, r.h = 256;
    SDL_BlitSurface( message, NULL, map_surface, &r );
    draw_screen();
    SDL_Delay(2000);
    SDL_FreeSurface(message);

    delete snake;
    cleanup();
 
    return 0;
}
Ejemplo n.º 18
0
int main() {
	//current dungeon level
	int level=1;

	srand((unsigned)time(NULL));
	init_curses();
	init_map();
	init_ents(level);
	init_items();

	//the player's coordinates
	int *y=&ent_l[0].y;
	int *x=&ent_l[0].x;

	//last key pressed
	chtype key=0;
	do {
		//move player
		if ('8'==key)//up
			move_to(y,x,-1,0);
		if ('2'==key)//down
			move_to(y,x,1,0);
		if ('4'==key)//left
			move_to(y,x,0,-1);
		if ('6'==key)//right
			move_to(y,x,0,1);
		if ('7'==key)//upper left
			move_to(y,x,-1,-1);
		if ('9'==key)//upper right
			move_to(y,x,-1,1);
		if ('1'==key)//lower left
			move_to(y,x,1,-1);
		if ('3'==key)//lower right
			move_to(y,x,1,1);
		if (('<'==key || ','==key) && NEXT_LEVEL==map[*y][*x].type) {
			if (++level>LAST_LEVEL)
				you_won();
			init_map();
			init_ents(level);
			init_items();
		}
		//move living enemies in the player's direction
		for (int e=1;e<ENTS_;e++) {
			if (ent_l[e].hp>0)
				move_enemy(&ent_l[e],&ent_l[0]);
		}

		//use unused item if the player is standing on one
		item* ci=item_m[*y][*x];
		if (NULL!=ci && !ci->used) {
			//heal hp
			if (MED_PACK==ci->type && ent_l[0].hp<PLAYER_HP) {
				ent_l[0].hp=min(ent_l[0].hp+MED_CHARGE,PLAYER_HP);
				ci->used=true;
			}
			//replenish air
			if (AIR_CAN==ci->type && ent_l[0].air<PLAYER_AIR) {
				ent_l[0].air=min(ent_l[0].air+AIR_CHARGE,PLAYER_AIR);
				ci->used=true;
			}
		}

		//mark last turn's field of view as SEEN
		for (int yy=0;yy<Y_;yy++)
			for (int xx=0;xx<X_;xx++)
				if (IN_SIGHT==view_m[yy][xx])
					view_m[yy][xx]=SEEN;
		//mark current field of view as IN_SIGHT
		fov(*y,*x, FOV_RADIUS);

		//draw map
		for (int yy=0; yy<Y_; yy++) {
			for (int xx=0; xx<X_ ;xx++) {
				chtype tile=map[yy][xx].type;
				if (IN_SIGHT==view_m[yy][xx]) {
					mvaddch(yy,xx,tile);
				} else if (SEEN==view_m[yy][xx]) {
					if (WALL==tile)
						mvaddch(yy,xx,tile);
					else
						mvaddch(yy,xx,' ');
				} else {
					mvaddch(yy,xx,' ');
				}
			}
		}
		//draw items
		for (int i=0; i<ITEMS_; i++) {
			if (!item_l[i].used && view_m[item_l[i].y][item_l[i].x]==IN_SIGHT)
				mvaddch(item_l[i].y,item_l[i].x,item_l[i].type);
		}
		//draw entities
		for (int e=0; e<ENTS_; e++) {
			if (ent_l[e].hp>0 && view_m[ent_l[e].y][ent_l[e].x]==IN_SIGHT)
				mvaddch(ent_l[e].y,ent_l[e].x,ent_l[e].type);
		}

		print_info(level);
		ent_l[0].air--;
		key=getch();
	} //exit when the player is dead or when ESC or q are pressed
	while (ent_l[0].hp>0 && ent_l[0].air>0 && ESC!=key && 'q'!=key);
	you_lost();
}