aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-30 15:52:16 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-30 15:52:16 +0100
commit57867bbbdc24b734d85f8d3569c7ad27dcd9504d (patch)
tree1727dd02444038341746894268ecea62b84aaea1
parent3a164bce55e173d5204c4aaa66dd4eb5bc1762f9 (diff)
downloadcub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.tar.gz
cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.tar.bz2
cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.zip
files restructuration
-rw-r--r--Makefile54
-rw-r--r--include/cub3d.h (renamed from cub3d.h)0
-rw-r--r--minimalist.cub4
-rw-r--r--src/capture.c (renamed from capture.c)0
-rw-r--r--src/error.c (renamed from error.c)0
-rw-r--r--src/event.c (renamed from event.c)0
-rw-r--r--src/helper.c (renamed from helper.c)0
-rw-r--r--src/main.c (renamed from main.c)0
-rw-r--r--src/parse/parse.c (renamed from parse/parse.c)0
-rw-r--r--src/parse/parse_check.c (renamed from parse/parse_check.c)0
-rw-r--r--src/parse/parse_color.c (renamed from parse/parse_color.c)0
-rw-r--r--src/parse/parse_resolution.c (renamed from parse/parse_resolution.c)0
-rw-r--r--src/parse/parse_textures.c (renamed from parse/parse_textures.c)0
-rw-r--r--src/render.c (renamed from render.c)0
-rw-r--r--src/render_state.c (renamed from render_state.c)4
-rw-r--r--src/state.c (renamed from state.c)0
-rw-r--r--src/vector.c (renamed from vector.c)0
-rw-r--r--textures/mossy.xpm95
18 files changed, 132 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 0f9454c..5b4222e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,36 +1,48 @@
LIBFT_PATH = ./libft
MINILIBX_PATH = ./miniLibX
+SRCDIR = src
+INCLUDEDIR = include
+OBJDIR = obj
+
CC = gcc
-CCFLAGS = -I$(LIBFT_PATH) -I$(MINILIBX_PATH) -I. -Wall -Wextra -g #-Werror
+CCFLAGS = -I$(LIBFT_PATH) -I$(MINILIBX_PATH) -I$(INCLUDEDIR) \
+ -Wall -Wextra #-Werror
LDFLAGS = -L$(LIBFT_PATH) -lft \
-L$(MINILIBX_PATH) -lmlx \
-framework OpenGL -framework AppKit -lm
NAME = cub3D
-SRC = main.c \
- parse/parse.c \
- parse/parse_textures.c \
- parse/parse_color.c \
- parse/parse_resolution.c \
- parse/parse_check.c \
- event.c \
- state.c \
- vector.c \
- render.c \
- render_state.c \
- helper.c \
- error.c \
- capture.c
-OBJ = $(SRC:.c=.o)
-INCLUDE = cub3d.h
-
-all: libft_all minilibx_all $(NAME)
+SRCFILES = main.c \
+ parse/parse.c \
+ parse/parse_textures.c \
+ parse/parse_color.c \
+ parse/parse_resolution.c \
+ parse/parse_check.c \
+ event.c \
+ state.c \
+ vector.c \
+ render.c \
+ render_state.c \
+ helper.c \
+ error.c \
+ capture.c
+SRC = $(addprefix $(SRCDIR)/,$(SRCFILES))
+$(info $(SRC))
+OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
+$(info $(OBJ))
+INCLUDE = $(addprefix $(INCLUDEDIR), cub3d.h)
+
+all: make_obj_dir libft_all minilibx_all $(NAME)
+
+make_obj_dir:
+ @if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi
+ @if [ ! -d $(OBJDIR)/parse ]; then mkdir $(OBJDIR)/parse; fi
$(NAME): $(OBJ)
- $(CC) $(LDFLAGS) -o $@ $(OBJ)
+ $(CC) -o $@ $(OBJ) $(LDFLAGS)
-%.o: %.c $(INCLUDE)
+$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CCFLAGS) -c -o $@ $<
clean: libft_clean minilibx_clean
diff --git a/cub3d.h b/include/cub3d.h
index 2c5d0c3..2c5d0c3 100644
--- a/cub3d.h
+++ b/include/cub3d.h
diff --git a/minimalist.cub b/minimalist.cub
index 9974bb2..a1d6433 100644
--- a/minimalist.cub
+++ b/minimalist.cub
@@ -1,7 +1,7 @@
R 700 500
-NO ./textures/brick.xpm
+NO ./textures/wood.xpm
SO ./textures/wood.xpm
-WE ./textures/wood.xpm
+WE ./textures/brick.xpm
EA ./textures/stone.xpm
S ./textures/brick.xpm
diff --git a/capture.c b/src/capture.c
index 521774a..521774a 100644
--- a/capture.c
+++ b/src/capture.c
diff --git a/error.c b/src/error.c
index eb94c9f..eb94c9f 100644
--- a/error.c
+++ b/src/error.c
diff --git a/event.c b/src/event.c
index 9dcaa75..9dcaa75 100644
--- a/event.c
+++ b/src/event.c
diff --git a/helper.c b/src/helper.c
index 9940848..9940848 100644
--- a/helper.c
+++ b/src/helper.c
diff --git a/main.c b/src/main.c
index 00a041d..00a041d 100644
--- a/main.c
+++ b/src/main.c
diff --git a/parse/parse.c b/src/parse/parse.c
index f4b5b66..f4b5b66 100644
--- a/parse/parse.c
+++ b/src/parse/parse.c
diff --git a/parse/parse_check.c b/src/parse/parse_check.c
index a65d74a..a65d74a 100644
--- a/parse/parse_check.c
+++ b/src/parse/parse_check.c
diff --git a/parse/parse_color.c b/src/parse/parse_color.c
index fd482e5..fd482e5 100644
--- a/parse/parse_color.c
+++ b/src/parse/parse_color.c
diff --git a/parse/parse_resolution.c b/src/parse/parse_resolution.c
index d6c5759..d6c5759 100644
--- a/parse/parse_resolution.c
+++ b/src/parse/parse_resolution.c
diff --git a/parse/parse_textures.c b/src/parse/parse_textures.c
index a0fb8f6..a0fb8f6 100644
--- a/parse/parse_textures.c
+++ b/src/parse/parse_textures.c
diff --git a/render.c b/src/render.c
index 88b0cae..88b0cae 100644
--- a/render.c
+++ b/src/render.c
diff --git a/render_state.c b/src/render_state.c
index 5fcc6ed..46fc7c5 100644
--- a/render_state.c
+++ b/src/render_state.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 14:40:14 by cacharle #+# #+# */
-/* Updated: 2020/01/30 15:14:39 by cacharle ### ########.fr */
+/* Updated: 2020/01/30 15:50:48 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -171,7 +171,7 @@ t_image *get_tex(t_state *state, t_render_state *rstate)
}
else if (rstate->side == SIDE_WE)
{
- if (rstate->probe.x < state->pos.x)
+ if (rstate->probe.x > state->pos.x)
return (state->textures + TEX_WEST);
else
return (state->textures + TEX_EAST);
diff --git a/state.c b/src/state.c
index 11e1c65..11e1c65 100644
--- a/state.c
+++ b/src/state.c
diff --git a/vector.c b/src/vector.c
index 44f784b..44f784b 100644
--- a/vector.c
+++ b/src/vector.c
diff --git a/textures/mossy.xpm b/textures/mossy.xpm
new file mode 100644
index 0000000..7e9d798
--- /dev/null
+++ b/textures/mossy.xpm
@@ -0,0 +1,95 @@
+/* XPM */
+static char *mossy[] = {
+/* columns rows colors chars-per-pixel */
+"64 64 25 1",
+" c #202020",
+". c #2C2C2C",
+"X c #383838",
+"o c #404000",
+"O c #585400",
+"+ c #706C00",
+"@ c #484848",
+"# c #545454",
+"$ c #646464",
+"% c #707070",
+"& c #7C7C7C",
+"* c #848400",
+"= c #9C9C00",
+"- c #B4AC00",
+"; c #CCC400",
+": c #E4D800",
+"> c #FCF420",
+", c #8C8C8C",
+"< c #989898",
+"1 c #A8A8A8",
+"2 c #B4B4B4",
+"3 c #C0C0C0",
+"4 c #D0D0D0",
+"5 c #DCDCDC",
+"6 c #ECECEC",
+/* pixels */
+"................................................................",
+"##########@5;;;;;555555---5 X,155555;;;%,,# @@@@@@@@@@##########",
+"##########@54----<1;;433;;, X,32,;&;===+##X X%====&&&%$@@@@@@@@@",
+",,,,,,,, #@54---+<;;=333*-$ X151,&;&+*+#&#X X=;:=+,23;;;$$;;,,,,",
+"42-221,, #@54==*+<;=11<,,=# X,3,,,11$*+#%#X X=:-+$&25;::@$;;*&44",
+"11--#%&% #@53=*+%&<1<=,%,*# X@1;=1,,&O#%##X X=:+$,2:;&==@$=*+@,<",
+"2<+#,,,% @@54=++&1<<<=,<%,# X@&=*-,11%$%XXX X*=+$&;;;&+=@%$@@$-&",
+"22&,1,%# X@54,&&<1<4&*<1,,# X@%,1,1,,,1%XXX.X*+$,,&;&&++@%&,%&*$",
+"<11%%,@@ .@531<&<;<<,<,,1,# @#%%##XXXXXXX XX&$,&11&,1&@%,<,,1&$",
+",,,,%#@@ .@561&<&;-%,,,1,,#. @@XXXXXXXXX XXX&22,=&<&&<$%<,<,,1,",
+"%%%%#@XX .@55,&<<;=%1,1,1,#. X@X.. ..XXXX&2&=@,1:&,%,%<$%,$$",
+"##@@@ .@151<&;-=%<,,&,%$X X@@@@%111155+XXX%2,&$$&=X##$@@@@@@@",
+" ....X#,54,&,=%,,1&,=,#X X@%1>>555445;+XX#,%$$#@OXXXXXX.....",
+".........X#%14,1,,,1,,<,$$#X .X1>;=,,1,1=%O XXXXXXXXXXX.. ",
+"XXXXXXXXXX#@,41,1<%<,&,1*##X .@1;*&1,::,=#+XX..........XXXXXXXXX",
+"#@XXXXXXXX#@%3,1<;=%1,1,+#%@ .@1:*&,;:&,*#OX@@#### @@@@@@@@@@@@@",
+"<<<<<<<<<. #@33*,=*1%,,,%$## @::&&1::%,+#XX@:--$#@#&<<<<<<<<<<<",
+"4;-55;=%%X #@,3+$<$,%%1,%,%@ @:&,&,=+$1,#XXX--*$.@&3;;;5-11;;;5",
+";-*--=+#%X #@%<$$,,%,#,%#%#@ @&,&,:$$$###X X=*#$ @<;;;&:=&1;=*%",
+"-*1-=*+#%X @#@<<%,$%%%%#%#@. .1,%,%#XXXXXX $=*%# @<;;&<==&<;=*%",
+"*1,-=++##X @#@$##XXXXXX. .,%XXX $,*,# @<1&,<=&&1;=*<",
+"1,1-+##,#X @#@.... .X#X ......,1,1# @,1<1<1&1&1=+%",
+",1&&#%,%#X X##@X @@@@@@@,,<=====&#.X$3513$ @,,1:<,1<11&&<",
+",;=&,,,$@X X,;;-=,222$X@$=;;;-4666;;;;-=* X&5351% @&<1<,1<:<&1<1",
+",=*1,,,$@X X;--=&&&&&X#@=;-%<11<1<=&=*=*+ X,5113: @:1<1<::&1<<1<",
+"<*,,,,%#XX X-=*$$$$$$ #@<6<<=<;1<<&1*&=+O X,:,,1= @=O%$:-*+O%%#%",
+"$$$$$#@XXX X-*$$<*=+$ @@<6:1<;*<;;1<*1*$O X,-%,1+ @OXX@OOOO@@###",
+"#@@XXX .X-*$<<&*+$ @@<6;1;=&<;*<1<<&$o X,%,15O @.. XX@",
+" ...@@@6$<1*,*+$ X@<6-<;+&1<1<&-*&$o X:6151# @XXXX... ",
+"@$$%,<,,,,@ 6<<1*,$&$o @<6-1=+&<&<1<-*&#o X-6331# @XXXXXXXXXXXXX",
+"$,2--,1111$ 614,+1,&$o @<61;=+&<11<1-*,#o +=511-# @+===--**@@@@#",
+"$2--*$1111@ 61<1&,&,$o @&<;=+%&1<<&<-*$#o X=55-=# @%=+===---*<X#",
+"$-=*$,1--%$ 641<1*,1$o X#<=+&&,<1&<&-*%@X X=51-+# @<%%==**+++&X#",
+"$-=%%1%-*%$ 6<,<1,,&$o .#161;;=,&&&&-*$@. +,43-O# @511=+%%O$%$X@",
+"$%,1,%,-+%# 5111<11&$o .#,63;*+&<<,1=*$@ =,41*+o @41,=+,&<$<$X@",
+"$11,11-=+%# 53&<;-&,$o @%43*+$&,1<-=$$X @,4,+Oo @311=+&,<<1#X@",
+"$5<1,,*++%# 35,<-*,1$oo @#25+$&,1,*$$$%X X@&1&+oOX@11,=*%<&%<#XX",
+"$511,<++%%# 25&1,,,,$oo X#,3<&&%%%$$%%#X X@#XXOOXX@%#@########XX",
+"$52,-*,%,<# <51&11&,$#o X#@,,%%##@ o@#@ X@#@@XXX@@ X",
+"$521,<,-=%# &5<<1,$,&#o .@@X... ...XXXXXX@@@@@@@@@@@@XXXXXXXXXX",
+"$5--<,-=*%# #611,,,1&#O .@@@XXXXX@@@##$$$%%&&&&&****&&&&&&&&&&X#",
+"$--*1<=++$# @6<,=&,&&#O .X$=======*&&,<<1111122;;;-*33:-3;-*3&X#",
+"$-*&<<,++$ .@61,*$1,$#O X+;;;;;;;;=1313<31333;-***22:-33---*$.@",
+"$-*&1,,,,# .@6,1$$,,$#O X+;-------*13113;=<1<-*1<;;-&,3-=-*&#.@",
+"$-*,,1,1,# X@51111,1$#o X.--======*+,311==11<3<1;--&,<1%%-%%#.X",
+"@*&,1,1,$# X@4,,1,,,$#X X.,,,=*=**++%131,&<3<<1;&&&<11<,,-%%#.X",
+"@,,,,&$## .X@21,,1,&$#X X.353=++++%%,13,2,<<;;<,&%,,:-21,-%%#.X",
+"@&&%$#### .X@<<1,,,%$#X X.254*%%%%&<,=121,2;1,,1,,<2-*1<<%%%# X",
+"@X ###### X@@&$$$$$$##X X.154%&,,--*2,,2<121,-1-1<2-*<11<--%# X",
+"###.. . .X@XXXXXXXXXXX ..,42,2<2--+,2,2<,,:-+<13<1<<1<,,2&%# X",
+"@@@@XX....X@XX .,<%%%%%*++,1%&,2:-+1,1<,,2&,,;<,<%# X",
+"@&1;;;=,$@@#XX............X#@X......#%%&,-2++&&%$&,,,&&2&$&&$# X",
+"@1;:;;;;-=1,%$#@XXXXXXXXXX@#@@XXXXXX.@####################### .X",
+"@1;:-,,,<13-::;;;-----*%&%$$##@@@@@XX..... ...... .X@",
+"@13<-<3323231,,========*,,311111,@#@XXXXXXXXX...............XX@@",
+"@133<3211<312321,,,,,***,<35::,3&X@#@@@XXXXXXXXXXXXXXXXXXXXX@@@#",
+"@124323:-*2241433;=<,,,,,21,:*,&$ X#@*---$@@@###+-=*++O@@@@@####",
+"@1331,&-*O313411143313141&141,,$# X@@-***$552##=;;;=&;114;2<&@@#",
+"@1,%$$$*O%&%$%&%$$$%&,1,&$$$$$$##X X@$**+$222$#,&&&&&11,;=%15< #",
+"@,$@XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .@2*+$<$<,$@,,1,1;;11=*%,1# #",
+"@X .@XoO#$$$$$@$$<1;;=&1*%%,,# #",
+"#@XXX...............................X@ooX X@##+O###+O##### #",
+"####@@@@@@@@XXXXXXXXXXXXXXXXXXXXXXXXX@@@@XXXXXX@@ #",
+"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+};