Cleanup + bug fix + assets for fx
Before Width: | Height: | Size: 110 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 144 B |
|
@ -4,14 +4,14 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char frame : 8;
|
unsigned char frame;
|
||||||
bopti_image_t *image;
|
bopti_image_t *image;
|
||||||
unsigned char len : 8;
|
unsigned char len;
|
||||||
unsigned short frame_ms : 16;
|
unsigned short frame_ms;
|
||||||
int current_ms : 32;
|
int current_ms;
|
||||||
unsigned short width : 16;
|
unsigned short width;
|
||||||
unsigned short height : 16;
|
unsigned short height;
|
||||||
unsigned char wrap_dest : 8;
|
unsigned char wrap_dest;
|
||||||
} Animation;
|
} Animation;
|
||||||
|
|
||||||
/* TODO: Doc! */
|
/* TODO: Doc! */
|
||||||
|
|
21
src/game.c
|
@ -3,6 +3,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "npc.h"
|
#include "npc.h"
|
||||||
|
#include "mapdata.h"
|
||||||
|
|
||||||
#include <gint/cpu.h>
|
#include <gint/cpu.h>
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
|
@ -11,6 +12,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern bopti_image_t SignAction_img;
|
extern bopti_image_t SignAction_img;
|
||||||
|
extern bopti_image_t player_male_img;
|
||||||
|
extern bopti_image_t tiny_npc_male;
|
||||||
|
|
||||||
extern Dialog *dialogRPG;
|
extern Dialog *dialogRPG;
|
||||||
// extern NPC *npcRPG;
|
// extern NPC *npcRPG;
|
||||||
|
@ -18,6 +21,24 @@ extern Dialog *dialogRPG;
|
||||||
|
|
||||||
#define MAX_INTERACTION_DISTANCE 12
|
#define MAX_INTERACTION_DISTANCE 12
|
||||||
|
|
||||||
|
void game_init(Game *game) {
|
||||||
|
game->map_level = worldRPG[0];
|
||||||
|
/* NPC animation */
|
||||||
|
animation_new(&game->npc_animation, &tiny_npc_male, 3, 250);
|
||||||
|
/* Wrapping back to 0 to skip the idle frame. */
|
||||||
|
game->npc_animation.wrap_dest = 1;
|
||||||
|
/* Player animation */
|
||||||
|
animation_new(&game->player.animation, &player_male_img, 3, 250);
|
||||||
|
/* Wrapping back to 1 to skip the idle frame. */
|
||||||
|
game->player.animation.wrap_dest = 1;
|
||||||
|
/* Add some event handlers (for testing only) */
|
||||||
|
events_init_handler(&game->handler);
|
||||||
|
events_bind_variable(&game->handler, (int *)&game->player.life, "life");
|
||||||
|
events_bind_variable(&game->handler, &game->mana, "mana");
|
||||||
|
|
||||||
|
// reload_npc(&game);
|
||||||
|
}
|
||||||
|
|
||||||
void interaction_available(Game *game) {
|
void interaction_available(Game *game) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,9 @@ typedef struct {
|
||||||
int mana; /* Only for testing events TODO: Remove this! */
|
int mana; /* Only for testing events TODO: Remove this! */
|
||||||
} Game;
|
} Game;
|
||||||
|
|
||||||
|
/* TODO: Doc! */
|
||||||
|
void game_init(Game *game);
|
||||||
|
|
||||||
/* (Mibi88) TODO: Describe what this function is doing. */
|
/* (Mibi88) TODO: Describe what this function is doing. */
|
||||||
void game_logic(Game *game);
|
void game_logic(Game *game);
|
||||||
|
|
||||||
|
|
17
src/main.c
|
@ -27,9 +27,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern bopti_image_t player_face_img;
|
/* extern bopti_image_t player_face_img; */
|
||||||
extern bopti_image_t player_male_img;
|
|
||||||
extern bopti_image_t tiny_npc_male;
|
|
||||||
|
|
||||||
extern Map *worldRPG[];
|
extern Map *worldRPG[];
|
||||||
|
|
||||||
|
@ -110,18 +108,7 @@ int main(void) {
|
||||||
}
|
}
|
||||||
timer_start(timer);
|
timer_start(timer);
|
||||||
|
|
||||||
game.map_level = worldRPG[0];
|
game_init(&game);
|
||||||
/* NPC animation */
|
|
||||||
animation_new(&game.npc_animation, &tiny_npc_male, 3, 250);
|
|
||||||
/* Player animation */
|
|
||||||
animation_new(&game.player.animation, &player_male_img, 3, 250);
|
|
||||||
/* Wrapping back to 1 to skip the idle frame. */
|
|
||||||
game.player.animation.wrap_dest = 1;
|
|
||||||
events_init_handler(&game.handler);
|
|
||||||
events_bind_variable(&game.handler, (int *)&game.player.life, "life");
|
|
||||||
events_bind_variable(&game.handler, &game.mana, "mana");
|
|
||||||
|
|
||||||
// reload_npc(&game);
|
|
||||||
|
|
||||||
#if USB_FEATURE
|
#if USB_FEATURE
|
||||||
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
|
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
|
||||||
|
|