crash on main_loop

This commit is contained in:
Shadow15510 2021-07-16 13:21:42 +02:00
parent bd868143b8
commit 8778623b1c
7 changed files with 89 additions and 82 deletions

View File

@ -25,6 +25,7 @@ set(ASSETS_fx
assets-fx/bgrounds.png
assets-fx/tileset.png
assets-fx/player.png
assets-fx/water.png
assets-fx/map/world.csv
# ...
)

View File

@ -1,16 +1,32 @@
-1,65,66,66,67,-1,50,-1,-1,-1,0,1,1,1,1,2,30,-1,-1,-1,27,28,27,28,29,29,29,29,29,-1,-1,-1
-1,84,85,84,84,-1,50,-1,22,23,19,30,64,-1,83,21,-1,-1,64,-1,46,47,46,47,44,-1,-1,-1,49,-1,-1,44
29,84,84,86,85,29,29,-1,41,42,38,-1,-1,11,-1,21,-1,-1,-1,-1,84,85,84,84,-1,-1,24,-1,-1,-1,-1,-1
-1,33,-1,11,-1,-1,-1,-1,-1,-1,57,58,58,58,-1,21,29,29,29,29,84,84,86,84,83,83,51,-1,49,-1,-1,-1
-1,-1,-1,-1,11,-1,-1,30,-1,-1,11,-1,-1,-1,-1,40,11,-1,64,-1,-1,-1,44,-1,29,29,29,29,29,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,58,58,58,59,-1,-1,-1,-1,-1,-1,44,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,13,-1,-1,-1,-1,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,-1,44,-1,-1
-1,-1,-1,-1,-1,-1,64,-1,-1,-1,-1,-1,-1,15,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1
-1,-1,26,-1,64,-1,-1,-1,-1,-1,26,24,-1,-1,-1,-1,34,35,36,-1,-1,-1,-1,18,-1,-1,18,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,64,-1,-1,-1,-1,-1,-1,-1,0,1,53,54,55,2,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,-1
-1,-1,-1,64,30,-1,-1,0,1,1,1,1,1,1,19,33,-1,-1,44,21,2,18,-1,44,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,19,22,23,52,-1,52,62,38,-1,-1,-1,44,40,21,-1,-1,-1,-1,11,-1,-1,-1,-1,-1,-1
-1,15,-1,-1,-1,-1,15,19,41,42,-1,-1,-1,-1,57,58,58,58,20,59,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1
-1,-1,-1,-1,-1,-1,-1,38,-1,-1,49,-1,-1,-1,-1,-1,-1,-1,-1,52,21,-1,-1,44,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,15,-1,-1,-1,-1,57,58,58,58,58,20,58,58,58,58,58,58,58,59,-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
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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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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1

1 56 65 56 66 56 66 56 67 56 56 -1 -1 83 -1 34 35 35 36 -1 -1 30 50 -1 -1 -1 27 -1 28 -1 27 45 28 -1 29 -1 29 -1 29 -1 29 56 29 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
2 56 84 56 85 56 84 56 84 56 49 -1 49 -1 49 -1 -1 53 54 53 53 22 -1 23 -1 -1 50 -1 64 45 -1 46 -1 47 -1 46 -1 47 44 -1 44 -1 -1 -1 -1 -1 -1 56 49 56 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 30 45 64 -1 19 -1 83 -1 -1 45 -1 -1 -1 -1 -1 -1 -1 -1 62 -1 21
3 56 84 56 84 56 86 56 85 -1 -1 29 83 29 -1 -1 -1 52 53 55 54 53 41 52 42 50 -1 29 -1 -1 -1 -1 84 -1 45 85 -1 84 -1 84 -1 -1 -1 -1 -1 24 56 -1 56 -1 56 -1 -1 -1 -1 -1 -1 24 -1 -1 -1 -1 -1 -1 -1 -1 62 38 19 -1 -1 19 11 -1 -1 -1 -1 -1 -1 -1 64 45 -1 -1 -1 -1 -1 21
4 56 33 56 -1 56 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 29 -1 29 -1 29 -1 29 -1 84 -1 84 -1 86 -1 84 -1 83 -1 83 -1 51 56 -1 56 49 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 57 19 58 -1 58 62 38 58 -1 -1 24 -1 -1 -1 -1 -1 -1 -1 31 -1 -1 -1 21
5 56 -1 56 -1 -1 -1 -1 11 -1 24 -1 -1 -1 30 -1 -1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1 -1 63 -1 -1 -1 -1 -1 -1 -1 -1 -1 25 -1 -1 -1 57 20 58 59 -1 -1 -1 -1 -1
30 -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 25 -1 -1 -1 -1 -1 -1 -1 -1
31 -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
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: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

@ -4,6 +4,12 @@
#include "core.h"
void next_frame(struct game *game)
{
game->water_frame = (game->water_frame + 1) % 2;
}
void analyze_input(struct game *game, const int last_key)
{
game->total_tick += ENGINE_TICK;
@ -31,24 +37,6 @@ void analyze_input(struct game *game, const int last_key)
}
}
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;
}
int is_walkable(const struct game game, const int direction)
{
@ -71,5 +59,23 @@ int is_walkable(const struct game game, const int direction)
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;
}

View File

@ -3,13 +3,12 @@
#define ENGINE_TICK 100
#define PARTICULE_NB 50
#define TILESET_WIDTH 19
#define TILE_SIZE 8
#define MAP_WIDTH 32
#define MAP_HEIGHT 16
#define MAP_WIDTH 64
#define MAP_HEIGHT 32
#define SCREEN_WIDTH 16
#define SCREEN_HEIGHT 8
@ -40,17 +39,23 @@ struct game
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
int 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);
int is_walkable(const struct game game, const int direction);
#endif /* _CORE_H */

View File

@ -7,6 +7,7 @@
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 ++)
{
@ -15,7 +16,9 @@ void draw_map(const struct game game)
if (game.map.data[game.world_y + i][game.world_x + j] != -1 && game.world_y + i < (MAP_HEIGHT) && game.world_y + i >= 0 && game.world_x + j < (MAP_WIDTH) && game.world_x + j >= 0)
{
int tile_x = (TILE_SIZE + 1) * (game.map.data[game.world_y + i][game.world_x + j] % TILESET_WIDTH), tile_y = (TILE_SIZE + 1) * (game.map.data[game.world_y + i][game.world_x + j] / TILESET_WIDTH);
dsubimage(j * TILE_SIZE, i * TILE_SIZE, &img_tileset, tile_x, tile_y, 8, 8, DIMAGE_NONE);
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);
}
}
}

View File

@ -29,8 +29,8 @@ int main(void)
dfont(&font_odyssee);
dgray(DGRAY_ON);
title_screen();
title_screen();
main_loop();
dgray(DGRAY_OFF);
@ -43,46 +43,12 @@ int main(void)
void title_screen(void)
{
extern const bopti_image_t img_title;
int key = 0;
// Initialise 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;
}
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)
{
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;
}
dupdate();
key = rtc_key();
}
if (t >= 0) timer_stop(t);
dclear(C_WHITE);
dimage(0, 0, &img_title);
dupdate();
getkey();
}
@ -92,18 +58,28 @@ void main_loop(void)
int key = 0;
struct player player = {DOWN};
struct game game = {map_world, 0, 0, player, 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);
next_frame(&game);
draw_map(game);
draw_player(game);
dupdate();
key = getkey().key;
key = rtc_key();
analyze_input(&game, key);
}
if (t >= 0) timer_stop(t);
}