From 8ef79972c8e0bdb96db0ad2020699416e4282051 Mon Sep 17 00:00:00 2001 From: mibi88 <76903855+mibi88@users.noreply.github.com> Date: Sat, 27 Jul 2024 17:20:06 +0200 Subject: [PATCH] Use the right tiny npc --- CMakeLists.txt | 6 ++++++ assets-cg/npc/char/fxconv-metadata.txt | 12 ++++++++++-- assets-fx/npc/char/fxconv-metadata.txt | 11 ++++++++++- assets-fx/npc/char/npc_female.png | Bin 0 -> 115 bytes assets-fx/npc/char/npc_milkman.png | Bin 0 -> 118 bytes assets-fx/npc/char/npc_police.png | Bin 0 -> 118 bytes src/npc.c | 22 +++++++++++++++++++--- src/player.c | 13 +++---------- src/player.h | 6 ++++++ 9 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 assets-fx/npc/char/npc_female.png create mode 100644 assets-fx/npc/char/npc_milkman.png create mode 100644 assets-fx/npc/char/npc_police.png 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 0000000000000000000000000000000000000000..08d2bcdcf00f67c0981be6882b3f0f46999d7543 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^93afW0wnX;%77$;m8Xki2**s{vl|5)3>Xd{C>J}! zWDtAfvdEo@D+1CjSNOIWh5BYpsVd<7#M{-tc)F}a_H6XEpC2#36*rX-Y`^Dx(iCKj Mr>mdKI;Vst0I#zoYXATM literal 0 HcmV?d00001 diff --git a/assets-fx/npc/char/npc_milkman.png b/assets-fx/npc/char/npc_milkman.png new file mode 100644 index 0000000000000000000000000000000000000000..639504e9570e3a5665dffcd87298f86dcfd5ce8b GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^93afW0wnX;%77$;t*47)2*=FSGY5Ga90Z&$nqPik zw&3c^i*g?~xb^;HZe-Co;=J{UK=4wP8ygo~DGxeSwp7&iZDDv-h4DXm_5Nu7H)};? Qeu7N$boFyt=akR{0IRbn!2kdN literal 0 HcmV?d00001 diff --git a/assets-fx/npc/char/npc_police.png b/assets-fx/npc/char/npc_police.png new file mode 100644 index 0000000000000000000000000000000000000000..639504e9570e3a5665dffcd87298f86dcfd5ce8b GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^93afW0wnX;%77$;t*47)2*=FSGY5Ga90Z&$nqPik zw&3c^i*g?~xb^;HZe-Co;=J{UK=4wP8ygo~DGxeSwp7&iZDDv-h4DXm_5Nu7H)};? Qeu7N$boFyt=akR{0IRbn!2kdN literal 0 HcmV?d00001 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 */