mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-07-16 17:27:33 +02:00
Faster dialog animation on cg + started adding support for compiling with Azur
This commit is contained in:
parent
471b35d605
commit
61df0a8787
14 changed files with 109 additions and 40 deletions
|
@ -9,11 +9,6 @@ set(COLORMODE_fx 1b)
|
|||
#set the color mode either to 1b, 2b or EGA64
|
||||
set(COLORMODE_cg EGA64)
|
||||
|
||||
if(NOT "${COLORMODE_cg}" STREQUAL EGA64)
|
||||
set(FXSDK_PLATFORM_LONG fx9860G_G3A)
|
||||
set(FXSDK_PLATFORM fx)
|
||||
endif()
|
||||
|
||||
include(GenerateG1A)
|
||||
include(GenerateG3A)
|
||||
|
||||
|
@ -22,6 +17,12 @@ find_package(Gint 2.11 REQUIRED)
|
|||
# Gint 2.11 is required, because we're using the new macros like GINT_RENDER_RGB
|
||||
find_package(LibProf 2.4 REQUIRED)
|
||||
|
||||
set(ENABLE_AZUR FALSE)
|
||||
|
||||
if(${ENABLE_AZUR})
|
||||
find_package(Azur 0.1)
|
||||
endif()
|
||||
|
||||
fxconv_declare_converters(assets/converters.py)
|
||||
|
||||
set(SOURCES
|
||||
|
@ -129,28 +130,35 @@ set(ASSETS_fx_2b
|
|||
# ...
|
||||
)
|
||||
|
||||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} ${ASSETS_fx_1b} ${ASSETS_fx_2b} ${ASSETS_cg_1b} ${ASSETS_cg_2b} ${ASSETS_cg_EGA64} WITH_METADATA)
|
||||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} ${ASSETS_fx_1b}
|
||||
${ASSETS_fx_2b} ${ASSETS_cg_1b} ${ASSETS_cg_2b}
|
||||
${ASSETS_cg_EGA64} WITH_METADATA)
|
||||
|
||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_fx}} )
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}
|
||||
${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_fx}} )
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_cg}} )
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}
|
||||
${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_cg}} )
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A)
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_fx}} )
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}
|
||||
${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_fx}} )
|
||||
endif()
|
||||
|
||||
target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage)
|
||||
target_link_options(myaddin PRIVATE -flto=auto -Wl,-Map=Build_Addin.map
|
||||
-Wl,--print-memory-usage)
|
||||
target_link_libraries(myaddin LibProf::LibProf Gint::Gint)
|
||||
|
||||
target_include_directories(myaddin PRIVATE src)
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -flto=auto -g)
|
||||
|
||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||
# fx colormode
|
||||
if("${COLORMODE_fx}" STREQUAL 1b)
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOR1BIT)
|
||||
target_compile_options(myaddin PRIVATE -DCOLOR1BIT)
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_fx}" STREQUAL 2b)
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -g -DCOLOR2BIT)
|
||||
target_compile_options(myaddin PRIVATE -DCOLOR2BIT)
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_fx}" STREQUAL 1b)
|
||||
|
@ -167,23 +175,38 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
|||
|
||||
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||
# cg colormode
|
||||
|
||||
if(${ENABLE_AZUR})
|
||||
if(${AZUR_FOUND})
|
||||
target_link_libraries(myaddin Azur::Azur)
|
||||
target_compile_options(myaddin PRIVATE -DAZUR)
|
||||
else()
|
||||
message(WARNING "Azur not found! "
|
||||
"Graphics will be rendered with gint instead on CG "
|
||||
"(slower)!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_cg}" STREQUAL EGA64)
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -O0 -g -DCOLOREGA)
|
||||
target_compile_options(myaddin PRIVATE -DCOLOREGA)
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_cg}" STREQUAL 1b)
|
||||
generate_g3a(TARGET myaddin OUTPUT "RPG_1bfx.g3a"
|
||||
NAME "RPG PC 1b fx" ICONS assets-cg/1b/icon-uns-1b.png assets-cg/1b/icon-sel-1b.png)
|
||||
NAME "RPG PC 1b fx" ICONS assets-cg/1b/icon-uns-1b.png
|
||||
assets-cg/1b/icon-sel-1b.png)
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_cg}" STREQUAL 2b)
|
||||
generate_g3a(TARGET myaddin OUTPUT "RPG_2bfx.g3a"
|
||||
NAME "RPG PC 2b fx" ICONS assets-cg/2b/icon-uns-2b.png assets-cg/2b/icon-sel-2b.png)
|
||||
NAME "RPG PC 2b fx" ICONS assets-cg/2b/icon-uns-2b.png
|
||||
assets-cg/2b/icon-sel-2b.png)
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_cg}" STREQUAL EGA64)
|
||||
generate_g3a(TARGET myaddin OUTPUT "RPG_ega.g3a"
|
||||
NAME "RPG PC EGA" ICONS assets-cg/ega64/icon-uns-ega64.png assets-cg/ega64/icon-sel-ega64.png)
|
||||
NAME "RPG PC EGA" ICONS assets-cg/ega64/icon-uns-ega64.png
|
||||
assets-cg/ega64/icon-sel-ega64.png)
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -192,12 +215,14 @@ elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A)
|
|||
|
||||
if("${COLORMODE_fx}" STREQUAL 1b)
|
||||
generate_g3a(TARGET myaddin OUTPUT "RPG_1bfx.g3a"
|
||||
NAME "RPG PC 1b fx" ICONS assets-cg/1b/icon-uns-1b.png assets-cg/1b/icon-sel-1b.png)
|
||||
NAME "RPG PC 1b fx" ICONS assets-cg/1b/icon-uns-1b.png
|
||||
assets-cg/1b/icon-sel-1b.png)
|
||||
endif()
|
||||
|
||||
if("${COLORMODE_fx}" STREQUAL 2b)
|
||||
generate_g3a(TARGET myaddin OUTPUT "RPG_2bfx.g3a"
|
||||
NAME "RPG PC 2b fx" ICONS assets-cg/2b/icon-uns-2b.png assets-cg/2b/icon-sel-2b.png)
|
||||
NAME "RPG PC 2b fx" ICONS assets-cg/2b/icon-uns-2b.png
|
||||
assets-cg/2b/icon-sel-2b.png)
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "animation.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
|
||||
void animation_new(Animation *animation, bopti_image_t *image,
|
||||
unsigned char len, unsigned short frame_ms) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#define DEBUGMODE 0
|
||||
#define PRECISION 8
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
|
||||
/* Enable GrayMode on either FX and FX_G3A targets */
|
||||
#if GINT_RENDER_MONO && defined(COLOR2BIT)
|
||||
|
|
|
@ -50,7 +50,7 @@ int dialogs_text_opt(Game *game, bopti_image_t *face, char *text,
|
|||
const char *c;
|
||||
if(start_anim) {
|
||||
/* Run a little fancy animation. */
|
||||
for(i = 0; i <= BOX_HEIGHT; i++) {
|
||||
for(i = 0; i <= BOX_HEIGHT; i+=PXSIZE) {
|
||||
/* Redrawing the entire screen, because maybe there was no dialog
|
||||
displayed before. */
|
||||
update_npcs(game);
|
||||
|
@ -73,7 +73,7 @@ int dialogs_text_opt(Game *game, bopti_image_t *face, char *text,
|
|||
game->frame_duration = 0;
|
||||
}
|
||||
} else {
|
||||
/* Here I'm drawing the same as if start_anim is true, but whitout
|
||||
/* Here I'm drawing the same as if start_anim is true, but without
|
||||
* making an animation. */
|
||||
game_draw(game);
|
||||
drect(0, 0, DWIDTH, BOX_HEIGHT * PXSIZE, C_WHITE);
|
||||
|
@ -191,7 +191,7 @@ int dialogs_text_opt(Game *game, bopti_image_t *face, char *text,
|
|||
return_int = call_before_end(game, i);
|
||||
if(end_anim) {
|
||||
/* Run another little fancy animation if we should. */
|
||||
for(i = BOX_HEIGHT; i > 0; i--) {
|
||||
for(i = BOX_HEIGHT; i > 0; i-=PXSIZE) {
|
||||
/* It is the same as the start animation. */
|
||||
update_npcs(game);
|
||||
game_draw(game);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "game.h"
|
||||
#include "map.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
|
|
36
src/display.h
Normal file
36
src/display.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef DISPLAY_H
|
||||
#define DISPLAY_H
|
||||
|
||||
#include <gint/display.h>
|
||||
|
||||
#ifdef AZUR
|
||||
|
||||
#include <azur/gint/render.h>
|
||||
|
||||
#define DMIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define DMAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
extern font_t const *topti_font;
|
||||
|
||||
#define dclear azrp_clear
|
||||
#define dupdate azrp_update
|
||||
#define drect(x1, y1, x2, y2, color) azrp_rect(DMIN(x1, x2), DMIN(y1, y2), \
|
||||
DMAX(x1, x2)-DMIN(x1, x2), \
|
||||
DMAX(y1, y2)-DMIN(y1, y2), \
|
||||
color)
|
||||
#define dimage azrp_image
|
||||
#define dsubimage azrp_subimage
|
||||
#define dline azrp_line
|
||||
#define dtext azrp_text
|
||||
#undef dtext_opt
|
||||
#define dtext_opt(x, y, fg, bg, halign, valign, str, size) \
|
||||
azrp_text_opt(x, y, topti_font, fg, halign, valign, str, size)
|
||||
#define dprint azrp_print
|
||||
#define dprint_opt azrp_print_opt
|
||||
#undef dprint_opt
|
||||
#define dprint_opt(x, y, fg, bg, halign, valign, format, ...) \
|
||||
azrp_print_opt(x, y, topti_font, fg, halign, valign, __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
#include "events.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <gint/keyboard.h> /*debug*/
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "npc.h"
|
||||
|
||||
#include <gint/cpu.h>
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -131,8 +131,7 @@ void game_draw(Game *game) {
|
|||
* otherwise */
|
||||
/* (Mibi88) if we do so, we should only use opaque tiles in the background
|
||||
layer (it's currently not the case), to artefacts when rendering dialogs. */
|
||||
if(game->map_level->indoor)
|
||||
dclear(C_WHITE);
|
||||
dclear(C_WHITE);
|
||||
map_render_by_layer(game, BACKGROUND);
|
||||
npc_draw(game);
|
||||
player_draw(game);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "animation.h"
|
||||
#include "events.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* The direction where the player is going to. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "inventory.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <string.h>
|
||||
|
||||
extern bopti_image_t inventory_img;
|
||||
|
|
13
src/main.c
13
src/main.c
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <fxlibc/printf.h>
|
||||
#include <gint/cpu.h>
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/timer.h>
|
||||
|
||||
|
@ -131,6 +131,7 @@ int main(void) {
|
|||
getkey();
|
||||
return 0;
|
||||
}
|
||||
|
||||
game_init(&game);
|
||||
|
||||
#if USB_FEATURE
|
||||
|
@ -150,10 +151,13 @@ int main(void) {
|
|||
#endif
|
||||
|
||||
do {
|
||||
/* start the logic of the game */
|
||||
game_logic(&game);
|
||||
|
||||
/* render the map */
|
||||
game_draw(&game);
|
||||
|
||||
/*#if DEBUGMODE && GINT_RENDER_RGB
|
||||
#if DEBUGMODE && GINT_RENDER_RGB
|
||||
if (game.debug_map)
|
||||
{
|
||||
dfont( NULL );
|
||||
|
@ -191,10 +195,7 @@ int main(void) {
|
|||
game.map_level->extradata[i].dialogID ].ID, game.map_level->dialogs[
|
||||
game.map_level->extradata[i].dialogID ].conclusion1[0] );
|
||||
}
|
||||
#endif*/
|
||||
|
||||
/* start the logic of the game */
|
||||
game_logic(&game);
|
||||
#endif
|
||||
|
||||
/* Screen blit */
|
||||
dupdate();
|
||||
|
|
10
src/map.c
10
src/map.c
|
@ -3,7 +3,7 @@
|
|||
#include "config.h"
|
||||
#include "game.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <gint/keyboard.h>
|
||||
|
||||
extern Map level0;
|
||||
|
@ -197,6 +197,14 @@ void map_render_by_layer(Game *game, int layer) {
|
|||
dsubimage(x * T_WIDTH - mx, y * T_HEIGHT - my,
|
||||
map_level->tileset, xtile, ytile, T_WIDTH,
|
||||
T_HEIGHT, DIMAGE_NONE);
|
||||
/*int idx = 128+((char*)map_level->tileset->data)[ytile*
|
||||
map_level->tileset->width+xtile];
|
||||
if(idx){
|
||||
drect(x * T_WIDTH - mx, y * T_HEIGHT - my,
|
||||
x * T_WIDTH - mx+T_WIDTH,
|
||||
y * T_HEIGHT - my+T_HEIGHT,
|
||||
map_level->tileset->palette[idx]);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "game.h"
|
||||
#include "map.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <gint/keyboard.h> /*debug*/
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "map.h"
|
||||
#include "npc.h"
|
||||
|
||||
#include <gint/display.h>
|
||||
#include <display.h>
|
||||
#include <gint/keyboard.h>
|
||||
|
||||
extern bopti_image_t player_male_img;
|
||||
|
|
Loading…
Add table
Reference in a new issue