address comments

This commit is contained in:
Kurausukun 2020-11-02 18:43:11 -05:00
parent fe40c0c466
commit 8bf401c227
19 changed files with 48 additions and 81 deletions

View File

@ -73,8 +73,6 @@ void nullsub_20(void);
void BeginBattleIntro(void);
void SwitchInClearSetData(void);
void FaintClearSetData(void);
void sub_803B3AC(void); // unused
void sub_803B598(void); // unused
void BattleTurnPassed(void);
u8 IsRunningFromBattleImpossible(void);
void SwitchPartyOrder(u8 battlerId);

View File

@ -387,13 +387,8 @@ static void AnimTranslateStinger(struct Sprite *sprite)
if (GetBattlerPosition(gBattleAnimTarget) == B_POSITION_PLAYER_LEFT
|| GetBattlerPosition(gBattleAnimTarget) == B_POSITION_OPPONENT_LEFT)
{
s16 temp1, temp2;
temp1 = gBattleAnimArgs[2];
gBattleAnimArgs[2] = -temp1;
temp2 = gBattleAnimArgs[0];
gBattleAnimArgs[0] = -temp2;
gBattleAnimArgs[2] *= -1;
gBattleAnimArgs[0] *= -1;
}
}

View File

@ -635,8 +635,6 @@ void AnimTask_MoveTargetMementoShadow(u8 taskId)
static void AnimTask_MoveTargetMementoShadow_Step(u8 taskId)
{
u8 pos;
u16 i;
struct Task *task = &gTasks[taskId];
switch (task->data[0])

View File

@ -5007,7 +5007,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
int otId;
u16 species;
u8 subpriority;
u8 isBackPic;
bool8 isBackPic;
s16 x;
switch (gTasks[taskId].data[0])
@ -5035,7 +5035,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
otId = gContestResources->moveAnim->otId;
species = gContestResources->moveAnim->species;
subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
isBackPic = 0;
isBackPic = FALSE;
x = -32;
}
else
@ -5050,7 +5050,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
isBackPic = 0;
isBackPic = FALSE;
x = 272;
}
else
@ -5063,7 +5063,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority - 1;
isBackPic = 1;
isBackPic = TRUE;
x = -32;
}
}
@ -5138,7 +5138,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
gSprites[spriteId].pos2.x = 0;
}
gTasks[taskId].data[1] = (u8)gTasks[taskId].data[1];
gTasks[taskId].data[1] &= 0xFF;
if (gSprites[spriteId].pos2.x == 0)
DestroyAnimVisualTask(taskId);
break;

View File

@ -1199,7 +1199,7 @@ static void AnimSkyAttackBird(struct Sprite *sprite)
sprite->data[7] = ((posy - sprite->pos1.y) << 4) / 12;
rotation = ArcTan2Neg(posx - sprite->pos1.x, posy - sprite->pos1.y);
rotation += 49152;
rotation -= 16384;
TrySetSpriteRotScale(sprite, 1, 0x100, 0x100, rotation);

View File

@ -1101,7 +1101,7 @@ static void AnimTask_TransparentCloneGrowAndShrink_Step(u8 taskId)
break;
case 1:
task->data[1] -= 4;
task->data[2] = 256 - (gSineTable[task->data[1]] >> 1);;
task->data[2] = 256 - (gSineTable[task->data[1]] >> 1);
SetSpriteRotScale(task->data[15], task->data[2], task->data[2], 0);
SetBattlerSpriteYOffsetFromOtherYScale(task->data[15], task->data[13]);
if (task->data[1] == 0)

View File

@ -569,7 +569,7 @@ static void sub_81172EC(u8 taskId)
if (gTasks[taskId].data[12] == 0)
{
sub_80A477C(0);
gTasks[taskId].data[15]++;;
gTasks[taskId].data[15]++;
}
}
break;

View File

@ -5292,7 +5292,7 @@ static void Task_ShowTourneyTree(u8 taskId)
gTasks[taskId].tState++;
break;
case 2:
sTilemapBuffer = AllocZeroed(0x800);
sTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE);
LZDecompressWram(gDomeTourneyLineMask_Tilemap, sTilemapBuffer);
SetBgTilemapBuffer(1, sTilemapBuffer);
CopyBgTilemapBufferToVram(1);

View File

@ -485,7 +485,7 @@ static void CB2_ShowTrainerHillRecords(void)
gMain.state++;
break;
case 2:
sTilemapBuffer = AllocZeroed(0x800);
sTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sTrainerHillRecordsBgTemplates, ARRAY_COUNT(sTrainerHillRecordsBgTemplates));
SetBgTilemapBuffer(3, sTilemapBuffer);

View File

@ -4142,12 +4142,12 @@ static u8 CreateContestantBoxBlinkSprites(u8 contestant)
CpuFill32(0, gContestResources->boxBlinkTiles2 + 0x500, 0x300);
RequestDma3Copy(gContestResources->boxBlinkTiles1,
(u8 *)(VRAM + 0x10000 + gSprites[spriteId1].oam.tileNum * 32),
(u8 *)(OBJ_VRAM0 + gSprites[spriteId1].oam.tileNum * 32),
0x800,
1);
RequestDma3Copy(gContestResources->boxBlinkTiles2,
(u8 *)(VRAM + 0x10000 + gSprites[spriteId2].oam.tileNum * 32),
(u8 *)(OBJ_VRAM0 + gSprites[spriteId2].oam.tileNum * 32),
0x800,
1);
@ -4736,8 +4736,8 @@ static void UpdateApplauseMeter(void)
src = &gContestApplauseMeterGfx[64];
else
src = gContestApplauseMeterGfx;
CpuCopy32(src, (void *)(VRAM + 0x10000 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32);
CpuCopy32(src + 32, (void *)(VRAM + 0x10000 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32);
CpuCopy32(src, (void *)(OBJ_VRAM0 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32);
CpuCopy32(src + 32, (void *)(OBJ_VRAM0 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32);
if (eContest.applauseLevel > 4)
StartApplauseOverflowAnimation();
@ -5018,7 +5018,7 @@ static void ShowHideNextTurnGfx(bool8 show)
{
if (eContestantStatus[i].turnOrderMod != 0 && show)
{
CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(VRAM + 0x10000 + (gSprites[eContestGfxState[i].nextTurnSpriteId].oam.tileNum + 6) * 32), 32);
CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(OBJ_VRAM0 + (gSprites[eContestGfxState[i].nextTurnSpriteId].oam.tileNum + 6) * 32), 32);
gSprites[eContestGfxState[i].nextTurnSpriteId].pos1.y = sNextTurnSpriteYPositions[gContestantTurnOrder[i]];
gSprites[eContestGfxState[i].nextTurnSpriteId].invisible = FALSE;
}

View File

@ -1178,10 +1178,10 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
src = (u8 *)(sUnknown_0858D6D0);
sprite = &gSprites[spriteId];
spriteTilePtrs[0] = (u8 *)(sprite->oam.tileNum * 32 + VRAM + 0x10000);
spriteTilePtrs[0] = (u8 *)(sprite->oam.tileNum * 32 + OBJ_VRAM0);
for (i = 1; i < 4; i++)
spriteTilePtrs[i] = (void*)(gSprites[sprite->data[i - 1]].oam.tileNum * 32 + VRAM + 0x10000);
spriteTilePtrs[i] = (void*)(gSprites[sprite->data[i - 1]].oam.tileNum * 32 + OBJ_VRAM0);
for (i = 0; i < 4; i++)
CpuFill32(0, spriteTilePtrs[i], 0x400);

View File

@ -1160,7 +1160,7 @@ static void sub_8175548(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBackgroundTemplates, 1);
SetBgTilemapBuffer(0, AllocZeroed(0x800));
SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE));
LoadPalette(gUnknown_085E56F0, 0x80, 0x40);
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();

View File

@ -8509,23 +8509,11 @@ void sub_809783C(struct Sprite *sprite, u8 a2, u8 a3, u8 a4)
sprite->data[6] = 0;
}
static const s16 gUnknown_0850E840[] = {
16, 16, 32,
};
static const u8 gUnknown_0850E846[] = {
0, 0, 1,
};
u8 sub_809785C(struct Sprite *sprite)
{
s16 v5[3];
u8 v6[3];
u8 v2;
memcpy(v5, gUnknown_0850E840, 6); // TODO: get rid of memcpy
memcpy(v6, gUnknown_0850E846, 3);
v2 = 0;
s16 v5[] = {16, 16, 32};
u8 v6[] = {0, 0, 1};
u8 v2 = 0;
if (sprite->data[4])
Step1(sprite, sprite->data[3]);
@ -8546,23 +8534,11 @@ u8 sub_809785C(struct Sprite *sprite)
return v2;
}
static const s16 gUnknown_0850E84A[] = {
32, 32, 64,
};
static const u8 gUnknown_0850E850[] = {
1, 1, 2,
};
u8 sub_80978E4(struct Sprite *sprite)
{
s16 v5[3];
u8 v6[3];
u8 v2;
memcpy(v5, gUnknown_0850E84A, 6);
memcpy(v6, gUnknown_0850E850, 3);
v2 = 0;
s16 v5[] = {32, 32, 64};
u8 v6[] = {1, 1, 2};
u8 v2 = 0;
if (sprite->data[4] && !(sprite->data[6] & 1))
Step1(sprite, sprite->data[3]);

View File

@ -824,7 +824,7 @@ void sub_817B1C8(u8 a)
LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&gUnknown_085F0CFC, 0, 96);
LoadCompressedSpriteSheet(gUnknown_085F5064);
LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000));
LZ77UnCompVram(gUnknown_085F16A8, (void *)(OBJ_VRAM0));
LoadPalette(&gUnknown_085F1668, 256, 32);
sub_817B76C();
break;
@ -834,7 +834,7 @@ void sub_817B1C8(u8 a)
LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&gUnknown_085F0D5C, 0, 96);
LoadCompressedSpriteSheet(gUnknown_085F5064);
LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000));
LZ77UnCompVram(gUnknown_085F16A8, (void *)(OBJ_VRAM0));
LoadPalette(&gUnknown_085F1688, 256, 32);
sub_817B76C();
break;

View File

@ -635,7 +635,7 @@ void MPlayStart(struct MusicPlayerInfo *mplayInfo, struct SongHeader *songHeader
track++;
}
if (songHeader->reverb & 0x80)
if (songHeader->reverb & SOUND_MODE_REVERB_SET)
m4aSoundMode(songHeader->reverb);
mplayInfo->ident = ID_NUMBER;

View File

@ -3189,7 +3189,7 @@ static void SpriteCB_LinkPlayer(struct Sprite *sprite)
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1);
sprite->oam.priority = ZCoordToPriority(objEvent->previousElevation);
if (!linkPlayerObjEvent->movementMode != MOVEMENT_MODE_FREE)
if (linkPlayerObjEvent->movementMode == MOVEMENT_MODE_FREE)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objEvent->range.as_byte));
else
StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(objEvent->range.as_byte));

View File

@ -2060,10 +2060,10 @@ static bool8 LoadPokedexListPage(u8 page)
SetGpuReg(REG_OFFSET_BG2VOFS, sPokedexView->initialVOffset);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sPokedex_BgTemplate, ARRAY_COUNT(sPokedex_BgTemplate));
SetBgTilemapBuffer(3, AllocZeroed(0x800));
SetBgTilemapBuffer(2, AllocZeroed(0x800));
SetBgTilemapBuffer(1, AllocZeroed(0x800));
SetBgTilemapBuffer(0, AllocZeroed(0x800));
SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE));
DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0);
CopyToBgTilemapBuffer(1, gPokedexList_Tilemap, 0, 0);
CopyToBgTilemapBuffer(3, gPokedexListUnderlay_Tilemap, 0, 0);
@ -3186,10 +3186,10 @@ static u8 LoadInfoScreen(struct PokedexListItem* item, u8 monSpriteId)
gTasks[taskId].data[5] = 255;
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sInfoScreen_BgTemplate, ARRAY_COUNT(sInfoScreen_BgTemplate));
SetBgTilemapBuffer(3, AllocZeroed(0x800));
SetBgTilemapBuffer(2, AllocZeroed(0x800));
SetBgTilemapBuffer(1, AllocZeroed(0x800));
SetBgTilemapBuffer(0, AllocZeroed(0x800));
SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE));
InitWindows(sInfoScreen_WindowTemplates);
DeactivateAllTextPrinters();
@ -3951,8 +3951,8 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
ResetOtherVideoRegisters(DISPCNT_BG0_ON);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sNewEntryInfoScreen_BgTemplate, ARRAY_COUNT(sNewEntryInfoScreen_BgTemplate));
SetBgTilemapBuffer(3, AllocZeroed(0x800));
SetBgTilemapBuffer(2, AllocZeroed(0x800));
SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE));
InitWindows(sNewEntryInfoScreen_WindowTemplates);
DeactivateAllTextPrinters();
gTasks[taskId].tState = 1;
@ -4812,10 +4812,10 @@ static void Task_LoadSearchMenu(u8 taskId)
ResetOtherVideoRegisters(0);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sSearchMenu_BgTemplate, ARRAY_COUNT(sSearchMenu_BgTemplate));
SetBgTilemapBuffer(3, AllocZeroed(0x800));
SetBgTilemapBuffer(2, AllocZeroed(0x800));
SetBgTilemapBuffer(1, AllocZeroed(0x800));
SetBgTilemapBuffer(0, AllocZeroed(0x800));
SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(2, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE));
InitWindows(sSearchMenu_WindowTemplate);
DeactivateAllTextPrinters();
PutWindowTilemap(0);

View File

@ -436,9 +436,9 @@ static u32 LoopedTask_ScrollMenuHeaderUp(s32 a0)
if (ChangeBgY(0, 384, 2) <= 0)
{
ChangeBgY(0, 0, 0);
return 4;
return LT_FINISH;
}
return 2;
return LT_PAUSE;
}
void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size)
@ -682,7 +682,7 @@ static void LoadLeftHeaderGfxForMenu(u32 menuGfxId)
size = GetDecompressedDataSize(sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].data);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(1) * 16) + 0x100, 0x20);
LZ77UnCompWram(sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].data, gDecompressionBuffer);
RequestDma3Copy(gDecompressionBuffer, (void *)VRAM + 0x10000 + (GetSpriteTileStartByTag(2) * 32), size, 1);
RequestDma3Copy(gDecompressionBuffer, (void *)OBJ_VRAM0 + (GetSpriteTileStartByTag(2) * 32), size, 1);
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + sPokenavMenuLeftHeaderSpriteSheets[menuGfxId].size;
if (menuGfxId == POKENAV_GFX_MAP_MENU_ZOOMED_OUT || menuGfxId == POKENAV_GFX_MAP_MENU_ZOOMED_IN)

View File

@ -349,7 +349,7 @@ static void VBlankCB_UpdateClockGraphics(void)
gMain.oamBuffer[0] = sClockOamData;
gMain.oamBuffer[0].x = 112;
gMain.oamBuffer[0].y = (CLOCK_WIN_TOP + 1) * 8;;
gMain.oamBuffer[0].y = (CLOCK_WIN_TOP + 1) * 8;
if (gSaveFailedClockInfo[CLOCK_RUNNING] != FALSE)
{