diff --git a/CMakeLists.txt b/CMakeLists.txt index a666cb1..65a6fb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(ASSETS fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA) add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}) -target_compile_options(myaddin PRIVATE -Wall -Wextra -Ofast) +target_compile_options(myaddin PRIVATE -Wall -Wextra -O3 -fira-region=all ) target_link_libraries(myaddin Gint::Gint ) target_link_libraries(myaddin LibProf::LibProf) target_link_options(myaddin PRIVATE -Wl,--print-memory-usage) diff --git a/src/.main.c.swp b/src/.main.c.swp new file mode 100644 index 0000000..c28ecf0 Binary files /dev/null and b/src/.main.c.swp differ diff --git a/src/main.c b/src/main.c index 66f2e02..98bd03e 100644 --- a/src/main.c +++ b/src/main.c @@ -19,7 +19,7 @@ #include "map_test.h" //====== Maze3D V0.2 ===== -// Git du moteur : https://github.com/attilavs2/Raycaster_prealpha +// Git du moteur : https://github.com/attilavs2/Raycaster_G90 // Git du jeu : https://gitea.planet-casio.com/Fcalva/Maze3D // // Page du jeu : https://www.planet-casio.com/Fr/programmes/programme4355-1-maze3d-fcalva-jeux-reflexion.html @@ -43,7 +43,7 @@ void USB_capture() { } #endif -#define debug //pour afficher les infos de debug +//#define debug //pour afficher les infos de debug extern char map_test[map_w][map_h]; @@ -110,8 +110,8 @@ int main(){ load_map(); - image_t frame_buffer = *image_alloc(viewport_w, viewport_h, IMAGE_RGB565A); - + image_t *frame_buffer = image_create_vram(); + image_t sky_tex = *image_alloc(64, 64, IMAGE_RGB565); image_t WXOR_tex = *image_alloc(64, 64, IMAGE_RGB565); image_t D_tex = *image_alloc(64, 64, IMAGE_RGB565); @@ -126,35 +126,33 @@ int main(){ } image_fill(&D_tex, 0x4228); image_fill(&sky_tex, 0x9dbd); - + prof_init(); #ifdef USB usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL}; usb_open(interfaces, GINT_CALL_NULL); #endif - + while (exit_game == 0) { prof_t frame = prof_make(); prof_enter(frame); - + drect(0, 0, 395, 112, 0x9dbd); drect(0,112, 395, 243, 0xc4c9); - image_clear(&frame_buffer); + image_clear(frame_buffer); - draw_walls(&buisson0, &briques0, &sky_tex, &WXOR_tex, &D_tex, &frame_buffer); - - dimage(0, 0, &frame_buffer); + draw_walls(&buisson0, &briques0, &sky_tex, &WXOR_tex, &D_tex, frame_buffer); if(first_frame == 1) main_menu(); - + keys_get(); logic(); if (disp_frame_time == 1) dprint( 1, 10, C_BLACK, "Frame time : %d ms", frame_time); - + #ifdef debug dprint( 1, 20, C_BLACK, "planeX : %d", planeX); dprint( 1, 30, C_BLACK, "planeY : %d", planeY); @@ -171,12 +169,13 @@ int main(){ } prof_quit(); + #ifdef USB usb_close(); + #endif free(&sky_tex); free(&WXOR_tex); free(&D_tex); - free(&frame_buffer); return 1; } diff --git a/src/moteur.c b/src/moteur.c index 0d99fc7..9a74f34 100644 --- a/src/moteur.c +++ b/src/moteur.c @@ -345,13 +345,14 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4, fixed_t texSize = fix(lineHeight) / 64; //taille proportionelle de la ligne a la tex if (texSize < 0x400) texSize = 0x400; //0x400 = 1/64 * 2^16 if (texSize > 0x3D000) { //0x3D000 = 3.8125 * 2^16, 3.8125 = viewport_h/64 - texSample = ffloor(fdiv(fix(viewport_h), texSize)); + texSample = fceil(fdiv(fix(viewport_h), texSize)); texSampleY = 32 - (int)texSample * 0.5 + 1; } else { texSample = 64; texSampleY = 0; } + image_t texStripe; image_clear(&texStripe); @@ -365,8 +366,6 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4, } image_scale(&texStripe, 0xFFFF, texSize, &temp); - temp.src_stride = 1; - temp.dst_stride = 1; image_linear(&texStripe, image_at(frame_buffer, x, (int)(viewport_h * 0.5 - lineHeight * 0.5) + v_offset), &temp); } }