From d555c5be6f2f398c7d5cdb27ff0fb366f3dc26ce Mon Sep 17 00:00:00 2001 From: mibi88 <76903855+mibi88@users.noreply.github.com> Date: Thu, 1 Aug 2024 23:09:04 +0200 Subject: [PATCH] Started inventory rendering. --- CMakeLists.txt | 11 ++- assets-cg/base_slot.png | Bin 0 -> 223 bytes assets-cg/inventory.png | Bin 2892 -> 2878 bytes assets-cg/items.png | Bin 0 -> 666 bytes assets-cg/selected.png | Bin 0 -> 206 bytes assets-cg/selection.png | Bin 0 -> 211 bytes assets-fx/1b/fxconv-metadata.txt | 4 + assets-fx/1b/items.png | Bin 0 -> 181 bytes assets-fx/2b/fxconv-metadata.txt | 4 + assets-fx/2b/items.png | Bin 0 -> 181 bytes assets-fx/selected.png | Bin 0 -> 93 bytes assets-fx/selection.png | Bin 0 -> 90 bytes src/config.h | 1 + src/game.c | 141 +++++++++++++++++-------------- src/game.h | 6 ++ src/inventory.c | 50 +++++++++++ src/inventory.h | 2 + src/main.c | 51 +++++------ 18 files changed, 182 insertions(+), 88 deletions(-) create mode 100644 assets-cg/base_slot.png create mode 100644 assets-cg/items.png create mode 100644 assets-cg/selected.png create mode 100644 assets-cg/selection.png create mode 100644 assets-fx/1b/items.png create mode 100644 assets-fx/2b/items.png create mode 100644 assets-fx/selected.png create mode 100644 assets-fx/selection.png diff --git a/CMakeLists.txt b/CMakeLists.txt index e646b91..ae1e57a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ set(SOURCES src/npc.c src/events.c src/animation.c + src/inventory.c # ... ) # Shared assets, fx-9860G-only assets and fx-CG-50-only assets @@ -56,6 +57,8 @@ set(ASSETS set(ASSETS_cg assets-cg/player_male.png assets-cg/player_female.png + assets-cg/player_male_inv.png + assets-cg/player_female_inv.png assets-cg/npc/char/npc_male.png assets-cg/npc/char/npc_female.png assets-cg/npc/char/npc_milkman.png @@ -69,6 +72,8 @@ set(ASSETS_cg assets-cg/INFO_Icon.png assets-cg/player_face.png assets-cg/font.png + assets-cg/inventory.png + assets-cg/items.png ) set(ASSETS_cg_EGA64 @@ -98,6 +103,8 @@ set(ASSETS_fx_1b assets-fx/1b/npc/face/npc_milkman.png assets-fx/1b/npc/face/npc_police.png assets-fx/1b/INFO_Icon.png + assets-fx/1b/inventory.png + assets-fx/1b/items.png # ... ) @@ -112,7 +119,9 @@ set(ASSETS_fx_2b assets-fx/2b/npc/face/npc_female.png assets-fx/2b/npc/face/npc_milkman.png assets-fx/2b/npc/face/npc_police.png - assets-fx/1b/INFO_Icon.png + assets-fx/2b/INFO_Icon.png + assets-fx/2b/inventory.png + assets-fx/2b/items.png # ... ) diff --git a/assets-cg/base_slot.png b/assets-cg/base_slot.png new file mode 100644 index 0000000000000000000000000000000000000000..8a45491edb2abd227ce4927331af6a2b276d6a71 GIT binary patch literal 223 zcmV<503iQ~P)Y+GE)aG@{k$aoS4NtR2^K! z5c(QGSZn&Y2#-E)G|WP*X!sqyE+Q}n&C!^L7H#n=hH8|kHbwtcxTf{D{8vk^QNR;k}2=(ykj?bVYq0Tf>=+LQc6`eYlj^gb1 Zd;+A>Nhl%vb^HJT002ovPDHLkV1nX4T%Q*8=l&7VvyiB2m`u`9D$ArO+(V~Nip=93)4!G z8u?*Y7N=x={Q9wDV?@rk3!5*bCb$rF6?6;)3xW? z8#j2Tx;8e6?7% zmSm;zjex;7)qWkc2;Ki_P_tZ|#3YKQ#WmqU#nxJ86H z7WL&6u%qFNjtj#ZC6q_4b{RI~JgPKLtKQxj1L@ zKiaZ_A?hK&AOIn4SZ4&tSgDv;s97*Yu|_-uWU>bHZichoFr`qHpgPqgezV+-M0>iN z%}*Dk>0BHebt2kTj@-ss(bDG=z0wPz!JeL|rhD{4iX1J^nTTr{xTd|07uJXFwrn2% zBvx+JfNE*#O7quVPyFz8due|%{CHi^H3m74JvqUB0s!-^uQ^k5quB$~gZeNNlRd-J zo3xF&aE@h5&Ec%~L>=y+Ax!_OuL98AXtoJDG#^S8TdS(MeLQA5JF`UePYh2P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aJX@@eg6?>B5pA`-XH{lI7!6DMqo?E?GIokB>Vmb zZ=&!@akt>B@HsHoxGp3aU`zKfR`(+;N`4w~nW>2n`~mtyo}@Na8kCDL&gR8v1$rOJ zpSK6|F>bN0@S_?s{!17kyMjqm{tsbb|NcH{$7+}i8IP@2M7JM0+&Kmo8ho5(;Ot}o zC&?D}s`L#j9QkI?(C7>uk5ZpPg+9m%7eh4Y7MCKlW%vCEUQy! z&h*$rG2wnF!@)b#EkYt&7+oRmx3NpIV0Nj(bke@was*vBzUxm}a?>4rL_Xg^$lS@N zZ#fd7YQ^fAWzT!$ih($4u8DzhQJnMzJ}Wo|h^gMrPROHBf~fsRL3nh`JFSq{O6C?F z0X4f(L_xOp7#_%}>ybC*qRmmw(nF_6r^Vs9Aq*w(-BBs~t~yTSg)tn6wzcZi;Odb# zP@W{DoA+(Y4(XMHE#%@F!6&cAO9ErNlXh}Q?A3DB)N-DsomoWP<1#x^TcV~4dV>!{bphpBB*}@SWJ5?TyMX2n<=<34b4j+xSl+QQa zjwer>?}Io@?-FJIHBq!xISL5mQ9h*WMfM+kZm%w=WG8Icf$B}z@KnCo3L><$I8;LQ z$H}J-zYrWRw@R7gb7C5Du=4IpoE7(D^?rs05o&mCOQh@cXTsaMUS4nL?*=IpAm88v zW?Ws?2R5?pGfIU076>flouVm>2yNf8G$$8#li2|bXI|J7F8BO#Nd3?vdc#Uy7u=|h^;_;uKQ>~xedF)}oMe#RY9LBo z93Vb6Ey9b`#|aq?sVistoa-BmswjjsP)~E4`A0ny=FaEqdMyL#VG+Mq_VEmu>07tS zF7bD|_2j}Uxj@Zp%1a_JqFIg^j1Q##>#-Ljm@JNBw0wD8(s(0)^nXP*r6*Gx%gC9I z6TY7X?o@4;+CTyRa-Mc;)JcrfkJaRYX7Yv3doBxyz$^8}{@+ DqlDG3 diff --git a/assets-cg/items.png b/assets-cg/items.png new file mode 100644 index 0000000000000000000000000000000000000000..3730ee2e93787d7efb8035e967a2d93d8c297061 GIT binary patch literal 666 zcmV;L0%iS)P)Q5a}paE>I@?M!#>`)f{zv@Gzzi^^jY zjUcmd@W6}4>waN{Nuc0?7nMg|oP~{`;DHyF_i}-QlxNWj9#v+^H_PM7me%DL`tOfQ zJPXs7VQI`Zt(Dg+m-~403Ujs$ZQ9zNRlJ;^KbA7Mw44pK+H^hM#cRbbk(OmyBx!h> z!Pn-a>Sk?As-q-z)9`Y(+iT$!%`i2*UY}^{a68leXrUh7K~ouuXK}d}-b~%3H?G7R zadne~J|kY6r>(m-bQmJ9|@+dM)hjX2hdeyi>4c|?iA4Tz%A470j(SC+qfFzl9ek-Ni2 zEhB8m)Z0Cf?kcR5wIkbnI|swN+ibPG!q2cCqLyW=b5^Tv*4DLi;gg4Uhe|D*(#rZ2 zrq%AS9%853h1k1d?NtMQ*CxR?=w(3c-r;PzwU_|11&DIo; zT3CC}j8WRtdJMutMg*D*Nl3Z6Spd(yzuKI>q3I_;{3a*`Ma9(YlC_{AJ};8ntJ zs=))V65hH29(a}TUMBFst0b<-r@n~|Jn%HU2c%N7FFW}h>i_@%07*qoM6N<$f?8@$ A*Z=?k literal 0 HcmV?d00001 diff --git a/assets-cg/selected.png b/assets-cg/selected.png new file mode 100644 index 0000000000000000000000000000000000000000..ae7cb57a1f3b92699b80d75535de7b83ee0338e3 GIT binary patch literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^GC(ZN!3HGrIo|64si~eWjv*eMZ>L@4YB1n%-JAUX z|LL!j61eB~WwOj&-m%r#HP^+jkNbUfuia!9z9Z)u7Oc&-P7w@A6w7+iqaJ#%WS{qz zTVa_xr^W8JOv%E2t%d!zjItW@(DDKo3d*QdE(H5U8Dg(c5Y_I=%h{+WC9Nlrmza?ZtlV|=xZZ` zMPJ>Cc`Up@wis9qV;xmcQ^P9g@|<^JnZ{C8Bx3;Z%21JArse+9FYN#ia383=m!8&A z-n+`er%jP%r14L;P(tZ`m<3euamQx_I!4VjDrjqJ+l7wi(k`4Wt{dH+a45oD6XgH^ N002ovPDHLkV1j0WRf7Nk literal 0 HcmV?d00001 diff --git a/assets-fx/1b/fxconv-metadata.txt b/assets-fx/1b/fxconv-metadata.txt index 400e93b..881385f 100644 --- a/assets-fx/1b/fxconv-metadata.txt +++ b/assets-fx/1b/fxconv-metadata.txt @@ -5,3 +5,7 @@ INFO_Icon.png: inventory.png: type: bopti-image name: inventory_img + +items.png: + type: bopti-image + name: items_img diff --git a/assets-fx/1b/items.png b/assets-fx/1b/items.png new file mode 100644 index 0000000000000000000000000000000000000000..eeb6dbf22372575ae4cc6412e4c4b252ca0f4736 GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^7C_9w!2%@NzJ395YCK&WLo_Dt4RYjbFyP4U{r|tn zwujTgV3tJWrVG5c`gnd=a(FNbO~~-zwToUmzmvZ)Kf&@rSmgxWX*X6UEfcoBv_WX2*=FiKmX@9Hck|DT-5lV o$0uXa|Ct6N6IVX{4+M!S3=Ka-fBcqs^Z=y6)78&qol`;+09pGU`2YX_ literal 0 HcmV?d00001 diff --git a/assets-fx/selection.png b/assets-fx/selection.png new file mode 100644 index 0000000000000000000000000000000000000000..70920377b65f2f2bd75a2fb4a4cc6bb6e6fcaf8b GIT binary patch literal 90 zcmeAS@N?(olHy`uVBq!ia0vp^93afW0wnX;%77$;qNj^v2*=Fi1PA6G9v+_m7k_v# m{g;%Oabc@~SVH5=qnr%hJ}jKyYWA)JsrGdBb6Mw<&;$TErxy+Y literal 0 HcmV?d00001 diff --git a/src/config.h b/src/config.h index 87598ae..67e0b3a 100644 --- a/src/config.h +++ b/src/config.h @@ -13,6 +13,7 @@ #endif #define SLOT_NUM 9 +#define SLOT_COLUMNS 3 #if GINT_RENDER_RGB /* The tile size */ diff --git a/src/game.c b/src/game.c index 25b94eb..0b5306e 100644 --- a/src/game.c +++ b/src/game.c @@ -1,6 +1,7 @@ #include "game.h" #include "config.h" +#include "inventory.h" #include "map.h" #include "mapdata.h" #include "npc.h" @@ -135,6 +136,7 @@ void game_draw(Game *game) { dprint(8, 8, C_BLACK, "npc_count: %d", npc_count); dprint(8, 16, C_BLACK, "Mana: %d", game->mana); dprint(8, 24, C_BLACK, "X: %d Y: %d", game->player.x, game->player.y); + inventory_draw(game, &game->inventory); } /* Key management */ @@ -149,86 +151,99 @@ void game_get_inputs(Game *game) { if(keydown(KEY_EXIT)) game->exittoOS = true; - /* Player actions - Prototypes in player.h and implementation in player.c */ - if(keydown(KEY_LEFT)) - player_move(game, D_LEFT); - if(keydown(KEY_RIGHT)) - player_move(game, D_RIGHT); - 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; + /* Inventory */ + if(keydown(KEY_ALPHA)) { + game->inventory.open = !game->inventory.open; /* TODO: Make something cleaner */ - while(keydown(KEY_OPTN)) { + while(keydown(KEY_ALPHA)) { clearevents(); sleep(); } - } - Player *player = &game->player; - if(keydown(KEY_SHIFT)) { - uint32_t i; - for(i = 0; i < game->map_level->nbPortal; i++) { - Portal *portal = &game->map_level->portals[i]; - if(player->x >= (int)portal->collider.x1 * PXSIZE && - player->x < (int)portal->collider.x2 * PXSIZE && - player->y >= (int)portal->collider.y1 * PXSIZE && - player->y < (int)portal->collider.y2 * PXSIZE) { - Portal *dest_portal = (Portal *)portal->portal; - Collider dest_collider = dest_portal->collider; - Map *dest_map = (Map *)portal->map; - player->x = (dest_collider.x1 + dest_collider.x2) / 2 * PXSIZE; - player->y = (dest_collider.y1 + dest_collider.y2) / 2 * PXSIZE; - game->map_level = dest_map; - /* TODO: Make something cleaner */ - while(keydown(KEY_SHIFT)) { - clearevents(); - sleep(); + } else { + /* Player actions - Prototypes in player.h and implementation in + * player.c */ + if(keydown(KEY_LEFT)) + player_move(game, D_LEFT); + if(keydown(KEY_RIGHT)) + player_move(game, D_RIGHT); + 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(); + } + } + Player *player = &game->player; + if(keydown(KEY_SHIFT)) { + uint32_t i; + for(i = 0; i < game->map_level->nbPortal; i++) { + Portal *portal = &game->map_level->portals[i]; + if(player->x >= (int)portal->collider.x1 * PXSIZE && + player->x < (int)portal->collider.x2 * PXSIZE && + player->y >= (int)portal->collider.y1 * PXSIZE && + player->y < (int)portal->collider.y2 * PXSIZE) { + Portal *dest_portal = (Portal *)portal->portal; + Collider dest_collider = dest_portal->collider; + Map *dest_map = (Map *)portal->map; + player->x = + (dest_collider.x1 + dest_collider.x2) / 2 * PXSIZE; + player->y = + (dest_collider.y1 + dest_collider.y2) / 2 * PXSIZE; + game->map_level = dest_map; + /* TODO: Make something cleaner */ + while(keydown(KEY_SHIFT)) { + clearevents(); + sleep(); + } } } } - } - /*Temp debug*/ - if(keydown(KEY_F1)) { - NPC *mynpc = npc_create(); - if(mynpc) { - mynpc->curx = (player->x << PRECISION) / PXSIZE; - mynpc->cury = (player->y << PRECISION) / PXSIZE; - mynpc->x = player->x; - mynpc->y = player->x; - mynpc->hasPath = 0; - mynpc->face = 0; - mynpc->paused = 0; - mynpc->has_dialog = 0; + /*Temp debug*/ + if(keydown(KEY_F1)) { + NPC *mynpc = npc_create(); + if(mynpc) { + mynpc->curx = (player->x << PRECISION) / PXSIZE; + mynpc->cury = (player->y << PRECISION) / PXSIZE; + mynpc->x = player->x; + mynpc->y = player->x; + mynpc->hasPath = 0; + mynpc->face = 0; + mynpc->paused = 0; + mynpc->has_dialog = 0; + } } - } - /* Display Debug Information on screen */ + /* Display Debug Information on screen */ #if DEBUGMODE - if(keydown(KEY_F1)) { - game->debug_map = !game->debug_map; - } - if(keydown(KEY_F2)) { - game->debug_player = !game->debug_player; - } - if(keydown(KEY_F3)) { - game->debug_extra = !game->debug_extra; - } + if(keydown(KEY_F1)) { + game->debug_map = !game->debug_map; + } + if(keydown(KEY_F2)) { + game->debug_player = !game->debug_player; + } + if(keydown(KEY_F3)) { + game->debug_extra = !game->debug_extra; + } #endif - /* if USB is enabled - keybinding for screencapture */ + /* if USB is enabled - keybinding for screencapture */ #if USB_FEATURE - if(keydown(KEY_7)) - game->screenshot = true; - if(keydown(KEY_8)) - game->record = !game->record; + if(keydown(KEY_7)) + game->screenshot = true; + if(keydown(KEY_8)) + game->record = !game->record; #endif // USB_FEATURE + } } void game_update_animations(Game *game, unsigned char ms) { diff --git a/src/game.h b/src/game.h index f82c51b..a58a438 100644 --- a/src/game.h +++ b/src/game.h @@ -25,6 +25,7 @@ typedef enum { I_NONE, I_ARMOR, I_GLOVE, + I_SWORD, I_BEER, I_MILK, I_TALISMAN, @@ -38,6 +39,10 @@ typedef struct { typedef struct { Slot slots[SLOT_NUM]; + Slot talisman; + Slot armor; + Slot weapon; + char open : 1; } Inventory; typedef struct { @@ -204,6 +209,7 @@ typedef struct { bool debug_extra; Animation npc_animation; + Inventory inventory; int mana; /* Only for testing events TODO: Remove this! */ } Game; diff --git a/src/inventory.c b/src/inventory.c index 91f36e5..511bf51 100644 --- a/src/inventory.c +++ b/src/inventory.c @@ -1 +1,51 @@ #include "inventory.h" + +#include + +extern bopti_image_t inventory_img; +extern bopti_image_t items_img; +extern bopti_image_t player_male_inv_img; +extern bopti_image_t player_female_inv_img; + +void inventory_draw(Game *game, Inventory *inventory) { + size_t i; + /* TODO: Cleanup! */ + inventory->slots[5].i = I_GLOVE; + inventory->armor.i = I_ARMOR; + inventory->talisman.i = I_TALISMAN; + inventory->weapon.i = I_SWORD; + if(inventory->open) { + dimage(0, 0, &inventory_img); + for(i=0;islots[i].i*28, 0, 28, 27, + DIMAGE_NONE); +#else + dsubimage(88+(i%SLOT_COLUMNS)*12, 24+(i/SLOT_COLUMNS)*12, + &items_img, inventory->slots[i].i*8, 0, 8, 8, + DIMAGE_NONE); +#endif + } +#if GINT_RENDER_RGB + dsubimage(222, 87, &items_img, inventory->talisman.i*28, 0, 28, 27, + DIMAGE_NONE); + dsubimage(222, 87+32, &items_img, inventory->armor.i*28, 0, 28, 27, + DIMAGE_NONE); + dsubimage(222, 87+64, &items_img, inventory->weapon.i*28, 0, 28, 27, + DIMAGE_NONE); +#else + dsubimage(72, 24, &items_img, inventory->talisman.i*8, 0, 8, 8, + DIMAGE_NONE); + dsubimage(72, 24+12, &items_img, inventory->armor.i*8, 0, 8, 8, + DIMAGE_NONE); + dsubimage(72, 24+24, &items_img, inventory->weapon.i*8, 0, 8, 8, + DIMAGE_NONE); +#endif +#if GINT_RENDER_RGB + dimage(183, 20, + game->player.is_male ? &player_male_inv_img + : &player_female_inv_img); +#endif + } +} diff --git a/src/inventory.h b/src/inventory.h index 2c41b82..b8a0368 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -4,4 +4,6 @@ /* The structs related to the inventory are defined in game.h */ #include "game.h" +void inventory_draw(Game *game, Inventory *inventory); + #endif diff --git a/src/main.c b/src/main.c index 986e4ea..e9762af 100644 --- a/src/main.c +++ b/src/main.c @@ -32,31 +32,34 @@ extern Map *worldRPG[]; /* Game data (defined in "game.h")*/ -Game game = {NULL, - {12 * PXSIZE, - 36 * PXSIZE, - 0, - 0, - 100, - SPEED, - false, - 0, - false, - false, - true, - {}}, - {{}, {}, 0}, - false, - false, - false, - 0, +Game game = { + NULL, + {12 * PXSIZE, + 36 * PXSIZE, + 0, + 0, + 100, + SPEED, + false, + 0, + false, + false, + true, + {}}, + {{}, {}, 0}, + false, + false, + false, + 0, - /* debug variables*/ - false, - false, - false, - {}, - 100}; + /* debug variables*/ + false, + false, + false, + {}, + {}, + 100, +}; /* screen capture management code. TODO: Clean this up! */