/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_basic_keys.c                                    :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:43:55 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:43:56 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <cub3d.h>
#include <stdint.h>

int
	ft_w_key(t_cub *clist)
{
	t_player	*pl;
	const float	move_speed = FT_MOVE_SPEED;

	pl = &clist->plist;
	pl->pos_y += move_speed * pl->dir_x;
	pl->pos_x += move_speed * pl->dir_y;
	clist->moves = 1;
	return (0);
}

int
	ft_a_key(t_cub *clist)
{
	t_player	*pl;
	const float	move_speed = FT_STRAFE_SPEED;

	pl = &clist->plist;
	pl->pos_y += move_speed * -pl->dir_y;
	pl->pos_x += move_speed * pl->dir_x;
	clist->moves = 1;
	return (0);
}

int
	ft_s_key(t_cub *clist)
{
	t_player	*pl;
	const float	move_speed = FT_MOVE_SPEED;

	pl = &clist->plist;
	pl->pos_y += move_speed * -pl->dir_x;
	pl->pos_x += move_speed * -pl->dir_y;
	clist->moves = 1;
	return (0);
}

int
	ft_d_key(t_cub *clist)
{
	t_player	*pl;
	const float	move_speed = FT_STRAFE_SPEED;

	pl = &clist->plist;
	pl->pos_y += move_speed * pl->dir_y;
	pl->pos_x += move_speed * -pl->dir_x;
	clist->moves = 1;
	return (0);
}