From 36cc92dc67c4cfdaceed7d47a4aa6992b407d1df Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Mon, 22 Mar 2004 15:47:31 +0000 Subject: [PATCH] - replaced YES/NO with true/false SVN-Revision: 322 --- src/badguy.cpp | 51 +++++++++++---------- src/badguy.h | 4 +- src/button.cpp | 18 ++++---- src/button.h | 10 ++--- src/collision.cpp | 111 ++++++++++++++++++++------------------------- src/collision.h | 8 ++-- src/defines.h | 13 +++--- src/gameloop.cpp | 126 ++++++++++++++++++++++------------------------------ src/gameloop.h | 10 ++--- src/globals.cpp | 6 ++- src/globals.h | 6 ++- src/intro.cpp | 2 +- src/leveleditor.cpp | 106 +++++++++++++++++++++---------------------- src/menu.cpp | 44 +++++++++--------- src/menu.h | 4 +- src/physic.cpp | 5 +-- src/player.cpp | 121 ++++++++++++++++++++++--------------------------- src/player.h | 48 ++++++++++---------- src/scene.cpp | 15 +++++-- src/scene.h | 12 ++++- src/setup.cpp | 96 +++++++++++++++++++-------------------- src/sound.cpp | 14 +++--- src/special.cpp | 4 +- src/timer.cpp | 22 ++++----- src/timer.h | 2 +- src/title.cpp | 8 ++-- src/world.cpp | 4 +- 27 files changed, 418 insertions(+), 452 deletions(-) diff --git a/src/badguy.cpp b/src/badguy.cpp index 1d69e845d..50295116a 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -35,7 +35,7 @@ void badguy_init(bad_guy_type* pbad, float x, float y, int kind) pbad->base.width = 32; pbad->base.height = 32; pbad->mode = NORMAL; - pbad->dying = NO; + pbad->dying = DYING_NOT; pbad->kind = kind; pbad->base.x = x; pbad->base.y = y; @@ -43,8 +43,8 @@ void badguy_init(bad_guy_type* pbad, float x, float y, int kind) pbad->base.ym = 4.8; pbad->old_base = pbad->base; pbad->dir = LEFT; - pbad->seen = NO; - timer_init(&pbad->timer,YES); + pbad->seen = false; + timer_init(&pbad->timer, true); physic_init(&pbad->physic); } @@ -58,9 +58,8 @@ void badguy_action(bad_guy_type* pbad) /* --- BLUE SCREEN OF DEATH MONSTER: --- */ /* Move left/right: */ - - if (pbad->dying == NO || - pbad->dying == FALLING) + if (pbad->dying == DYING_NOT || + pbad->dying == DYING_FALLING) { if (pbad->dir == RIGHT) pbad->base.x = pbad->base.x + pbad->base.xm * frame_ratio; @@ -73,7 +72,7 @@ void badguy_action(bad_guy_type* pbad) pbad->base.y = pbad->base.y + pbad->base.ym * frame_ratio; - if (pbad->dying != FALLING) + if (pbad->dying != DYING_FALLING) collision_swept_object_map(&pbad->old_base,&pbad->base); if (pbad->base.y > screen->h) bad_guys.erase(static_cast::iterator>(pbad)); @@ -94,7 +93,7 @@ void badguy_action(bad_guy_type* pbad) /* Fall if we get off the ground: */ - if (pbad->dying != FALLING) + if (pbad->dying != DYING_FALLING) { if (!issolid(pbad->base.x+16, pbad->base.y + 32)) { @@ -139,8 +138,8 @@ void badguy_action(bad_guy_type* pbad) if (pbad->mode == NORMAL || pbad->mode == KICK) { - if (pbad->dying == NO || - pbad->dying == FALLING) + if (pbad->dying == DYING_NOT || + pbad->dying == DYING_FALLING) { if (pbad->dir == RIGHT) pbad->base.x = pbad->base.x + pbad->base.xm * frame_ratio; @@ -188,7 +187,7 @@ void badguy_action(bad_guy_type* pbad) if(pbad->mode != HELD) pbad->base.y = pbad->base.y + pbad->base.ym * frame_ratio; - if (pbad->dying != FALLING) + if (pbad->dying != DYING_FALLING) collision_swept_object_map(&pbad->old_base,&pbad->base); if (pbad->base.y > screen->h) bad_guys.erase(static_cast::iterator>(pbad)); @@ -224,7 +223,7 @@ void badguy_action(bad_guy_type* pbad) /* Fall if we get off the ground: */ - if (pbad->dying != FALLING) + if (pbad->dying != DYING_FALLING) { if (!issolid(pbad->base.x+16, pbad->base.y + 32)) { @@ -272,7 +271,7 @@ void badguy_action(bad_guy_type* pbad) pbad->base.y = pbad->base.y + pbad->base.ym * frame_ratio; - if (pbad->dying != FALLING) + if (pbad->dying != DYING_FALLING) collision_swept_object_map(&pbad->old_base,&pbad->base); if (pbad->base.y > screen->h) @@ -284,7 +283,7 @@ void badguy_action(bad_guy_type* pbad) physic_set_start_vy(&pbad->physic,0.); } - if (pbad->dying != FALLING) + if (pbad->dying != DYING_FALLING) { if(issolid(pbad->base.x, pbad->base.y + 32)) { @@ -339,7 +338,7 @@ void badguy_action(bad_guy_type* pbad) /* Handle dying timer: */ - if (pbad->dying == SQUISHED) + if (pbad->dying == DYING_SQUISHED) { /* Remove it if time's up: */ if(!timer_check(&pbad->timer)) @@ -356,7 +355,7 @@ void badguy_action(bad_guy_type* pbad) /* Once it's on screen, it's activated! */ if (pbad->base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) - pbad->seen = YES; + pbad->seen = true; } /*}*/ } @@ -370,7 +369,7 @@ void badguy_draw(bad_guy_type* pbad) { /* --- BLUE SCREEN OF DEATH MONSTER: --- */ - if (pbad->dying == NO) + if (pbad->dying == DYING_NOT) { /* Alive: */ @@ -389,7 +388,7 @@ void badguy_draw(bad_guy_type* pbad) NO_UPDATE); } } - else if (pbad->dying == FALLING) + else if (pbad->dying == DYING_FALLING) { /* Falling: */ @@ -408,7 +407,7 @@ void badguy_draw(bad_guy_type* pbad) NO_UPDATE); } } - else if (pbad->dying == SQUISHED) + else if (pbad->dying == DYING_SQUISHED) { /* Dying - Squished: */ @@ -432,7 +431,7 @@ void badguy_draw(bad_guy_type* pbad) { /* --- LAPTOP MONSTER: --- */ - if (pbad->dying == NO) + if (pbad->dying == DYING_NOT) { /* Alive: */ @@ -475,7 +474,7 @@ void badguy_draw(bad_guy_type* pbad) } } } - else if (pbad->dying == FALLING) + else if (pbad->dying == DYING_FALLING) { /* Falling: */ @@ -545,7 +544,7 @@ void badguy_collision(bad_guy_type* pbad, void *p_c_object, int c_object) switch (c_object) { case CO_BULLET: - pbad->dying = FALLING; + pbad->dying = DYING_FALLING; pbad->base.ym = -8; /* Gain some points: */ @@ -574,15 +573,15 @@ void badguy_collision(bad_guy_type* pbad, void *p_c_object, int c_object) /* We're in kick mode, kill the other guy and yourself(wuahaha) : */ - pbad_c->dying = FALLING; + pbad_c->dying = DYING_FALLING; pbad_c->base.ym = -8; play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); add_score(pbad->base.x - scroll_x, pbad->base.y, 100); - pbad_c->dying = FALLING; + pbad_c->dying = DYING_FALLING; - pbad->dying = FALLING; + pbad->dying = DYING_FALLING; pbad->base.ym = -8; add_score(pbad_c->base.x - scroll_x, @@ -595,7 +594,7 @@ void badguy_collision(bad_guy_type* pbad, void *p_c_object, int c_object) { if (pbad->kind == BAD_BSOD) { - pbad->dying = SQUISHED; + pbad->dying = DYING_SQUISHED; timer_start(&pbad->timer,4000); physic_set_state(&pplayer_c->vphysic,PH_VT); physic_set_start_vy(&pplayer_c->vphysic,2.); diff --git a/src/badguy.h b/src/badguy.h index 0acdcea6c..60b74c308 100644 --- a/src/badguy.h +++ b/src/badguy.h @@ -33,9 +33,9 @@ typedef struct bad_guy_type { int mode; - int dying; + DyingType dying; int kind; - int seen; + bool seen; int dir; int frame; base_type base; diff --git a/src/button.cpp b/src/button.cpp index 93801588d..c13439e2f 100644 --- a/src/button.cpp +++ b/src/button.cpp @@ -51,7 +51,7 @@ void button_load(button_type* pbutton,char* icon_file, char* info, SDLKey shortc pbutton->h = pbutton->icon.h; pbutton->tag = -1; pbutton->state = BUTTON_NONE; - pbutton->show_info = NO; + pbutton->show_info = false; pbutton->bkgd = NULL; } @@ -90,7 +90,7 @@ void button_draw(button_type* pbutton) texture_draw(pbutton->bkgd,pbutton->x,pbutton->y,NO_UPDATE); } texture_draw(&pbutton->icon,pbutton->x,pbutton->y,NO_UPDATE); - if(pbutton->show_info == YES) + if(pbutton->show_info) { char str[80]; int i = -32; @@ -130,7 +130,7 @@ void button_event(button_type* pbutton, SDL_Event *event) } else { - pbutton->show_info = YES; + pbutton->show_info = true; } } else if(event->type == SDL_MOUSEBUTTONUP) @@ -141,7 +141,7 @@ void button_event(button_type* pbutton, SDL_Event *event) } else if(event->button.button != SDL_BUTTON_LEFT && pbutton->state != BUTTON_PRESSED) { - pbutton->show_info = YES; + pbutton->show_info = true; } } @@ -155,7 +155,7 @@ void button_event(button_type* pbutton, SDL_Event *event) pbutton->state = BUTTON_NONE; if(pbutton->show_info) { - pbutton->show_info = NO; + pbutton->show_info = false; } } @@ -174,7 +174,7 @@ void button_event(button_type* pbutton, SDL_Event *event) if(pbutton->show_info) { - pbutton->show_info = NO; + pbutton->show_info = false; } } } @@ -202,12 +202,12 @@ void button_panel_init(button_panel_type* pbutton_panel, int x, int y, int w, in pbutton_panel->y = y; pbutton_panel->w = w; pbutton_panel->h = h; - pbutton_panel->hidden = NO; + pbutton_panel->hidden = false; } button_type* button_panel_event(button_panel_type* pbutton_panel, SDL_Event* event) { - if(pbutton_panel->hidden == NO) + if(pbutton_panel->hidden == false) { int i; for(i = 0; i < pbutton_panel->num_items; ++i) @@ -237,7 +237,7 @@ void button_panel_free(button_panel_type* pbutton_panel) void button_panel_draw(button_panel_type* pbutton_panel) { - if(pbutton_panel->hidden == NO) + if(pbutton_panel->hidden == false) { int i; fillrect(pbutton_panel->x,pbutton_panel->y,pbutton_panel->w,pbutton_panel->h,100,100,100,200); diff --git a/src/button.h b/src/button.h index 90285687c..ee86dfede 100644 --- a/src/button.h +++ b/src/button.h @@ -28,11 +28,11 @@ typedef struct button_type texture_type* bkgd; char *info; SDLKey shortcut; - int x; - int y; - int w; - int h; - int show_info; + int x; + int y; + int w; + int h; + bool show_info; ButtonState state; int tag; } diff --git a/src/collision.cpp b/src/collision.cpp index 95ceae992..82be6bcd4 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -15,38 +15,23 @@ #include "bitmask.h" #include "scene.h" -int rectcollision(base_type* one, base_type* two) +bool rectcollision(base_type* one, base_type* two) { - - if (one->x >= two->x - one->width + 1 && - one->x <= two->x + two->width - 1 && - one->y >= two->y - one->height + 1&& - one->y <= two->y + two->height - 1) - { - return YES; - } - else - { - return NO; - } + return (one->x >= two->x - one->width + 1 && + one->x <= two->x + two->width - 1 && + one->y >= two->y - one->height + 1 && + one->y <= two->y + two->height - 1); } -int rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y) +bool rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y) { - if (one->x >= two->x - one->width +off_x + 1 && - one->x <= two->x + two->width + off_x - 1 && - one->y >= two->y - one->height + off_y + 1 && - one->y <= two->y + two->height + off_y - 1) - { - return YES; - } - else - { - return NO; - } + return (one->x >= two->x - one->width +off_x + 1 && + one->x <= two->x + two->width + off_x - 1 && + one->y >= two->y - one->height + off_y + 1 && + one->y <= two->y + two->height + off_y - 1); } -int collision_object_map(base_type* pbase) +bool collision_object_map(base_type* pbase) { int v,h,i; @@ -57,36 +42,36 @@ int collision_object_map(base_type* pbase) issolid(pbase->x + pbase->width -1, pbase->y + 1) || issolid(pbase->x +1, pbase->y + pbase->height -1) || issolid(pbase->x + pbase->width -1, pbase->y + pbase->height - 1)) - return YES; + return true; for(i = 1; i < h; ++i) { if(issolid(pbase->x + i*16,pbase->y + 1)) - return YES; + return true; } for(i = 1; i < h; ++i) { if( issolid(pbase->x + i*16,pbase->y + pbase->height - 1)) - return YES; + return true; } for(i = 1; i < v; ++i) { if( issolid(pbase->x + 1, pbase->y + i*16)) - return YES; + return true; } for(i = 1; i < v; ++i) { if( issolid(pbase->x + pbase->width - 1, pbase->y + i*16)) - return YES; + return true; } - return NO; + return false; } -int collision_swept_object_map(base_type* old, base_type* current) +void collision_swept_object_map(base_type* old, base_type* current) { int steps; /* Used to speed up the collision tests, by stepping every 16pixels in the path. */ int h; @@ -101,7 +86,7 @@ int collision_swept_object_map(base_type* old, base_type* current) if(old->x == current->x && old->y == current->y) { - return 0; + return; } else if(old->x == current->x && old->y != current->y) { @@ -118,7 +103,6 @@ int collision_swept_object_map(base_type* old, base_type* current) h = 1; xd = 0; - } else if(old->x != current->x && old->y == current->y) { @@ -218,7 +202,6 @@ int collision_swept_object_map(base_type* old, base_type* current) } *old = *current; -return 0; } void collision_handler() @@ -228,30 +211,30 @@ void collision_handler() /* CO_BULLET & CO_BADGUY check */ for(i = 0; i < bullets.size(); ++i) { - for(j = 0; j < bad_guys.size(); ++j) + for(j = 0; j < bad_guys.size(); ++j) + { + if(bad_guys[j].dying == DYING_NOT) { - if(bad_guys[j].dying == NO) + if(rectcollision(&bullets[i].base,&bad_guys[j].base)) { - if(rectcollision(&bullets[i].base,&bad_guys[j].base) == YES) - { - /* We have detected a collision and now call the collision functions of the collided objects. */ - bullet_collision(&bullets[i], CO_BADGUY); - badguy_collision(&bad_guys[j], &bullets[i], CO_BULLET); - } + /* We have detected a collision and now call the collision functions of the collided objects. */ + bullet_collision(&bullets[i], CO_BADGUY); + badguy_collision(&bad_guys[j], &bullets[i], CO_BULLET); } } + } } /* CO_BADGUY & CO_BADGUY check */ for(i = 0; i < bad_guys.size(); ++i) { - if(bad_guys[i].dying == NO) + if(bad_guys[i].dying == DYING_NOT) { for(j = i+1; j < bad_guys.size(); ++j) { - if(j != i && bad_guys[j].dying == NO) + if(j != i && !bad_guys[j].dying) { - if(rectcollision(&bad_guys[i].base,&bad_guys[j].base) == YES) + if(rectcollision(&bad_guys[i].base, &bad_guys[j].base)) { /* We have detected a collision and now call the collision functions of the collided objects. */ badguy_collision(&bad_guys[j], &bad_guys[i], CO_BADGUY); @@ -267,30 +250,30 @@ void collision_handler() /* CO_BADGUY & CO_PLAYER check */ for(i = 0; i < bad_guys.size(); ++i) { - if(bad_guys[i].dying == NO && rectcollision_offset(&bad_guys[i].base,&tux.base,0,0) == YES ) + if(bad_guys[i].dying == DYING_NOT && rectcollision_offset(&bad_guys[i].base,&tux.base,0,0)) + { + /* We have detected a collision and now call the collision functions of the collided objects. */ + if (tux.previous_base.y < tux.base.y && + tux.previous_base.y + tux.previous_base.height < bad_guys[i].base.y + bad_guys[i].base.height/2 && + bad_guys[i].kind != BAD_MONEY && bad_guys[i].mode != HELD) { - /* We have detected a collision and now call the collision functions of the collided objects. */ - if (tux.previous_base.y < tux.base.y && - tux.previous_base.y + tux.previous_base.height < bad_guys[i].base.y + bad_guys[i].base.height/2 && - bad_guys[i].kind != BAD_MONEY && bad_guys[i].mode != HELD) - { - badguy_collision(&bad_guys[i], &tux, CO_PLAYER); - } - else - { - player_collision(&tux, &bad_guys[i], CO_BADGUY); - } + badguy_collision(&bad_guys[i], &tux, CO_PLAYER); } + else + { + player_collision(&tux, &bad_guys[i], CO_BADGUY); + } + } } /* CO_UPGRADE & CO_PLAYER check */ for(i = 0; i < upgrades.size(); ++i) { - if(rectcollision(&upgrades[i].base,&tux.base) == YES) - { - /* We have detected a collision and now call the collision functions of the collided objects. */ - upgrade_collision(&upgrades[i], &tux, CO_PLAYER); - } + if(rectcollision(&upgrades[i].base,&tux.base)) + { + /* We have detected a collision and now call the collision functions of the collided objects. */ + upgrade_collision(&upgrades[i], &tux, CO_PLAYER); + } } } diff --git a/src/collision.h b/src/collision.h index 8f189042f..210559412 100644 --- a/src/collision.h +++ b/src/collision.h @@ -23,10 +23,10 @@ enum CO_PLAYER }; -int rectcollision(base_type* one, base_type* two); -int rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y); -int collision_swept_object_map(base_type* old, base_type* current); -int collision_object_map(base_type* object); +bool rectcollision(base_type* one, base_type* two); +bool rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y); +void collision_swept_object_map(base_type* old, base_type* current); +bool collision_object_map(base_type* object); /* Checks for all possible collisions. And calls the collision_handlers, which the collision_objects provide for this case (or not). */ diff --git a/src/defines.h b/src/defines.h index 5beafb0ce..97c7a7849 100644 --- a/src/defines.h +++ b/src/defines.h @@ -33,12 +33,6 @@ #define JOY_X 0 #define JOY_Y 1 - -/* Booleans: */ - -#define NO 0 -#define YES 1 - /* Direction (keyboard/joystick) states: */ #define UP 0 @@ -47,8 +41,11 @@ /* Dying types: */ /* ---- NO 0 */ -#define SQUISHED 1 -#define FALLING 2 +enum DyingType { + DYING_NOT = 0, + DYING_SQUISHED = 1, + DYING_FALLING = 2 +}; /* Hurt modes: */ diff --git a/src/gameloop.cpp b/src/gameloop.cpp index b7ac2df8d..8b362f380 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -41,7 +41,7 @@ /* extern variables */ st_level current_level; -int game_started = NO; +int game_started = false; /* Local variables: */ @@ -187,7 +187,7 @@ void game_event(void) } break; case SDLK_TAB: - if(debug_mode == YES) + if(debug_mode) { tux.size = !tux.size; if(tux.size == BIG) @@ -199,33 +199,33 @@ void game_event(void) } break; case SDLK_END: - if(debug_mode == YES) + if(debug_mode) distros += 50; break; case SDLK_SPACE: - if(debug_mode == YES) + if(debug_mode) next_level = 1; break; case SDLK_DELETE: - if(debug_mode == YES) + if(debug_mode) tux.got_coffee = 1; break; case SDLK_INSERT: - if(debug_mode == YES) + if(debug_mode) timer_start(&tux.invincible_timer,TUX_INVINCIBLE_TIME); break; case SDLK_l: - if(debug_mode == YES) + if(debug_mode) --tux.lives; break; case SDLK_s: - if(debug_mode == YES) + if(debug_mode) score += 1000; case SDLK_f: - if(debug_fps == YES) - debug_fps = NO; + if(debug_fps) + debug_fps = false; else - debug_fps = YES; + debug_fps = true; break; default: break; @@ -400,7 +400,7 @@ int game_action(void) /* Handle distro counting: */ - if (counting_distros == YES) + if (counting_distros) { distro_counter--; @@ -580,10 +580,10 @@ int gameloop(const char * subset, int levelnb, int mode) { int fps_cnt, jump, done; timer_type fps_timer, frame_timer; - timer_init(&fps_timer, YES); - timer_init(&frame_timer, YES); + timer_init(&fps_timer, true); + timer_init(&frame_timer, true); - game_started = YES; + game_started = true; st_gl_mode = mode; level = levelnb; @@ -619,7 +619,7 @@ int gameloop(const char * subset, int levelnb, int mode) if(st_gl_mode == ST_GL_PLAY || st_gl_mode == ST_GL_LOAD_LEVEL_FILE) levelintro(); - timer_init(&time_left,YES); + timer_init(&time_left,true); start_timers(); if(st_gl_mode == ST_GL_LOAD_GAME) @@ -628,13 +628,13 @@ int gameloop(const char * subset, int levelnb, int mode) /* --- MAIN GAME LOOP!!! --- */ - jump = NO; + jump = false; done = 0; quit = 0; frame = 0; game_pause = 0; - timer_init(&fps_timer,YES); - timer_init(&frame_timer,YES); + timer_init(&fps_timer,true); + timer_init(&frame_timer,true); fps_cnt = 0; /* Clear screen: */ @@ -652,7 +652,7 @@ int gameloop(const char * subset, int levelnb, int mode) game_draw(); do { - jump = NO; + jump = false; /* Calculate the movement-factor */ frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE); @@ -681,10 +681,10 @@ int gameloop(const char * subset, int levelnb, int mode) st_pause_ticks_stop(); break; case 3: - update_load_save_game_menu(&save_game_menu, NO); + update_load_save_game_menu(&save_game_menu, false); break; case 4: - update_load_save_game_menu(&load_game_menu, YES); + update_load_save_game_menu(&load_game_menu, true); break; case 7: st_pause_ticks_stop(); @@ -698,11 +698,11 @@ int gameloop(const char * subset, int levelnb, int mode) } else if(current_menu == &save_game_menu ) { - process_save_load_game_menu(YES); + process_save_load_game_menu(true); } else if(current_menu == &load_game_menu ) { - process_save_load_game_menu(NO); + process_save_load_game_menu(false); } } @@ -730,7 +730,7 @@ int gameloop(const char * subset, int levelnb, int mode) SDL_Delay(50); } - if(debug_mode && debug_fps == YES) + if(debug_mode && debug_fps == true) SDL_Delay(60); /*Draw the current scene to the screen */ @@ -740,7 +740,7 @@ int gameloop(const char * subset, int levelnb, int mode) /*if( ! fps_fps < 50.0 ) game_draw(); else - jump = YES;*/ /*FIXME: Implement this tweak right.*/ + jump = true;*/ /*FIXME: Implement this tweak right.*/ game_draw(); /* Time stops in pause mode */ @@ -757,7 +757,7 @@ int gameloop(const char * subset, int levelnb, int mode) /* Pause till next frame, if the machine running the game is too fast: */ /* FIXME: Works great for in OpenGl mode, where the CPU doesn't have to do that much. But the results in SDL mode aren't perfect (thought the 100 FPS are reached), even on an AMD2500+. */ - if(last_update_time >= update_time - 12 && jump != YES ) + if(last_update_time >= update_time - 12 && !jump) SDL_Delay(10); /*if((update_time - last_update_time) < 10) SDL_Delay((11 - (update_time - last_update_time))/2);*/ @@ -805,7 +805,7 @@ int gameloop(const char * subset, int levelnb, int mode) unloadshared(); arrays_free(); - game_started = NO; + game_started = false; return(quit); } @@ -1379,66 +1379,44 @@ unsigned char shape(float x, float y) /* Is is ground? */ -int issolid(float x, float y) +bool issolid(float x, float y) { - if (isbrick(x, y) || - isice(x, y) || - (shape(x, y) == '[') || - (shape(x, y) == '=') || - (shape(x, y) == ']') || - (shape(x, y) == 'A') || - (shape(x, y) == 'B') || - (shape(x, y) == '!') || - (shape(x, y) == 'a')) - { - return YES; - } - - return NO; + return (isbrick(x, y) || + isice(x, y) || + (shape(x, y) == '[') || + (shape(x, y) == '=') || + (shape(x, y) == ']') || + (shape(x, y) == 'A') || + (shape(x, y) == 'B') || + (shape(x, y) == '!') || + (shape(x, y) == 'a')); } - /* Is it a brick? */ -int isbrick(float x, float y) +bool isbrick(float x, float y) { - if (shape(x, y) == 'X' || - shape(x, y) == 'x' || - shape(x, y) == 'Y' || - shape(x, y) == 'y') - { - return YES; - } - - return NO; + return (shape(x, y) == 'X' || + shape(x, y) == 'x' || + shape(x, y) == 'Y' || + shape(x, y) == 'y'); } /* Is it ice? */ -int isice(float x, float y) +bool isice(float x, float y) { - if (shape(x, y) == '#') - { - return YES; - } - - return NO; + return (shape(x, y) == '#'); } - /* Is it a full box? */ -int isfullbox(float x, float y) +bool isfullbox(float x, float y) { - if (shape(x, y) == 'A' || - shape(x, y) == 'B' || - shape(x, y) == '!') - { - return YES; - } - - return NO; + return (shape(x, y) == 'A' || + shape(x, y) == 'B' || + shape(x, y) == '!'); } /* Break a brick: */ @@ -1454,9 +1432,9 @@ void trybreakbrick(float x, float y) add_bouncy_distro(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32); - if (counting_distros == NO) + if (!counting_distros) { - counting_distros = YES; + counting_distros = true; distro_counter = 50; } @@ -1579,7 +1557,7 @@ void trybumpbadguy(float x, float y) if (bad_guys[i].kind == BAD_BSOD || bad_guys[i].kind == BAD_LAPTOP) { - bad_guys[i].dying = FALLING; + bad_guys[i].dying = DYING_FALLING; bad_guys[i].base.ym = -8; play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); } diff --git a/src/gameloop.h b/src/gameloop.h index b3718e62c..b8e0eb294 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -33,11 +33,11 @@ int gameloop(const char * subset, int levelnb, int mode); void savegame(int slot); void loadgame(int slot); void slotinfo(char **pinfo, int slot); -int issolid(float x, float y); -int isbrick(float x, float y); -int isice(float x, float y); -int isfullbox(float x, float y); -int rectcollision(base_type* one, base_type* two); +bool issolid(float x, float y); +bool isbrick(float x, float y); +bool isice(float x, float y); +bool isfullbox(float x, float y); +bool rectcollision(base_type* one, base_type* two); void drawshape(float x, float y, unsigned char c); unsigned char shape(float x, float y); void bumpbrick(float x, float y); diff --git a/src/globals.cpp b/src/globals.cpp index 3b64443f2..74b2e491f 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -18,7 +18,11 @@ std::string datadir; SDL_Surface * screen; text_type black_text, gold_text, blue_text, red_text, yellow_nums, white_text, white_small_text, white_big_text; -int use_gl, use_joystick, use_fullscreen, debug_mode, show_fps; +bool use_gl; +bool use_joystick; +bool use_fullscreen; +bool debug_mode; +bool show_fps; int joystick_num = 0; char* level_startup_file = 0; diff --git a/src/globals.h b/src/globals.h index eb56df5eb..48c2884a3 100644 --- a/src/globals.h +++ b/src/globals.h @@ -24,7 +24,11 @@ extern std::string datadir; extern SDL_Surface * screen; extern text_type black_text, gold_text, white_text, white_small_text, white_big_text, blue_text, red_text, yellow_nums; -extern int use_gl, use_joystick, use_fullscreen, debug_mode, show_fps; +extern bool use_gl; +extern bool use_joystick; +extern bool use_fullscreen; +extern bool debug_mode; +extern bool show_fps; /** The number of the joystick that will be use in the game */ extern int joystick_num; diff --git a/src/intro.cpp b/src/intro.cpp index 18f818de4..0edd17a14 100644 --- a/src/intro.cpp +++ b/src/intro.cpp @@ -89,7 +89,7 @@ int intro(void) scene = 0; i = 0; - timer_init(&timer,NO); + timer_init(&timer, false); timer_start(&timer,10000); while (timer_check(&timer) && !done && !quit) diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index c7776a3f5..6e8bbab68 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -81,7 +81,7 @@ void le_update_buttons(const char*); /* leveleditor internals */ static string_list_type level_subsets; -static int le_level_changed; /* if changes, ask for saving, when quiting*/ +static bool le_level_changed; /* if changes, ask for saving, when quiting*/ static int pos_x, cursor_x, cursor_y, fire; static int le_level; static st_level* le_current_level; @@ -91,7 +91,7 @@ static int le_frame; static texture_type le_selection; static int done; static char le_current_tile; -static int le_mouse_pressed[2]; +static bool le_mouse_pressed[2]; static button_type le_save_level_bt; static button_type le_test_level_bt; static button_type le_next_level_bt; @@ -160,7 +160,7 @@ int leveleditor(int levelnb) while (SDL_PollEvent(&event)) {} - while(YES) + while(true) { last_time = SDL_GetTicks(); le_frame++; @@ -192,7 +192,7 @@ int leveleditor(int levelnb) switch (menu_check(&leveleditor_menu)) { case 2: - show_menu = NO; + show_menu = false; break; case 3: update_subset_settings_menu(); @@ -211,7 +211,7 @@ int leveleditor(int levelnb) menu_set_current(&leveleditor_menu); break; default: - show_menu = YES; + show_menu = true; break; } } @@ -239,7 +239,7 @@ int leveleditor(int levelnb) le_set_defaults(); level_load_gfx(le_current_level); le_activate_bad_guys(); - show_menu = YES; + show_menu = true; } break; } @@ -272,7 +272,7 @@ int leveleditor(int levelnb) level_load_gfx(le_current_level); le_activate_bad_guys(); menu_item_change_input(&subset_new_menu.item[2],""); - show_menu = YES; + show_menu = true; break; } } @@ -288,7 +288,7 @@ int leveleditor(int levelnb) { case 5: save_subset_settings_menu(); - show_menu = YES; + show_menu = true; break; } } @@ -331,7 +331,7 @@ void le_update_buttons(const char *theme) bkgd_files = dfiles(pathname,"bkgd-", NULL); string_list_sort(&bkgd_files); - le_bkgd_panel.hidden = YES; + le_bkgd_panel.hidden = true; key = SDLK_a; for(i = 0; i < bkgd_files.num_items; ++i) { @@ -370,18 +370,18 @@ int le_init() string_list_type bad_files; level_subsets = dsubdirs("/levels", "info"); - le_show_grid = YES; + le_show_grid = true; /* level_changed = NO;*/ fire = DOWN; done = 0; le_frame = 0; /* support for frames in some tiles, like waves and bad guys */ - le_level_changed = NO; + le_level_changed = false; le_current_level = NULL; le_current_tile = '.'; - le_mouse_pressed[LEFT] = NO; - le_mouse_pressed[RIGHT] = NO; + le_mouse_pressed[LEFT] = false; + le_mouse_pressed[RIGHT] = false; texture_load(&le_selection, datadir + "/images/leveleditor/select.png", USE_ALPHA); @@ -404,7 +404,7 @@ int le_init() string_list_sort(&bkgd_files); button_panel_init(&le_bkgd_panel, screen->w - 64,98, 64, 318); - le_bkgd_panel.hidden = YES; + le_bkgd_panel.hidden = true; key = SDLK_a; for(i = 0; i < bkgd_files.num_items; ++i) { @@ -480,7 +480,7 @@ int le_init() string_list_add_item(&bad_files,"laptop-left-0.png"); string_list_add_item(&bad_files,"bag-left-0.png"); button_panel_init(&le_bad_panel, screen->w - 64,98, 64, 318); - le_bad_panel.hidden = YES; + le_bad_panel.hidden = true; key = SDLK_a; for(i = 0; i < bad_files.num_items; ++i) { @@ -500,7 +500,7 @@ int le_init() menu_reset(); menu_set_current(&leveleditor_menu); - show_menu = YES; + show_menu = true; menu_init(&subset_load_menu); menu_additem(&subset_load_menu,MN_LABEL,"Load Level Subset",0,0); @@ -531,7 +531,7 @@ int le_init() menu_additem(&subset_settings_menu,MN_BACK,"Back",0,0); menu_init(&level_settings_menu); - level_settings_menu.arrange_left = YES; + level_settings_menu.arrange_left = true; menu_additem(&level_settings_menu,MN_LABEL,"Level Settings",0,0); menu_additem(&level_settings_menu,MN_HL,"",0,0); menu_additem(&level_settings_menu,MN_TEXTFIELD,"Name ",0,0); @@ -593,24 +593,24 @@ void update_subset_settings_menu() void apply_level_settings_menu() { int i,y,j; - i = NO; + i = false; le_current_level->name = level_settings_menu.item[2].input; if(le_current_level->bkgd_image.compare(string_list_active(level_settings_menu.item[5].list)) != 0) { le_current_level->bkgd_image = string_list_active(level_settings_menu.item[5].list); - i = YES; + i = true; } if(le_current_level->theme.compare(string_list_active(level_settings_menu.item[3].list)) != 0) { le_current_level->theme = string_list_active(level_settings_menu.item[3].list); le_update_buttons(le_current_level->theme.c_str()); - i = YES; + i = true; } - if(i == YES) + if(i == true) { level_free_gfx(); level_load_gfx(le_current_level); @@ -681,7 +681,7 @@ void le_goto_level(int levelnb) void le_quit(void) { - /*if(level_changed == YES) + /*if(level_changed == true) if(askforsaving() == CANCEL) return;*/ //FIXME @@ -807,7 +807,7 @@ void le_drawinterface() } else { - if(show_menu == NO) + if(show_menu == false) text_draw(&white_small_text, "No Level Subset loaded - Press ESC and choose one in the menu", 10, 430, 1, NO_UPDATE); else text_draw(&white_small_text, "No Level Subset loaded", 10, 430, 1, NO_UPDATE); @@ -901,7 +901,7 @@ void le_checkevents() menu_event(&event.key.keysym); if(key == SDLK_ESCAPE) { - show_menu = NO; + show_menu = false; menu_set_current(&leveleditor_menu); } break; @@ -910,9 +910,9 @@ void le_checkevents() { case SDLK_ESCAPE: if(!show_menu) - show_menu = YES; + show_menu = true; else - show_menu = NO; + show_menu = false; break; case SDLK_LEFT: if(fire == DOWN) @@ -986,7 +986,7 @@ void le_checkevents() case SDL_MOUSEBUTTONDOWN: if(event.button.button == SDL_BUTTON_LEFT) { - le_mouse_pressed[LEFT] = YES; + le_mouse_pressed[LEFT] = true; selection.x1 = event.motion.x + pos_x; selection.y1 = event.motion.y; @@ -994,13 +994,13 @@ void le_checkevents() selection.y2 = event.motion.y; } else if(event.button.button == SDL_BUTTON_RIGHT) - le_mouse_pressed[RIGHT] = YES; + le_mouse_pressed[RIGHT] = true; break; case SDL_MOUSEBUTTONUP: if(event.button.button == SDL_BUTTON_LEFT) - le_mouse_pressed[LEFT] = NO; + le_mouse_pressed[LEFT] = false; else if(event.button.button == SDL_BUTTON_RIGHT) - le_mouse_pressed[RIGHT] = NO; + le_mouse_pressed[RIGHT] = false; break; case SDL_MOUSEMOTION: if(!show_menu) @@ -1011,13 +1011,13 @@ void le_checkevents() cursor_x = ((int)(pos_x + x) / 32) * 32; cursor_y = ((int) y / 32) * 32; - if(le_mouse_pressed[LEFT] == YES) + if(le_mouse_pressed[LEFT] == true) { selection.x2 = x + pos_x; selection.y2 = y; } - if(le_mouse_pressed[RIGHT] == YES) + if(le_mouse_pressed[RIGHT] == true) { pos_x += -1 * event.motion.xrel; } @@ -1036,10 +1036,10 @@ void le_checkevents() if(event.type == SDL_KEYDOWN || event.type == SDL_KEYUP || ((event.type == SDL_MOUSEBUTTONDOWN || SDL_MOUSEMOTION) && (event.motion.x > screen->w-64 && event.motion.x < screen->w && event.motion.y > 0 && event.motion.y < screen->h))) { - le_mouse_pressed[LEFT] = NO; - le_mouse_pressed[RIGHT] = NO; + le_mouse_pressed[LEFT] = false; + le_mouse_pressed[RIGHT] = false; - if(show_menu == NO) + if(show_menu == false) { /* Check for button events */ button_event(&le_test_level_bt,&event); @@ -1113,38 +1113,38 @@ void le_checkevents() button_event(&le_bad_bt,&event); if(button_get_state(&le_bad_bt) == BUTTON_CLICKED) { - le_bad_panel.hidden = NO; - le_fgd_panel.hidden = YES; - le_bkgd_panel.hidden = YES; + le_bad_panel.hidden = false; + le_fgd_panel.hidden = true; + le_bkgd_panel.hidden = true; } button_event(&le_fgd_bt,&event); if(button_get_state(&le_fgd_bt) == BUTTON_CLICKED) { - le_bad_panel.hidden = YES; - le_fgd_panel.hidden = NO; - le_bkgd_panel.hidden = YES; + le_bad_panel.hidden = true; + le_fgd_panel.hidden = false; + le_bkgd_panel.hidden = true; } button_event(&le_bkgd_bt,&event); if(button_get_state(&le_bkgd_bt) == BUTTON_CLICKED) { - le_bad_panel.hidden = YES; - le_fgd_panel.hidden = YES; - le_bkgd_panel.hidden = NO; + le_bad_panel.hidden = true; + le_fgd_panel.hidden = true; + le_bkgd_panel.hidden = false; } button_event(&le_settings_bt,&event); if(button_get_state(&le_settings_bt) == BUTTON_CLICKED) { - if(show_menu == NO) + if(show_menu == false) { update_level_settings_menu(); menu_set_current(&level_settings_menu); - show_menu = YES; + show_menu = true; } else { menu_set_current(&leveleditor_menu); - show_menu = NO; + show_menu = false; } } if((pbutton = button_panel_event(&le_bkgd_panel,&event)) != NULL) @@ -1226,21 +1226,21 @@ void le_checkevents() button_event(&le_settings_bt,&event); if(button_get_state(&le_settings_bt) == BUTTON_CLICKED) { - if(show_menu == NO) + if(show_menu == false) { update_level_settings_menu(); menu_set_current(&level_settings_menu); - show_menu = YES; + show_menu = true; } else { menu_set_current(&leveleditor_menu); - show_menu = NO; + show_menu = false; } } } } - if(show_menu == NO) + if(show_menu == false) { button_event(&le_move_left_bt,&event); button_event(&le_move_right_bt,&event); @@ -1252,7 +1252,7 @@ void le_checkevents() } } } - if(show_menu == NO) + if(show_menu == false) { if(button_get_state(&le_move_left_bt) == BUTTON_PRESSED) { @@ -1316,7 +1316,7 @@ void le_change(float x, float y, unsigned char c) int x1, x2, y1, y2; unsigned int i; - /* level_changed = YES; */ + /* level_changed = true; */ switch(le_selection_mode) { diff --git a/src/menu.cpp b/src/menu.cpp index c89655839..27182469b 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -32,8 +32,8 @@ /* (global) menu variables */ MenuAction menuaction; -int show_menu; -int menu_change; +bool show_menu; +bool menu_change; texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right; menu_type main_menu, game_menu, options_menu, highscore_menu, load_game_menu, save_game_menu; @@ -48,7 +48,7 @@ void menu_set_current(menu_type* pmenu) { if(pmenu != current_menu) { - menu_change = YES; + menu_change = true; last_menu = current_menu; current_menu = pmenu; timer_start(&pmenu->effect, 500); @@ -65,7 +65,7 @@ menu_item_type* menu_item_create(MenuItemKind kind, char *text, int init_toggle, if(kind == MN_TOGGLE) pnew_item->toggled = init_toggle; else - pnew_item->toggled = NO; + pnew_item->toggled = false; pnew_item->target_menu = target_menu; pnew_item->input = (char*) malloc(sizeof(char)); pnew_item->input[0] = '\0'; @@ -123,7 +123,7 @@ void menu_init(menu_type* pmenu) pmenu->num_items = 0; pmenu->active_item = 0; pmenu->item = NULL; - timer_init(&pmenu->effect,NO); + timer_init(&pmenu->effect,false); } /* Add an item to a menu */ @@ -187,11 +187,11 @@ void menu_action(menu_type* pmenu) else if(item.kind == MN_TOGGLE) { item.toggled = !item.toggled; - menu_change = YES; + menu_change = true; } else if(item.kind == MN_ACTION || item.kind == MN_TEXTFIELD || item.kind == MN_NUMFIELD) { - item.toggled = YES; + item.toggled = true; } else if(item.kind == MN_BACK) { @@ -263,9 +263,9 @@ int menu_check(menu_type* pmenu) if(pmenu->num_items != 0 && pmenu->item != NULL) { - if((item.kind == MN_ACTION || item.kind == MN_TEXTFIELD || item.kind == MN_NUMFIELD) && item.toggled == YES) + if((item.kind == MN_ACTION || item.kind == MN_TEXTFIELD || item.kind == MN_NUMFIELD) && item.toggled == true) { - item.toggled = NO; + item.toggled = false; show_menu = 0; return pmenu->active_item; } @@ -306,7 +306,7 @@ void menu_draw_item(menu_type* pmenu, int list_width = strlen(string_list_active(pitem.list)) * font_width; text_type* text_font = &white_text; - if(pmenu->arrange_left == YES) + if(pmenu->arrange_left == true) x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2; if(index == pmenu->active_item) @@ -405,7 +405,7 @@ void menu_draw_item(menu_type* pmenu, { text_draw_align(text_font, pitem.text, x_pos, y_pos, A_HMIDDLE, A_VMIDDLE, shadow_size); - if(pitem.toggled == YES) + if(pitem.toggled == true) texture_draw(&checkbox_checked, x_pos + (text_width+font_width)/2, y_pos - 8); @@ -462,8 +462,8 @@ void menu_draw(menu_type* pmenu) /* Reset/Set global defaults */ void menu_reset(void) { - menu_change = NO; - show_menu = NO; + menu_change = false; + show_menu = false; menuaction = MENU_ACTION_NONE; current_menu = NULL; last_menu = NULL; @@ -476,7 +476,7 @@ void menu_reset(void) /* Draw the current menu and execute the (menu)events */ void menu_process_current(void) { - menu_change = NO; + menu_change = false; if(current_menu != NULL) { @@ -511,43 +511,43 @@ void menu_event(SDL_keysym* keysym) { case SDLK_UP: /* Menu Up */ menuaction = MENU_ACTION_UP; - menu_change = YES; + menu_change = true; break; case SDLK_DOWN: /* Menu Down */ menuaction = MENU_ACTION_DOWN; - menu_change = YES; + menu_change = true; break; case SDLK_LEFT: /* Menu Up */ menuaction = MENU_ACTION_LEFT; - menu_change = YES; + menu_change = true; break; case SDLK_RIGHT: /* Menu Down */ menuaction = MENU_ACTION_RIGHT; - menu_change = YES; + menu_change = true; break; case SDLK_SPACE: if(current_menu->item[current_menu->active_item].kind == MN_TEXTFIELD) { menuaction = MENU_ACTION_INPUT; - menu_change = YES; + menu_change = true; mn_input_char = ' '; break; } case SDLK_RETURN: /* Menu Hit */ menuaction = MENU_ACTION_HIT; - menu_change = YES; + menu_change = true; break; case SDLK_DELETE: case SDLK_BACKSPACE: menuaction = MENU_ACTION_REMOVE; - menu_change = YES; + menu_change = true; delete_character++; break; default: if( (key >= SDLK_0 && key <= SDLK_9) || (key >= SDLK_a && key <= SDLK_z) || (key >= SDLK_SPACE && key <= SDLK_SLASH)) { menuaction = MENU_ACTION_INPUT; - menu_change = YES; + menu_change = true; mn_input_char = *ch; } else diff --git a/src/menu.h b/src/menu.h index f459b5c0d..7cf9dbec0 100644 --- a/src/menu.h +++ b/src/menu.h @@ -84,8 +84,8 @@ enum MenuAction { /* (global) menu variables */ extern MenuAction menuaction; -extern int show_menu; -extern int menu_change; +extern bool show_menu; +extern bool menu_change; extern texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right; extern menu_type main_menu, game_menu, options_menu, highscore_menu, load_game_menu, save_game_menu; diff --git a/src/physic.cpp b/src/physic.cpp index 0f6fddeb3..3b2813a48 100644 --- a/src/physic.cpp +++ b/src/physic.cpp @@ -52,10 +52,7 @@ void physic_set_acceleration(physic_type* pphysic, float acceleration) int physic_is_set(physic_type* pphysic) { - if(pphysic->state != -1) - return YES; - else - return NO; + return (pphysic->state != -1); } float physic_get_velocity(physic_type* pphysic) diff --git a/src/player.cpp b/src/player.cpp index fc119e1ce..906a2b21c 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -47,7 +47,7 @@ void player_init(player_type* pplayer) pplayer->base.height = 32; pplayer->size = SMALL; - pplayer->got_coffee = NO; + pplayer->got_coffee = false; pplayer->base.x = 0; pplayer->base.y = 240; @@ -55,10 +55,10 @@ void player_init(player_type* pplayer) pplayer->base.ym = 0; pplayer->old_base = pplayer->base; pplayer->dir = RIGHT; - pplayer->duck = NO; + pplayer->duck = false; - pplayer->dying = NO; - pplayer->jumping = NO; + pplayer->dying = DYING_NOT; + pplayer->jumping = false; pplayer->frame_main = 0; pplayer->frame = 0; @@ -74,10 +74,10 @@ void player_init(player_type* pplayer) pplayer->keymap.right = SDLK_RIGHT; pplayer->keymap.fire = SDLK_LCTRL; - timer_init(&pplayer->invincible_timer,YES); - timer_init(&pplayer->skidding_timer,YES); - timer_init(&pplayer->safe_timer,YES); - timer_init(&pplayer->frame_timer,YES); + timer_init(&pplayer->invincible_timer,true); + timer_init(&pplayer->skidding_timer,true); + timer_init(&pplayer->safe_timer,true); + timer_init(&pplayer->frame_timer,true); physic_init(&pplayer->hphysic); physic_init(&pplayer->vphysic); } @@ -87,30 +87,30 @@ int player_key_event(player_type* pplayer, SDLKey key, int state) if(key == pplayer->keymap.right) { pplayer->input.right = state; - return YES; + return true; } else if( key == pplayer->keymap.left) { pplayer->input.left = state; - return YES; + return true; } else if(key == pplayer->keymap.jump) { pplayer->input.up = state; - return YES; + return true; } else if(key == pplayer->keymap.duck) { pplayer->input.down = state; - return YES; + return true; } else if(key == pplayer->keymap.fire) { pplayer->input.fire = state; - return YES; + return true; } else - return NO; + return false; } void player_level_begin(player_type* pplayer) @@ -123,18 +123,17 @@ void player_level_begin(player_type* pplayer) player_input_init(&pplayer->input); - timer_init(&pplayer->invincible_timer,YES); - timer_init(&pplayer->skidding_timer,YES); - timer_init(&pplayer->safe_timer,YES); - timer_init(&pplayer->frame_timer,YES); + timer_init(&pplayer->invincible_timer,true); + timer_init(&pplayer->skidding_timer,true); + timer_init(&pplayer->safe_timer,true); + timer_init(&pplayer->frame_timer,true); physic_init(&pplayer->hphysic); physic_init(&pplayer->vphysic); } void player_action(player_type* pplayer) { - int jumped_in_solid; - jumped_in_solid = NO; + bool jumped_in_solid = false; /* --- HANDLE TUX! --- */ @@ -163,7 +162,7 @@ void player_action(player_type* pplayer) { physic_set_state(&pplayer->vphysic,PH_VT); physic_set_start_vy(&pplayer->vphysic,0); - jumped_in_solid = YES; + jumped_in_solid = true; } else { @@ -194,7 +193,7 @@ void player_action(player_type* pplayer) score_multiplier = 1; } - if(jumped_in_solid == YES) + if(jumped_in_solid == true) { if (isbrick(pplayer->base.x, pplayer->base.y) || @@ -234,9 +233,9 @@ void player_action(player_type* pplayer) add_bouncy_distro((((int)pplayer->base.x) / 32) * 32, ((int)pplayer->base.y / 32) * 32); - if (counting_distros == NO) + if (counting_distros == false) { - counting_distros = YES; + counting_distros = true; distro_counter = 100; } @@ -253,9 +252,9 @@ void player_action(player_type* pplayer) add_bouncy_distro((((int)pplayer->base.x + 31) / 32) * 32, ((int)pplayer->base.y / 32) * 32); - if (counting_distros == NO) + if (counting_distros == false) { - counting_distros = YES; + counting_distros = true; distro_counter = 100; } @@ -270,14 +269,14 @@ void player_action(player_type* pplayer) } player_grabdistros(pplayer); - if(jumped_in_solid == YES) + if(jumped_in_solid == true) { ++pplayer->base.y; ++pplayer->old_base.y; if(player_on_ground(pplayer)) { /* Make sure jumping is off. */ - pplayer->jumping = NO; + pplayer->jumping = false; } } @@ -330,32 +329,18 @@ void player_action(player_type* pplayer) } -int player_on_ground(player_type *pplayer) +bool player_on_ground(player_type *pplayer) { - if( issolid(pplayer->base.x + pplayer->base.width / 2, pplayer->base.y + pplayer->base.height) || - issolid(pplayer->base.x + 1, pplayer->base.y + pplayer->base.height) || - issolid(pplayer->base.x + pplayer->base.width - 1, pplayer->base.y + pplayer->base.height) ) - { - return YES; - } - else - { - return NO; - } + return ( issolid(pplayer->base.x + pplayer->base.width / 2, pplayer->base.y + pplayer->base.height) || + issolid(pplayer->base.x + 1, pplayer->base.y + pplayer->base.height) || + issolid(pplayer->base.x + pplayer->base.width - 1, pplayer->base.y + pplayer->base.height) ); } -int player_under_solid(player_type *pplayer) +bool player_under_solid(player_type *pplayer) { - if( issolid(pplayer->base.x + pplayer->base.width / 2, pplayer->base.y) || - issolid(pplayer->base.x + 1, pplayer->base.y) || - issolid(pplayer->base.x + pplayer->base.width - 1, pplayer->base.y) ) - { - return YES; - } - else - { - return NO; - } + return ( issolid(pplayer->base.x + pplayer->base.width / 2, pplayer->base.y) || + issolid(pplayer->base.x + 1, pplayer->base.y) || + issolid(pplayer->base.x + pplayer->base.width - 1, pplayer->base.y) ); } void player_handle_horizontal_input(player_type *pplayer, int dir) @@ -448,7 +433,7 @@ void player_handle_vertical_input(player_type *pplayer) physic_set_state(&pplayer->vphysic,PH_VT); physic_set_start_vy(&pplayer->vphysic,5.5); --pplayer->base.y; - pplayer->jumping = YES; + pplayer->jumping = true; if (pplayer->size == SMALL) play_sound(sounds[SND_JUMP], SOUND_CENTER_SPEAKER); else @@ -456,16 +441,16 @@ void player_handle_vertical_input(player_type *pplayer) } } } - else if(pplayer->input.up == UP && pplayer->jumping == YES) + else if(pplayer->input.up == UP && pplayer->jumping == true) { if (player_on_ground(pplayer)) { physic_init(&pplayer->vphysic); - pplayer->jumping = NO; + pplayer->jumping = false; } else { - pplayer->jumping = NO; + pplayer->jumping = false; if(physic_is_set(&pplayer->vphysic)) { if(physic_get_velocity(&pplayer->vphysic) < 0.) @@ -489,7 +474,7 @@ void player_input(player_type *pplayer) { /* Handle key and joystick state: */ - if(pplayer->duck == NO) + if(pplayer->duck == false) { if (pplayer->input.right == DOWN && pplayer->input.left == UP) { @@ -518,7 +503,7 @@ void player_input(player_type *pplayer) /* Jump/jumping? */ - if ( pplayer->input.up == DOWN || (pplayer->input.up == UP && pplayer->jumping == YES)) + if ( pplayer->input.up == DOWN || (pplayer->input.up == UP && pplayer->jumping == true)) { player_handle_vertical_input(pplayer); } @@ -535,16 +520,16 @@ void player_input(player_type *pplayer) if (pplayer->input.down == DOWN) { - if (pplayer->size == BIG && pplayer->duck != YES) + if (pplayer->size == BIG && pplayer->duck != true) { - pplayer->duck = YES; + pplayer->duck = true; pplayer->base.height = 32; pplayer->base.y += 32; } } else { - if (pplayer->size == BIG && pplayer->duck == YES) + if (pplayer->size == BIG && pplayer->duck == true) { /* Make sure we're not standing back up into a solid! */ pplayer->base.height = 64; @@ -552,7 +537,7 @@ void player_input(player_type *pplayer) if (!collision_object_map(&pplayer->base) /*issolid(pplayer->base.x + 16, pplayer->base.y - 16)*/) { - pplayer->duck = NO; + pplayer->duck = false; pplayer->base.height = 64; pplayer->old_base.y -= 32; pplayer->old_base.height = 64; @@ -565,7 +550,7 @@ void player_input(player_type *pplayer) } else { - pplayer->duck = NO; + pplayer->duck = false; } } @@ -898,7 +883,7 @@ void player_collision(player_type* pplayer, void* p_c_object, int c_object) } else { - pbad_c->dying = FALLING; + pbad_c->dying = DYING_FALLING; play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); add_score(pbad_c->base.x - scroll_x, pbad_c->base.y, @@ -915,7 +900,7 @@ void player_collision(player_type* pplayer, void* p_c_object, int c_object) } else { - pbad_c->dying = FALLING; + pbad_c->dying = DYING_FALLING; play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); add_score(pbad_c->base.x - scroll_x, pbad_c->base.y, @@ -947,7 +932,7 @@ void player_kill(player_type* pplayer, int mode) if (mode == SHRINK && pplayer->size == BIG) { if (pplayer->got_coffee) - pplayer->got_coffee = NO; + pplayer->got_coffee = false; pplayer->size = SMALL; pplayer->base.height = 32; @@ -956,7 +941,7 @@ void player_kill(player_type* pplayer, int mode) } else { - pplayer->dying = 1; + pplayer->dying = DYING_SQUISHED; } } @@ -968,7 +953,7 @@ void player_dying(player_type *pplayer) --pplayer->lives; player_remove_powerups(pplayer); - pplayer->dying = NO; + pplayer->dying = DYING_NOT; player_level_begin(pplayer); @@ -977,7 +962,7 @@ void player_dying(player_type *pplayer) /* Remove Tux's power ups */ void player_remove_powerups(player_type* pplayer) { - pplayer->got_coffee = NO; + pplayer->got_coffee = false; pplayer->size = SMALL; pplayer->base.height = 32; } @@ -989,7 +974,7 @@ void player_keep_in_bounds(player_type* pplayer) pplayer->base.x= 0; else if(pplayer->base.x< scroll_x) pplayer->base.x= scroll_x; - else if (pplayer->base.x< 160 + scroll_x && scroll_x > 0 && debug_mode == YES) + else if (pplayer->base.x< 160 + scroll_x && scroll_x > 0 && debug_mode == true) { scroll_x = pplayer->base.x- 160; /*pplayer->base.x+= 160;*/ diff --git a/src/player.h b/src/player.h index 36b678ecc..435f39c7a 100644 --- a/src/player.h +++ b/src/player.h @@ -62,28 +62,28 @@ void player_input_init(player_input_type* pplayer_input); typedef struct player_type { - player_input_type input; - player_keymap_type keymap; - int score; - int distros; - int got_coffee; - int size; - int duck; - int dying; - int dir; - int jumping; - int frame_main; - int frame; - int lives; - base_type base; - base_type old_base; - base_type previous_base; - timer_type invincible_timer; - timer_type skidding_timer; - timer_type safe_timer; - timer_type frame_timer; - physic_type vphysic; - physic_type hphysic; + player_input_type input; + player_keymap_type keymap; + int score; + int distros; + bool got_coffee; + int size; + bool duck; + DyingType dying; + int dir; + bool jumping; + int frame_main; + int frame; + int lives; + base_type base; + base_type old_base; + base_type previous_base; + timer_type invincible_timer; + timer_type skidding_timer; + timer_type safe_timer; + timer_type frame_timer; + physic_type vphysic; + physic_type hphysic; } player_type; @@ -113,7 +113,7 @@ void player_kill(player_type *pplayer, int mode); void player_dying(player_type *pplayer); void player_remove_powerups(player_type *pplayer); void player_keep_in_bounds(player_type *pplayer); -int player_on_ground(player_type *pplayer); -int player_under_solid(player_type *pplayer); +bool player_on_ground(player_type *pplayer); +bool player_under_solid(player_type *pplayer); #endif /*SUPERTUX_PLAYER_H*/ diff --git a/src/scene.cpp b/src/scene.cpp index 2fdacb700..cceb7ecbd 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -13,7 +13,16 @@ #include #include "scene.h" -int score, distros, level, next_level, game_pause, quit, score_multiplier, endpos, counting_distros, distro_counter; +int score; +int distros; +int level; +int next_level; +int game_pause; +bool quit; +int score_multiplier; +int endpos; +bool counting_distros; +int distro_counter; timer_type super_bkgd_timer; float scroll_x; int frame; @@ -53,9 +62,9 @@ void set_defaults(void) scroll_x = 0; score_multiplier = 1; - timer_init(&super_bkgd_timer, YES); + timer_init(&super_bkgd_timer, true); - counting_distros = NO; + counting_distros = false; distro_counter = 0; endpos = 0; diff --git a/src/scene.h b/src/scene.h index 9aa052964..1dd7b3f8b 100644 --- a/src/scene.h +++ b/src/scene.h @@ -22,7 +22,17 @@ #include "level.h" #define FRAME_RATE 10 // 100 Frames per second (10ms) -extern int score, distros, level, next_level, game_pause, quit, score_multiplier, endpos, counting_distros, distro_counter; +extern int score; +extern int distros; +extern int level; +extern int next_level; +extern int game_pause; +extern bool quit; +extern int score_multiplier; +extern int endpos; +extern bool counting_distros; +extern int distro_counter; + extern timer_type super_bkgd_timer; extern float scroll_x; extern int frame; diff --git a/src/setup.cpp b/src/setup.cpp index 7c30b4ad2..54f1c7659 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -56,14 +56,14 @@ int faccessible(const char *filename) struct stat filestat; if (stat(filename, &filestat) == -1) { - return NO; + return false; } else { if(S_ISREG(filestat.st_mode)) - return YES; + return true; else - return NO; + return false; } } @@ -74,9 +74,9 @@ int fwriteable(const char *filename) fi = fopen(filename, "wa"); if (fi == NULL) { - return NO; + return false; } - return YES; + return true; } /* Makes sure a directory is created in either the SuperTux base directory or the SuperTux base directory.*/ @@ -89,16 +89,16 @@ int fcreatedir(const char* relative_dir) snprintf(path, 1024, "%s/%s/", datadir.c_str(), relative_dir); if(mkdir(path,0755) != 0) { - return NO; + return false; } else { - return YES; + return true; } } else { - return YES; + return true; } } @@ -334,7 +334,7 @@ void st_menu(void) menu_additem(&options_menu, MN_LABEL,"Options",0,0); menu_additem(&options_menu, MN_HL,"",0,0); menu_additem(&options_menu, MN_TOGGLE,"Fullscreen",use_fullscreen,0); - if(audio_device == YES) + if(audio_device) { menu_additem(&options_menu, MN_TOGGLE,"Sound ",use_sound,0); menu_additem(&options_menu, MN_TOGGLE,"Music ",use_music,0); @@ -410,16 +410,16 @@ void process_save_load_game_menu(int save) default: if(slot != -1) { - if(save == YES) + if(save == true) { savegame(slot - 1); } else { - if(game_started == NO) + if(game_started == false) { gameloop("default",slot - 1,ST_GL_LOAD_GAME); - show_menu = YES; + show_menu = true; menu_set_current(&main_menu); } else @@ -450,17 +450,17 @@ void process_options_menu(void) case 4: if(use_music != options_menu.item[4].toggled) { - if(use_music == YES) + if(use_music == true) { if(playing_music()) { halt_music(); } - use_music = NO; + use_music = false; } else { - use_music = YES; + use_music = true; if (!playing_music()) { play_current_music(); @@ -576,7 +576,7 @@ void st_video_setup_sdl(void) { SDL_FreeSurface(screen); - if (use_fullscreen == YES) + if (use_fullscreen == true) { screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */ if (screen == NULL) @@ -586,7 +586,7 @@ void st_video_setup_sdl(void) "640x480 mode.\n" "The Simple DirectMedia error that occured was:\n" "%s\n\n", SDL_GetError()); - use_fullscreen = NO; + use_fullscreen = false; } } else @@ -614,7 +614,7 @@ void st_video_setup_gl(void) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - if (use_fullscreen == YES) + if (use_fullscreen == true) { screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */ if (screen == NULL) @@ -624,7 +624,7 @@ void st_video_setup_gl(void) "640x480 mode.\n" "The Simple DirectMedia error that occured was:\n" "%s\n\n", SDL_GetError()); - use_fullscreen = NO; + use_fullscreen = false; } } else @@ -665,7 +665,7 @@ void st_joystick_setup(void) /* Init Joystick: */ - use_joystick = YES; + use_joystick = true; if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { @@ -673,7 +673,7 @@ void st_joystick_setup(void) "The Simple DirectMedia error that occured was:\n" "%s\n\n", SDL_GetError()); - use_joystick = NO; + use_joystick = false; } else { @@ -682,7 +682,7 @@ void st_joystick_setup(void) { fprintf(stderr, "Warning: No joysticks are available.\n"); - use_joystick = NO; + use_joystick = false; } else { @@ -694,7 +694,7 @@ void st_joystick_setup(void) "The Simple DirectMedia error that occured was:\n" "%s\n\n", joystick_num, SDL_GetError()); - use_joystick = NO; + use_joystick = false; } else { @@ -705,7 +705,7 @@ void st_joystick_setup(void) fprintf(stderr, "Warning: Joystick does not have enough axes!\n"); - use_joystick = NO; + use_joystick = false; } else { @@ -715,7 +715,7 @@ void st_joystick_setup(void) "Warning: " "Joystick does not have enough buttons!\n"); - use_joystick = NO; + use_joystick = false; } } } @@ -728,14 +728,14 @@ void st_audio_setup(void) /* Init SDL Audio silently even if --disable-sound : */ - if (audio_device == YES) + if (audio_device == true) { if (SDL_Init(SDL_INIT_AUDIO) < 0) { /* only print out message if sound or music was not disabled at command-line */ - if (use_sound == YES || use_music == YES) + if (use_sound || use_music) { fprintf(stderr, "\nWarning: I could not initialize audio!\n" @@ -746,23 +746,23 @@ void st_audio_setup(void) because in this case, use_sound & use_music' values are ignored when there's no available audio device */ - use_sound = NO; - use_music = NO; - audio_device = NO; + use_sound = false; + use_music = false; + audio_device = false; } } /* Open sound silently regarless the value of "use_sound": */ - if (audio_device == YES) + if (audio_device == true) { if (open_audio(44100, AUDIO_S16, 2, 2048) < 0) { /* only print out message if sound or music was not disabled at command-line */ - if ((use_sound == YES) || (use_music == YES)) + if ((use_sound == true) || (use_music == true)) { fprintf(stderr, "\nWarning: I could not set up audio for 44100 Hz " @@ -770,9 +770,9 @@ void st_audio_setup(void) "The Simple DirectMedia error that occured was:\n" "%s\n\n", SDL_GetError()); } - use_sound = NO; - use_music = NO; - audio_device = NO; + use_sound = false; + use_music = false; + audio_device = false; } } @@ -848,14 +848,14 @@ void parseargs(int argc, char * argv[]) /* Set defaults: */ - debug_mode = NO; - use_fullscreen = NO; - show_fps = NO; - use_gl = NO; + debug_mode = false; + use_fullscreen = false; + show_fps = false; + use_gl = false; - use_sound = YES; - use_music = YES; - audio_device = YES; + use_sound = true; + use_music = true; + audio_device = true; /* Parse arguments: */ @@ -866,7 +866,7 @@ void parseargs(int argc, char * argv[]) { /* Use full screen: */ - use_fullscreen = YES; + use_fullscreen = true; } else if (strcmp(argv[i], "--joystick") == 0 || strcmp(argv[i], "-j") == 0) { @@ -887,7 +887,7 @@ void parseargs(int argc, char * argv[]) { /* Use full screen: */ - show_fps = YES; + show_fps = true; } else if (strcmp(argv[i], "--opengl") == 0 || strcmp(argv[i], "-gl") == 0) @@ -895,7 +895,7 @@ void parseargs(int argc, char * argv[]) #ifndef NOOPENGL /* Use OpengGL: */ - use_gl = YES; + use_gl = true; #endif } @@ -916,18 +916,18 @@ void parseargs(int argc, char * argv[]) { /* Disable the compiled in sound feature */ printf("Sounds disabled \n"); - use_sound = NO; + use_sound = false; } else if (strcmp(argv[i], "--disable-music") == 0) { /* Disable the compiled in sound feature */ printf("Music disabled \n"); - use_music = NO; + use_music = false; } else if (strcmp(argv[i], "--debug-mode") == 0) { /* Enable the debug-mode */ - debug_mode = YES; + debug_mode = true; } else if (strcmp(argv[i], "--help") == 0) diff --git a/src/sound.cpp b/src/sound.cpp index cec212fa5..173e30809 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -77,7 +77,7 @@ int open_audio (int frequency, Uint16 format, int channels, int chunksize) void close_audio( void ) { - if (audio_device == YES) { + if (audio_device) { Mix_UnregisterAllEffects( SOUND_LEFT_SPEAKER ); Mix_UnregisterAllEffects( SOUND_RIGHT_SPEAKER ); Mix_CloseAudio(); @@ -94,7 +94,7 @@ Mix_Chunk * load_sound(const std::string& file) snd = Mix_LoadWAV(file.c_str()); /* printf message and abort if there is an initialized audio device */ - if ((snd == NULL) && (audio_device == YES)) + if ((snd == NULL) && audio_device) st_abort("Can't load", file); return(snd); @@ -110,7 +110,7 @@ Mix_Music * load_song(const std::string& file) sng = Mix_LoadMUS(file.c_str()); /* printf message and abort if there is an initialized audio device */ - if ((sng == NULL) && (audio_device == YES)) + if ((sng == NULL) && audio_device) st_abort("Can't load", file); return (sng); } @@ -123,7 +123,7 @@ void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker) /* this won't call the function if the user has disabled sound * either via menu or via command-line option */ - if ((use_sound == YES) && (audio_device == YES)) + if ((use_sound == true) && (audio_device == true)) { Mix_PlayChannel( whichSpeaker, snd, 0); @@ -156,7 +156,7 @@ void free_chunk(Mix_Chunk *chunk) int playing_music(void) { - if (use_music == YES) + if (use_music == true) { return Mix_PlayingMusic(); } @@ -170,7 +170,7 @@ int playing_music(void) int halt_music(void) { - if ((use_music == YES) && (audio_device == YES)) + if ((use_music == true) && (audio_device == true)) { return Mix_HaltMusic(); } @@ -183,7 +183,7 @@ int halt_music(void) int play_music(Mix_Music *music, int loops) { - if ((use_music == YES) && (audio_device == YES)) + if ((use_music == true) && (audio_device == true)) { DEBUG_MSG(__PRETTY_FUNCTION__); return Mix_PlayMusic(music, loops); diff --git a/src/special.cpp b/src/special.cpp index 9b1b5cc7d..029149444 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -245,14 +245,14 @@ void upgrade_collision(upgrade_type* pupgrade, void* p_c_object, int c_object) { pplayer->base.height = 32; pplayer->base.y += 32; - pplayer->duck = YES; + pplayer->duck = true; } timer_start(&super_bkgd_timer, 350); } else if (pupgrade->kind == UPGRADE_COFFEE) { play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER); - pplayer->got_coffee = YES; + pplayer->got_coffee = true; timer_start(&super_bkgd_timer, 250); } else if (pupgrade->kind == UPGRADE_HERRING) diff --git a/src/timer.cpp b/src/timer.cpp index bff15a944..89525ad28 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -41,12 +41,12 @@ void st_pause_ticks_stop(void) st_pause_count = 0; } -void timer_init(timer_type* ptimer, int st_ticks) +void timer_init(timer_type* ptimer, bool st_ticks) { ptimer->period = 0; ptimer->time = 0; - if(st_ticks == YES) + if(st_ticks) ptimer->get_ticks = st_get_ticks; else ptimer->get_ticks = SDL_GetTicks; @@ -62,28 +62,28 @@ void timer_start(timer_type* ptimer, unsigned int period) void timer_stop(timer_type* ptimer) { if(ptimer->get_ticks == st_get_ticks) - timer_init(ptimer,YES); + timer_init(ptimer,true); else - timer_init(ptimer,NO); + timer_init(ptimer,false); } int timer_check(timer_type* ptimer) { if((ptimer->time != 0) && (ptimer->time + ptimer->period > ptimer->get_ticks())) - return YES; + return true; else { ptimer->time = 0; - return NO; + return false; } } int timer_started(timer_type* ptimer) { if(ptimer->time != 0) - return YES; + return true; else - return NO; + return false; } int timer_get_left(timer_type* ptimer) @@ -108,9 +108,9 @@ void timer_fwrite(timer_type* ptimer, FILE* fi) fwrite(&ptimer->period,sizeof(unsigned int),1,fi); fwrite(&diff_ticks,sizeof(unsigned int),1,fi); if(ptimer->get_ticks == st_get_ticks) - tick_mode = YES; + tick_mode = true; else - tick_mode = NO; + tick_mode = false; fwrite(&tick_mode,sizeof(unsigned int),1,fi); } @@ -121,7 +121,7 @@ void timer_fread(timer_type* ptimer, FILE* fi) fread(&ptimer->period,sizeof(unsigned int),1,fi); fread(&diff_ticks,sizeof(unsigned int),1,fi); fread(&tick_mode,sizeof(unsigned int),1,fi); - if(tick_mode == YES) + if(tick_mode == true) ptimer->get_ticks = st_get_ticks; else ptimer->get_ticks = SDL_GetTicks; diff --git a/src/timer.h b/src/timer.h index 146b76130..372adcc62 100644 --- a/src/timer.h +++ b/src/timer.h @@ -28,7 +28,7 @@ unsigned int st_get_ticks(void); void st_pause_ticks_init(void); void st_pause_ticks_start(void); void st_pause_ticks_stop(void); -void timer_init(timer_type* ptimer, int st_ticks); +void timer_init(timer_type* ptimer, bool st_ticks); void timer_start(timer_type* ptimer, unsigned int period); void timer_stop(timer_type* ptimer); /*====================================================================== diff --git a/src/title.cpp b/src/title.cpp index 13f878be3..bfa539d67 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -212,13 +212,13 @@ int title(void) } else if(key == SDLK_SPACE || key == SDLK_RETURN) { - done = YES; + done = true; quit = gameloop(subset.name.c_str(),1,ST_GL_PLAY); subset.free(); } else if(key == SDLK_ESCAPE) { - done = YES; + done = true; } break; default: @@ -229,7 +229,7 @@ int title(void) } break; case 3: - update_load_save_game_menu(&load_game_menu, YES); + update_load_save_game_menu(&load_game_menu, true); break; case 5: done = 1; @@ -249,7 +249,7 @@ int title(void) } else if(current_menu == &load_game_menu) { - process_save_load_game_menu(NO); + process_save_load_game_menu(false); } flipscreen(); diff --git a/src/world.cpp b/src/world.cpp index 6f5da507b..6bbbfe92a 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -51,7 +51,7 @@ void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float pbroken_brick->base.y = y; pbroken_brick->base.xm = xm; pbroken_brick->base.ym = ym; - timer_init(&pbroken_brick->timer,YES); + timer_init(&pbroken_brick->timer, true); timer_start(&pbroken_brick->timer,200); } @@ -141,7 +141,7 @@ void floating_score_init(floating_score_type* pfloating_score, float x, float y, { pfloating_score->base.x = x; pfloating_score->base.y = y - 16; - timer_init(&pfloating_score->timer,YES); + timer_init(&pfloating_score->timer,true); timer_start(&pfloating_score->timer,1000); pfloating_score->value = s; } -- 2.11.0