Compare commits

...

7 Commits
master ... dev

Author SHA1 Message Date
Shadow15510 bf2d3e70f2 fuck massena ♥ 2021-08-22 17:17:43 +02:00
Shadow15510 3c98e0168e Add animated player and animated water 2021-07-17 15:32:47 +02:00
Shadow15510 8778623b1c crash on main_loop 2021-07-16 13:21:42 +02:00
Shadow15510 bd868143b8 World gestion : displaying and collisions 2021-07-04 22:44:08 +02:00
Shadow15510 240242c2ee Clean repository 2021-07-04 09:45:42 +02:00
Shadow15510 6501d06447 fix compilation bugs 2021-07-04 09:42:41 +02:00
Shadow15510 a2b0736329 Key repetition problem 2021-07-04 09:40:38 +02:00
55 changed files with 329 additions and 69 deletions

12
.gitignore vendored
View File

@ -1,12 +1,12 @@
# Build files
projet/build-fx
projet/build-cg
project/build-fx
project/build-cg
# Executables
projet/Odyssee.g1a
projet/Odyssee.g3a
project/Odyssee.g1a
project/Odyssee.g3a
# Python bytecode
projet/__pycache__/*
projet/assets-fx/__pycache__/*
project/__pycache__/*
project/assets-fx/__pycache__/*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 865 B

View File

Before

Width:  |  Height:  |  Size: 934 B

After

Width:  |  Height:  |  Size: 934 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

4
pictures/Odyssée.tsx Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.5" tiledversion="1.7.1" name="Odyssée" tilewidth="8" tileheight="8" spacing="1" tilecount="95" columns="19">
<image source="../dépôts_git/Odyssee_RP/project/assets-fx/tileset.png" width="170" height="44"/>
</tileset>

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 990 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -12,6 +12,7 @@ find_package(Gint 2.1 REQUIRED)
set(SOURCES
src/main.c
src/core.c
src/display_engine.c
# ...
)
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
@ -22,8 +23,10 @@ set(ASSETS_fx
assets-fx/odyssee.png
assets-fx/title.png
assets-fx/bgrounds.png
assets-fx/tileset.png
assets-fx/player.png
assets-fx/player_sword.png
assets-fx/water.png
assets-fx/map/world.csv
# ...
)
set(ASSETS_cg
@ -31,6 +34,7 @@ set(ASSETS_cg
)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
fxconv_declare_converters(assets-fx/converters.py)
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,31 @@
import fxconv
def convert(input_name, output, params, target):
if params["custom-type"] == "map":
convert_map(input_name, output, params, target)
return 0
else:
return 1
def convert_map(input_name, output, params, target):
# Read informations
with open(input_name, "r") as file:
csv_data = file.read().splitlines()
walkable = [-1, 11, 12, 13, 14, 15, 16, 17, 18, 20, 24, 25, 26, 30, 31, 37, 43, 44, 45, 62, 63, 64]
# Convertion into bytes
tiles = bytes()
collision = bytes()
for line in csv_data:
for value in line.split(","):
value = int(value)
tiles += fxconv.u32(value)
collision += fxconv.u8(value in walkable)
data = fxconv.ObjectData()
data += tiles + collision
fxconv.elf(data, output, "_" + params["name"], **target)

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,3 @@
*.csv:
custom-type: map
name_regex: (.*)\.csv map_\1

View File

@ -0,0 +1,32 @@
56,56,56,56,56,56,-1,-1,83,-1,34,35,35,36,-1,-1,50,-1,-1,-1,-1,-1,45,-1,-1,-1,-1,56,56,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
56,56,56,56,56,49,49,49,-1,-1,53,54,53,53,-1,-1,50,-1,45,-1,-1,-1,-1,-1,-1,-1,-1,56,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,45,-1,19,-1,-1,-1,45,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,21
56,56,56,56,-1,-1,83,-1,-1,52,53,55,54,53,52,50,-1,-1,-1,-1,45,-1,-1,-1,-1,-1,56,56,56,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,62,19,-1,-1,19,-1,-1,-1,-1,-1,-1,-1,64,45,-1,-1,-1,-1,-1,21
56,56,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,56,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,-1,62,38,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,31,-1,-1,-1,21
56,56,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,44,-1,-1,-1,-1,-1,24,56,56,31,-1,-1,-1,-1,-1,-1,-1,-1,-1,31,-1,-1,-1,-1,-1,-1,19,49,49,57,58,58,58,58,58,58,58,58,59,-1,-1,-1,-1,-1,40
56,56,-1,-1,-1,-1,-1,-1,83,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,56,56,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,-1,-1,-1,-1,-1,-1,-1,64,64,-1,-1,-1,-1,-1,-1,57,58,59
56,56,24,-1,-1,-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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
32 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
project/assets-fx/water.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

103
project/src/core.c Normal file
View File

@ -0,0 +1,103 @@
#include <gint/keyboard.h>
#include <gint/timer.h>
#include <gint/clock.h>
#include "core.h"
void next_frame(struct game *game)
{
game->total_tick += ENGINE_TICK;
if (!(game->total_tick % 200)) game->water_frame = (game->water_frame + 1) % 8;
if (!(game->total_tick % 500))
{
switch (game->player->animation_frame)
{
case 2:
game->player->animation_frame = 0;
break;
case 3:
game->player->animation_frame = 1;
break;
default:
game->player->animation_frame = (game->player->animation_frame + 1) % 2;
break;
}
}
}
void analyze_input(struct game *game, const int last_key)
{
switch (last_key)
{
case KEY_UP:
if (is_walkable(game, UP)) game->world_y -= 1;
game->player->direction = UP;
game->player->animation_frame = 2 + (game->player->animation_frame + 1) % 2;
break;
case KEY_RIGHT:
if (is_walkable(game, RIGHT)) game->world_x += 1;
game->player->direction = RIGHT;
game->player->animation_frame = 2 + (game->player->animation_frame + 1) % 2;
break;
case KEY_DOWN:
if (is_walkable(game, DOWN)) game->world_y += 1;
game->player->direction = DOWN;
game->player->animation_frame = 2 + (game->player->animation_frame + 1) % 2;
break;
case KEY_LEFT:
if (is_walkable(game, LEFT)) game->world_x -= 1;
game->player->direction = LEFT;
game->player->animation_frame = 2 + (game->player->animation_frame + 1) % 2;
break;
}
}
uint8_t is_walkable(const struct game *game, const int direction)
{
switch (direction)
{
case UP:
if (game->world_y + 4 >= 0) return game->map->collision[game->world_y + 4][game->world_x + 7];
break;
case RIGHT:
if (game->world_x + 8 < MAP_WIDTH) return game->map->collision[game->world_y + 5][game->world_x + 8];
break;
case DOWN:
if (game->world_y + 6 < MAP_HEIGHT) return game->map->collision[game->world_y + 6][game->world_x + 7];
break;
case LEFT:
if (game->world_x + 5 >= 0) return game->map->collision[game->world_y + 5][game->world_x + 6];
break;
}
return 0;
}
int rtc_key(void)
{
int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS;
int timeout = 1;
key_event_t ev = getkey_opt(opt, &timeout);
if (ev.type == KEYEV_NONE) return 0;
return ev.key;
}
int callback_tick(volatile int *tick)
{
*tick = 1;
return TIMER_CONTINUE;
}

63
project/src/core.h Normal file
View File

@ -0,0 +1,63 @@
#ifndef _CORE_H
#define _CORE_H
#define ENGINE_TICK 100
#define TILESET_WIDTH 19
#define TILE_SIZE 8
#define SCREEN_WIDTH 16
#define SCREEN_HEIGHT 8
#define MAP_WIDTH 64
#define MAP_HEIGHT 32
#define UP 0
#define RIGHT 1
#define DOWN 2
#define LEFT 3
struct player
{
int direction;
int animation_frame;
};
struct map
{
int data[MAP_HEIGHT][MAP_WIDTH];
uint8_t collision[MAP_HEIGHT][MAP_WIDTH];
};
struct game
{
// Current map and coord's map in the world
const struct map *map;
int world_x, world_y;
struct player *player;
int total_tick;
int water_frame;
};
// next_frame : compute the next frame to display
void next_frame(struct game *game);
// analyze_input : change the player's position
void analyze_input(struct game *game, const int last_key);
// is_walkable : check if the player can go on the targeted case
uint8_t is_walkable(const struct game *game, const int direction);
// rtc_key : returns the key code with RTC system
int rtc_key(void);
// callback_tick : timer's function
int callback_tick(volatile int *tick);
#endif /* _CORE_H */

View File

@ -0,0 +1,35 @@
#include <gint/display.h>
#include <gint/gray.h>
#include <math.h>
#include "display_engine.h"
void draw_map(const struct game *game)
{
extern const bopti_image_t img_tileset;
extern const bopti_image_t img_water;
for (int i = 0; i < SCREEN_HEIGHT; i ++)
{
for (int j = 0; j < SCREEN_WIDTH; j++)
{
if ((game->world_y + i < MAP_HEIGHT && game->world_y + i >= 0 && game->world_x + j < MAP_WIDTH && game->world_x + j >= 0) && (game->map->data[game->world_y + i][game->world_x + j] != -1))
{
unsigned int tile_x = (TILE_SIZE + 1) * (game->map->data[game->world_y + i][game->world_x + j] % TILESET_WIDTH);
unsigned int tile_y = (TILE_SIZE + 1) * (game->map->data[game->world_y + i][game->world_x + j] / TILESET_WIDTH);
if (game->map->data[game->world_y + i][game->world_x + j] != 56) dsubimage(j * TILE_SIZE, i * TILE_SIZE, &img_tileset, tile_x, tile_y, 8, 8, DIMAGE_NONE);
else dsubimage(j * TILE_SIZE, i * TILE_SIZE, &img_water, 9 * game->water_frame, 0, 8, 8, DIMAGE_NONE);
}
}
}
}
void draw_player(const struct game *game)
{
extern const bopti_image_t img_player;
dsubimage(56, 35, &img_player, 9 * game->player->animation_frame, 13 * game->player->direction, 8, 12, DIMAGE_NONE);
}

View File

@ -0,0 +1,14 @@
#ifndef _DISPLAY_ENGINE_H
#define _DISPLAY_ENGINE_H
#include "core.h"
// draw_map : display a map on the screen
void draw_map(const struct game *game);
//draw_player : display the player with animation
void draw_player(const struct game *game);
#endif /* _DISPLAY_ENGINE_H */

View File

@ -9,22 +9,33 @@
*/
#include <gint/display.h>
#include <gint/gray.h>
#include <gint/keyboard.h>
#include <gint/timer.h>
#include <gint/clock.h>
#include <gint/std/stdlib.h>
#include "core.h"
#include "display_engine.h"
// title_screen : display the title screen with particule effect
void title_screen(void);
void main_loop(void);
int main(void)
{
extern font_t font_odyssee;
dfont(&font_odyssee);
dgray(DGRAY_ON);
title_screen();
main_loop();
dgray(DGRAY_OFF);
dupdate();
return 1;
}
@ -32,44 +43,42 @@ int main(void)
void title_screen(void)
{
extern const bopti_image_t img_title;
dclear(C_WHITE);
dimage(0, 0, &img_title);
dupdate();
getkey();
}
void main_loop(void)
{
extern const struct map map_world;
int key = 0;
// Initialise the particule effect
srand(1551001551);
int coord_x[PARTICULE_NB];
int coord_y[PARTICULE_NB];
for (int i = 0; i < PARTICULE_NB; i ++)
{
coord_x[i] = rand() % 128;
coord_y[i] = rand() % 64;
}
struct player player = {DOWN, 0};
struct game game = {&map_world, 0, 0, &player, 0, 0};
static volatile int tick = 0;
int t = timer_configure(TIMER_ANY, ENGINE_TICK*1000, GINT_CALL(callback_tick, &tick));
if (t >= 0) timer_start(t);
while (key != KEY_EXIT)
{
{
while (!tick) sleep();
tick = 0;
dclear(C_WHITE);
dimage(0, 0, &img_title);
// Update particules positions
for (int i = 0; i < PARTICULE_NB; i ++)
{
dpixel(coord_x[i], coord_y[i], C_BLACK);
coord_x[i] += (rand() % 3) - 1;
coord_y[i] += (rand() % 3) - 1;
if (coord_x[i] < 0 || coord_x[i] > 128) coord_x[i] = rand() % 128;
if (coord_y[i] < 0 || coord_y[i] > 64) coord_y[i] = rand() % 64;
}
next_frame(&game);
draw_map(&game);
draw_player(&game);
dupdate();
key = rtc_key();
}
key = rtc_key();
analyze_input(&game, key);
}
if (t >= 0) timer_stop(t);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,24 +0,0 @@
#include <gint/keyboard.h>
#include <gint/timer.h>
#include <gint/clock.h>
#include "core.h"
int rtc_key(void)
{
int opt = GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA & ~GETKEY_REP_ARROWS;
int timeout = 1;
key_event_t ev = getkey_opt(opt, &timeout);
if(ev.type == KEYEV_NONE) return 0;
return ev.key;
}
int callback_tick(volatile int *tick)
{
*tick = 1;
return TIMER_CONTINUE;
}

View File

@ -1,14 +0,0 @@
#ifndef _CORE_H
#define _CORE_H
#define ENGINE_TICK 100
#define PARTICULE_NB 50
// rtc_key : returns the key code with RTC system
int rtc_key(void);
// callback_tick : timer's function
int callback_tick(volatile int *tick);
#endif /* _CORE_H */