feat: add activable wall
This commit is contained in:
parent
192f1a866e
commit
840d0b31e9
6 changed files with 68 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/26 16:32:36 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/20 15:47:12 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/21 16:04:08 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -23,6 +23,7 @@ const t_consts g_consts = {
|
|||
{c: 'E', object: exit_init, surface: CASE_FLOOR_1},
|
||||
{c: 'F', object: firsk_init, surface: CASE_FLOOR_1},
|
||||
{c: 'B', object: NULL, surface: CASE_BRIDGE},
|
||||
{c: 'A', object: activablewall_init, surface: CASE_FLOOR_1},
|
||||
{c: '\0'}
|
||||
},
|
||||
levels: {
|
||||
|
|
|
|||
51
src/room/object_activablewall.c
Normal file
51
src/room/object_activablewall.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* object_activablewall.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/15 15:27:03 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/21 16:09:40 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
static t_point activablewall_loop(t_object *obj, t_point pos)
|
||||
{
|
||||
(void)obj;
|
||||
(void)pos;
|
||||
return (point_init(0, 0));
|
||||
}
|
||||
|
||||
static void activablewall_draw(t_object *obj, t_point p)
|
||||
{
|
||||
if (g_env.ketchup < g_env.max_ketchup)
|
||||
sprite_draw(p, &((t_activablewall_data *)obj->data)->spr);
|
||||
}
|
||||
|
||||
static bool activablewall_walk_through(
|
||||
t_object *obj, t_character *character, t_point pos)
|
||||
{
|
||||
(void)obj;
|
||||
(void)character;
|
||||
(void)pos;
|
||||
return (g_env.ketchup == g_env.max_ketchup);
|
||||
}
|
||||
|
||||
t_object activablewall_init(t_memclass mc)
|
||||
{
|
||||
static const t_objecttype type
|
||||
= {solid_firsk: false, solid_snas: false,
|
||||
init: activablewall_init, loop: activablewall_loop,
|
||||
draw: activablewall_draw, walk_through: activablewall_walk_through};
|
||||
t_object r;
|
||||
t_wall_data *data;
|
||||
|
||||
r.type = type;
|
||||
data = mem_alloc(error_err, mc, sizeof(t_activablewall_data));
|
||||
data->spr = sprite_init(SPR_WALL);
|
||||
r.data = data;
|
||||
return (r);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue