int main(void) { title(); menu(); init_game(); int x=0, y=0; while(1) { key_poll(); x += key_tri_horz()*2; y += key_tri_vert()*2; vid_vsync(); //oam_copy(oam_mem, obj_buffer, 128); REG_BG1HOFS = x; REG_BG1VOFS = y; } return 0; }
int scene_CommandMenu(int index, int lastAction) { char buffy[255]; u8 actioncursors[8] = { 16,35, 23,35, 16,37, 23,37 }; //cursor positions int bfrInt = 0; sprintf(buffy, strBattleWhatToDo, fighters_This(index)); vwClearLine(1,8); vwClearLine(1,12); vwWriteG(0,4,buffy); scene_SetLine(actioncursors[lastAction*2],1,actioncursors[(lastAction*2)+1],255,15); btlWindowShifts[2] = 160; while(1) { DoVBlank(); KeyRead(); if((Trg & KEY_LEFT) || (Trg & KEY_RIGHT)) { scene_SetLine(actioncursors[lastAction*2],1,actioncursors[(lastAction*2)+1],319,15); bfrInt = lastAction; lastAction = wrap(lastAction + key_tri_horz(), 0, 4); if(lastAction == 3 && ThisBattle.trainer) lastAction = bfrInt; scene_SetLine(actioncursors[lastAction*2],1,actioncursors[(lastAction*2)+1],255,15); } if((Trg & KEY_UP) || (Trg & KEY_DOWN)) { scene_SetLine(actioncursors[lastAction*2],1,actioncursors[(lastAction*2)+1],319,15); bfrInt = lastAction; lastAction = wrap(lastAction + (key_tri_vert()*2), 0, 4); if(lastAction == 3 && ThisBattle.trainer) lastAction = bfrInt; scene_SetLine(actioncursors[lastAction*2],1,actioncursors[(lastAction*2)+1],255,15); } if(Trg & A_BUTTON) { scene_SetLine(actioncursors[lastAction*2],1,actioncursors[(lastAction*2)+1],319,15); break; } } return lastAction+1; }
void PokeSearch() { int i, cursor = 0, color = 0, type1 = 0, type2 = 0, letter = 0, dexid = PokeSearchGetDexID(), sort = 0; signed int j; u16 *SortSourceDex = (u16*)PokeDexes[0]; CleanUpCrap(); ClearOamBak(); DmaArrayCopy(dexfilterTiles, MEM_VRAM + 0x0000); DmaArrayCopy(dexfilterPal, MEM_PAL_BG + 0x0000); DmaArrayCopy(dexfilterMap, MEM_VRAM + 0xE800); vwClear(1); vwNormalLUT(); vwSetLine(15,16,2,96,15); vwSetLine(15,16,4,160,15); vwSetLine(15,16,6,224,15); vwSetLine(15,16,8,288,15); vwSetLine(15,16,10,352,15); vwSetLine(15,16,12,416,15); PokeSearchDrawStuff(cursor, dexid, sort, letter, color, type1, type2); while(1) { DoVBlank(); KeyRead(); if(Trg & KEY_UP || Trg & KEY_DOWN) { cursor = wrap(cursor + key_tri_vert(), 0, (dexid == 2) ? 6 : 2); PokeSearchDrawStuff(cursor, dexid, sort, letter, color, type1, type2); } if(Trg & KEY_LEFT || Trg & KEY_RIGHT) { switch(cursor) { case 0: dexid = wrap(dexid + key_tri_horz(), 0, 3); break; case 1: sort = wrap(sort + key_tri_horz(), 0, 2); break; case 2: letter = wrap(letter + key_tri_horz(), 0, 27); break; case 3: type1 = wrap(type1 + key_tri_horz(), 0, 19); if(type1 == 10) type1 += key_tri_horz(); break; case 4: type2 = wrap(type2 + key_tri_horz(), 0, 19); if(type2 == 10) type2 += key_tri_horz(); break; case 5: color = wrap(color + key_tri_horz(), 0, 11); break; } PokeSearchDrawStuff(cursor, dexid, sort, letter, color, type1, type2); } if(Trg & B_BUTTON) { return; } if(Trg & A_BUTTON) { if(dexid==2 && (color == 0 && type1 == 0 && type2 == 0 && letter == 0)) { AGBPrint("PokeSearch: No filters specified...\n"); dexid = PokeSearchGetDexID(); } if(dexid==2) //didn't get caught on not filtering? { DmaArrayClear(0, FilteredDex); j = 1; SortSourceDex = (u16*)PokeDexes[sort * 2]; for(i = 1; i < SortSourceDex[0]; i++) { int takeit = 1; if(!GETBIT(MyDex.seen, SortSourceDex[i])) takeit = 0; if(color && BaseStats[SortSourceDex[i]].Color != color-1) takeit = 0; if(type1 && BaseStats[SortSourceDex[i]].Type1 != type1-1) takeit = 0; if(type2 && BaseStats[SortSourceDex[i]].Type2 != type2-1) takeit = 0; if(letter && PokeNames[SortSourceDex[i]][0] != 'A'+letter-1) takeit = 0; if(takeit) { FilteredDex[j] = SortSourceDex[i]; j++; } } if(j == 1) { AGBPrint("PokeSearch: nothing found.\n"); return; } FilteredDex[0] = j; DexList = (void*)FilteredDex; AGBPrint("PokeSearch: Pokédex set to Filtered mode.\n"); return; } else { if(sort == 1) { AGBPrintf("PokeSearch: alphabetical sort? Okay.\n"); DmaArrayClear(0, FilteredDex); j = 1; SortSourceDex = (u16*)PokeDexes[2]; for(i = 1; i < SortSourceDex[0]; i++) { if(GETBIT(MyDex.seen, SortSourceDex[i])) { FilteredDex[j] = SortSourceDex[i]; j++; } } FilteredDex[0] = j; DexList = (void*)FilteredDex; } else { DexList = (void*)PokeDexes[dexid]; AGBPrintf("PokeSearch: Pokédex set to #%d.\n",dexid); } return; } } } }
/* Function to choose a move in a battle */ int scene_FightMenu(int fighterIndex) { u8 moveCursors[8] = { 1,55, 10,55, 1,57, 10,57 }; int lastmove = fighters[fighterIndex].lastused; AGBPrintf("scene_FightMenu(%d)\n", fighterIndex); vwClearLine(1,16); vwClearLine(1,20); vwClearLine(1,24); vwClearLine(1,28); vw_SetSmall(); // Write attack names to the screen vwWriteG(0,8, moveNames[GetMonsterStats(fighters[fighterIndex].mon, pMove1)]); vwWriteG(0,10,moveNames[GetMonsterStats(fighters[fighterIndex].mon, pMove2)]); vwWriteG(0,12,moveNames[GetMonsterStats(fighters[fighterIndex].mon, pMove3)]); vwWriteG(0,14,moveNames[GetMonsterStats(fighters[fighterIndex].mon, pMove4)]); // Make the font bigger vw_SetBig(); // Draw cursor scene_SetLine(moveCursors[lastmove*2],1,moveCursors[(lastmove*2)+1],255,15); // Shows type and PP scene_DrawMoveData(fighters[fighterIndex].mon, lastmove); btlWindowShifts[2] = 320; while(1) { DoVBlank(); KeyRead(); // Move cursor sideways if((Trg & KEY_LEFT) || (Trg & KEY_RIGHT)) { scene_SetLine(moveCursors[lastmove*2], 1, moveCursors[(lastmove*2)+1], 319, 15); lastmove = wrap(lastmove + key_tri_horz(), 0, 4); scene_SetLine(moveCursors[lastmove*2], 1, moveCursors[(lastmove*2)+1], 255, 15); scene_DrawMoveData(fighters[fighterIndex].mon, lastmove); } // Move cursor up- and downwards if((Trg & KEY_UP) || (Trg & KEY_DOWN)) { scene_SetLine(moveCursors[lastmove*2],1,moveCursors[(lastmove*2)+1],319,15); lastmove = wrap(lastmove + (key_tri_vert()*2), 0, 4); scene_SetLine(moveCursors[lastmove*2],1,moveCursors[(lastmove*2)+1],255,15); scene_DrawMoveData(fighters[fighterIndex].mon, lastmove); } if(Trg & A_BUTTON) { // If move is != 0 if(GetMonsterStats(fighters[0].mon, pPP1 + lastmove)) { fighters[0].lastused = lastmove; scene_SetLine(moveCursors[lastmove*2],1,moveCursors[(lastmove*2)+1],319,15); return lastmove; } // Else do nothing else { //Beep! } } else if(Trg & B_BUTTON) { scene_SetLine(moveCursors[lastmove*2],1,moveCursors[(lastmove*2)+1],319,15); btlWindowShifts[2] = 160; return -1; } } }