Merge branch 'dev' of git.planet-casio.com:Slyvtt/Collab_RPG into dev
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"
|
||||
|
||||
typedef struct {
|
||||
unsigned char frame : 8;
|
||||
unsigned char frame;
|
||||
bopti_image_t *image;
|
||||
unsigned char len : 8;
|
||||
unsigned short frame_ms : 16;
|
||||
int current_ms : 32;
|
||||
unsigned short width : 16;
|
||||
unsigned short height : 16;
|
||||
unsigned char wrap_dest : 8;
|
||||
unsigned char len;
|
||||
unsigned short frame_ms;
|
||||
int current_ms;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
unsigned char wrap_dest;
|
||||
} Animation;
|
||||
|
||||
/* TODO: Doc! */
|
||||
|
|
21
src/game.c
|
@ -3,6 +3,7 @@
|
|||
#include "config.h"
|
||||
#include "map.h"
|
||||
#include "npc.h"
|
||||
#include "mapdata.h"
|
||||
|
||||
#include <gint/cpu.h>
|
||||
#include <gint/display.h>
|
||||
|
@ -11,6 +12,8 @@
|
|||
#include <string.h>
|
||||
|
||||
extern bopti_image_t SignAction_img;
|
||||
extern bopti_image_t player_male_img;
|
||||
extern bopti_image_t tiny_npc_male;
|
||||
|
||||
extern Dialog *dialogRPG;
|
||||
// extern NPC *npcRPG;
|
||||
|
@ -18,6 +21,24 @@ extern Dialog *dialogRPG;
|
|||
|
||||
#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) {
|
||||
uint32_t i;
|
||||
|
||||
|
|
|
@ -181,6 +181,9 @@ typedef struct {
|
|||
int mana; /* Only for testing events TODO: Remove this! */
|
||||
} Game;
|
||||
|
||||
/* TODO: Doc! */
|
||||
void game_init(Game *game);
|
||||
|
||||
/* (Mibi88) TODO: Describe what this function is doing. */
|
||||
void game_logic(Game *game);
|
||||
|
||||
|
|
17
src/main.c
|
@ -27,9 +27,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern bopti_image_t player_face_img;
|
||||
extern bopti_image_t player_male_img;
|
||||
extern bopti_image_t tiny_npc_male;
|
||||
/* extern bopti_image_t player_face_img; */
|
||||
|
||||
extern Map *worldRPG[];
|
||||
|
||||
|
@ -119,18 +117,7 @@ int main(void) {
|
|||
}
|
||||
timer_start(timer);
|
||||
|
||||
game.map_level = worldRPG[0];
|
||||
/* 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);
|
||||
game_init(&game);
|
||||
|
||||
#if USB_FEATURE
|
||||
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
|
||||
|
|