Commit graph

193 commits

Author SHA1 Message Date
Theo Champion
b138fe8100 fix(sprite caster): Fixed crash when sprites overlap
Actually I'm not that sure it's the sprite overlap but it happened when
the sprites overlapped too close to the player, but basically the
program tried to render pixels out of bounds from the images, tex_x or
tex_y were able to go < 0. I forcefully set them to 0 if it was the
case, and I didn't see really much of visual glitches or something.
Anyways I'll stop rambling in this commit, just to say I stopped a real
weird crash because when I tried using valgrind or sanitizers, the
program would behave well and not crash. Might be tied to how fast the
program renders frames ?
2025-08-19 19:45:00 +02:00
Theo Champion
0ac7c27445 norme: Fixed norme error 2025-08-19 19:13:58 +02:00
Theo Champion
38487527f9 feat: Improved movements for the sprite 2025-08-19 18:58:55 +02:00
Theo Champion
b680e49ef9 feat: Added some credits 2025-08-18 20:05:50 +02:00
Theo Champion
14f178759e feat: finished zombie movements code 2025-08-18 19:52:14 +02:00
Theo Champion
c9fd8ea384 fix: Fixed norme issue 2025-08-18 19:20:33 +02:00
5242679d95
feat: load zombie sprites from map 2025-08-18 13:58:24 +02:00
8445f240a2
feat: basic zombie movement (very bad) 2025-08-18 13:42:47 +02:00
Theo Champion
2fc8cf21a1 fix: fixed segfault when compiling for mandatory part. Fixed bad check 2025-08-18 13:40:01 +02:00
92770f44f8 fix: segfault & leak with missing sprite image 2025-08-18 13:18:12 +02:00
Theo Champion
4568124d3f fix: git merge conflict again 2025-08-18 13:13:42 +02:00
Theo Champion
5c7cc77419 dev: improved how sprites are detected in maps 2025-08-18 13:07:08 +02:00
Theo Champion
ef7a6c27a4 fix: Removed git conflict marker 2025-08-18 13:04:13 +02:00
Theo Champion
541bc9ccf8 dev: Added sprite types and gave 'base' sprites their types 2025-08-14 21:47:21 +02:00
Theo Champion
0ac6ee9394 norme: Fixed little oopsie 2025-08-14 21:47:00 +02:00
Theo Champion
3511b6aaf8 norme: Fixed little oopsie 2025-08-14 21:45:39 +02:00
Theo Champion
01f0ac21df feat: Made a little sprite interaction for perk type sprites
It's more for the sake of the demo but it shows we can make interactions
with sprites. Although it's badly integrated.
2025-08-14 21:41:35 +02:00
Theo Champion
ee329812fd dev: Added sprite types and gave 'base' sprites their types 2025-08-14 21:41:33 +02:00
Theo Champion
0d6cc4063a dev: changed the c var in place_base_sprites to a counter in data struct 2025-08-14 21:38:49 +02:00
Theo Champion
4a70e44697 fix: Added a check for the sprites, to avoid segfaults and/or invalid writes 2025-08-14 21:27:53 +02:00
Theo Champion
94075506f6 fix: Transferred sprite pathes to constants 2025-08-14 21:25:03 +02:00
Theo Champion
412dc89336 fix: Transferred trailing magic error messages as consts 2025-08-14 19:52:34 +02:00
Theo Champion
db66decbf8 fix: removed trailing BONUS definition 2025-08-12 16:18:34 +02:00
Theo Champion
dafe94804e norme: normed everything 2025-08-12 16:15:02 +02:00
Theo Champion
00e8a73d14 dev: improved sprites by creating a create_sprite function 2025-08-12 15:57:27 +02:00
Theo Champion
09ff569a31 feat: made sprites be placed in map file 2025-08-12 15:41:42 +02:00
Theo Champion
04705fe9e5 feat: added temp perk textures and placed perks in testmap_2 2025-08-12 15:40:29 +02:00
Theo Champion
41437ec215 dev: Changed magic values for error messages to constants 2025-08-12 14:49:44 +02:00
Theo Champion
2eb1d635d4 norme: Fixed little norm error 2025-08-12 14:49:11 +02:00
Theo Champion
9988b09e91 dev: Changed allowed characters to comply more about the current state of the game 2025-08-12 14:49:11 +02:00
Theo Champion
f1697a6c73 dev: Improved memory management of sprites 2025-08-12 14:49:11 +02:00
Theo Champion
3230a60c9f fix: Fixed memory leak 2025-08-12 14:49:09 +02:00
Theo Champion
aae5e42b13 fix(main): Bumped calloc for sprites from 3 to MAX_SPRITES and moved it 2025-08-12 14:48:41 +02:00
Theo Champion
b7d56363ab removal(main): Removed sprites initialization in main function 2025-08-12 14:48:15 +02:00
fcb08f6447
fix: various rendering issues
- Correct rendering on whole window if window is not square
- Multiple crashes eliminated
- Sprites no longer lag behind player movement/rotation
2025-08-12 14:34:49 +02:00
98e0119c91
fix: prevent moving through walls in extreme lag situations 2025-08-12 12:16:57 +02:00
Theo Champion
b9b164e32d norm: Fixed norm errors except for comments in main function 2025-08-11 11:03:51 +02:00
Theo Champion
4564db6f2f feat: Added fps counter 2025-08-11 10:50:59 +02:00
Theo Champion
a0967d5f93 fix(sprite caster): Added a check for empty list of sprites to avoid SEGFAULTing 2025-08-08 11:56:45 +02:00
Theo Champion
c796d44b56 norme: finished norme for the sprites except in main.c 2025-08-07 13:45:01 +02:00
Theo Champion
cab1036359 dev: made a 'macro' for sprite to write less and more efficiently 2025-08-07 13:19:17 +02:00
Theo Champion
c8da6964d0 fix: moved almost all variables to the sprite structure 2025-08-07 12:59:43 +02:00
Theo Champion
10576f5751 feat: Made sprites dynamic in memory and allocated in heap 2025-08-07 12:36:22 +02:00
Theo Champion
2e0fd93831 fix: changed size of test.xpm 2025-08-07 12:33:47 +02:00
Theo Champion
9a113374a6 norm: normed code (except sprites) 2025-08-06 14:47:29 +02:00
Theo Champion
258372bf09 feat: Added sprites 2025-08-06 14:06:52 +02:00
Theo Champion
7a1e8c18df dev: moved my_mlx_get_pixel function in draw utils for easier access 2025-08-06 14:05:40 +02:00
Theo Champion
aed03e79c3 fix: changed transparency color for the texture 2025-08-06 14:03:27 +02:00
Theo Champion
134a6e14f0 wip: trying to render sprites 2025-08-06 14:01:29 +02:00
Theo Champion
d3ba05a36d feat: Made a sprite structure and added a static sprite field in data
A static sprite is a sprite that is not supposed to move, it'll be
placed at the parsing part. The sprite struct is prone to change as I am
testing it
2025-08-06 14:01:29 +02:00