From 2d04eba931ac84e2f09d3c8391125f8a991ca7d3 Mon Sep 17 00:00:00 2001 From: XaviDCR92 Date: Sun, 5 Nov 2017 18:00:57 +0100 Subject: Deprecated use of sprintf() in favor of custom routine Systemitoa(). When B button is released and showActionsMenu == true, showActionsMenu = false. --- Unit.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Unit.c') diff --git a/Unit.c b/Unit.c index 9147306..08d9e82 100644 --- a/Unit.c +++ b/Unit.c @@ -162,7 +162,7 @@ void UnitDraw(TYPE_UNIT* ptrUnit, TYPE_CAMERA* ptrCamera, bool bHighlighted) ptrSpr->rotation = GFX_NOROT; ptrSpr->flip = GFX_NOFLIP; - if (ptrUnit->walking == true) + if (ptrUnit->walking != false) { if (++ptrUnit->walk_counter > WALK_FRAMES) { @@ -176,14 +176,14 @@ void UnitDraw(TYPE_UNIT* ptrUnit, TYPE_CAMERA* ptrCamera, bool bHighlighted) case DIRECTION_UP: ptrSpr->flip |= GFX_FLIPV; - if (ptrUnit->mirror == true) + if (ptrUnit->mirror != false) { ptrSpr->flip |= GFX_FLIPH; } break; case DIRECTION_DOWN: - if (ptrUnit->mirror == true) + if (ptrUnit->mirror != false) { ptrSpr->flip |= GFX_FLIPH; } @@ -193,7 +193,7 @@ void UnitDraw(TYPE_UNIT* ptrUnit, TYPE_CAMERA* ptrCamera, bool bHighlighted) ptrSpr->rotation = GFX_ROTCCW; ptrSpr->flip |= GFX_FLIPH; - if (ptrUnit->mirror == true) + if (ptrUnit->mirror != false) { ptrSpr->flip |= GFX_FLIPV; } @@ -202,7 +202,7 @@ void UnitDraw(TYPE_UNIT* ptrUnit, TYPE_CAMERA* ptrCamera, bool bHighlighted) case DIRECTION_RIGHT: ptrSpr->rotation = GFX_ROTCCW; - if (ptrUnit->mirror == true) + if (ptrUnit->mirror != false) { ptrSpr->flip |= GFX_FLIPV; } @@ -232,14 +232,14 @@ void UnitDraw(TYPE_UNIT* ptrUnit, TYPE_CAMERA* ptrCamera, bool bHighlighted) GfxDrawSprite(ptrSpr); - if ( (bHighlighted == true) || (ptrUnit->selected == true) ) + if ( (bHighlighted != false) || (ptrUnit->selected != false) ) { TYPE_COLLISION_BLOCK cb = CameraApplyCoordinatesToCoordinates(ptrCamera, ptrUnit->x, ptrUnit->y); int8_t colour = ptrUnit->selected? GFX_BLACK : GFX_GRAY; uint8_t w = UnitGetWidthFromID(id); uint8_t h = UnitGetHeightFromID(id); - if (ptrUnit->building == true) + if (ptrUnit->building != false) { GfxDrawRectangle(cb.x - (w >> 3), cb.y - (h >> 3), w + (w >> 2), h + (h >> 2), colour); } @@ -298,7 +298,7 @@ void UnitHandler(TYPE_UNIT* unitArray, size_t sz) bool bMoving = true; - if (ptrUnit->walking == true) + if (ptrUnit->walking != false) { int8_t x_d = 0; int8_t y_d = 0; @@ -328,7 +328,7 @@ void UnitHandler(TYPE_UNIT* unitArray, size_t sz) bMoving = false; } - if (ptrUnit->walking == true) + if (ptrUnit->walking != false) { // If player is still walking, check collisions // against all other active units. @@ -361,17 +361,17 @@ void UnitHandler(TYPE_UNIT* unitArray, size_t sz) ou.w = UnitGetWidthFromID(ptrOtherUnit->id); ou.h = UnitGetHeightFromID(ptrOtherUnit->id); - if (SystemCollisionCheck(&cu, &ou) == true) + if (SystemCollisionCheck(&cu, &ou) != false) { - bMoving = false; - break; + //bMoving = false; + return; } } } ptrUnit->walking = bMoving; - if (ptrUnit->walking == true) + if (ptrUnit->walking != false) { // If no collision is detected, keep moving to the new position ptrUnit->x += x_d; -- cgit v1.2.3