/*
** EPITECH PROJECT, 2018
** task01
** File description:
** I do task
*/
#include <stdlib.h>
#include "game/message_data.h"
#include "game/memory.h"
#include "game/ascii.h"
#include "game/core.h"


message_t **load_message(scene_t *scene, uint8_t type)
{
	message_t **message;
	int offset;
	int i;

	i = -1;
	offset = (type == MESSAGE_GAME) ? 3 : 0;
	scene->message_active = 0x00;
	scene->nb_message = (type == MESSAGE_GAME) ? 17 : 3;
	message = (message_t**)malloc(sizeof(message_t*)
	* scene->nb_message);
	while (++i < scene->nb_message){
		message[i] = (message_t*)malloc(sizeof(message_t));
		message[i]->trigger_data = default_trigger_start[i + offset];
		message[i]->message = (void*)default_message[i + offset];
		message[i]->action = default_action[i + offset];
		message[i]->timer_message = MESSAGE_DEFAULT_TIME -
		((message[i]->action == MESSAGE_BEGIN) ? 1 : 0);
		message[i]->x = 0;
		message[i]->y = 0;
	}
	return (message);
}
