From f80eb125f5c82a3ddadb88c5f8ff00fd8cc816f9 Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Wed, 3 Sep 2025 18:39:30 +0200 Subject: [PATCH] feat: Added the round counter on the hud --- Makefile | 1 + ressources/Mastodonte.png | Bin 0 -> 3361 bytes ressources/juggernog.xpm | 173 +++++++++++++++++++------------------ ressources/round_eight.xpm | 65 ++++++++++++++ ressources/round_five.xpm | 65 ++++++++++++++ ressources/round_four.xpm | 65 ++++++++++++++ ressources/round_nine.xpm | 65 ++++++++++++++ ressources/round_one.xpm | 65 ++++++++++++++ ressources/round_seven.xpm | 65 ++++++++++++++ ressources/round_six.xpm | 65 ++++++++++++++ ressources/round_three.xpm | 65 ++++++++++++++ ressources/round_two.xpm | 65 ++++++++++++++ ressources/round_zero.xpm | 65 ++++++++++++++ ressources/tally_five.xpm | 65 ++++++++++++++ ressources/tally_four.xpm | 65 ++++++++++++++ ressources/tally_one.xpm | 65 ++++++++++++++ ressources/tally_three.xpm | 65 ++++++++++++++ ressources/tally_two.xpm | 65 ++++++++++++++ src/cub3d_data.h | 5 +- src/hud/load_texture.c | 95 ++++++++++++++++++++ src/hud/load_texture.h | 21 +++++ src/main.c | 23 ++++- src/utils/hooks.c | 4 +- src/utils/inits.c | 35 ++------ 24 files changed, 1217 insertions(+), 115 deletions(-) create mode 100644 ressources/Mastodonte.png create mode 100644 ressources/round_eight.xpm create mode 100644 ressources/round_five.xpm create mode 100644 ressources/round_four.xpm create mode 100644 ressources/round_nine.xpm create mode 100644 ressources/round_one.xpm create mode 100644 ressources/round_seven.xpm create mode 100644 ressources/round_six.xpm create mode 100644 ressources/round_three.xpm create mode 100644 ressources/round_two.xpm create mode 100644 ressources/round_zero.xpm create mode 100644 ressources/tally_five.xpm create mode 100644 ressources/tally_four.xpm create mode 100644 ressources/tally_one.xpm create mode 100644 ressources/tally_three.xpm create mode 100644 ressources/tally_two.xpm create mode 100644 src/hud/load_texture.c create mode 100644 src/hud/load_texture.h diff --git a/Makefile b/Makefile index 781e3f5..2217473 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ endif IFLAGS = -I./mlx -I./libft SOURCEFILES = \ + src/hud/load_texture.c \ src/utils/inits.c \ src/utils/time.c \ src/utils/destroy_utils.c \ diff --git a/ressources/Mastodonte.png b/ressources/Mastodonte.png new file mode 100644 index 0000000000000000000000000000000000000000..b2de264c28d2c21fc312fd7529e5338967e9a575 GIT binary patch literal 3361 zcmeAS@N?(olHy`uVBq!ia0y~yU~m9o4kiW$23787oeT^NoCO|{#S9F3${@^GvDChd zfq^q5GbExU!q>+tIX_n~F(p4KRj(qqfB^(->?;Zqle1Gx6p~WYGxKbf-tXS8q>!0n zs}yePYv5bpoSKp8QB{;0T;&&%T$P<{nWAKGr(jcIRgqhen_7~nP?4LHS8P>bs{}UJ zDzDfIB&@Hb09I0xZL8!6vQQzyH$cHTzbI9~RL@K|+0ev7!Q4{M(9FcZ*i1*k$iUE2 z-@roO&{)^N(8|Ef%G6u|3Y6>=Y>HCStb$zJpmr6dq}eKEl#~=$>Fbx5m+O@q>*W`v z>l<2HTIw4Z=^Gj87Nw-=7FXt#Bv$C=6)VF`a7isrF3Kz@$;{7F0GXJWlwVq6tE2=q zwj#FxZfssLG?;i`*ET+2%Et1b?yEJ)Q4N-fSWElN&xElbTSQHJ@TxFjeQ5j0pW zL)9LXng-Wgkda@KU!0MTBM{)y@SrHLaxO|uEXgkl$54J>pG4MU8KtxSxpOf9qxjI0a{AWD5xOA=EOOA?V4 zTk0AZhZtH|8CqBwnV~4oPsvQHB&akc*(xo+C^xahRw*+#F+EkkATJ$ko3F2xXI^nh zVqS8pr;DvpMQ(v!W@d_2YNDm7MY3U{uCaNVxo&ETNuq9|nX!p(qH&^0vZ> zmWdXIhH%sTi!#$Q^AdBAO$E6sB{Rh;F)`63)zrd3H_0r`Lf0b6#8B75GBs5<$Kk#BxVs;!bSC@X-Iq?JczaY=qrB{Xvdrxrq4IhhLJRA`l$ z49Y0BO39!|PEAp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Wk+itF&j#5la5TR zkJsI1!(VH(jUm}@adH~}9{0{Y%TI4HXWr@X<-o0nfs15U^3=%x=doR}mHEE^YXjjh vd7Fo?b(t*>Us?5AVbk*34<;Yy&-u&9`n${fkVn2Hs1xJq>gTe~DWM4f$ZxJI literal 0 HcmV?d00001 diff --git a/ressources/juggernog.xpm b/ressources/juggernog.xpm index 3bdb87f..c2f44e5 100644 --- a/ressources/juggernog.xpm +++ b/ressources/juggernog.xpm @@ -1,86 +1,89 @@ /* XPM */ -static char * juggernog_xpm[] = { -"64 64 19 1", -" c #FF00DC", -". c #000001", -"+ c #E4E4E4", -"@ c #D53737", -"# c #FDECB3", -"$ c #FF0000", -"% c #FFFFFF", -"& c #FADF84", -"* c #C2C2C2", -"= c #903030", -"- c #782A2A", -"; c #B12A2A", -"> c #A7A7A7", -", c #E9E9E9", -"' c #817F7F", -") c #8E2323", -"! c #C1C1C1", -"~ c #686666", -"{ c #FF5400", -" ....... ", -" ...+++++... ", -" ..+++++++++.. ", -" ..@@@@@@@@@@@.. ", -" ..@@@@#####@$$@.. ", -" .+@@@@#####$$$@%. ", -" ..+@@@@####&&$@@+.. ", -" .++@######$$&##@++. ", -" .++@#####$$$###@++. ", -" .++@####$$$####@++. ", -" .++@###$$$#####@++. ", -" .++@##$$$######@++. ", -" ..+@@$$$####@@@@+.. ", -" .++@@$#####@@@++. ", -" ..++@@#####@@++.. ", -" ..++@@@@@@@++.. ", -" ..++@@@@@++.. ", -" ...+@@@+... ", -" ....... ", -" .......................... ", -" ..************************.. ", -" ..**=*=*=*===**===**===*===*.. ", -" ..***=*=*=*=****=****=***=*=**.. ", -" .****=*=*=*=*==*=*==*==**===***. ", -" .**=*=*=*=*=**=*=**=*=***==****. ", -" .**===*===*====*====*===*=*=***. ", -" .******************************. ", -" .*******=***=*====*===*********. ", -" .*******==**=*=**=*=***********. ", -" .*******=*=*=*=**=*=*==********. ", -" .*******=**==*=**=*=**=********. ", -" .*******=***=*====*====********. ", -" .******************************. ", -" .*-*--*--**********************. ", -" .--*--*-***********************. ", -" .*-*--*--**********************. ", -" .*-*--***;;;;;;;;;;;;;*********. ", -" .*******;>>>>>>>>>>>>>;********. ", -" .,,,,,,,;''''''''''''';,,,,,,,,. ", -" .)))))));''''''''''''';)))))))). ", -" .)!!))));>>>>>>>>>>>>>;)))))))). ", -" .!))))));;..~~..~~~.~;;)))))))). ", -" .)))))));;~~~~..~~~.~;;)))))))). ", -" .)))))));;...........;;)))))))!. ", -" .!))))));;;;;;;;;;;;;;;))))))!). ", -" .)))))));;;;;;;;;;;;;;;)))))))). ", -" .))))))!;;;;;;;';;;;;;;!)))))!). ", -" .)))))));;;;;;;';;;;;;;)))))))). ", -" .)))))));;;;...'...;;;;)!)))))). ", -" .)))))!);;;;.;;;;;.;;;;)!)))))). ", -" .))))!));;;;.......;;;;)!)))))). ", -" .))))!));;;;;;;;;;;;;;;)!)))))). ", -" .)))))));;~~~~;;;;;...;)!)))))). ", -" .)))))));;~{{~;;;;;.;.;!))))))). ", -" .)))))));;~{{~;;;;;...;)))))))). ", -" .)))))));;~{{~;;;;;;;;;))))!))). ", -" .))))!));;~~~~;;;;;;;;;)!!!)))). ", -" .!!!!))));;;;;;;;;;;;;))))))))). ", -" .))!)))))))))))))))))!))))))))). ", -" .)!!)))))))))))))))))!))))))))). ", -" ..!))))))!!))))))))))))))))))).. ", -" ..)))))!!)!))))))))))))))))).. ", -" ..)))!)))!)))))))))))))))).. ", -" .......................... "}; +static char *juggernog[] = { +/* columns rows colors chars-per-pixel */ +"64 64 19 1 ", +" c black", +". c #000001", +"X c #6A6A69", +"o c #727271", +"O c #9A2B2B", +"+ c #A93030", +"@ c #C70000", +"# c #CE1C1C", +"$ c red", +"% c #996262", +"& c #FF00DC", +"* c #838381", +"= c #8C8C8A", +"- c #929292", +"; c #A7A7A7", +": c #CECECE", +"> c #ECE8D8", +", c gray96", +"< c white", +/* pixels */ +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....&&&&&&&&&&&&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&&.,O:O::O:,,,,,,,@,,,@@,@,,@@,.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.,OOOOOO::,,,,,,,@@,@@,@@,@,,.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.,,OOOOO,,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.,,,,,,,,############,,,,,,,,.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.oooooooo#;;;;;;;;;;#oooooooo.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OO----O#************#OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.O-----O#************#OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.---OOOO#;;;;;;;;;;;;#OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO#************#OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##############OOOOO--.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO######==######OOOO---.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO######==######OOOO---.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##....==....##OOO----.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##.###==###.##OOO----.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##..........##OO-----.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##############OO----O.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##############OOO--OO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##########==##OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO##########==##OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.-OOOOOO##############OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.-OOOOOO##############OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.--OOOOO#####====#####OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.---OOOO#####=XX=#####OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OO-OOOO#####=XX=#####OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OO--OOO#####====#####OOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOO%OOOO############OOOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOOOO--OOOOOOOOOOOOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOOO--OOOOOOOOOOOOOOOOOO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&.OOOOOOO---OOOOOOOOOOOOO---OO.&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&..OOOOOO-O----OOOOOOOOO-----..&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&..OOOOOOOO---OOOOOOOOO-OOO..&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&..........................&&&&&&&&&&&&&&&&&&&" +}; diff --git a/ressources/round_eight.xpm b/ressources/round_eight.xpm new file mode 100644 index 0000000..b93b2ee --- /dev/null +++ b/ressources/round_eight.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_eight_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ........ ", +" .......... ", +" ............ ", +" ............... ", +" ................. ", +" ................... ", +" .................... ", +" .............. ....... ", +" ............... ....... ", +" ............. ....... ", +" ........... ....... ", +" ........... ....... ", +" ........ ....... ", +" ........ ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ........ ", +" ....... ......... ", +" ....... ........ ", +" ........ ........ ", +" ........... ........ ", +" ............... ....... ", +" ...................... ", +" ..................... ", +" ...................... ", +" ...................... ", +" ................... ", +" ................... ", +" ...................... ", +" ........................ ", +" ............. ........... ", +" ........... ......... ", +" ........... ......... ", +" ........ ......... ", +" ......... ........ ", +" ........ ....... ", +" ........ ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ........ ", +" ....... ........ ", +" ....... ....... ", +" ....... ....... ", +" ........ ....... ", +" ......... ........ ", +" .......... ......... ", +" .......... ........... ", +" ........................... ", +" ........................... ", +" ........................ ", +" ....................... ", +" ................... ", +" ................ ", +" ........... ", +" "}; diff --git a/ressources/round_five.xpm b/ressources/round_five.xpm new file mode 100644 index 0000000..93b20ce --- /dev/null +++ b/ressources/round_five.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_five_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ............. ", +" ................. ", +" ........................ ", +" ......................... ", +" ......................... ", +" ........................ ", +" ........................ ", +" ....... ............ ", +" ....... ......... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ......... ", +" .................... ", +" ....................... ", +" ........................ ", +" ........................ ", +" ......................... ", +" .......................... ", +" ......... ........... ", +" ...... ......... ", +" ..... ......... ", +" ......... ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ......... ", +" ..... ........... ", +" ..................... ", +" ..................... ", +" ................... ", +" ................... ", +" ................ ", +" ............... ", +" ........ ", +" ..... "}; diff --git a/ressources/round_four.xpm b/ressources/round_four.xpm new file mode 100644 index 0000000..eb032dc --- /dev/null +++ b/ressources/round_four.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_four_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ....... ", +" ........ ", +" ......... ", +" ............ ", +" ............. ", +" ............. ", +" .............. ", +" ............... ", +" ................ ", +" ................. ", +" ......... ....... ", +" .......... ....... ", +" ........... ....... ", +" ......... ....... ", +" .......... ....... ", +" ......... ....... ", +" ........ ....... ", +" ......... ....... ", +" ......... ....... ", +" ........ ....... ", +" ......... ....... ", +" ......... ....... ", +" ......... ............... ", +" ................................... ", +" ................................... ", +" ................................... ", +" ................................... ", +" .................................. ", +" .................................. ", +" .................... ....... ", +" ......... ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_nine.xpm b/ressources/round_nine.xpm new file mode 100644 index 0000000..f61d01e --- /dev/null +++ b/ressources/round_nine.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_nine_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ........ ", +" ............ ", +" ............. ", +" .................. ", +" .................... ", +" .................... ", +" ...................... ", +" ........... ........... ", +" ........... ......... ", +" ........ ......... ", +" ........ .......... ", +" ....... .......... ", +" ....... ......... ", +" ....... ......... ", +" ....... ........ ", +" ......... ........ ", +" .......... ....... ", +" ............ ........ ", +" ............... ........ ", +" ........................ ", +" ...................... ", +" ...................... ", +" .................... ", +" ................... ", +" ................. ", +" .............. ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ......... ", +" ......... ", +" .......... ", +" ............. ", +" ..................... ", +" ...................... ", +" .................... ", +" ................... ", +" ................... ", +" ................ ", +" ............ ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_one.xpm b/ressources/round_one.xpm new file mode 100644 index 0000000..fa41b25 --- /dev/null +++ b/ressources/round_one.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_one_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ....... ", +" ......... ", +" .......... ", +" ............ ", +" ............. ", +" ............. ", +" .............. ", +" ............... ", +" ............... ", +" ................ ", +" ................. ", +" ........ ....... ", +" ........ ....... ", +" ....... ....... ", +" ...... ....... ", +" ..... ....... ", +" ....... ", +" ........ ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" .............. ", +" ................. ", +" ....................... ", +" ........................ ", +" ........................ ", +" ........................ ", +" ........................ ", +" ..... ............ ", +" ........ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_seven.xpm b/ressources/round_seven.xpm new file mode 100644 index 0000000..c5e6704 --- /dev/null +++ b/ressources/round_seven.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_seven_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ................... ", +" ........................... ", +" .................................. ", +" .................................... ", +" ..................................... ", +" ..................................... ", +" .................................... ", +" .................. ", +" .......... ", +" ........ ", +" ......... ", +" ........ ", +" ......... ", +" ......... ", +" ........ ", +" ......... ", +" ......... ", +" ........ ", +" ......... ", +" ......... ", +" ........ ", +" ........ ", +" ........ ", +" ....... ", +" ........ ", +" ......... ", +" ........ ", +" ........ ", +" ....... ", +" ....... ", +" ........ ", +" ......... ", +" ......... ", +" ......... ", +" .......... ", +" ........ ", +" ......... ", +" ......... ", +" ........ ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_six.xpm b/ressources/round_six.xpm new file mode 100644 index 0000000..fd8b320 --- /dev/null +++ b/ressources/round_six.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_six_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ......... ", +" ........... ", +" ........... ", +" ............ ", +" ............. ", +" .............. ", +" ............... ", +" ............ ", +" ............ ", +" ............. ", +" ........... ", +" ........... ", +" ........ ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ....... ........ ", +" ...................... ", +" ........................ ", +" ......................... ", +" .......................... ", +" .......................... ", +" ............................ ", +" ............ ........... ", +" ....... .......... ", +" ........ .......... ", +" ........ ......... ", +" ....... ......... ", +" ........ ........ ", +" ........ ........ ", +" ......... ....... ", +" ............ ........ ", +" ............... ........... ", +" .......................... ", +" ........................ ", +" ....................... ", +" ..................... ", +" .................. ", +" ............ ", +" ..... ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_three.xpm b/ressources/round_three.xpm new file mode 100644 index 0000000..6df28ee --- /dev/null +++ b/ressources/round_three.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_three_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ............... ", +" .................... ", +" ....................... ", +" ......................... ", +" .......................... ", +" .......................... ", +" ............ ............ ", +" ...... ........ ", +" ..... ........ ", +" ....... ", +" ....... ", +" ........ ", +" ........ ", +" ......... ", +" ......... ", +" .......... ", +" ............. ", +" ............. ", +" .............. ", +" .............. ", +" ................ ", +" ................. ", +" .................. ", +" .................. ", +" ............... ", +" ......... ", +" ........ ", +" ........ ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" ......... ", +" ..... ............ ", +" ...................... ", +" ...................... ", +" .................... ", +" ................... ", +" ................... ", +" ............... ", +" ......... ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_two.xpm b/ressources/round_two.xpm new file mode 100644 index 0000000..5f2645c --- /dev/null +++ b/ressources/round_two.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_two_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ......... ", +" ............... ", +" ................... ", +" ...................... ", +" ....................... ", +" ......................... ", +" .......................... ", +" ......... ............ ", +" ..... .......... ", +" ......... ", +" ........ ", +" ....... ", +" ....... ", +" ........ ", +" ........ ", +" ....... ", +" ........ ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ............ ......... ", +" ........................ ", +" ........................ ", +" ....................... ", +" .......................... ", +" .............................. ", +" ................................ ", +" .......................... ", +" ................... ", +" ................ ", +" ............. ", +" ........ ", +" ..... ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/round_zero.xpm b/ressources/round_zero.xpm new file mode 100644 index 0000000..622729c --- /dev/null +++ b/ressources/round_zero.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * round_zero_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ....... ", +" ............. ", +" ................. ", +" .................... ", +" ......................... ", +" ........................... ", +" ............................... ", +" ............... ............... ", +" ............ ............ ", +" ............. ........... ", +" ........... ........... ", +" ......... ......... ", +" .......... ........ ", +" ......... ....... ", +" ........ ........ ", +" ......... ....... ", +" ........ ....... ", +" ........ ........ ", +" ....... ........ ", +" ....... ....... ", +" ....... ........ ", +" ....... ........ ", +" ....... ....... ", +" ....... ....... ", +" ....... ........ ", +" ....... ....... ", +" ........ ....... ", +" ........ ....... ", +" ....... ....... ", +" ........ ....... ", +" ........ ....... ", +" ........ ....... ", +" ......... ....... ", +" ......... ........ ", +" ......... ......... ", +" ......... .......... ", +" .............. ............. ", +" .................... ............... ", +" ................................... ", +" ................................... ", +" ............................... ", +" ............................. ", +" ......................... ", +" ................ ", +" ..... ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/tally_five.xpm b/ressources/tally_five.xpm new file mode 100644 index 0000000..c4e7d22 --- /dev/null +++ b/ressources/tally_five.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * tally_five_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ..... ", +" ....... ....... ..... ..... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ..... ", +" ....... ....... ....... ....... ....... ", +" ....... ....... ....... ....... ....... ", +" ....... ....... ....... ....... ........ ", +" ....... ........ ....... ................ ", +" ....... ....... ....... ................ ", +" ....... ....... ....... ................ ", +" ........ ....... ....... ............... ", +" ....... ....... ....... .............. ", +" ....... ....... ....... .............. ", +" ....... ....... ....... ............. ", +" ....... ....... ....... .............. ", +" ....... ....... .................... ", +" ....... ....... .................... ", +" ....... ....... ................... ", +" ....... ....... .................... ", +" ....... ....... .................... ", +" ........ ....... ........... ....... ", +" ........ ....... ............ ........ ", +" ....... ....... .......... ....... ", +" ....... .................. ....... ", +" ....... .................. ....... ", +" ....... .................. ....... ", +" ....... .................. ....... ", +" ....... .................. ....... ", +" ....... ................... ....... ", +" ................... ....... ....... ", +" ................... ....... ....... ", +" ................. ....... ....... ", +" ................. ....... ....... ", +" ................. ....... ....... ", +" .................. ....... ....... ", +" .................... ....... ....... ", +" ..................... ....... ....... ", +" ............. ....... ....... ....... ", +" ............. ....... ....... ....... ", +" ............. ....... ....... ....... ", +" ............. ....... ....... ....... ", +" ............. ....... ....... ....... ", +" ............. ...... ....... ....... ", +" ............ ..... ...... ...... ", +" ....... ..... ..... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/tally_four.xpm b/ressources/tally_four.xpm new file mode 100644 index 0000000..853d5f1 --- /dev/null +++ b/ressources/tally_four.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * tally_four_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ..... ", +" ....... ....... ..... ..... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ........ ....... ....... ", +" ....... ....... ....... ........ ", +" ....... ....... ....... ....... ", +" ........ ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ........ ", +" ....... ....... ....... ........ ", +" ....... ....... ....... ....... ", +" ....... ....... ........ ........ ", +" ....... ....... ........ ........ ", +" ........ ....... ....... ....... ", +" ........ ....... ....... ........ ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ....... ....... ....... ", +" ....... ...... ....... ....... ", +" ....... ..... ...... ...... ", +" ....... ..... ..... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/tally_one.xpm b/ressources/tally_one.xpm new file mode 100644 index 0000000..e4de7ed --- /dev/null +++ b/ressources/tally_one.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * tally_one_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ........ ", +" ........ ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ....... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/tally_three.xpm b/ressources/tally_three.xpm new file mode 100644 index 0000000..67b9d3e --- /dev/null +++ b/ressources/tally_three.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * tally_three_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ..... ", +" ....... ....... ..... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ........ ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ........ ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ........ ", +" ....... ....... ........ ", +" ........ ....... ....... ", +" ........ ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ....... ....... ", +" ....... ...... ....... ", +" ....... ..... ...... ", +" ....... ..... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" "}; diff --git a/ressources/tally_two.xpm b/ressources/tally_two.xpm new file mode 100644 index 0000000..7827f42 --- /dev/null +++ b/ressources/tally_two.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * tally_two_xpm[] = { +"60 60 2 1", +" c #FF00DC", +". c #EB0000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ..... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ........ ", +" ....... ....... ", +" ....... ....... ", +" ........ ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ........ ....... ", +" ........ ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ....... ", +" ....... ...... ", +" ....... ..... ", +" ....... ", +" ...... ", +" ..... ", +" ", +" ", +" ", +" ", +" "}; diff --git a/src/cub3d_data.h b/src/cub3d_data.h index 4aa6650..6b6494f 100644 --- a/src/cub3d_data.h +++ b/src/cub3d_data.h @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */ -/* Updated: 2025/09/03 16:31:54 by tchampio ### ########.fr */ +/* Updated: 2025/09/03 18:22:15 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,6 +32,8 @@ typedef struct s_cub3d_data t_img_data *img_data; t_img_data *point_figures[10]; t_img_data *perk_logos[3]; + t_img_data *tally_marks[5]; + t_img_data *round_figures[10]; t_mapdata *map; t_player player; t_keypresses keypresses; @@ -43,6 +45,7 @@ typedef struct s_cub3d_data double zbuffer[WIDTH]; int sprite_order[MAX_SPRITES]; double sprite_distances[MAX_SPRITES]; + int round; } t_cub3d_data; #endif // CUB3D_DATA_H diff --git a/src/hud/load_texture.c b/src/hud/load_texture.c new file mode 100644 index 0000000..54f6357 --- /dev/null +++ b/src/hud/load_texture.c @@ -0,0 +1,95 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* load_texture.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tchampio +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/03 17:02:08 by tchampio #+# #+# */ +/* Updated: 2025/09/03 18:24:18 by tchampio ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "../../libft/includes/libft.h" +#include "../cub3d_data.h" +#include "../utils/frees.h" +#include "../utils/inits.h" +#include "../../mlx/mlx.h" + +t_img_data *load_hud_texture(t_cub3d_data *data, char *path) +{ + int width; + int height; + void *img; + t_img_data *img_data; + + img = mlx_xpm_file_to_image(data->mlx, path, &width, &height); + if (img == NULL) + { + ft_printf("Error: failed to open image at %s\n", path); + destroy(data, 1); + } + ft_printf("image: %p\n", img); + img_data = ft_calloc(sizeof(t_img_data), 1); + img_data->img = img; + img_data->addr = mlx_get_data_addr(img_data->img, + &img_data->bits_per_pixel, &img_data->line_length, + &img_data->endian); + img_data->height = height; + img_data->width = width; + return (img_data); +} + +void load_points_textures(t_cub3d_data *data) +{ + data->point_figures[0] = load_hud_texture(data, "ressources/zero.xpm"); + data->point_figures[1] = load_hud_texture(data, "ressources/one.xpm"); + data->point_figures[2] = load_hud_texture(data, "ressources/two.xpm"); + data->point_figures[3] = load_hud_texture(data, "ressources/three.xpm"); + data->point_figures[4] = load_hud_texture(data, "ressources/four.xpm"); + data->point_figures[5] = load_hud_texture(data, "ressources/five.xpm"); + data->point_figures[6] = load_hud_texture(data, "ressources/six.xpm"); + data->point_figures[7] = load_hud_texture(data, "ressources/seven.xpm"); + data->point_figures[8] = load_hud_texture(data, "ressources/eight.xpm"); + data->point_figures[9] = load_hud_texture(data, "ressources/nine.xpm"); +} + +void load_perk_logos(t_cub3d_data *data) +{ + data->perk_logos[0] = load_hud_texture(data, + "ressources/juggernog_logo.xpm"); + data->perk_logos[1] = load_hud_texture(data, + "ressources/revive_logo.xpm"); + data->perk_logos[2] = load_hud_texture(data, + "ressources/doubletap_logo.xpm"); +} + +void load_round_indicators(t_cub3d_data *data) +{ + data->tally_marks[4] = load_hud_texture(data, "ressources/tally_five.xpm"); + data->tally_marks[3] = load_hud_texture(data, "ressources/tally_four.xpm"); + data->tally_marks[2] = load_hud_texture(data, "ressources/tally_three.xpm"); + data->tally_marks[1] = load_hud_texture(data, "ressources/tally_two.xpm"); + data->tally_marks[0] = load_hud_texture(data, "ressources/tally_one.xpm"); + data->round_figures[0] = load_hud_texture(data, "ressources/round_zero.xpm"); + data->round_figures[1] = load_hud_texture(data, "ressources/round_one.xpm"); + data->round_figures[2] = load_hud_texture(data, "ressources/round_two.xpm"); + data->round_figures[3] = load_hud_texture(data, "ressources/round_three.xpm"); + data->round_figures[4] = load_hud_texture(data, "ressources/round_four.xpm"); + data->round_figures[5] = load_hud_texture(data, "ressources/round_five.xpm"); + data->round_figures[6] = load_hud_texture(data, "ressources/round_six.xpm"); + data->round_figures[7] = load_hud_texture(data, "ressources/round_seven.xpm"); + data->round_figures[8] = load_hud_texture(data, "ressources/round_eight.xpm"); + data->round_figures[9] = load_hud_texture(data, "ressources/round_nine.xpm"); +} + +void load_textures(t_cub3d_data *data) +{ + data->no_texture = load_single_texture(data, data->map->no_texture); + data->so_texture = load_single_texture(data, data->map->so_texture); + data->we_texture = load_single_texture(data, data->map->we_texture); + data->ea_texture = load_single_texture(data, data->map->ea_texture); + load_points_textures(data); + load_perk_logos(data); + load_round_indicators(data); +} diff --git a/src/hud/load_texture.h b/src/hud/load_texture.h new file mode 100644 index 0000000..c317141 --- /dev/null +++ b/src/hud/load_texture.h @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* load_texture.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tchampio +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/03 17:06:02 by tchampio #+# #+# */ +/* Updated: 2025/09/03 17:06:52 by tchampio ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LOAD_TEXTURE_H +# define LOAD_TEXTURE_H + +# include "../cub3d_data.h" + +t_img_data *load_hud_texture(t_cub3d_data *data, char *path); +void load_textures(t_cub3d_data *data); + +#endif // LOAD_TEXTURE_H diff --git a/src/main.c b/src/main.c index dafc208..65aa904 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ -/* Updated: 2025/09/03 16:32:13 by tchampio ### ########.fr */ +/* Updated: 2025/09/03 18:31:54 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -74,12 +74,33 @@ void draw_perks(t_cub3d_data *data) } } +void draw_round(t_cub3d_data *data) +{ + int i; + int pos; + char round_str[5]; + + if (data->round <= 5) + return (matrix_image_put(data, data->tally_marks[data->round - 1], 20, HEIGHT - 85)); + pos = 20; + i = 0; + ft_itoa_static(data->round, round_str, 5); + while (round_str[i]) + { + matrix_image_put(data, data->round_figures[round_str[i] - '0'], pos, HEIGHT - 85); + pos += 50; + i++; + } +} + void create_hud(t_cub3d_data *data) { // draw points draw_points(data); // draw perks draw_perks(data); + // draw round + draw_round(data); // draw weapon // draw map } diff --git a/src/utils/hooks.c b/src/utils/hooks.c index 651d9d1..6b775c5 100644 --- a/src/utils/hooks.c +++ b/src/utils/hooks.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */ -/* Updated: 2025/09/01 15:39:07 by tchampio ### ########.fr */ +/* Updated: 2025/09/03 17:54:36 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,6 +39,8 @@ int keypress_handler(int keycode, t_cub3d_data *data) data->keypresses.is_right_pressed = true; if (keycode == XK_p) data->player.points += 500; + if (keycode == XK_u) + data->round++; return (0); } diff --git a/src/utils/inits.c b/src/utils/inits.c index d17e0c0..d886db0 100644 --- a/src/utils/inits.c +++ b/src/utils/inits.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */ -/* Updated: 2025/09/01 17:49:33 by tchampio ### ########.fr */ +/* Updated: 2025/09/03 17:53:41 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,6 +15,7 @@ #include "../../libft/includes/libft.h" #include "../../mlx/mlx.h" #include "../map/map_checker.h" +#include "../hud/load_texture.h" #include "../sprites/create_sprite.h" #include "frees.h" #include @@ -32,11 +33,11 @@ t_img_data *load_single_texture(t_cub3d_data *data, char *path) ft_printf("Error: failed to open image at %s\n", path); destroy(data, 1); } -// if (width != height || width != TEXTURE_SIZE) -// { -// ft_printf("Error: textures are not the right size\n"); -// destroy(data, 1); -// } +// if (width != height || width != TEXTURE_SIZE) +// { +// ft_printf("Error: textures are not the right size\n"); +// destroy(data, 1); +// } ft_printf("image: %p\n", img); img_data = ft_calloc(sizeof(t_img_data), 1); img_data->img = img; @@ -48,27 +49,6 @@ t_img_data *load_single_texture(t_cub3d_data *data, char *path) return (img_data); } -void load_textures(t_cub3d_data *data) -{ - data->no_texture = load_single_texture(data, data->map->no_texture); - data->so_texture = load_single_texture(data, data->map->so_texture); - data->we_texture = load_single_texture(data, data->map->we_texture); - data->ea_texture = load_single_texture(data, data->map->ea_texture); - data->point_figures[0] = load_single_texture(data, "ressources/zero.xpm"); - data->point_figures[1] = load_single_texture(data, "ressources/one.xpm"); - data->point_figures[2] = load_single_texture(data, "ressources/two.xpm"); - data->point_figures[3] = load_single_texture(data, "ressources/three.xpm"); - data->point_figures[4] = load_single_texture(data, "ressources/four.xpm"); - data->point_figures[5] = load_single_texture(data, "ressources/five.xpm"); - data->point_figures[6] = load_single_texture(data, "ressources/six.xpm"); - data->point_figures[7] = load_single_texture(data, "ressources/seven.xpm"); - data->point_figures[8] = load_single_texture(data, "ressources/eight.xpm"); - data->point_figures[9] = load_single_texture(data, "ressources/nine.xpm"); - data->perk_logos[0] = load_single_texture(data, "ressources/juggernog_logo.xpm"); - data->perk_logos[1] = load_single_texture(data, "ressources/revive_logo.xpm"); - data->perk_logos[2] = load_single_texture(data, "ressources/doubletap_logo.xpm"); -} - void place_base_sprites(t_cub3d_data *data, char **map) { int y; @@ -96,6 +76,7 @@ void init_cub3d_data(t_cub3d_data *data, char **argv) { ft_bzero(data, sizeof(*data)); data->map = ft_calloc(sizeof(t_mapdata), 1); + data->round = 1; if (!check_cubfile(argv[1], data->map)) return (ft_printf("Error: Wrong map file. Reason: %s\n", data->map->error), free_map(data->map), exit(1));