Minor fix

This commit is contained in:
onpon4 2015-04-26 18:49:18 -04:00
parent 6ede2722a0
commit bca1c618f0
1 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ void loadGameGraphics()
if (shipShape[i - SHIP_HIT_INDEX] == NULL) if (shipShape[i - SHIP_HIT_INDEX] == NULL)
continue; continue;
shipShape[i] = createSurface(shipShape[i - SHIP_HIT_INDEX]->w, shipShape[i] = createSurface(shipShape[i - SHIP_HIT_INDEX]->w,
shipShape[i- SHIP_HIT_INDEX]->h); shipShape[i - SHIP_HIT_INDEX]->h);
blit(shipShape[i - SHIP_HIT_INDEX], 0, 0, shipShape[i]); blit(shipShape[i - SHIP_HIT_INDEX], 0, 0, shipShape[i]);
switch (shipShape[i]->format->BitsPerPixel) switch (shipShape[i]->format->BitsPerPixel)
@ -88,34 +88,34 @@ void loadGameGraphics()
case 32: case 32:
SDL_LockSurface(shipShape[i]); SDL_LockSurface(shipShape[i]);
p32 = (Uint32 *)shipShape[i]->pixels; p32 = (Uint32 *)shipShape[i]->pixels;
SDL_UnlockSurface(shipShape[i]);
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++) for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
{ {
if (p32[j]) if (p32[j])
p32[j] |= shipShape[i]->format->Rmask; p32[j] |= shipShape[i]->format->Rmask;
} }
SDL_UnlockSurface(shipShape[i]);
break; break;
case 16: case 16:
SDL_LockSurface(shipShape[i]); SDL_LockSurface(shipShape[i]);
p16 = (Uint16 *)shipShape[i]->pixels; p16 = (Uint16 *)shipShape[i]->pixels;
SDL_UnlockSurface(shipShape[i]);
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++) for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
{ {
if (p16[j]) if (p16[j])
p16[j] |= shipShape[i]->format->Rmask; p16[j] |= shipShape[i]->format->Rmask;
} }
SDL_UnlockSurface(shipShape[i]);
break; break;
case 8: case 8:
SDL_LockSurface(shipShape[i]); SDL_LockSurface(shipShape[i]);
p8 = (Uint8 *)shipShape[i]->pixels; p8 = (Uint8 *)shipShape[i]->pixels;
SDL_UnlockSurface(shipShape[i]);
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++) for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
{ {
if (p8[j]) if (p8[j])
p8[j] = SDL_MapRGB(shipShape[i]->format, 255, 0, 0); p8[j] = SDL_MapRGB(shipShape[i]->format, 255, 0, 0);
} }
SDL_UnlockSurface(shipShape[i]);
break; break;
} }