feat: add some ketchup *

also fix the 4th ketchup still image
This commit is contained in:
mcolonna 2024-04-03 14:49:35 +02:00
parent a7deecf072
commit ea59cdd8a6
22 changed files with 733 additions and 556 deletions

View file

@ -6,28 +6,32 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/15 14:58:25 by mcolonna #+# #+# */
/* Updated: 2024/04/02 17:49:28 by mcolonna ### ########.fr */
/* Updated: 2024/04/03 16:11:55 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef OBJECT_H
# define OBJECT_H
typedef struct s_object t_object;
typedef struct s_object t_object;
typedef struct s_character t_character;
typedef struct s_objecttype
{
t_point (*loop)(t_object *, t_point pos);
void (*draw)(t_object *, int x, int y);
} t_objecttype;
t_point (*loop)(t_object *, t_point pos);
void (*draw)(t_object *, int x, int y);
// Called when a character want to walk through this object.
// Returns false to block the character. If true, it will pass.
// If walk_through is NULL, the character is blocked.
bool (*walk_through)(t_character *, t_point pos);
} t_objecttype;
typedef struct s_object
{
t_objecttype type;
void *data;
bool solid;
} t_object;
typedef t_object (*t_object_init)(t_memclass);
typedef t_object (*t_object_init)(t_memclass);
#endif

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/02 17:47:01 by mcolonna #+# #+# */
/* Updated: 2024/04/02 17:48:38 by mcolonna ### ########.fr */
/* Updated: 2024/04/03 15:25:31 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -29,4 +29,12 @@ typedef struct s_wall_data
t_object wall_init(t_memclass mc);
// KETCHUP
typedef struct s_ketchup_data
{
t_sprite spr;
} t_ketchup_data;
t_object ketchup_init(t_memclass mc);
#endif

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/07 23:00:45 by mcolonna #+# #+# */
/* Updated: 2024/04/02 17:50:58 by mcolonna ### ########.fr */
/* Updated: 2024/04/03 15:32:23 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,6 +19,7 @@ typedef struct s_room
int height;
t_sprite *surfaces;
t_object **objects;
t_visual **visuals;
t_memclass mc;
} t_room;

24
includes/room/visual.h Normal file
View file

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* visual.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/03 15:34:18 by mcolonna #+# #+# */
/* Updated: 2024/04/03 15:51:14 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef VISUAL_H
# define VISUAL_H
typedef struct s_visual
{
t_sprite spr;
} t_visual;
void visual_loop(t_visual **visual, int x, int y);
void visual_addtoroom(t_spritesmap_id sprid, t_point pos);
#endif