Exemple #1
0
 public static GameObject removeObject(int x, int y, int height, int type) {
   Location loc = Location.locate(x, y, height);
   GameObject oldObj = loc.getGameObjectType(type);
   loc.removeObject(oldObj);
   if (oldObj != null) {
     CacheObjectDefinition def = CacheObjectDefinition.forId(oldObj.getId());
     int xLength;
     int yLength;
     if (oldObj.getRotation() != 1 && oldObj.getRotation() != 3) {
       xLength = def.getSizeX();
       yLength = def.getSizeY();
     } else {
       xLength = def.getSizeY();
       yLength = def.getSizeX();
     }
     if (oldObj.getType() == 22) {
       if (def.getActionCount() == 1) {
         removeClipping(x, y, height, 0x200000);
       }
     } else if (oldObj.getType() >= 9 && oldObj.getType() <= 11) {
       if (def.getActionCount() != 0) {
         removeClippingForSolidObject(
             x, y, height, xLength, yLength, def.isSolid(), !def.isClippingFlag());
       }
     } else if (oldObj.getType() >= 0 && oldObj.getType() <= 3) {
       if (def.getActionCount() != 0) {
         removeClippingForVariableObject(
             x,
             y,
             height,
             oldObj.getType(),
             oldObj.getRotation(),
             def.isSolid(),
             !def.isClippingFlag());
       }
     }
   }
   return oldObj;
 }
Exemple #2
0
 public static GameObject addObject(
     int objectId, int x, int y, int height, int type, int direction, boolean ignoreObjects) {
   if (!ignoreObjects && objectId == -1) {
     removeObject(x, y, height, type);
   }
   if (objectId == -1) {
     return null;
   }
   CacheObjectDefinition def = CacheObjectDefinition.forId(objectId);
   if (def == null) {
     return null;
   }
   int xLength;
   int yLength;
   GameObject object = new GameObject(objectId, x, y, height, type, direction);
   if (direction == 1 || direction == 3) {
     xLength = def.getSizeX();
     yLength = def.getSizeY();
   } else {
     xLength = def.getSizeY();
     yLength = def.getSizeX();
   }
   if (type == 22) {
     if (def.getActionCount() == 1) {
       addClipping(x, y, height, 0x200000);
     }
   } else if (type >= 9 && type <= 11) {
     if (def.getActionCount() != 0) {
       addClippingForSolidObject(
           x, y, height, xLength, yLength, def.isSolid(), !def.isClippingFlag());
     }
   } else if (type >= 0 && type <= 3) {
     if (def.getActionCount() != 0) {
       addClippingForVariableObject(
           x, y, height, type, direction, def.isSolid(), !def.isClippingFlag());
     }
   }
   if (!ignoreObjects) {
     removeObject(x, y, height, type);
   }
   addGameObject(object);
   return object;
 }