changed some things on default window size

This commit is contained in:
anselme16 2015-01-22 13:08:07 +01:00
parent 5e3bb43576
commit 0a75bce02f
2 changed files with 13 additions and 5 deletions

13
main.c
View File

@ -54,6 +54,7 @@ void updateTeam(t_team team){
int i; int i;
for(i=0; i<team.nb_dudes; i++){ for(i=0; i<team.nb_dudes; i++){
current_dude = team.dudes + i;
team.dudes[i].action = team.update((void*)(team.dudes[i].custom_data), (void*)(team.dudes[i].com_data), team.dudes[i].success); team.dudes[i].action = team.update((void*)(team.dudes[i].custom_data), (void*)(team.dudes[i].com_data), team.dudes[i].success);
} }
@ -193,10 +194,12 @@ void handleAction(t_dude* dude){
map[target_pos.x][target_pos.y].data = NULL; map[target_pos.x][target_pos.y].data = NULL;
putpixel(img, target_pos.x, target_pos.y, getColor(map[target_pos.x][target_pos.y])); putpixel(img, target_pos.x, target_pos.y, getColor(map[target_pos.x][target_pos.y]));
} }
dude->success = 1;
}else }else
dude->success = 0; dude->success = 0;
break; break;
case PUT : case PUT :
dude->success = 1;
if(dude->inventory != -1 && (target.type == GRASS || target.type == MARK || target.type == dude->inventory)){ if(dude->inventory != -1 && (target.type == GRASS || target.type == MARK || target.type == dude->inventory)){
if(target.type == GRASS || target.type == MARK){ if(target.type == GRASS || target.type == MARK){
map[target_pos.x][target_pos.y].type = dude->inventory; map[target_pos.x][target_pos.y].type = dude->inventory;
@ -327,6 +330,7 @@ void handleAction(t_dude* dude){
dude->success = 1; dude->success = 1;
break; break;
default : default :
dude->success = 0;
break; break;
} }
break; break;
@ -395,7 +399,7 @@ int MAIN
int paused = 0; int paused = 0;
int x_offset = 0; int x_offset = 0;
int y_offset = 0; int y_offset = 0;
int zoom_level = 1; int zoom_level = DEFAULT_STARTING_ZOOM;
int over = 0; int over = 0;
int time = 0; int time = 0;
int wait_time = 100; int wait_time = 100;
@ -404,6 +408,8 @@ int MAIN
int fullscreen = 0; int fullscreen = 0;
int width = DEFAULT_GAME_WIDTH; int width = DEFAULT_GAME_WIDTH;
int height = DEFAULT_GAME_HEIGHT; int height = DEFAULT_GAME_HEIGHT;
int disp_width = DEFAULT_WINDOW_WIDTH;
int disp_height = DEFAULT_WINDOW_HEIGHT;
#ifndef _WIN32 #ifndef _WIN32
argv++; argv++;
@ -415,9 +421,11 @@ int MAIN
break; break;
case 'w' : case 'w' :
width = atoi(argv[0]+2); width = atoi(argv[0]+2);
disp_width = 2*width;
break; break;
case 'h' : case 'h' :
height = atoi(argv[0]+2); height = atoi(argv[0]+2);
disp_height = 2*height;
break; break;
default : default :
break; break;
@ -427,7 +435,7 @@ int MAIN
} }
#endif #endif
screen = initSDL(width, height, fullscreen); screen = initSDL(disp_width, disp_height, fullscreen);
initWorld(width, height); initWorld(width, height);
SDL_Flip(img); SDL_Flip(img);
@ -504,7 +512,6 @@ int MAIN
spawnDudes(); spawnDudes();
for(i=0; i<NB_TEAMS; i++) for(i=0; i<NB_TEAMS; i++)
updateTeam(teams[i]); updateTeam(teams[i]);
// resolve_fights(); // TODO : debugging
resolve_moves(); resolve_moves();
remaining_time = wait_time; remaining_time = wait_time;

5
main.h
View File

@ -15,8 +15,9 @@
#define STACK_SIZE 5 #define STACK_SIZE 5
#define DEFAULT_GAME_WIDTH 400 #define DEFAULT_GAME_WIDTH 400
#define DEFAULT_GAME_HEIGHT 250 #define DEFAULT_GAME_HEIGHT 250
#define DEFAULT_WINDOW_WIDTH 400 #define DEFAULT_WINDOW_WIDTH 800
#define DEFAULT_WINDOW_HEIGHT 250 #define DEFAULT_WINDOW_HEIGHT 500
#define DEFAULT_STARTING_ZOOM 2
#define NB_STARTING_FOOD 5 #define NB_STARTING_FOOD 5
#define SPAWN_COOLDOWN 30 #define SPAWN_COOLDOWN 30