GML Fixed FPS Camera issue

Tyler Ryals

In my player object I have a camera example I followed in this tutorial, but it arch's just right for the camera to be more "first person" like. While this is fine in most cases, I really want to get my Camera to remain inside a fixed set of boundaries (like stopping on walls and such so there's no turning around to view anymore).

Create event code for the player
///init player

depth = 100000

display_reset(0, false);

//variable for player

move_f = 0;
move_s = 0;
vsp = 0;
hsp = 0;
accel = 0.5;
maxspeed = 2;

hp = 100;
player_h = 32;

xto = x+1;
yto = y+1;
zto = player_h;
zdir = 0;

forward = ord("W");
back = ord("S");
left = ord("A");
right = ord("D");

this handled the mouse (player step)
///Mouse look

//calculate turning
direction -= (display_mouse_get_x() - display_get_width()/2) /8;
zdir -= (display_mouse_get_y() - display_get_height()/2) /10;

//clamp zdir
zdir = clamp(zdir, -70, 70);

//calculate xto, yto, zto variables
var d = degtorad(direction);
var zd = degtorad(zdir);
xto = x + cos(d) * abs(sin(zd) + sign(-zdir));
yto = y - sin(d) * abs(sin(zd) + sign(-zdir));
zto = player_h + sin(zd);

//Lock cursor to center of screen
var centerx = display_get_width()/2;
var centery = display_get_height()/2;
display_mouse_set(centerx, centery);
and finally the draw event:
///draw camera

d3d_set_projection_ext(x, y, player_h, xto, yto, zto, 0, 0, 1, 75, 16/9, 1, 1000000)
So my real question here is, how can I change the camera from arching, to locked in a specific set of boundaries in front of the player, but with fixed (more angled) camera movement in just that portion between the boundaries. A good example of this is the camera in the Danganronpa series when you've entered a room. You can look around but you can't turn a full 360.