コード例 #1
0
ファイル: gui.c プロジェクト: NoctuaNivalis/Bomberman
void gui_add_bomb(Bomb * bomb)
{
	if(!ready) {
		printf("gui error: Please call the initialize method first!");
	} else {
		if(bomb->x < MAX_LEVEL_WIDTH*TILE_SIZE && bomb->y < MAX_LEVEL_HEIGHT*TILE_SIZE) {
			char* cmd = create_cmd_string("BOMB ");
			append_coord(cmd, bomb->x, bomb->y, 0);
			enqueue(&cmd_queue, cmd);
		}
	}
}
コード例 #2
0
ファイル: gui.c プロジェクト: NoctuaNivalis/Bomberman
void gui_add_obstacle(Obstacle * obstacle) 
{
	if(!ready) {
		printf("gui error: Please call the initialize method first!");
	} else {
		if(obstacle->x < MAX_LEVEL_WIDTH*TILE_SIZE && obstacle->y < MAX_LEVEL_HEIGHT*TILE_SIZE) {
			char* cmd = create_cmd_string("OBSTACLE ");
			append_coord(cmd, obstacle->x, obstacle->y, 0);
			enqueue(&cmd_queue, cmd);
		}
	}
}
コード例 #3
0
ファイル: gui.c プロジェクト: NoctuaNivalis/Bomberman
void gui_add_player(Player * player)
{
	if(!ready) {
		printf("gui error: Please call the initialize method first!");
	} else {
		if(player->x < MAX_LEVEL_WIDTH*TILE_SIZE && player->y < MAX_LEVEL_HEIGHT*TILE_SIZE) {
			char* cmd = create_cmd_string("PLAYER ");
			append_coord(cmd, player->x, player->y, 1);
			append_orientation(cmd, player->orientation);
			enqueue(&cmd_queue, cmd);
		}
	}
}
コード例 #4
0
ファイル: algos_sha1.c プロジェクト: emcconville/VizSum
void algo_populate_sha1(struct context_heap * c, unsigned long flags)
{
    int i;
    struct sha1_map * map_ptr;
    struct hue_map * map_hue_ptr;
    unsigned char sha1_digest[SHA1_DIGEST_SIZE];
    algo_hash_sha1(sha1_digest);
    if ( flags ) {
        for ( i=0; i < 6; i++ ) {
            map_hue_ptr = (struct hue_map *)(sha1_digest + (sizeof(struct hue_map) * i));
            append_coord(c, &map_hue_ptr->v);
            append_hue(c, map_hue_ptr->h);
        }
    } else {
        for ( i = 0; i < 2; i++) {
            map_ptr = (struct sha1_map *)(sha1_digest + (sizeof(struct sha1_map) * i));
            append_coord(c, &map_ptr->v1);
            append_color(c, &map_ptr->c1);
            append_coord(c, &map_ptr->v2);
            append_color(c, &map_ptr->c2);
        }
    }
}
コード例 #5
0
ファイル: gui.c プロジェクト: NoctuaNivalis/Bomberman
/* tekent 'kruis' van bepaalde grootte, gui checkt voor randen */
void gui_add_explosion_tile(int x, int y, int intensity)
{
	if(!ready) {
		printf("gui error: Please call the initialize method first!");
	} else {
		if(x < MAX_LEVEL_WIDTH*TILE_SIZE && y < MAX_LEVEL_HEIGHT*TILE_SIZE) {
			char power_str[8];
			char* cmd = create_cmd_string("EXPLOSION ");
			append_coord(cmd, x, y, 1);
			sprintf(power_str, "%d", intensity);
			append_str(cmd, power_str);
			enqueue(&cmd_queue, cmd);
		}
	}
}
コード例 #6
0
ファイル: gui.c プロジェクト: NoctuaNivalis/Bomberman
void gui_add_powerup(Powerup *  powerup) 
{
	if(!ready) {
		printf("gui error: Please call the initialize method first!");
	} else {
		if(powerup->x < MAX_LEVEL_WIDTH*TILE_SIZE && powerup->y < MAX_LEVEL_HEIGHT*TILE_SIZE) {
			char* cmd = create_cmd_string("POWERUP ");
			append_coord(cmd, powerup->x, powerup->y, 1);
			if(powerup->powerup_type == EXTRA_POWER) {
				append_str(cmd, "normal");
			} else if(powerup->powerup_type == EXTRA_BOMB) {
				append_str(cmd, "extra_bomb");
			} else if(powerup->powerup_type == FREEZE_ENEMIES) {
				append_str(cmd, "freeze_enemies");
			}
			enqueue(&cmd_queue, cmd);
		}
	}
}
コード例 #7
0
ファイル: gui.c プロジェクト: NoctuaNivalis/Bomberman
void gui_add_enemy(Enemy * enemy) 
{
	if(!ready) {
		printf("gui error: Please call the initialize method first!");
	} else {
		if(enemy->x < MAX_LEVEL_WIDTH*TILE_SIZE && enemy->y < MAX_LEVEL_HEIGHT*TILE_SIZE) {
			char* cmd = create_cmd_string("NPC ");
			append_coord(cmd, enemy->x, enemy->y, 1);
			if(!enemy->is_boss) {
				append_str(cmd, "critter ");
			} else {
				append_str(cmd, "boss ");
			}
			append_orientation(cmd, enemy->move_direction);
			if(enemy->frozen) {
				append_str(cmd, " frozen");
			}
			enqueue(&cmd_queue, cmd);
		}
	}
}