diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-11-05 18:00:57 +0100 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-11-05 18:00:57 +0100 |
| commit | 2d04eba931ac84e2f09d3c8391125f8a991ca7d3 (patch) | |
| tree | e4694bc9ae0072a927b25ef4bade962de822de0d /Unit.c | |
| parent | 8fba2176bc34aa7e507f0b9d983427bb5e522e17 (diff) | |
| download | pocketempires-2d04eba931ac84e2f09d3c8391125f8a991ca7d3.tar.gz | |
Deprecated use of sprintf() in favor of custom routine Systemitoa().
When B button is released and showActionsMenu == true, showActionsMenu = false.
Diffstat (limited to 'Unit.c')
| -rw-r--r-- | Unit.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -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; |
