Permalink
Browse files

Merge pull request #832 from Flet/basefix

workaround to allow different size bases for now
  • Loading branch information...
2 parents 5007296 + a51d642 commit 6e269cc761d5ae5bf0f3d7cdd3d83dcbc02a65c4 @Flet Flet committed Mar 7, 2012
Showing with 20 additions and 8 deletions.
  1. +20 −8 src/com/mojang/mojam/level/Level.java
@@ -358,20 +358,32 @@ private void renderTilesAndBases(Screen screen, int x0, int y0, int x1, int y1){
continue;
}
+ Bitmap[][] playerBaseZero = Art.getPlayerBase(getPlayerCharacter(0));
+ Bitmap[][] playerBaseOne = Art.getPlayerBase(getPlayerCharacter(1));
+ int baseOneTileHeight = playerBaseOne[0].length;
+ int baseOneTileWidth = playerBaseOne.length;
+ int baseZeroTileHeight = playerBaseZero[0].length;
+ int baseZeroTileWidth = playerBaseZero.length;
+
+
// if we are in the center area (4*7 Tiles): draw player bases
- int xt = x - (width / 2) + 5;
- int yt = y - 4;
+ int xt = x - (width / 2) + ((baseOneTileWidth-(baseOneTileWidth%2))/2) + (baseOneTileWidth%2);
+ int yt = y - baseOneTileHeight;
- if (xt >= 0 && yt >= 0 && xt < 9 && yt < 4 && (isNotBaseRailTile(xt) || yt < 3)) {
- screen.blit(Art.getPlayerBase(getPlayerCharacter(1))[xt][yt], x * Tile.WIDTH, y
+ if (xt >= 0 && yt >= 0 && xt < baseOneTileWidth && yt < baseOneTileHeight && (isNotBaseRailTile(xt) || yt < baseOneTileHeight-1)) {
+ screen.blit(playerBaseOne[xt][yt], x * Tile.WIDTH, y
* Tile.HEIGHT);
continue;
}
-
+
+ // if we are in the center area (4*7 Tiles): draw player bases
+ xt = x - (width / 2) + ((baseZeroTileWidth-(baseZeroTileWidth%2))/2) + (baseZeroTileWidth%2);
+
+
yt = y - (height - 8);
- if (xt >= 0 && yt >= 0 && xt < 9 && yt < 4 && (isNotBaseRailTile(xt) || yt > 0)) {
- screen.blit(Art.getPlayerBase(getPlayerCharacter(0))[xt][yt], x * Tile.WIDTH, y * Tile.HEIGHT);
- if ((xt == 0 || xt == 1 || xt >= 7 && xt <= 8) && yt == 0) {
+ if (xt >= 0 && yt >= 0 && xt < baseZeroTileWidth && yt < baseZeroTileHeight && (isNotBaseRailTile(xt) || yt > 0)) {
+ screen.blit(playerBaseZero[xt][yt], x * Tile.WIDTH, y * Tile.HEIGHT);
+ if (yt == 0 && ((xt <=(baseZeroTileWidth-3)/2) || (xt >=((baseZeroTileWidth-3)/2)+3 ))) {
screen.blit(Art.shadow_north, x * Tile.WIDTH, y * Tile.HEIGHT);
}
if ((xt == 2) && yt == 0) {

0 comments on commit 6e269cc

Please sign in to comment.