Document a bit of script menu and battle anims

This commit is contained in:
DizzyEggg 2019-04-02 13:35:52 +02:00 committed by huderlem
parent 2745cdc7d2
commit baa187665b
8 changed files with 126 additions and 125 deletions

View File

@ -5347,7 +5347,7 @@ Move_ICE_BEAM:
loadspritegfx ANIM_TAG_ICE_CRYSTALS
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK
waitforvisualfinish
createsoundtask sub_8158C58, 183, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10
createsoundtask sub_8158C58, SE_W062B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10
createsprite gUnknown_08595B2C, ANIM_ATTACKER, 2, 20, 12, 0, 12, 20
createsprite gUnknown_08595B2C, ANIM_ATTACKER, 2, 20, -12, 0, -12, 20
delay 1
@ -5403,7 +5403,7 @@ Move_AURORA_BEAM:
call AuroraBeam1
call AuroraBeam1
setarg 7, -1
createsoundtask sub_8158C58, 183, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 6, 0, 10
createsoundtask sub_8158C58, SE_W062B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 6, 0, 10
createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 40, 1
call AuroraBeam1
call AuroraBeam1
@ -7123,7 +7123,7 @@ Move_PSYBEAM:
loadspritegfx ANIM_TAG_GOLD_RING
playsewithpan SE_W060, SOUND_PAN_ATTACKER
call SetPsychicBackground
createsoundtask sub_8158C58, 200, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15
createsoundtask sub_8158C58, SE_W060B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15
call Psybeam1
call Psybeam1
createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 4, ANIM_TARGET
@ -7169,7 +7169,7 @@ Move_PSYWAVE:
playsewithpan SE_W060, SOUND_PAN_ATTACKER
call SetPsychicBackground
createvisualtask sub_81076C8, 5, 100
createsoundtask sub_8158C58, 203, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10
createsoundtask sub_8158C58, SE_W100, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10
call Psywave1
call Psywave1
createvisualtask sub_8115A04, 2, 4, 1, 4, 0, 12, RGB(31, 18, 31)
@ -7346,8 +7346,8 @@ Move_SHADOW_BALL:
fadetobg BG_GHOST
waitbgfadein
delay 15
createsoundtask sub_8158C58, 168, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5
createsprite gUnknown_08596D58, ANIM_TARGET, 2, 16, 16, 8
createsoundtask sub_8158C58, SE_W054, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5
createsprite gShadowBallSpriteTemplate, ANIM_TARGET, 2, 16, 16, 8
waitforvisualfinish
playsewithpan SE_W028, SOUND_PAN_TARGET
createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1
@ -8019,7 +8019,7 @@ Move_TRI_ATTACK:
delay 20
playsewithpan SE_W161, SOUND_PAN_ATTACKER
delay 20
createsoundtask sub_8158C58, 220, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7
createsoundtask sub_8158C58, SE_W161, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7
waitforvisualfinish
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK
delay 16
@ -8356,7 +8356,7 @@ Move_HYPER_BEAM:
createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 4, 1
waitforvisualfinish
delay 30
createsoundtask sub_8158C58, 247, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 1, 15, 0, 5
createsoundtask sub_8158C58, SE_W063B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 1, 15, 0, 5
createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1
createvisualtask sub_8115D94, 2, ANIM_TAG_ORBS, 1, 12, 31, 16, 0, 0
call HyperBeam1

View File

@ -91,7 +91,7 @@ void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette);
void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP);
void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram);
void sub_8197AE8(bool8 copyToVram);
void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs);
void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs);
s8 Menu_ProcessInputGridLayout(void);
u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted);
s8 Menu_ProcessInputNoWrapAround_other(void);

View File

@ -11,7 +11,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3);
bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void);
int convert_pixel_width_to_tile_width(int);
u8 CreateWindowFromRect(u8, u8, u8, u8);
void sub_80E2A78(u8);
void ClearToTransparentAndRemoveWindow(u8);
int display_text_and_get_width(const u8*, int);
int sub_80E2D5C(int arg0, int tileWidth);
bool16 ScrSpecial_CreatePCMenu(void);

View File

@ -87,7 +87,7 @@ const union AffineAnimCmd *const gUnknown_08596D54[] =
gUnknown_08596D44,
};
const struct SpriteTemplate gUnknown_08596D58 =
const struct SpriteTemplate gShadowBallSpriteTemplate =
{
.tileTag = ANIM_TAG_SHADOW_BALL,
.paletteTag = ANIM_TAG_SHADOW_BALL,
@ -399,9 +399,9 @@ static void sub_811196C(u8 taskId)
// arg 2: duration step 3 (center -> target)
static void InitAnimShadowBall(struct Sprite *sprite)
{
u16 r5, r6;
r5 = sprite->pos1.x;
r6 = sprite->pos1.y;
s16 oldPosX = sprite->pos1.x;
s16 oldPosY = sprite->pos1.y;
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
sprite->data[0] = 0;
@ -410,8 +410,8 @@ static void InitAnimShadowBall(struct Sprite *sprite)
sprite->data[3] = gBattleAnimArgs[2];
sprite->data[4] = sprite->pos1.x << 4;
sprite->data[5] = sprite->pos1.y << 4;
sprite->data[6] = (((s16)r5 - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1);
sprite->data[7] = (((s16)r6 - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1);
sprite->data[6] = ((oldPosX - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1);
sprite->data[7] = ((oldPosY - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1);
sprite->callback = AnimShadowBallStep;
}
@ -465,30 +465,33 @@ static void sub_8111B9C(struct Sprite *sprite)
sprite->callback = sub_8111BB4;
}
static void sub_8111BB4(struct Sprite *sprite) {
s8 r5 = FALSE;
static void sub_8111BB4(struct Sprite *sprite)
{
bool8 r5 = FALSE;
bool8 r6 = FALSE;
if (sprite->animEnded)
{
if(!(sprite->invisible))
if (!sprite->invisible)
sprite->invisible = TRUE;
switch (sprite->data[0])
{
case 0:
if((sprite->data[1]) != 2)
break;
goto loc_08111C06;
case 1:
if((sprite->data[1]) == 4)
r5 = TRUE;
break;
default:
r6 = TRUE;
break;
case 0:
if (sprite->data[1] == 2)
r5 = TRUE;
break;
case 1:
if (sprite->data[1] == 4)
r5 = TRUE;
break;
}
if (r5)
{
loc_08111C06:
sprite->invisible ^= 1;
sprite->data[2]++;
sprite->data[1] = 0;
@ -499,11 +502,15 @@ static void sub_8111BB4(struct Sprite *sprite) {
}
}
else if (r6)
{
DestroyAnimSprite(sprite);
}
else
{
sprite->data[1]++;
}
}
}
void sub_8111C50(u8 taskId)
{
@ -523,7 +530,7 @@ void sub_8111C50(u8 taskId)
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3]));
gSprites[task->data[0]].data[0] = 80;
if (GetBattlerSide(gBattleAnimTarget) == 0)
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
gSprites[task->data[0]].data[1] = -144;
gSprites[task->data[0]].data[2] = 112;
@ -573,6 +580,7 @@ static void sub_8111D78(u8 taskId)
break;
case 2:
DestroyAnimVisualTask(taskId);
break;
}
}
@ -595,7 +603,7 @@ static void sub_8111E78(u8 taskId)
switch (task->data[15])
{
case 0:
task->data[14] = AllocSpritePalette(0x2771);
task->data[14] = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
if (task->data[14] == 0xFF || task->data[14] == 0xF)
{
DestroyAnimVisualTask(taskId);
@ -605,7 +613,7 @@ static void sub_8111E78(u8 taskId)
task->data[0] = CloneBattlerSpriteWithBlend(1);
if (task->data[0] < 0)
{
FreeSpritePaletteByTag(0x2771);
FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON);
DestroyAnimVisualTask(taskId);
}
else
@ -698,14 +706,14 @@ static void sub_81120DC(u8 taskId)
static void sub_8112170(u8 taskId)
{
struct Task *task = &gTasks[taskId];
u8 position = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget);
u8 rank = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget);
switch (task->data[15])
{
case 0:
gScanlineEffect.state = 3;
task->data[14] = GetAnimBattlerSpriteId(1);
if (position == 1)
if (rank == 1)
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
@ -714,12 +722,12 @@ static void sub_8112170(u8 taskId)
BlendPalette(task->data[4], 16, 0, RGB(13, 0, 15));
break;
case 2:
gSprites[task->data[14]].invisible = 1;
gSprites[task->data[14]].invisible = TRUE;
obj_delete_but_dont_free_vram(&gSprites[task->data[0]]);
FreeSpritePaletteByTag(0x2771);
FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
if (position == 1)
if (rank == 1)
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
@ -1081,7 +1089,7 @@ static void sub_8112ACC(struct Sprite *sprite)
if (sprite->data[0] == 0)
{
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0x10, 0));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0));
sprite->data[0]++;
sprite->data[1] = 0;
sprite->data[2] = 0;

View File

@ -1193,7 +1193,7 @@ static void Task_StoryListMenu(u8 taskId) // Task_StoryListMenu
gSpecialVar_Result = 1;
sSelectedStory = selection;
}
sub_80E2A78(sStorytellerWindowId);
ClearToTransparentAndRemoveWindow(sStorytellerWindowId);
DestroyTask(taskId);
EnableBothScriptContexts();
break;

View File

@ -1661,16 +1661,14 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos);
}
void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs)
void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs)
{
u32 i;
u32 j;
for (i = 0; i < a7; i++)
u32 i, j;
for (i = 0; i < verticalCount; i++)
{
for (j = 0; j < a6; j++)
{
AddTextPrinterParameterized(windowId, 1, strs[(i * a6) + j].text, (a4 * j) + 8, (i * 16) + 1, 0xFF, NULL);
}
for (j = 0; j < horizontalCount; j++)
AddTextPrinterParameterized(windowId, 1, strs[(i * horizontalCount) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL);
}
CopyWindowToVram(windowId, 2);
}

View File

@ -1183,7 +1183,7 @@ static void Task_HandleMultichoiceInput(u8 taskId)
{
gSpecialVar_Result = selection;
}
sub_80E2A78(tWindowId);
ClearToTransparentAndRemoveWindow(tWindowId);
DestroyTask(taskId);
EnableBothScriptContexts();
}
@ -1219,8 +1219,6 @@ bool8 IsScriptActive(void)
static void Task_HandleYesNoInput(u8 taskId)
{
u8 left, top;
if (gTasks[taskId].tRight < 5)
{
gTasks[taskId].tRight++;
@ -1229,9 +1227,9 @@ static void Task_HandleYesNoInput(u8 taskId)
switch (Menu_ProcessInputNoWrapClearOnChoose())
{
case -2:
case MENU_NOTHING_CHOSEN:
return;
case -1:
case MENU_B_PRESSED:
case 1:
PlaySE(SE_SELECT);
gSpecialVar_Result = 0;
@ -1247,8 +1245,6 @@ static void Task_HandleYesNoInput(u8 taskId)
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 columnCount)
{
u8 bottom = 0;
if (FuncIsActiveTask(Task_HandleMultichoiceGridInput) == TRUE)
{
return FALSE;
@ -1256,10 +1252,8 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr
else
{
u8 taskId;
u8 unk2;
int width;
int i;
u8 newWidth;
u8 rowCount, newWidth;
int i, width;
gSpecialVar_Result = 0xFF;
width = 0;
@ -1272,15 +1266,15 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr
newWidth = convert_pixel_width_to_tile_width(width);
left = sub_80E2D5C(left, columnCount * newWidth);
unk2 = gMultichoiceLists[multichoiceId].count / columnCount;
rowCount = gMultichoiceLists[multichoiceId].count / columnCount;
taskId = CreateTask(Task_HandleMultichoiceGridInput, 80);
gTasks[taskId].tIgnoreBPress = ignoreBPress;
gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, unk2 * 2);
gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, rowCount * 2);
SetStandardWindowBorderStyle(gTasks[taskId].tWindowId, 0);
sub_81997AC(gTasks[taskId].tWindowId, newWidth * 8, columnCount, unk2, gMultichoiceLists[multichoiceId].list);
sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, unk2, 0);
PrintMenuGridTable(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, gMultichoiceLists[multichoiceId].list);
sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, 0);
CopyWindowToVram(gTasks[taskId].tWindowId, 3);
return TRUE;
}
@ -1291,24 +1285,25 @@ static void Task_HandleMultichoiceGridInput(u8 taskId)
s16 *data = gTasks[taskId].data;
s8 selection = Menu_ProcessInputGridLayout();
if (selection != -2)
{
if (selection == -1)
switch (selection)
{
case MENU_NOTHING_CHOSEN:
return;
case MENU_B_PRESSED:
if (tIgnoreBPress)
return;
PlaySE(SE_SELECT);
gSpecialVar_Result = 0x7F;
}
else
{
break;
default:
gSpecialVar_Result = selection;
break;
}
sub_80E2A78(tWindowId);
ClearToTransparentAndRemoveWindow(tWindowId);
DestroyTask(taskId);
EnableBothScriptContexts();
}
}
#undef tWindowId
@ -1564,7 +1559,7 @@ static void Task_PokemonPicWindow(u8 taskId)
task->tState++;
break;
case 3:
sub_80E2A78(task->tWindowId);
ClearToTransparentAndRemoveWindow(task->tWindowId);
DestroyTask(taskId);
break;
}
@ -1628,7 +1623,7 @@ u8 CreateWindowFromRect(u8 x, u8 y, u8 width, u8 height)
return windowId;
}
void sub_80E2A78(u8 windowId)
void ClearToTransparentAndRemoveWindow(u8 windowId)
{
ClearStdWindowAndFrameToTransparent(windowId, TRUE);
RemoveWindow(windowId);

View File

@ -395,7 +395,7 @@ static void sub_80F8EE8(u8 taskId)
task->data[0]++;
break;
case 4:
sub_80E2A78(gTasks[taskId].data[5]);
ClearToTransparentAndRemoveWindow(gTasks[taskId].data[5]);
DestroyTask(taskId);
break;
}