mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-28 04:23:42 +01:00
Use the right tiny npc
This commit is contained in:
parent
d100d0c160
commit
8ef79972c8
9 changed files with 54 additions and 16 deletions
|
@ -40,6 +40,9 @@ set(ASSETS_cg
|
|||
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
|
||||
|
@ -66,6 +69,9 @@ set(ASSETS_cg_EGA64
|
|||
set(ASSETS_fx
|
||||
assets-fx/player_male.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
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
npc_male.png:
|
||||
type: bopti-image
|
||||
name: demo_PNJ_img
|
||||
name: tiny_npc_male
|
||||
|
||||
npc_female.png:
|
||||
type: bopti-image
|
||||
name: demo_PNJ_img
|
||||
name: tiny_npc_female
|
||||
|
||||
npc_milkman.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_milkman
|
||||
|
||||
npc_police.png:
|
||||
type: bopti-image
|
||||
name: tiny_npc_police
|
||||
|
|
|
@ -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
BIN
assets-fx/npc/char/npc_female.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 B |
BIN
assets-fx/npc/char/npc_milkman.png
Normal file
BIN
assets-fx/npc/char/npc_milkman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
BIN
assets-fx/npc/char/npc_police.png
Normal file
BIN
assets-fx/npc/char/npc_police.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
22
src/npc.c
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);
|
||||
|
||||
}
|
||||
|
||||
|
|
13
src/player.c
13
src/player.c
|
@ -6,13 +6,6 @@
|
|||
#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 npc_male;
|
||||
extern bopti_image_t npc_female;
|
||||
|
@ -21,7 +14,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},
|
||||
|
@ -133,7 +126,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 +157,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 */
|
||||
|
|
Loading…
Reference in a new issue