Skip to content

Commit

Permalink
remove dex viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardoGiordano committed Dec 27, 2017
1 parent eb0df60 commit 0e18a75
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 119 deletions.
2 changes: 0 additions & 2 deletions include/dex.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,5 @@ int getDexFormIndexSM(int species, int formct, int start);
void setDexFlags(u8 mainbuf[], int index, int gender, int shiny, int baseSpecies);
bool sanitizeFormsToIterate(int species, int fsfe[], int formIn);
void setDex(u8 mainbuf[], u8* pkmn);
bool getCaught(u8* mainbuf, int species);
bool getSeen(u8* mainbuf, int species);

#endif
1 change: 0 additions & 1 deletion include/graphic.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ void printSettings(u8* config_buf, int currentEntry, int configSize, wchar_t* de
void infoViewer(u8* pkmn);
void wcxInfoViewer(u8* buf);
void printfHexEditorInfo(u8* pkmn, int byte);
void printDexViewer(u8* mainbuf, int currentEntry, int page, int seen, int caught);
void printfConfigEditorInfo(int currentEntry);

#endif
24 changes: 3 additions & 21 deletions source/bank.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void bank(u8* mainbuf) {
saveBox = 0;
}

if ((touch.px > 208 && touch.px < 317 && touch.py > 70 && touch.py < 97) && !(isBufferized)) {
if ((touch.px > 208 && touch.px < 317 && touch.py > 72 && touch.py < 99) && !(isBufferized)) {
if (confirmDisp(i18n(S_BANK_Q_ERASE_SELECTED_BOX))) {
u8 tmp[ofs.pkxLength];
memset(tmp, 0, ofs.pkxLength);
Expand Down Expand Up @@ -407,7 +407,7 @@ void bank(u8* mainbuf) {
}
}

if ((touch.px > 208 && touch.px < 317 && touch.py > 97 && touch.py < 124) && !(isBufferized)) {
if ((touch.px > 208 && touch.px < 317 && touch.py > 100 && touch.py < 129) && !(isBufferized)) {
u8 tmp[ofs.pkxLength];
memset(tmp, 0, ofs.pkxLength);
if (currentEntry < 30)
Expand All @@ -418,25 +418,7 @@ void bank(u8* mainbuf) {
setToWirelessBuf(wirelessbuf, saveBox, currentEntry - 30, tmp);
}

if (touch.px > 208 && touch.px < 317 && touch.py > 153 && touch.py < 180) {
int dexEntry = 0;
int page = 0, maxpages = ofs.maxSpecies / 40 + 1;
int seen = 0;
int caught = 0;

for (int i = 1; i <= ofs.maxSpecies; i++) {
seen = getSeen(mainbuf, i) ? seen + 1 : seen;
caught = getCaught(mainbuf, i) ? caught + 1 : caught;
}

while (aptMainLoop() && !(hidKeysDown() & KEY_B)) {
hidScanInput();
calcCurrentEntryMorePages(&dexEntry, &page, maxpages, 39, 8);
printDexViewer(mainbuf, dexEntry, page, seen, caught);
}
}

if (touch.px > 208 && touch.px < 317 && touch.py > 180 && touch.py < 210)
if (touch.px > 208 && touch.px < 317 && touch.py > 128 && touch.py < 156)
{
bool isbank = currentEntry < 30;
dumpPkx(isbank ? bankbuf : mainbuf, isbank ? bankBox : saveBox, currentEntry);
Expand Down
51 changes: 0 additions & 51 deletions source/dex.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,55 +277,4 @@ void setDex(u8 mainbuf[], u8* pkmn) {
if (lbit >> 3 < 920)
mainbuf[PokeDexLanguageFlags + (lbit >> 3)] |= (u8)(1 << (lbit & 7));
}
}

bool getCaught(u8* mainbuf, int species) {
int PokeDex = ofs.pokedex;
int miscdata = 0;
if (game_isgen7()) {
miscdata = 0x80;
}

int bit = species - 1;
int bd = bit >> 3;
int bm = bit & 7;
int off = PokeDex + 0x08 + miscdata;

if (game_isgen6()) {
if ((1 << bm & mainbuf[off + bd]) != 0)
return true;

if (game_getisORAS() || bit >= 649)
return false;

return (1 << bm & mainbuf[off + bd + 0x644]) != 0;
}

return (1 << bm & mainbuf[off + bd]) != 0;
}

bool getSeen(u8* mainbuf, int species) {
int PokeDex = ofs.pokedex;
int miscdata = 0;
int brSize = 0;

if (game_isgen7()) {
miscdata = 0x80;
brSize = 0x8C;
} else if (game_getisORAS()) {
brSize = 0x60;
} else if (game_getisXY()) {
brSize = 0x60;
}

int bit = species - 1;
int bd = bit >> 3;
int bm = bit & 7;
u8 mask = (u8)(1 << bm);
int off = PokeDex + 0x08 + miscdata;

for (int i = 1; i <= 4; i++)
if ((mainbuf[off + bd + i * brSize] & mask) != 0)
return true;
return false;
}
1 change: 0 additions & 1 deletion source/editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,6 @@ void pokemonEditor(u8* mainbuf) {
if (!isTeam && confirmDisp(i18n(S_EDITOR_Q_CONFIRM_RELEASE))) {
memset(pkmn, 0, ofs.pkmnLength);
pkx_set_as_it_is(mainbuf, box, currentEntry, pkmn);
infoDisp(i18n(S_EDITOR_RELEASED));
operationDone = true;
}
break;
Expand Down
50 changes: 7 additions & 43 deletions source/graphic.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,40 +838,6 @@ void wcxInfoViewer(u8* buf) {
}
}

void printDexViewer(u8* mainbuf, int currentEntry, int page, int seen, int caught) {
char temp[12];

pp2d_begin_draw(GFX_TOP, GFX_LEFT);
pp2d_draw_texture(TEXTURE_GENERATION_BG, 0, 0);
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 8; j++) {
if (currentEntry == i * 8 + j)
printSelector(j*49 + j, i*47 + i, 49, 47);

int entry = i*8+j + 40*page;
if ((entry) < ofs.maxSpecies) {
if (getCaught(mainbuf, entry + 1))
pp2d_draw_texture_part(TEXTURE_NORMAL_SPRITESHEET, 7 + 49 * j + j, 2 + 47 * i + i, 34 * ((entry + 1) % 30), 30 * ((entry + 1) / 30), 34, 30);
else if (getSeen(mainbuf, entry + 1)) {
pp2d_draw_texture_part(TEXTURE_NORMAL_SPRITESHEET, 7 + 49 * j + j, 2 + 47 * i + i, 34 * ((entry + 1) % 30), 30 * ((entry + 1) / 30), 34, 30);
pp2d_draw_texture_part_blend(TEXTURE_NORMAL_SPRITESHEET, 7 + 49 * j + j, 2 + 47 * i + i, 34 * ((entry + 1) % 30), 30 * ((entry + 1) / 30), 34, 30, RGBA8(0,0,0,160));
} else {
pp2d_draw_texture_part_blend(TEXTURE_NORMAL_SPRITESHEET, 7 + 49 * j + j, 2 + 47 * i + i, 34 * ((entry + 1) % 30), 30 * ((entry + 1) / 30), 34, 30, RGBA8(0,0,0,255));
}
sprintf(temp, "%d", entry + 1);
pp2d_draw_text(49 * j + (49 - pp2d_get_text_width(temp, FONT_SIZE_9, FONT_SIZE_9)) / 2 + j, 34 + i * 47 + i, FONT_SIZE_9, FONT_SIZE_9, getCaught(mainbuf, entry + 1) ? WHITE : DS, temp);
}
}
}

pp2d_draw_on(GFX_BOTTOM, GFX_LEFT);
printMenuBottom();
pp2d_draw_wtextf(16, 32, FONT_SIZE_14, FONT_SIZE_14, WHITE, i18n(S_GRAPHIC_PKBANK_SEEN), seen);
pp2d_draw_wtextf(16, 48, FONT_SIZE_14, FONT_SIZE_14, WHITE, i18n(S_GRAPHIC_PKBANK_CAUGHT), caught);
printBottomIndications(i18n(S_GRAPHIC_CREDITS_INDICATIONS));
pp2d_end_draw();
}

void printPKViewer(u8* mainbuf, u8* tmp, bool isTeam, int currentEntry, int menuEntry, int box, int mode, int additional1, int additional2) {
int game = game_get();

Expand Down Expand Up @@ -1442,15 +1408,13 @@ void printPKBank(u8* bankbuf, u8* mainbuf, u8* wirelessBuffer, u8* pkmnbuf, int
pksm_draw_texture(TEXTURE_TRANSFER_BUTTON, 242, 5);
pksm_draw_texture(TEXTURE_BACK_BUTTON, 283, 211);
pksm_draw_texture(TEXTURE_BUTTON, 208, 43);
pksm_draw_texture(TEXTURE_BUTTON, 208, 70);
pksm_draw_texture(TEXTURE_BUTTON, 208, 97);
pksm_draw_texture(TEXTURE_BUTTON, 208, 153);
pksm_draw_texture(TEXTURE_BUTTON, 208, 180);
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_VIEW), FONT_SIZE_12, FONT_SIZE_12)) / 2, 50, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_VIEW));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_CLEARBOX), FONT_SIZE_12, FONT_SIZE_12)) / 2, 77, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_CLEARBOX));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_RELEASE), FONT_SIZE_12, FONT_SIZE_12)) / 2, 104, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_RELEASE));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_DEX), FONT_SIZE_12, FONT_SIZE_12)) / 2, 160, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_DEX));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_DUMP), FONT_SIZE_12, FONT_SIZE_12)) / 2, 187, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_DUMP));
pksm_draw_texture(TEXTURE_BUTTON, 208, 72);
pksm_draw_texture(TEXTURE_BUTTON, 208, 101);
pksm_draw_texture(TEXTURE_BUTTON, 208, 130);
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_VIEW), FONT_SIZE_12, FONT_SIZE_12)) / 2, 49, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_VIEW));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_CLEARBOX), FONT_SIZE_12, FONT_SIZE_12)) / 2, 78, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_CLEARBOX));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_RELEASE), FONT_SIZE_12, FONT_SIZE_12)) / 2, 107, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_RELEASE));
pp2d_draw_wtext(208 + (109 - pp2d_get_wtext_width(i18n(S_GRAPHIC_PKBANK_MENU_DUMP), FONT_SIZE_12, FONT_SIZE_12)) / 2, 136, FONT_SIZE_12, FONT_SIZE_12, BLACK, i18n(S_GRAPHIC_PKBANK_MENU_DUMP));
pksm_draw_texture(TEXTURE_OTA_BUTTON, 240, 211);

y = 45;
Expand Down

0 comments on commit 0e18a75

Please sign in to comment.