diff --git a/CMakeLists.txt b/CMakeLists.txt index eaca920..94eeb0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/assets-cg/INFO_Icon.png b/assets-cg/INFO_Icon.png index ce5e500..ba8e286 100644 Binary files a/assets-cg/INFO_Icon.png and b/assets-cg/INFO_Icon.png differ diff --git a/assets-cg/NPC_Icon_2.png b/assets-cg/NPC_Icon_2.png index 6f0245a..47640be 100644 Binary files a/assets-cg/NPC_Icon_2.png and b/assets-cg/NPC_Icon_2.png differ diff --git a/assets-cg/SGN_Icon.png b/assets-cg/SGN_Icon.png index d68b589..d3b15f5 100644 Binary files a/assets-cg/SGN_Icon.png and b/assets-cg/SGN_Icon.png differ diff --git a/assets-cg/SignAction.png b/assets-cg/SignAction.png index ced6850..965ea6e 100644 Binary files a/assets-cg/SignAction.png and b/assets-cg/SignAction.png differ diff --git a/assets-cg/fxconv-metadata.txt b/assets-cg/fxconv-metadata.txt index 87de14b..86e8216 100644 --- a/assets-cg/fxconv-metadata.txt +++ b/assets-cg/fxconv-metadata.txt @@ -2,9 +2,6 @@ custom-type: custom-image name_regex: (.*)\.png \1_img profile: p8 - scale: 2 - -demo_PNG.png: scale: 1 font.png: diff --git a/assets-cg/npc/char/fxconv-metadata.txt b/assets-cg/npc/char/fxconv-metadata.txt index b7658e5..33fca10 100644 --- a/assets-cg/npc/char/fxconv-metadata.txt +++ b/assets-cg/npc/char/fxconv-metadata.txt @@ -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 diff --git a/assets-cg/npc/char/npc_female.png b/assets-cg/npc/char/npc_female.png new file mode 100644 index 0000000..041e951 Binary files /dev/null and b/assets-cg/npc/char/npc_female.png differ diff --git a/assets-cg/npc/char/npc_male.png b/assets-cg/npc/char/npc_male.png index f4d654b..9734b02 100644 Binary files a/assets-cg/npc/char/npc_male.png and b/assets-cg/npc/char/npc_male.png differ diff --git a/assets-cg/npc/char/npc_milkman.png b/assets-cg/npc/char/npc_milkman.png new file mode 100644 index 0000000..92ead4b Binary files /dev/null and b/assets-cg/npc/char/npc_milkman.png differ diff --git a/assets-cg/npc/char/npc_police.png b/assets-cg/npc/char/npc_police.png new file mode 100644 index 0000000..e590a72 Binary files /dev/null and b/assets-cg/npc/char/npc_police.png differ diff --git a/assets-cg/npc/face/npc_female.png b/assets-cg/npc/face/npc_female.png index 16321ae..77f10cc 100644 Binary files a/assets-cg/npc/face/npc_female.png and b/assets-cg/npc/face/npc_female.png differ diff --git a/assets-cg/npc/face/npc_male.png b/assets-cg/npc/face/npc_male.png index c4f4820..e91f2e6 100644 Binary files a/assets-cg/npc/face/npc_male.png and b/assets-cg/npc/face/npc_male.png differ diff --git a/assets-cg/npc/face/npc_milkman.ase b/assets-cg/npc/face/npc_milkman.ase new file mode 100644 index 0000000..6993b2e Binary files /dev/null and b/assets-cg/npc/face/npc_milkman.ase differ diff --git a/assets-cg/npc/face/npc_milkman.png b/assets-cg/npc/face/npc_milkman.png index 98b92bf..78aa9f7 100644 Binary files a/assets-cg/npc/face/npc_milkman.png and b/assets-cg/npc/face/npc_milkman.png differ diff --git a/assets-cg/npc/face/npc_police.ase b/assets-cg/npc/face/npc_police.ase new file mode 100644 index 0000000..fdfef9e Binary files /dev/null and b/assets-cg/npc/face/npc_police.ase differ diff --git a/assets-cg/npc/face/npc_police.png b/assets-cg/npc/face/npc_police.png index 8888672..d9ec265 100644 Binary files a/assets-cg/npc/face/npc_police.png and b/assets-cg/npc/face/npc_police.png differ diff --git a/assets-cg/player_face.png b/assets-cg/player_face.png index f564e32..a749649 100644 Binary files a/assets-cg/player_face.png and b/assets-cg/player_face.png differ diff --git a/assets-cg/player_female.png b/assets-cg/player_female.png new file mode 100644 index 0000000..5bacf68 Binary files /dev/null and b/assets-cg/player_female.png differ diff --git a/assets-cg/player_male.png b/assets-cg/player_male.png new file mode 100644 index 0000000..830590a Binary files /dev/null and b/assets-cg/player_male.png differ diff --git a/assets-fx/demo_player.png b/assets-fx/demo_player.png deleted file mode 100644 index 7c1da00..0000000 Binary files a/assets-fx/demo_player.png and /dev/null differ diff --git a/assets-fx/fxconv-metadata.txt b/assets-fx/fxconv-metadata.txt index 12e9d02..1020805 100644 --- a/assets-fx/fxconv-metadata.txt +++ b/assets-fx/fxconv-metadata.txt @@ -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 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/assets-fx/npc/face/npc_female.png b/assets-fx/npc/face/npc_female.png index b8ac9b6..dcd2468 100644 Binary files a/assets-fx/npc/face/npc_female.png and b/assets-fx/npc/face/npc_female.png differ diff --git a/assets-fx/player_female.png b/assets-fx/player_female.png new file mode 100644 index 0000000..786f9b9 Binary files /dev/null and b/assets-fx/player_female.png differ diff --git a/assets-cg/demo_player.png b/assets-fx/player_male.png similarity index 100% rename from assets-cg/demo_player.png rename to assets-fx/player_male.png diff --git a/src/game.c b/src/game.c index 2f7cb7a..dd2bb1c 100644 --- a/src/game.c +++ b/src/game.c @@ -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 diff --git a/src/game.h b/src/game.h index 07df01a..77fb3a7 100644 --- a/src/game.h +++ b/src/game.h @@ -43,6 +43,7 @@ typedef struct { bool isDoingAction; /* the player is interacting with a NPC */ bool isInteractingWithNPC; + bool is_male; } Player; diff --git a/src/main.c b/src/main.c index 8055976..76655fd 100644 --- a/src/main.c +++ b/src/main.c @@ -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 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..dbb443a 100644 --- a/src/player.c +++ b/src/player.c @@ -6,14 +6,8 @@ #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 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;iface)){ face = current_face.face; } @@ -164,7 +159,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 */