sub_815B0CC and rollback of failed attempt to make it compilable

This commit is contained in:
jiangzhengwenjz
2019-06-03 03:19:15 +08:00
parent 0a13397b85
commit 49a1de36d3
7 changed files with 65 additions and 79 deletions
+32 -4
View File
@@ -17,6 +17,7 @@
#include "item.h"
#include "menu_indicators.h"
#include "field_map_obj.h"
#include "random.h"
#include "constants/songs.h"
#include "constants/items.h"
@@ -36,12 +37,12 @@ void C2TeachyTv();
void C2TeachyTvMainCallback();
void VblankHandlerTeachyTv();
void sub_815ABC4(u8 mode, void (*cb)());
void CB2_ReturnToTeachyTV();
void sub_815ABFC();
extern void sub_815AC20();
void TeachyTvCreateAndRenderRbox();
void TeachyTvInitIo();
u8 TeachyTvSetupObjEventAndOam();
extern void TeachyTvConfigRboxAndObj(u8);
extern void TeachyTvSetupPostBattleWindowAndObj(u8);
u8 TeachyTvSetupWindow();
void TeachyTvSetupScrollIndicatorArrowPair();
void TeachyTvSetWindowRegs();
@@ -95,7 +96,7 @@ void sub_815ABC4(u8 mode, void (*cb)())
SetMainCallback2(C2TeachyTvMainCallback);
}
void CB2_ReturnToTeachyTV()
void sub_815ABFC()
{
if(gTeachyTV_StaticResources.mode == 1)
sub_815ABC4(1,gTeachyTV_StaticResources.callback);
@@ -151,7 +152,7 @@ void C2TeachyTvMainCallback()
{
taskId = CreateTask(TeachyTvTaskFunction, 0);
gTasks[taskId].data[1] = TeachyTvSetupObjEventAndOam();
TeachyTvConfigRboxAndObj(taskId);
TeachyTvSetupPostBattleWindowAndObj(taskId);
}
else
{
@@ -316,3 +317,30 @@ void TeachyTvClearWindowRegs()
SetGpuReg(0x40u, 0);
}
void TeachyTvBg2AnimController()
{
u16 *tilemapBuffer;
u8 counter;
u32 offset2;
u32 offset;
u32 counter2;
tilemapBuffer = (u16 *)GetBgTilemapBuffer(2u);
counter = 1;
do
{
offset2 = 2;
offset = 0x20 * counter;
counter2 = counter + 1;
do
{
tilemapBuffer[offset + offset2] = ((Random() & 3) << 10) + 0x301F;
offset2 = (offset2 + 1) << 0x18 >> 0x18;
}
while ( offset2 <= 0x1B );
counter = counter2;
}
while ( counter2 << 0x18 >> 0x18 <= 0xCu );
schedule_bg_copy_tilemap_to_vram(2u);
}
+1 -1
View File
@@ -1147,7 +1147,7 @@ void PokeDude_InitTMCase(void)
AddBagItem(ITEM_TM03, 1);
AddBagItem(ITEM_TM09, 1);
AddBagItem(ITEM_TM35, 1);
InitTMCase(4, CB2_ReturnToTeachyTV, 0);
InitTMCase(4, sub_815ABFC, 0);
}
static void Task_TMCaseDude1(u8 taskId)
+18 -19
View File
@@ -24,8 +24,6 @@
#include "unk_810c3a4.h"
#include "constants/movement_commands.h"
#include "vs_seeker.h"
#include "item.h"
#include "constants/items.h"
typedef enum
{
@@ -637,7 +635,6 @@ void sub_810C444(void)
#ifdef NONMATCHING
bool8 sub_810C4EC(void)
{
s8 mask;
if (CheckBagHasItem(ITEM_VS_SEEKER, 1) == TRUE)
{
if ((gSaveBlock1Ptr->trainerRematchStepCounter & 0xFF) < 100)
@@ -646,23 +643,25 @@ bool8 sub_810C4EC(void)
if (FlagGet(0x801) == TRUE)
{
register u8 x,y;
x = gSaveBlock1Ptr->trainerRematchStepCounter >> 8;
if (x > 99) {
mask = -1;
goto section_1;
u16 x;
do {
x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & 0xFF;
} while (0);
if (x < 100)
{
x++;
gSaveBlock1Ptr->trainerRematchStepCounter = ((u16)(x << 8)) | (gSaveBlock1Ptr->trainerRematchStepCounter & 0xFF);
}
do {
x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & 0xFF;
} while (0);
if (x == 100)
{
FlagClear(0x801);
sub_810C640();
sub_810D0D0();
return TRUE;
}
y = ((u8)x + 1);
gSaveBlock1Ptr->trainerRematchStepCounter = (((gSaveBlock1Ptr->trainerRematchStepCounter) & (u8)0xFFFFFFFF) | (y << 8));
section_1:
x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & mask;
if (x == 100)
{
FlagClear(0x801);
sub_810C640();
sub_810D0D0();
return TRUE;
}
}
return FALSE;