-
Notifications
You must be signed in to change notification settings - Fork 0
/
wall_edge_sprite_functions.c
53 lines (48 loc) · 1.65 KB
/
wall_edge_sprite_functions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* ************************************************************************** */
/* */
/* :::::::: */
/* wall_edge_sprite_functions.c :+: :+: */
/* +:+ */
/* By: cschuijt <[email protected]> +#+ */
/* +#+ */
/* Created: 2022/11/22 16:24:00 by cschuijt #+# #+# */
/* Updated: 2022/11/22 16:24:00 by cschuijt ######## odam.nl */
/* */
/* ************************************************************************** */
#include "so_long.h"
uint8_t edge_single(uint8_t surroundings)
{
if (surroundings >> 0 & 1)
return (20);
if (surroundings >> 2 & 1)
return (19);
if (surroundings >> 4 & 1)
return (4);
return (5);
}
uint8_t edge_consecutive(uint8_t surroundings)
{
if ((surroundings >> 0 & 1) & (surroundings >> 2 & 1))
return (50);
if ((surroundings >> 2 & 1) & (surroundings >> 4 & 1))
return (22);
if ((surroundings >> 4 & 1) & (surroundings >> 6 & 1))
return (35);
return (21);
}
uint8_t edge_opposing(uint8_t surroundings)
{
if (surroundings >> 0 & 1)
return (34);
return (49);
}
uint8_t edge_triple(uint8_t surroundings)
{
if (!(surroundings >> 0 & 1))
return (52);
if (!(surroundings >> 2 & 1))
return (51);
if (!(surroundings >> 4 & 1))
return (36);
return (37);
}