diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d8cc9b..be3b00f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/assets-cg/npc/char/fxconv-metadata.txt b/assets-cg/npc/char/fxconv-metadata.txt index caf3ddb..33fca10 100644 --- a/assets-cg/npc/char/fxconv-metadata.txt +++ b/assets-cg/npc/char/fxconv-metadata.txt @@ -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 diff --git a/assets-fx/npc/char/fxconv-metadata.txt b/assets-fx/npc/char/fxconv-metadata.txt index b7658e5..be0fd73 100644 --- a/assets-fx/npc/char/fxconv-metadata.txt +++ b/assets-fx/npc/char/fxconv-metadata.txt @@ -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 diff --git a/assets-fx/npc/char/npc_female.png b/assets-fx/npc/char/npc_female.png new file mode 100644 index 0000000..08d2bcd Binary files /dev/null and b/assets-fx/npc/char/npc_female.png differ diff --git a/assets-fx/npc/char/npc_milkman.png b/assets-fx/npc/char/npc_milkman.png new file mode 100644 index 0000000..639504e Binary files /dev/null and b/assets-fx/npc/char/npc_milkman.png differ diff --git a/assets-fx/npc/char/npc_police.png b/assets-fx/npc/char/npc_police.png new file mode 100644 index 0000000..639504e Binary files /dev/null and b/assets-fx/npc/char/npc_police.png differ diff --git a/src/npc.c b/src/npc.c index f7c776c..dbdcf04 100644 --- a/src/npc.c +++ b/src/npc.c @@ -11,7 +11,10 @@ #include -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; ucurx * 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;iface)){ + 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); } diff --git a/src/player.c b/src/player.c index 58d8e37..9578c66 100644 --- a/src/player.c +++ b/src/player.c @@ -6,13 +6,6 @@ #include "npc.h" #include -#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;iface)){ face = current_face.face; } @@ -164,7 +157,7 @@ void player_action(Game *game) { * fast string comparison. */ face = NULL; for(i=0;iface)){ face = current_face.face; } diff --git a/src/player.h b/src/player.h index a36d988..5e246c9 100644 --- a/src/player.h +++ b/src/player.h @@ -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 */