From 6b333303ec6a67927997020bfbdd3fc0be9db6e0 Mon Sep 17 00:00:00 2001 From: Sylvain PILLOT Date: Wed, 27 Mar 2024 10:44:15 +0100 Subject: [PATCH] Added FXG3A build targets with dully corrected code [dev] --- src/config.h | 31 ++++++++++++++++++++++--------- src/dialogs.c | 4 ++-- src/dialogs.h | 4 +--- src/main.c | 2 +- src/npc.c | 9 --------- src/player.h | 15 +-------------- 6 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/config.h b/src/config.h index ed692b7..2ce6b98 100644 --- a/src/config.h +++ b/src/config.h @@ -2,27 +2,40 @@ #define CONFIG_H -#if !defined(FXCG50) && defined(COLOR2BIT) +#define USB_FEATURE 0 +#define DEBUGMODE 0 + + +/* Enable GrayMode on either FX and FX_G3A targets */ +#if GINT_RENDER_MONO && defined(COLOR2BIT) #define GRAYMODEOK 1 #endif -#define USB_FEATURE 0 -#define DEBUGMODE 0 -#ifdef FXCG50 +#if GINT_RENDER_RGB #define T_HEIGHT 16 #define T_WIDTH 16 + #define PXSIZE 2 + #define PATH_COLOR C_RED + #define P_WIDTH 16 + #define P_HEIGHT 16 #else #define T_HEIGHT 8 #define T_WIDTH 8 -#endif - -#ifdef FXCG50 - #define PXSIZE 2 -#else #define PXSIZE 1 + #define PATH_COLOR C_BLACK + #define P_WIDTH 8 + #define P_HEIGHT 8 #endif +/* SPEED should NOT be 8 or bigger: it may cause bugs when handling + * collisions! */ +#define SPEED PXSIZE*2 + + +#define F_WIDTH (32*PXSIZE) +#define F_HEIGHT (32*PXSIZE) + #endif diff --git a/src/dialogs.c b/src/dialogs.c index 233bf8f..bbbbcd0 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -27,7 +27,7 @@ extern font_t fontRPG; /* the color of the text to go to the next dialog phase */ /* it improves readability to have somathing lighter */ -#if GRAYMODEOK || (defined(FXCG50) && !defined(COLOR1BIT)) +#if GRAYMODEOK || (defined(GINT_RENDER_RGB) && !defined(COLOR1BIT)) #define NEXT_COLOR C_DARK #else #define NEXT_COLOR C_BLACK @@ -38,7 +38,7 @@ void blit() { dupdate(); - #if GRAYMODEOK + #if GRAYMODEOK && !defined(GINT_HW_CG) dgray_getvram( &lightVRAMnext, &darkVRAMnext ); dgray_getscreen( &lightVRAMcurrent, &darkVRAMcurrent ); diff --git a/src/dialogs.h b/src/dialogs.h index 39729b7..7259f7a 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -5,9 +5,7 @@ #include #include "game.h" #include "map.h" - -#define F_WIDTH (32*PXSIZE) -#define F_HEIGHT (32*PXSIZE) +#include "config.h" /* showtext_opt() * diff --git a/src/main.c b/src/main.c index 0375212..4fd5996 100644 --- a/src/main.c +++ b/src/main.c @@ -130,7 +130,7 @@ int main(void) { /* render the map */ draw(&game); - #if DEBUGMODE && FXCG50 + #if DEBUGMODE && GINT_RENDER_RGB if (game.debug_map) { dfont( NULL ); diff --git a/src/npc.c b/src/npc.c index 12c5aec..bc68e6b 100644 --- a/src/npc.c +++ b/src/npc.c @@ -14,15 +14,6 @@ extern bopti_image_t demo_PNJ_img; -/* the color of the text to go to the next dialog phase */ -/* it improves readability to have somathing lighter */ -#if defined(FXCG50) - #define PATH_COLOR C_RED -#else - #define PATH_COLOR C_BLACK -#endif - - NPC *npcRPG; uint32_t nbNPC = 0; diff --git a/src/player.h b/src/player.h index 7b69716..a395cda 100644 --- a/src/player.h +++ b/src/player.h @@ -1,21 +1,8 @@ #ifndef PLAYER_H #define PLAYER_H -/* The size of the player. */ -#ifdef FXCG50 - #define P_WIDTH 16 - #define P_HEIGHT 16 -#else - #define P_WIDTH 8 - #define P_HEIGHT 8 -#endif - -/* SPEED should NOT be 8 or bigger: it may cause bugs when handling - * collisions! */ -#define SPEED PXSIZE*2 - #include - +#include "config.h" #include "game.h" #include "memory.h"