Draw only the onscreen tiles and a 1 tile margin around the screen edges to make smooth scrolling easier. In other words, if your display is 15x15 tiles then draw 17x17 tiles.
As for centering the map around the character;
Start by getting your map x/y (which tile are you on) to use as the point to center on.
Subtract half the screen width (in tiles) from x and half the height from y.
This should give you the x/y of the tile to be placed in the upper-left corner.
I haven't looked at your code but I think you could probably take it from there.
If you want to the screen to not scroll its edges past the map edge then you'll need to do some bounds checking. For instance, run the above calculations and if x or y is negative then set them to 0. If they're greater than the map dims minus the screen dims then set them to map dims minus screen dims, etc.
Okay, I will try to always render the hero at the center of the map first. brb.
Edit: Alright the game is centered properly. Thank you for the answer.