diff --git a/CMakeLists - Kikoudx.txt b/CMakeLists - Kikoudx.txt deleted file mode 100644 index 2bfe772..0000000 --- a/CMakeLists - Kikoudx.txt +++ /dev/null @@ -1,86 +0,0 @@ -# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the - # toolchain file and module path of the fxSDK - - cmake_minimum_required(VERSION 3.18) - # replace this with your project's name - project(Windmill) - - include(GenerateG1A) - include(GenerateG3A) - include(Fxconv) - find_package(Gint 2.1 REQUIRED) - - # include directories, put your .h files in those folders - include_directories(include) - - # source files - set(SOURCES - src/main.cpp - - # ... - ) - # shared assets - set(ASSETS - # ... - ) - # fx-9860G-only assets (monochrome) - set(ASSETS_fx - assets-fx/example.png - assets-fx/img/windmill.png - # ... - ) - # fx-CG-50-only assets (polychrome) - set(ASSETS_cg - assets-cg/example.png - # ... - ) - - # Compile flags - set(FLAGS - # C standard, other values: c89, c99 - -std=c11 - - # general warnings - -Wall -Wextra -pedantic - - # enable this flag to stop compilation on warnings - #-Werror - - # specific warnings - # variable shadowing - -Wshadow - # switch/case safety - -Wswitch-default -Wswitch-enum - # unreachable code, bad 99% of the time - -Wunreachable-code - # prototypes warnings - -Wstrict-prototypes -Wmissing-prototypes - # function declaration - -Werror-implicit-function-declaration - - # optimisation level - # -Os: like -O2 without space-expensive optimizations - # -O2: good speed/size tradeoff - # -O3: gotta go fast - -Os - ) - - fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA) - - add_executable(${PROJECT_NAME} ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}) - target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS}) - target_link_libraries(${PROJECT_NAME} Gint::Gint) - - if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G) - generate_g1a( - TARGET ${PROJECT_NAME} - OUTPUT "${PROJECT_NAME}.g1a" - NAME "${PROJECT_NAME}" - ICON assets-fx/icon.png) - elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) - generate_g3a( - TARGET ${PROJECT_NAME} - OUTPUT "${PROJECT_NAME}.g3a" - NAME "${PROJECT_NAME}" - ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) - endif() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a388894..b0b1b1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,26 +38,26 @@ fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA) set_source_files_properties(src/map.cpp PROPERTIES COMPILE_OPTIONS "-Wp,-w;-Wno-missing-field-initializers") -add_executable(${PROJECT_NAME} ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}) - -target_include_directories(${PROJECT_NAME} PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm") - -target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Os -fno-use-cxa-atexit) - -target_link_options(${PROJECT_NAME} PRIVATE -Wl,-Map=map) - -target_link_libraries(${PROJECT_NAME} Gint::Gint -lopenlibm -lc -lsupc++) +add_executable(addin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}) +target_compile_definitions(addin PRIVATE -D__BSD_VISIBLE=1) +target_compile_options(addin PRIVATE -Wall -Wextra -Os -fno-use-cxa-atexit) +target_link_options(addin PRIVATE -Wl,-Map=map -Wl,--print-memory-usage) +target_link_libraries(addin Gint::Gint) if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G) - generate_g1a( - TARGET ${PROJECT_NAME} - OUTPUT "${PROJECT_NAME}.g1a" - NAME "${PROJECT_NAME}" - ICON assets-fx/icon.png) - elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) - generate_g3a( - TARGET ${PROJECT_NAME} - OUTPUT "${PROJECT_NAME}.g3a" - NAME "${PROJECT_NAME}" - ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) - endif() + generate_g1a( + TARGET addin + OUTPUT "${PROJECT_NAME}.g1a" + NAME "${PROJECT_NAME}" + ICON assets-fx/icon.png) + add_custom_command( + TARGET addin POST_BUILD + COMMAND echo -n "Size of g1a : " + COMMAND stat -c %s "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.g1a") +elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) + generate_g3a( + TARGET addin + OUTPUT "${PROJECT_NAME}.g3a" + NAME "${PROJECT_NAME}" + ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) +endif() diff --git a/src/Scene_Title.hpp b/src/Scene_Title.hpp index 74caa04..5b03f1b 100644 --- a/src/Scene_Title.hpp +++ b/src/Scene_Title.hpp @@ -10,10 +10,7 @@ #define DEF_SCENE_TITLE -extern "C" -{ - #include "Input.h" -} +#include "Input.h" #include "Game.hpp" #include "Windmill.hpp" #include "Camera.hpp" diff --git a/src/camera.cpp b/src/camera.cpp index df79065..515f580 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -170,27 +170,3 @@ void Camera::look_at(float look_at_x, float look_at_y, float look_at_z, float du // calcule de sqrt ?? look_at_duration = duration; } - -/* -//----------------------------------------------------------------------------- -// MIN -//----------------------------------------------------------------------------- -int Camera::min(int a, int b) -{ - return (a < b) ? a : b; -} - - -//----------------------------------------------------------------------------- -// MAX -//----------------------------------------------------------------------------- -int Camera::max(int a, int b) -{ - return (a > b) ? a : b; -} -*/ - - - - - diff --git a/src/camera.hpp b/src/camera.hpp index d42a672..5325ffe 100644 --- a/src/camera.hpp +++ b/src/camera.hpp @@ -41,12 +41,8 @@ #ifndef DEF_CAMERA #define DEF_CAMERA -extern "C" -{ - #define __BSD_VISIBLE 1 - #include - #include -} +#include +#include //#define PI 3.1415 diff --git a/src/game.hpp b/src/game.hpp index a593e49..45afddc 100644 --- a/src/game.hpp +++ b/src/game.hpp @@ -2,13 +2,7 @@ #define DEF_GAME -extern "C" -{ - #define __BSD_VISIBLE 1 - #include - //#include "MonochromeLib.h" -} - +#include //#include "camera.hpp" //#include "Structures.hpp" diff --git a/src/player.hpp b/src/player.hpp index b8121ab..cfcf5c5 100644 --- a/src/player.hpp +++ b/src/player.hpp @@ -1,13 +1,7 @@ #ifndef DEF_PLAYER #define DEF_PLAYER -extern "C" -{ - #define __BSD_VISIBLE 1 - #include -} - - +#include #define MAP_EXTERIOR_LIMIT 1000 #define COL_NO 0 diff --git a/src/scene_map.cpp b/src/scene_map.cpp index 7f49957..6ee85c5 100644 --- a/src/scene_map.cpp +++ b/src/scene_map.cpp @@ -76,12 +76,12 @@ void Scene_Map::load_map() for (int k=0; ktype; k++) { Point point = windmill.get_point(current_modele, k); - current_bbox->x1 = min(current_bbox->x1, point.x); - current_bbox->y1 = min(current_bbox->y1, point.y); - current_bbox->z1 = min(current_bbox->z1, point.z); - current_bbox->x2 = max(current_bbox->x2, point.x); - current_bbox->y2 = max(current_bbox->y2, point.y); - current_bbox->z2 = max(current_bbox->z2, point.z); + current_bbox->x1 = min((int)current_bbox->x1, point.x); + current_bbox->y1 = min((int)current_bbox->y1, point.y); + current_bbox->z1 = min((int)current_bbox->z1, point.z); + current_bbox->x2 = max((int)current_bbox->x2, point.x); + current_bbox->y2 = max((int)current_bbox->y2, point.y); + current_bbox->z2 = max((int)current_bbox->z2, point.z); } } if (current_object->axe == Z_BILLBOARD) diff --git a/src/scene_map.hpp b/src/scene_map.hpp index 60aed71..099ef34 100644 --- a/src/scene_map.hpp +++ b/src/scene_map.hpp @@ -1,11 +1,8 @@ #ifndef DEF_SCENE_MAP #define DEF_SCENE_MAP -extern "C" -{ - #include - #include -} +#include +#include #include "windmill.hpp" #include "game.hpp" diff --git a/src/windmill.hpp b/src/windmill.hpp index 56fc9b3..b434b82 100644 --- a/src/windmill.hpp +++ b/src/windmill.hpp @@ -1,16 +1,11 @@ #ifndef DEF_WINDMILL #define DEF_WINDMILL - -extern "C" -{ - #define __BSD_VISIBLE 1 - #include - #include // pour affichage des coordonnées - #include - #include - #include -} +#include +#include // pour affichage des coordonnées +#include +#include +#include #include "camera.hpp" #define get_vram_address() ((char *)gint_vram) @@ -103,8 +98,8 @@ struct Modele struct Object { short x, y, z; - float angle; char axe; + float angle; const Modele* modele; const int modele_size; // ajouter ici @@ -112,9 +107,9 @@ struct Object //const char for_collision; //const char type_collision; bool hidden; + bool on_screen; Sphere sphere; int distance_to_camera; - bool on_screen; };