Merge pull request 'Better graphics' (#55) from graphics into dev
Reviewed-on: https://git.planet-casio.com/Slyvtt/Collab_RPG/pulls/55
|
@ -37,8 +37,12 @@ set(ASSETS
|
|||
)
|
||||
|
||||
set(ASSETS_cg
|
||||
assets-cg/demo_player.png
|
||||
assets-cg/player_male.png
|
||||
assets-cg/player_female.png
|
||||
assets-cg/npc/char/npc_male.png
|
||||
assets-cg/npc/char/npc_female.png
|
||||
assets-cg/npc/char/npc_milkman.png
|
||||
assets-cg/npc/char/npc_police.png
|
||||
assets-cg/SignAction.png
|
||||
assets-cg/npc/face/npc_male.png
|
||||
assets-cg/npc/face/npc_female.png
|
||||
|
@ -63,8 +67,12 @@ set(ASSETS_cg_EGA64
|
|||
)
|
||||
|
||||
set(ASSETS_fx
|
||||
assets-fx/demo_player.png
|
||||
assets-fx/player_male.png
|
||||
assets-fx/player_female.png
|
||||
assets-fx/npc/char/npc_male.png
|
||||
assets-fx/npc/char/npc_female.png
|
||||
assets-fx/npc/char/npc_milkman.png
|
||||
assets-fx/npc/char/npc_police.png
|
||||
assets-fx/SignAction.png
|
||||
assets-fx/npc/face/npc_male.png
|
||||
assets-fx/npc/face/npc_female.png
|
||||
|
|
Before Width: | Height: | Size: 7 KiB After Width: | Height: | Size: 920 B |
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 187 B |
|
@ -2,9 +2,6 @@
|
|||
custom-type: custom-image
|
||||
name_regex: (.*)\.png \1_img
|
||||
profile: p8
|
||||
scale: 2
|
||||
|
||||
demo_PNG.png:
|
||||
scale: 1
|
||||
|
||||
font.png:
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
npc_male.png:
|
||||
type: bopti-image
|
||||
name: demo_PNJ_img
|
||||
name: tiny_npc_male
|
||||
|
||||
npc_female.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_female
|
||||
|
||||
npc_milkman.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_milkman
|
||||
|
||||
npc_police.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_police
|
||||
|
|
BIN
assets-cg/npc/char/npc_female.png
Normal file
After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 206 B |
BIN
assets-cg/npc/char/npc_milkman.png
Normal file
After Width: | Height: | Size: 222 B |
BIN
assets-cg/npc/char/npc_police.png
Normal file
After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 808 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 861 B |
BIN
assets-cg/npc/face/npc_milkman.ase
Normal file
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 1,000 B |
BIN
assets-cg/npc/face/npc_police.ase
Normal file
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 992 B |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 246 B |
BIN
assets-cg/player_female.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
assets-cg/player_male.png
Normal file
After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 107 B |
|
@ -1,6 +1,9 @@
|
|||
demo_player.png:
|
||||
player_male.png:
|
||||
type: bopti-image
|
||||
name: demo_player_img
|
||||
name: player_male_img
|
||||
player_female.png:
|
||||
type: bopti-image
|
||||
name: player_female_img
|
||||
|
||||
player_face.png:
|
||||
type: bopti-image
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
npc_male.png:
|
||||
type: bopti-image
|
||||
name: demo_PNJ_img
|
||||
name: tiny_npc_male
|
||||
npc_female.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_female
|
||||
npc_milkman.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_milkman
|
||||
npc_police.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_police
|
||||
|
|
BIN
assets-fx/npc/char/npc_female.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
assets-fx/npc/char/npc_milkman.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
assets-fx/npc/char/npc_police.png
Normal file
After Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 323 B |
BIN
assets-fx/player_female.png
Normal file
After Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 107 B After Width: | Height: | Size: 107 B |
|
@ -114,6 +114,14 @@ void game_get_inputs(Game *game) {
|
|||
if(keydown(KEY_UP)) player_move(game, D_UP);
|
||||
if(keydown(KEY_DOWN)) player_move(game, D_DOWN);
|
||||
if(keydown(KEY_SHIFT)) player_action(game);
|
||||
if(keydown(KEY_OPTN)){
|
||||
game->player.is_male = !game->player.is_male;
|
||||
/* TODO: Make something cleaner */
|
||||
while(keydown(KEY_OPTN)){
|
||||
clearevents();
|
||||
sleep();
|
||||
}
|
||||
}
|
||||
|
||||
/* Display Debug Information on screen */
|
||||
#if DEBUGMODE
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef struct {
|
|||
bool isDoingAction;
|
||||
/* the player is interacting with a NPC */
|
||||
bool isInteractingWithNPC;
|
||||
bool is_male;
|
||||
} Player;
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ extern Map *worldRPG[];
|
|||
/* Game data (defined in "game.h")*/
|
||||
Game game = {
|
||||
NULL,
|
||||
{12*PXSIZE, 36*PXSIZE, 0, 0, 12*PXSIZE, 36*PXSIZE, 100, SPEED, false, 0, false, false},
|
||||
{12*PXSIZE, 36*PXSIZE, 0, 0, 12*PXSIZE, 36*PXSIZE, 100, SPEED, false, 0, false, false, true},
|
||||
{{}, {}, 0},
|
||||
false, false, false, 0
|
||||
|
||||
|
|
22
src/npc.c
|
@ -11,7 +11,10 @@
|
|||
#include <math.h>
|
||||
|
||||
|
||||
extern bopti_image_t demo_PNJ_img;
|
||||
extern bopti_image_t tiny_npc_male;
|
||||
extern bopti_image_t tiny_npc_female;
|
||||
extern bopti_image_t tiny_npc_milkman;
|
||||
extern bopti_image_t tiny_npc_police;
|
||||
|
||||
|
||||
NPC *npcRPG;
|
||||
|
@ -309,6 +312,13 @@ void reload_npc(Game *game)
|
|||
|
||||
void npc_draw(Game *game) {
|
||||
Player *pl = &game->player;
|
||||
size_t i;
|
||||
const Face npc_sprites[FACES] = {
|
||||
{"MALE", &tiny_npc_male},
|
||||
{"FEMALE", &tiny_npc_female},
|
||||
{"MILKMAN", &tiny_npc_milkman},
|
||||
{"POLICE", &tiny_npc_police}
|
||||
};
|
||||
|
||||
for (uint32_t u=0; u<nbNPC; u++)
|
||||
{
|
||||
|
@ -344,7 +354,13 @@ void npc_draw(Game *game) {
|
|||
|
||||
int16_t delX=((int16_t) (Data->curx * PXSIZE))-(int16_t) pl->wx;
|
||||
int16_t delY=((int16_t) (Data->cury * PXSIZE))-(int16_t) pl->wy;
|
||||
dimage( pl->px-P_WIDTH/2+delX, pl->py-P_HEIGHT/2+delY, &demo_PNJ_img);
|
||||
bopti_image_t *face = &tiny_npc_male;
|
||||
for(i=0;i<FACES;i++){
|
||||
if(!strcmp(npc_sprites[i].name, Data->face)){
|
||||
face = npc_sprites[i].face;
|
||||
}
|
||||
}
|
||||
dimage( pl->px-P_WIDTH/2+delX, pl->py-P_HEIGHT/2+delY, face);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,7 +408,7 @@ void OLD_npc_draw(Game *game) {
|
|||
int16_t deltaY=((int16_t) (Data->y * PXSIZE))-(int16_t) player->wy;
|
||||
dimage( player->px-P_WIDTH/2+deltaX,
|
||||
player->py-P_HEIGHT/2+deltaY,
|
||||
&demo_PNJ_img);
|
||||
&tiny_npc_male);
|
||||
|
||||
}
|
||||
|
||||
|
|
19
src/player.c
|
@ -6,14 +6,8 @@
|
|||
#include "npc.h"
|
||||
#include <gint/display.h>
|
||||
|
||||
#define FACES 4
|
||||
|
||||
struct Face {
|
||||
const char *name;
|
||||
bopti_image_t *face;
|
||||
};
|
||||
|
||||
extern bopti_image_t demo_player_img;
|
||||
extern bopti_image_t player_male_img;
|
||||
extern bopti_image_t player_female_img;
|
||||
extern bopti_image_t npc_male;
|
||||
extern bopti_image_t npc_female;
|
||||
extern bopti_image_t npc_milkman;
|
||||
|
@ -21,7 +15,7 @@ extern bopti_image_t npc_police;
|
|||
extern bopti_image_t SGN_Icon_img;
|
||||
extern bopti_image_t INFO_Icon_img;
|
||||
|
||||
const struct Face faces[FACES] = {
|
||||
const Face faces[FACES] = {
|
||||
{"MALE", &npc_male},
|
||||
{"FEMALE", &npc_female},
|
||||
{"MILKMAN", &npc_milkman},
|
||||
|
@ -57,7 +51,8 @@ extern uint32_t nbNPC;
|
|||
|
||||
void player_draw(Game *game) {
|
||||
Player *player = &game->player;
|
||||
dimage(player->px-P_WIDTH/2, player->py-P_HEIGHT/2, &demo_player_img);
|
||||
dimage(player->px-P_WIDTH/2, player->py-P_HEIGHT/2,
|
||||
player->is_male ? &player_male_img : &player_female_img);
|
||||
}
|
||||
|
||||
void player_move(Game *game, Direction direction) {
|
||||
|
@ -133,7 +128,7 @@ void player_action(Game *game) {
|
|||
* fast string comparison. */
|
||||
face = NULL;
|
||||
for(i=0;i<FACES;i++){
|
||||
struct Face current_face = faces[i];
|
||||
Face current_face = faces[i];
|
||||
if(!strcmp(current_face.name, currentData->face)){
|
||||
face = current_face.face;
|
||||
}
|
||||
|
@ -164,7 +159,7 @@ void player_action(Game *game) {
|
|||
* fast string comparison. */
|
||||
face = NULL;
|
||||
for(i=0;i<FACES;i++){
|
||||
struct Face current_face = faces[i];
|
||||
Face current_face = faces[i];
|
||||
if(!strcmp(current_face.name, currentNPC->face)){
|
||||
face = current_face.face;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
#include "game.h"
|
||||
#include "memory.h"
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
bopti_image_t *face;
|
||||
} Face;
|
||||
|
||||
#define FACES 4
|
||||
|
||||
/* Structure 'Player' has been moved to game.h */
|
||||
/* to avoid circular references between map.h, game.h and player.h */
|
||||
|
|