Question: #include #include #include void init(); void deinit(); void param_house(int width, int height, int roof_height, int door_height, int door_width, int wall_color, int roof_color, int door_color); int

#include
#include
#include
void init();
void deinit();
void param_house(int width, int height, int roof_height, int door_height, int door_width, int wall_color, int roof_color, int door_color);
int main() {
init();
srand(time(NULL)); // initialize random seed
while (!key[KEY_ESC]) {
clear_to_color(screen, makecol(0, 0, 255)); // blue sky
rectfill(screen, 0, 599, 799, 200, makecol(0, 255, 0)); // green lawn
int x = 50, y = 350;
int min_distance = 150; // minimum distance between houses
// generate random houses
for (int i = 0; i
// generate random house parameters
int width = rand() % 150 + 100;
int height = rand() % 100 + 150;
int roof_height = rand() % 50 + 50;
int door_height = rand() % 50 + 70;
int door_width = rand() % 30 + 20;
int wall_color = makecol(rand() % 256, rand() % 256, rand() % 256);
int roof_color = makecol(rand() % 256, rand() % 256, rand() % 256);
int door_color = makecol(rand() % 256, rand() % 256, rand() % 256);
// check for collision with previous houses
int collided = 0;
for (int j = 0; j
if (abs(x - (50 + j * (min_distance + width)))
collided = 1;
break;
}
}
// draw house if no collision
if (!collided) {
param_house(x, y, width, height, roof_height, door_height, door_width, wall_color, roof_color, door_color);
}
// move to next house position
x += min_distance + width;
}
rest(50); // sleep for 50 ms to avoid high CPU usage
}
deinit();
return 0;
}
END_OF_MAIN()
void init() {
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);
if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
/* add other initializations here */
}
void deinit() {
clear_keybuf();
/* add other deinitializations here */
}
void param_house(int x, int y, int width, int height, int roof_height, int door_height, int door_width, int wall_color, int roof_color, int door_color) {
int roof[] = { x, y - roof_height, x + width, y - roof_height, x + width * 0.8, y - roof_height - width * 0.3, x + width * 0.2, y - roof_height - width * 0
}
int wall[] = { x, y, x + width, y, x + width, y - height, x, y - height };
int door[] = { x + width / 2 - door_width / 2, y, x + width / 2 + door_width / 2, y, x + width / 2 + door_width / 2, y - door_height, x + width / 2 - door_width / 2, y - door_height };
// draw roof
triangle(screen, roof[0], roof[1], roof[2], roof[3], roof[4], roof[5], roof_color);
triangle(screen, roof[0], roof[1], roof[6], roof[7], roof[4], roof[5], roof_color);
// draw wall
rectfill(screen, wall[0], wall[1], wall[2], wall[5], wall_color);
// draw door
rectfill(screen, door[0], door[1], door[2], door[5], door_color);
}
Message In function 'int_mangled_main(]': too many arguments to function 'void param_house(int, int, int, int, int, int, int, int)' at this point in file In function "void param_house[int, int, int, int, int, int, int, int, int, int)': [Warning] converting to 'int' from 'double' [Warning] converting to 'int' from 'double' [Warning] converting to 'int' from 'double' expected " or ", before "int" 'wall' undeclared (first use this function) [Each undeclared identifier is reported only once for each function it appears in.) [Build Error] [main.o] Error 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
