merged MiBi88's work on map movement and rendering + FCalva's work on adding a target for fxCG50

This commit is contained in:
SlyVTT 2023-07-07 18:22:39 +02:00
parent 78d45a1e78
commit f0417bee16
21 changed files with 93 additions and 97 deletions

2
.gitignore vendored
View file

@ -12,3 +12,5 @@ __pycache__/
*.sublime-project
*.sublime-workspace
.vscode
*.json

View file

@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.15)
project(MyAddin)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.9 REQUIRED)
find_package(LibProf 2.4 REQUIRED)
@ -13,20 +15,20 @@ find_package(LibProf 2.4 REQUIRED)
set(COLORMODE 2b)
fxconv_declare_converters(assets-fx/converters.py)
fxconv_declare_converters(assets/converters.py)
add_custom_command(
COMMENT "Convert Tiled TMX map to usable JSON file"
COMMAND tiled --export-tileset json tilesetnpp.tsx tilesetnpp.json
COMMAND find | grep .*.tmx | sed 's/.tmx//g' | xargs -l bash -c 'tiled --export-map json $$0.tmx $$0.json'
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets-fx/levels/
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets/
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-fx/levels/level0.json"
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets/level0.json"
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
DEPENDS assets-fx/converters.py
assets-fx/levels/tileset.png
assets-fx/levels/tilesetnpp.tsx
assets-fx/levels/level0.tmx
DEPENDS assets/converters.py
assets/tileset.png
assets/tilesetnpp.tsx
assets/level0.tmx
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
)
@ -39,11 +41,16 @@ set(SOURCES
)
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
set(ASSETS
assets/level0.json
assets/demo_player.png
# ...
)
set(ASSETS_cg
assets-cg/tileset2b_CG.png
)
set(ASSETS_fx
assets-fx/levels/level0.json
assets-fx/demo_player.png
# ...
)
@ -57,10 +64,11 @@ set(ASSETS_fx_2b
# ...
)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_fx_1b} ${ASSETS_fx_2b} WITH_METADATA)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} ${ASSETS_fx_1b} ${ASSETS_fx_2b} WITH_METADATA)
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE}} )
if("${COLORMODE}" STREQUAL 1b)
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR1BIT)
endif()
@ -76,6 +84,7 @@ target_link_libraries(myaddin LibProf::LibProf Gint::Gint)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
if("${COLORMODE}" STREQUAL 1b)
generate_g1a(TARGET myaddin OUTPUT "PrjPC1b.g1a"
NAME "Col RPG NB" ICON assets-fx/icon1.png)
@ -85,4 +94,11 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
generate_g1a(TARGET myaddin OUTPUT "PrjPC2b.g1a"
NAME "Col RPG Grey" ICON assets-fx/icon2.png)
endif()
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET myaddin OUTPUT "PRJPC_CG.g3a"
NAME "Col_RPG_CG" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

9
LICENSE.txt Normal file
View file

@ -0,0 +1,9 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to https://unlicense.org

View file

@ -0,0 +1,5 @@
tileset2b_CG.png:
type: bopti-image
name: img_tilesetnpp

BIN
assets-cg/icon-sel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
assets-cg/icon-uns.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets-cg/tileset2b_CG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View file

@ -1,6 +0,0 @@
example.png:
type: bopti-image
name: img_example
demo_player.png:
type: bopti-image
name: demo_player_img

View file

@ -1,7 +1,3 @@
*.json:
custom-type: map
name_regex: (.*)\.json map_\1
tileset1b.png:
type: bopti-image
name: img_tilesetnpp

View file

@ -1,44 +0,0 @@
{ "compressionlevel":-1,
"height":24,
"infinite":false,
"layers":[
{
"data":[257, 297, 298, 299, 300, 257, 386, 297, 298, 299, 300, 2, 2, 2, 2, 2, 257, 2, 2, 225, 226, 227, 228, 201, 202, 203, 204, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 253, 205, 229, 205, 229, 280, 179, 180, 179, 156, 156, 156, 158, 157, 179, 180, 253, 2, 2, 249, 250, 251, 252, 225, 226, 227, 228, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 301, 125, 126, 127, 128, 2, 385, 303, 350, 351, 303, 2, 2, 2, 350, 351, 301, 2, 2, 273, 274, 275, 276, 249, 250, 251, 252, 201, 202, 203, 204, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 325, 149, 150, 151, 152, 2, 2, 327, 374, 375, 327, 2, 184, 185, 374, 375, 325, 2, 279, 297, 298, 299, 300, 273, 274, 275, 276, 225, 226, 227, 228, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 257, 2, 2, 385, 2, 2, 385, 2, 265, 266, 2, 2, 208, 209, 352, 353, 257, 2, 302, 2, 130, 129, 166, 297, 298, 299, 300, 249, 250, 251, 252, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 281, 176, 2, 2, 278, 2, 2, 385, 289, 290, 2, 2, 232, 233, 376, 377, 281, 2, 326, 2, 154, 153, 190, 201, 202, 203, 204, 273, 274, 275, 276, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 201, 202, 203, 204, 302, 385, 2, 2, 265, 266, 2, 385, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 166, 225, 226, 227, 228, 297, 298, 299, 300, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 225, 226, 227, 228, 326, 2, 385, 2, 265, 266, 2, 2, 2, 2, 214, 215, 2, 2, 2, 2, 2, 2, 190, 249, 250, 251, 252, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 249, 250, 251, 252, 201, 202, 203, 204, 289, 290, 2, 258, 259, 260, 238, 239, 260, 260, 261, 262, 262, 263, 264, 273, 274, 275, 276, 2, 93, 94, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 273, 274, 275, 276, 225, 226, 227, 228, 265, 266, 2, 282, 283, 284, 285, 285, 285, 285, 285, 285, 286, 287, 288, 297, 298, 299, 300, 2, 117, 118, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 297, 298, 299, 300, 249, 250, 251, 252, 290, 2, 2, 306, 307, 308, 309, 308, 309, 308, 309, 310, 310, 311, 312, 131, 2, 339, 340, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 202, 203, 204, 386, 273, 274, 275, 276, 2, 2, 2, 330, 331, 332, 333, 332, 333, 332, 333, 334, 334, 335, 336, 132, 2, 363, 364, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 226, 227, 228, 386, 297, 298, 299, 300, 2, 290, 2, 162, 163, 164, 165, 162, 163, 164, 165, 162, 163, 164, 165, 132, 2, 201, 202, 203, 204, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 250, 251, 252, 2, 2, 2, 2, 2, 2, 2, 2, 86, 87, 88, 89, 186, 187, 188, 189, 86, 87, 88, 89, 132, 2, 225, 226, 227, 228, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 274, 275, 276, 2, 270, 271, 271, 271, 272, 2, 2, 110, 111, 112, 113, 210, 211, 212, 213, 110, 111, 112, 113, 133, 2, 249, 250, 251, 252, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 298, 299, 300, 2, 294, 1, 1, 1, 296, 2, 2, 136, 137, 0, 0, 234, 290, 265, 237, 2, 2, 339, 340, 2, 2, 273, 274, 275, 276, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 202, 203, 204, 2, 294, 1, 1, 1, 296, 2, 2, 160, 161, 265, 266, 266, 265, 266, 2, 2, 2, 363, 364, 2, 2, 297, 298, 299, 300, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 226, 227, 228, 2, 318, 319, 319, 319, 320, 2, 2, 2, 2, 289, 290, 265, 266, 290, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 250, 251, 252, 2, 2, 2, 2, 2, 2, 385, 386, 2, 2, 265, 265, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 274, 275, 276, 201, 202, 203, 204, 257, 2, 2, 2, 257, 2, 265, 265, 2, 257, 2, 2, 2, 257, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 298, 299, 300, 225, 226, 227, 228, 253, 205, 229, 205, 253, 2, 290, 265, 2, 253, 205, 229, 205, 253, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 386, 249, 250, 251, 252, 345, 346, 347, 348, 277, 2, 265, 266, 2, 301, 386, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 202, 203, 204, 273, 274, 275, 276, 369, 370, 371, 372, 301, 2, 289, 290, 2, 325, 387, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 226, 227, 228, 297, 298, 299, 300, 393, 394, 395, 396, 325, 2, 265, 266, 2, 301, 386, 2, 2, 2, 2, 257, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":24,
"id":2,
"name":"Foreground",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":48,
"x":0,
"y":0
}],
"nextlayerid":3,
"nextobjectid":1,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.8.0",
"tileheight":8,
"tilesets":[
{
"firstgid":1,
"source":"tilesetnpp.tsx"
}],
"tilewidth":8,
"type":"map",
"version":"1.8",
"width":48
}

View file

@ -1,14 +0,0 @@
{ "columns":24,
"image":"tileset.png",
"imageheight":136,
"imagewidth":192,
"margin":0,
"name":"tileset",
"spacing":0,
"tilecount":408,
"tiledversion":"1.8.0",
"tileheight":8,
"tilewidth":8,
"type":"tileset",
"version":"1.8"
}

View file

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 105 B

View file

@ -0,0 +1,7 @@
*.json:
custom-type: map
name_regex: (.*)\.json map_\1
demo_player.png:
type: bopti-image
name: demo_player_img

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -10,9 +10,13 @@
#endif //USB_FEATURE
#ifdef COLOR2BIT
#if !defined(FXCG50) && defined(COLOR2BIT)
#define GRAYMODEOK
#endif
#ifdef GRAYMODEOK
#include <gint/gray.h>
#endif //COLOR2BIT
#endif //GRAYMODEOK
#include <stdint.h>
#include <stdbool.h>
@ -71,18 +75,31 @@ static void get_inputs( void )
void USB_feature( void )
{
if (screenshot && usb_is_open()) {
if (!dgray_enabled())
usb_fxlink_screenshot(false);
else
usb_fxlink_screenshot_gray(false);
screenshot = false;
#ifdef GRAYMODEOK // This is a trick, if GRAYMODEOK is defined then we make the code accessible
if (dgray_enabled())
usb_fxlink_screenshot_gray(false);
else
#endif
usb_fxlink_screenshot(false); // else we just let the usual screeshot function
screenshot = false;
}
if (record && usb_is_open()) {
if (!dgray_enabled())
#ifdef GRAYMODEOK
if (dgray_enabled())
usb_fxlink_videocapture_gray(false);
else
#endif
usb_fxlink_videocapture(false);
else
usb_fxlink_videocapture_gray(false);
}
}
@ -90,7 +107,7 @@ static void get_inputs( void )
void GameLogic(void) {
// to be done
}
@ -104,7 +121,7 @@ int main(void) {
/* start grayscale engine */
#ifdef COLOR2BIT
#ifdef GRAYMODEOK
dgray( DGRAY_ON );
#endif
@ -138,7 +155,7 @@ int main(void) {
/* shutdown grayengine*/
#ifdef COLOR2BIT
#ifdef GRAYMODEOK
dgray( DGRAY_OFF );
#endif

View file

@ -71,14 +71,14 @@ void RenderMap(Player *player, Map *map_level) {
if(tx+x>=0 && tx+x < map_level->w &&
ty+y>=0 && ty+y < map_level->h){
tile = map_level->layers[l][(y+ty) * map_level->w + tx+x];
/* tile == -1 means nothing to be draw */
/* tile == -1 means nothing to be drawn */
if(tile >= 0){
/* get x and y position in the tileset image */
xtile = (tile % map_level->tileset_size) * T_WIDTH;
ytile = (tile / map_level->tileset_size) * T_HEIGHT;
/* render */
dsubimage(x*T_WIDTH-mx, y*T_HEIGHT-my,
map_level->tileset, xtile, ytile, 8, 8,
map_level->tileset, xtile, ytile, T_WIDTH, T_HEIGHT,
DIMAGE_NONE);
}
}

View file

@ -1,8 +1,15 @@
#ifndef MAP_H
#define MAP_H
#define T_HEIGHT 8
#define T_WIDTH 8
#ifdef FXCG50
#define T_HEIGHT 16
#define T_WIDTH 16
#else
#define T_HEIGHT 8
#define T_WIDTH 8
#endif
#include <gint/display.h>

View file

@ -9,6 +9,7 @@ extern Player MyPlayer;
extern Map *map_level;
extern bopti_image_t demo_player_img;
void PlayerDraw(void) {
dimage(MyPlayer.px-P_WIDTH/2, MyPlayer.py-P_HEIGHT/2, &demo_player_img);
}