/*-------------------------------------------------------------------- * METHODS * --------------------------------------------------------------------*/ /*********************************************************** * * Method: * physics_type * * Description: * Constructor. * ***********************************************************/ public physics_type() { init_position = new int_vector2_type(0, 0); init_velocity = new int_vector2_type(0, 0); position = new int_vector2_type(0, 0); velocity = new int_vector2_type(0, 0); acceleration = new int_vector2_type(0, 0); } /* physics_type() */
/*-------------------------------------------------------------------- * METHODS * --------------------------------------------------------------------*/ /*********************************************************** * * Method: * pipe_type * * Description: * Constructor. * ***********************************************************/ public pipe_type(map_type m, int _x, int _y, Boolean vertical, int length) { int ofst = 0; link_p = null; link_v = null; is_vertical = vertical; x = _x; y = _y; if (m.get_back_color(x) == Color.Black) { ofst = (int)block_enum.PIPE2_HORIZONTAL_B - (int)block_enum.PIPE_HORIZONTAL_B; } if (vertical) { if (y == 0) { m.blocks[x, y] = new block_pipe_type(this, (int)block_enum.PIPE_VERTICAL_L + ofst); m.blocks[x + 1, y] = new block_pipe_type(this, (int)block_enum.PIPE_VERTICAL_R + ofst); } else { m.blocks[x, y] = new block_pipe_type(this, (int)block_enum.PIPE_VERTICAL_ENTRY_L + ofst); m.blocks[x + 1, y] = new block_pipe_type(this, (int)block_enum.PIPE_VERTICAL_ENTRY_R + ofst); } for (int j = y + 1; j < y + length; j++) { m.blocks[x, j] = new block_pipe_type(this, (int)block_enum.PIPE_VERTICAL_L + ofst); m.blocks[x + 1, j] = new block_pipe_type(this, (int)block_enum.PIPE_VERTICAL_R + ofst); } } else { m.blocks[x, y] = new block_pipe_type(this, (int)block_enum.PIPE_HORIZONTAL_ENTRY_T + ofst); m.blocks[x, y + 1] = new block_pipe_type(this, (int)block_enum.PIPE_HORIZONTAL_ENTRY_B + ofst); for (int i = x + 1; i < x + length - 1; i++) { m.blocks[i, y] = new block_pipe_type(this, (int)block_enum.PIPE_HORIZONTAL_T + ofst); m.blocks[i, y + 1] = new block_pipe_type(this, (int)block_enum.PIPE_HORIZONTAL_B + ofst); } if ((m.blocks[x + length - 1, y].GetType() == typeof(block_pipe_type)) && (m.blocks[x + length - 1, y + 1].GetType() == typeof(block_pipe_type))) { m.blocks[x + length - 1, y] = new block_pipe_type(this, (int)block_enum.PIPE_MESH_T + ofst); m.blocks[x + length - 1, y + 1] = new block_pipe_type(this, (int)block_enum.PIPE_MESH_B + ofst); } } } /* pipe_type() */
} /* move_view_location() */ /*********************************************************** * * Method: * check_locks * * Description: * Check for view locks. * ***********************************************************/ public static void check_locks(model_type m) { int_vector2_type position = new int_vector2_type(); position.x = m.level.mario.physics.position.x >> 12; position.y = m.level.mario.physics.position.y >> 12; foreach (Rectangle r in m.level.map.view_locks) { if (r.Contains(position.x, position.y)) { view.X = r.X << 12; view.Y = r.Y << 12; } } } /* check_locks() */
} /* link_pipe() */ public void link_pipe(int_vector2_type destination) { link_v = destination; link_p = null; } /* link_pipe() */
} /* pipe_type() */ /*********************************************************** * * Method: * link_pipe * * Description: * Adds a destination after entering pipe. * ***********************************************************/ public void link_pipe(pipe_type destination_pipe) { link_p = destination_pipe; link_v = null; } /* link_pipe() */