From d1142b4290e8688a0d42bfc1b95b9d90b1721459 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 26 Nov 2019 11:47:12 -0700 Subject: [PATCH] extract graphics data --- data/graphics.s | 16 ++-- graphics/shop_menu/shop_menu.pal | 35 +++++++++ graphics/shop_menu/shop_menu.png | Bin 0 -> 261 bytes graphics/shop_menu/shop_tilemap.bin | Bin 0 -> 316 bytes graphics/shop_menu/shop_tmHmTilemap.bin | Bin 0 -> 312 bytes include/graphics.h | 6 ++ include/sea_cottage.h | 1 - include/shop.h | 2 - src/sea_cottage_special_anim.c | 86 ++++++++++++--------- src/shop.c | 98 +++++++++++------------- 10 files changed, 143 insertions(+), 101 deletions(-) create mode 100644 graphics/shop_menu/shop_menu.pal create mode 100644 graphics/shop_menu/shop_menu.png create mode 100644 graphics/shop_menu/shop_tilemap.bin create mode 100644 graphics/shop_menu/shop_tmHmTilemap.bin diff --git a/data/graphics.s b/data/graphics.s index 5eacc0cb2..ec4fc10dd 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -14008,17 +14008,17 @@ gBerryPouchSpritePalette:: @ 8E85C1C gBerryPouchBg1Tilemap:: @ 8E85C44 .incbin "graphics/berry_pouch/unk_8E85C44.bin.lz" -gUnknown_8E85DC8:: @ 8E85DC8 - .incbin "baserom.gba", 0xE85DC8, 0x134 +gBuyMenuFrame_Gfx:: @ 8E85DC8 + .incbin "graphics/shop_menu/shop_menu.4bpp.lz" -gUnknown_8E85EFC:: @ 8E85EFC - .incbin "baserom.gba", 0xE85EFC, 0x13C +gBuyMenuFrame_Tilemap:: @ 8E85EFC + .incbin "graphics/shop_menu/shop_tilemap.bin" -gUnknown_8E86038:: @ 8E86038 - .incbin "baserom.gba", 0xE86038, 0x138 +gBuyMenuFrame_TmHmTilemap:: @ 8E86038 + .incbin "graphics/shop_menu/shop_tmHmTilemap.bin" -gUnknown_8E86170:: @ 8E86170 - .incbin "baserom.gba", 0xE86170, 0x38 +gBuyMenuFrame_Pal:: @ 8E86170 + .incbin "graphics/shop_menu/shop_menu.gbapal.lz" gUnknown_8E861A8:: @ 8E861A8 .incbin "baserom.gba", 0xE861A8, 0x98 diff --git a/graphics/shop_menu/shop_menu.pal b/graphics/shop_menu/shop_menu.pal new file mode 100644 index 000000000..b0fec0a30 --- /dev/null +++ b/graphics/shop_menu/shop_menu.pal @@ -0,0 +1,35 @@ +JASC-PAL +0100 +32 +238 230 172 +222 156 106 +255 189 131 +255 222 164 +255 255 213 +238 230 172 +106 106 106 +189 213 213 +238 255 255 +222 246 255 +255 255 255 +164 222 255 +16 172 222 +0 82 115 +0 115 139 +0 123 197 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +189 213 213 +238 255 255 +222 246 255 +255 255 255 +164 222 255 +24 82 180 +0 90 131 +24 82 180 +24 82 180 diff --git a/graphics/shop_menu/shop_menu.png b/graphics/shop_menu/shop_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..23af464a2c0b6052706c01805222aaf78abfe044 GIT binary patch literal 261 zcmV+g0s8)lP)#qHtipZ(2^5Ko4mDA4)7ZIh+cB<6Cnm&G#F?`h~#WB2s&>8%6dW`T#o%p@`@p zndYGK{jThL literal 0 HcmV?d00001 diff --git a/graphics/shop_menu/shop_tilemap.bin b/graphics/shop_menu/shop_tilemap.bin new file mode 100644 index 0000000000000000000000000000000000000000..8d5ab35b782ae200334a503a62e6fa62e9b24546 GIT binary patch literal 316 zcmbV|%WVQd5JamCnB`-$d>3(HjN?E}D5QW000KaQ5H4q4a}Rb3 z&r5ED=*rzU{MOeC|0_l|u15>9odNU0fvF=QAv?F%*z6gr3}344RC)p9PG~?2=RrD literal 0 HcmV?d00001 diff --git a/graphics/shop_menu/shop_tmHmTilemap.bin b/graphics/shop_menu/shop_tmHmTilemap.bin new file mode 100644 index 0000000000000000000000000000000000000000..92fbb7dade9d23b73b811bae28c4845b3f7f9ba8 GIT binary patch literal 312 zcmbVEI}Sks5S;P<6_3WBhguv!URL5FuArBwB_xjED2|}gdPi6qjpW(&3en1BCo{9V z6QG1TftVR&mHU_>2xy&s9ASJ_S+Ia%QF&tirgD;!OBLNJ6Qjt5&4-gTHzT@s zex~__<;Tp<AYC-f_jH>0pTYSv_teJH$3Qv9 ZP^Z=*O|PitemCount; i++) { - PokeMartWriteNameAndIdAt(&sShopMenuListMenu[i], mart->itemList[i], sShopMenuItemStrings[i]); //PokeMartWriteNameAndIdAt(u16 a0, u16 a1, u8* a2) + PokeMartWriteNameAndIdAt(&sShopMenuListMenu[i], mart->itemList[i], sShopMenuItemStrings[i]); } ADD_CANCEL: @@ -640,6 +635,7 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s CreateItemMenuIcon(item, gShopData.itemSlot); else CreateItemMenuIcon(ITEM_N_A, gShopData.itemSlot); + gShopData.itemSlot ^= 1; BuyMenuPrint(5, 2, description, 0, 3, 2, 1, 0, 0); } @@ -652,6 +648,7 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s } #ifdef NONMATCHING +// As simple as this seems, I could not get the while loop to use the correct registers. It should pad the front of gStringVar4 with 0 based on the length of gStringVar1. static void BuyMenuPrintPriceInList(u8 windowId, s32 item, u8 y) { u32 len, x; @@ -857,10 +854,7 @@ static void sub_809B764(void) static void BuyMenuDrawMapBg(void) { - s16 i; - s16 j; - s16 x; - s16 y; + s16 i, j, x, y; const struct MapData *mapData; u16 metatile; u8 metatileLayerType; @@ -913,7 +907,6 @@ static void BuyMenuDrawMapMetatile(s16 x, s16 y, const u16 *src, u8 metatileLaye static void BuyMenuDrawMapMetatileLayer(u16 *dest, s16 offset1, s16 offset2, const u16 *src) { - // This function draws a whole 2x2 metatile. dest[offset1 + offset2] = src[0]; // top left dest[offset1 + offset2 + 1] = src[1]; // top right dest[offset1 + offset2 + 32] = src[2]; // bottom left @@ -922,12 +915,9 @@ static void BuyMenuDrawMapMetatileLayer(u16 *dest, s16 offset1, s16 offset2, con static void BuyMenuCollectEventObjectData(void) { - s16 facingX; - s16 facingY; - u8 y; - u8 x; + s16 facingX, facingY; + u8 x, y, z; u8 num = 0; - u8 z; GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY); z = PlayerGetZCoord(); @@ -970,8 +960,7 @@ static void BuyMenuCollectEventObjectData(void) static void BuyMenuDrawEventObjects(void) { - u8 i; - u8 spriteId; + u8 i, spriteId; const struct MapObjectGraphicsInfo *graphicsInfo; for (i = 0; i < MAP_OBJECTS_COUNT; i++) @@ -993,7 +982,6 @@ static void BuyMenuDrawEventObjects(void) static void BuyMenuCopyTilemapData(void) { s16 i; - u16 *dst = *gShopTilemapBuffer2; u16 *src = *gShopTilemapBuffer1; @@ -1049,6 +1037,7 @@ static void Task_BuyMenu(u8 taskId) CopyItemName(itemId, gStringVar1); BuyMenuDisplayMessage(taskId, gText_Var1CertainlyHowMany, Task_BuyHowManyDialogueInit); } + break; } } } @@ -1056,7 +1045,6 @@ static void Task_BuyMenu(u8 taskId) static void Task_BuyHowManyDialogueInit(u8 taskId) { s16 *data = gTasks[taskId].data; - u16 quantityInBag = BagGetQuantityByItemId(tItemId); u16 maxQuantity; @@ -1120,7 +1108,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId) static void CreateBuyMenuConfirmPurchaseWindow(u8 taskId) { - BuyMenuConfirmPurchase(taskId, gUnknown_83DF0B4); + BuyMenuConfirmPurchase(taskId, sShopMenuActions_BuyQuit); } static void BuyMenuTryMakePurchase(u8 taskId) @@ -1204,6 +1192,7 @@ static void nullsub_53(void) } #ifdef NONMATCHING +// couldn't get registers to match. It should store an address into r4 (what tmp wants to be), and load/store from there, eg. ldrh r0, [r4,#4]. Which indicates an array inside the MartHistory struct, except data sizes are not consistent. void RecordItemPurchase(u16 item, u16 quantity, u8 a2) { struct MartHistory *tmp; @@ -1343,6 +1332,7 @@ static void RecordQuestLogItemPurchase(void) v = history->unkA; if (v != 0) sub_8113550(v + 0x24, (const u16*)history); + v = history->unk16; if (v != 0) {