mirror of
https://github.com/pret/pokediamond.git
synced 2026-10-01 04:46:47 -05:00
Merge pull request #560 from red031000/master
Some checks failed
build / build (push) Has been cancelled
Some checks failed
build / build (push) Has been cancelled
remove assignment and bitfield alignment
This commit is contained in:
@@ -5,12 +5,11 @@ LineEnding: LF
|
||||
ColumnLimit: 0
|
||||
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: true
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
AlignEscapedNewlines: LeftWithLastLine
|
||||
AlignTrailingComments: true
|
||||
AlignArrayOfStructures: Left
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ label:
|
||||
|
||||
void ov05_021E7358(FieldSystem *fieldSystem, u32 param1, u32 param2) {
|
||||
UnkStruct021E7358 *res = ov05_021E74D4(24);
|
||||
res->fieldSystem = fieldSystem;
|
||||
res->Unk10 = param1;
|
||||
res->Unk00 = param2;
|
||||
res->fieldSystem = fieldSystem;
|
||||
res->Unk10 = param1;
|
||||
res->Unk00 = param2;
|
||||
PlaySE(SEQ_SE_DP_F209);
|
||||
FieldSystem_CreateTask(fieldSystem, ov05_021E73B4, res);
|
||||
}
|
||||
@@ -65,9 +65,9 @@ u32 ov05_021E7388(u32 param0) {
|
||||
}
|
||||
|
||||
BOOL ov05_021E73B4(TaskManager *taskManager) {
|
||||
UnkStruct021E7358 *strct = TaskManager_GetEnvironment(taskManager);
|
||||
UnkStruct021E7358 *strct = TaskManager_GetEnvironment(taskManager);
|
||||
LocalMapObject *playerObject = PlayerAvatar_GetMapObject(strct->Unk10);
|
||||
u8 res2 = (u8)sub_02058720(playerObject);
|
||||
u8 res2 = (u8)sub_02058720(playerObject);
|
||||
switch (strct->Unk08) {
|
||||
case 0:
|
||||
MapObject_SetFlagsBits(playerObject, MAPOBJECTFLAG_UNK8);
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
#include "heap.h"
|
||||
|
||||
const struct BgTemplate ov19_02252508 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0x000,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GF_BG_CLR_4BPP,
|
||||
.baseTile = 0x000,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GF_BG_CLR_4BPP,
|
||||
.screenBase = 12,
|
||||
.charBase = 0,
|
||||
.priority = 0,
|
||||
.areaOver = 0,
|
||||
.mosaic = 0
|
||||
.charBase = 0,
|
||||
.priority = 0,
|
||||
.areaOver = 0,
|
||||
.mosaic = 0
|
||||
};
|
||||
|
||||
void ov19_02252440(struct BgConfig *bgConfig) {
|
||||
|
||||
@@ -46,7 +46,7 @@ BOOL ov21_0225489C(UnkStruct02254854 *param0, u32 param1, u32 param2, u32 param3
|
||||
param0->bytearray[2] = 0;
|
||||
param0->bytearray[3] = 1;
|
||||
param0->bytearray[6] = 0;
|
||||
param0->Unk20 = 0;
|
||||
param0->Unk20 = 0;
|
||||
GF_RTC_CopyTime(¶m0->time);
|
||||
if (param0->time.hour >= 0x18) {
|
||||
param0->time.hour = param0->time.hour % 0x18;
|
||||
@@ -55,7 +55,7 @@ BOOL ov21_0225489C(UnkStruct02254854 *param0, u32 param1, u32 param2, u32 param3
|
||||
param0->time.hour = param0->time.hour % 0x3c;
|
||||
}
|
||||
param0->bytearray[5] = (u8)param0->time.minute;
|
||||
param0->Unk10 = ov20_02254130((void *)ov21_02254D80, TRUE, ov21_02254974, param0, 8);
|
||||
param0->Unk10 = ov20_02254130((void *)ov21_02254D80, TRUE, ov21_02254974, param0, 8);
|
||||
if (param0->Unk10 == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -94,11 +94,11 @@ void ov21_02254974(u32 param0, u32 param1, u32 param2, UnkStruct02254854 *param3
|
||||
#pragma unused(param0, param1)
|
||||
switch (param2) {
|
||||
case 1:
|
||||
param3->Unk20 = 1;
|
||||
param3->Unk20 = 1;
|
||||
param3->bytearray[6] = 1;
|
||||
return;
|
||||
case 0:
|
||||
param3->Unk20 = 0;
|
||||
param3->Unk20 = 0;
|
||||
param3->bytearray[6] = 1;
|
||||
return;
|
||||
default:
|
||||
|
||||
@@ -45,7 +45,7 @@ BOOL ov21_02254A6C(UnkStruct02254A6C *param0, void *param1) {
|
||||
ov20_022536F4(strct->Unk08, 8);
|
||||
strct->Unk00 = param1;
|
||||
strct->Unk04 = ov20_02252D34();
|
||||
void *res = GfGfxLoader_GetScrnData(12, 0x19, 1, &sp4, 8);
|
||||
void *res = GfGfxLoader_GetScrnData(12, 0x19, 1, &sp4, 8);
|
||||
if (res == 0) {
|
||||
FreeToHeap(strct);
|
||||
return FALSE;
|
||||
@@ -100,13 +100,13 @@ BOOL ov21_02254B60(u32 param0, void *param1) {
|
||||
ov20_02252D7C(0, 0);
|
||||
ov21_02254C5C(strct);
|
||||
BgCommitTilemapBufferToVram(strct->Unk04, 6);
|
||||
u32 r3 = reg_GXS_DB_DISPCNT;
|
||||
u32 r2 = reg_GXS_DB_DISPCNT;
|
||||
u32 r3 = reg_GXS_DB_DISPCNT;
|
||||
u32 r2 = reg_GXS_DB_DISPCNT;
|
||||
vu32 tmp = r3; // unused? wtf
|
||||
u32 r0 = ~0x1F00 & r2;
|
||||
r2 = r3 << 19; // cast with shift? can't replicate both though
|
||||
r3 = r2 >> 27;
|
||||
r2 = 4 | r3;
|
||||
u32 r0 = ~0x1F00 & r2;
|
||||
r2 = r3 << 19; // cast with shift? can't replicate both though
|
||||
r3 = r2 >> 27;
|
||||
r2 = 4 | r3;
|
||||
r2 <<= 8;
|
||||
r0 |= r2;
|
||||
reg_GXS_DB_DISPCNT = r0;
|
||||
@@ -140,13 +140,13 @@ BOOL ov21_02254C40(u32 param0, void *param1) {
|
||||
}
|
||||
|
||||
void ov21_02254C5C(UnkStruct02254A6C *param0) {
|
||||
u32 tmp = (u32)param0->Unk00->Unk00;
|
||||
reg_CP_DIVCNT = 0;
|
||||
u32 tmp = (u32)param0->Unk00->Unk00;
|
||||
reg_CP_DIVCNT = 0;
|
||||
(*(vu32 *)REG_DIV_NUMER_ADDR) = tmp;
|
||||
reg_CP_DIV_DENOM = 10;
|
||||
reg_CP_DIV_DENOM = 10;
|
||||
while (reg_CP_DIVCNT & ((u32)®_CP_DIVCNT >> 0xb)) {}
|
||||
|
||||
u32 regaddr = (u32)®_CP_DIV_RESULT_L;
|
||||
u32 regaddr = (u32)®_CP_DIV_RESULT_L;
|
||||
u32 divResult = *(u32 *)regaddr;
|
||||
while (reg_CP_DIVCNT & (regaddr >> 0xb)) {}
|
||||
|
||||
@@ -154,10 +154,10 @@ void ov21_02254C5C(UnkStruct02254A6C *param0) {
|
||||
CopyToBgTilemapRect(param0->Unk04, 6, 3, 7, 4, 9, param0->Unk30, (u8)(divResult << 2), 0, 40, 9);
|
||||
CopyToBgTilemapRect(param0->Unk04, 6, 8, 7, 4, 9, param0->Unk30, (u8)(divRemRes << 2), 0, 40, 9);
|
||||
|
||||
tmp = param0->Unk00->Unk04;
|
||||
reg_CP_DIVCNT = 0;
|
||||
tmp = param0->Unk00->Unk04;
|
||||
reg_CP_DIVCNT = 0;
|
||||
(*(vu32 *)REG_DIV_NUMER_ADDR) = tmp;
|
||||
reg_CP_DIV_DENOM = 10;
|
||||
reg_CP_DIV_DENOM = 10;
|
||||
|
||||
while (reg_CP_DIVCNT & ((u32)®_CP_DIVCNT >> 0xb)) {}
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
typedef enum {
|
||||
TOUCH_TYPE_ERASE = 0,
|
||||
TOUCH_TYPE_DRAW = 1,
|
||||
TOUCH_TYPE_DRAW = 1,
|
||||
} TouchType;
|
||||
|
||||
typedef enum {
|
||||
MEMO_PAD_PIXEL_TYPE_FILLED = 1,
|
||||
MEMO_PAD_PIXEL_TYPE_EMPTY = 4,
|
||||
MEMO_PAD_PIXEL_TYPE_EMPTY = 4,
|
||||
} MemoPadPixelType;
|
||||
|
||||
typedef struct MemoPadDrawState {
|
||||
|
||||
@@ -39,15 +39,15 @@ BOOL ov24_0225489C(MemoPadAppHandler *appHandler, u32 arg1, u32 arg2, u32 arg3)
|
||||
static const u8 ov24_022550F8[] = {
|
||||
0x18, 0x58, 0xB4, 0xCC, 0x68, 0xA8, 0xB4, 0xCC
|
||||
};
|
||||
appHandler->drawState.unk16E8 = arg3;
|
||||
appHandler->drawState.unk16E8 = arg3;
|
||||
appHandler->drawState.touchType = TOUCH_TYPE_DRAW;
|
||||
if (ov24_02254CA0(&(appHandler->displayHandler), &(appHandler->drawState))) {
|
||||
appHandler->unk0 = 0;
|
||||
appHandler->unk1 = 0;
|
||||
appHandler->unk2 = 0;
|
||||
appHandler->unk0 = 0;
|
||||
appHandler->unk1 = 0;
|
||||
appHandler->unk2 = 0;
|
||||
appHandler->touchHeld = FALSE;
|
||||
appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8);
|
||||
appHandler->unk16F8 = arg1;
|
||||
appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8);
|
||||
appHandler->unk16F8 = arg1;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -151,8 +151,8 @@ BOOL ov24_02254A70(MemoPadAppHandler *appHandler) {
|
||||
y = (y - 16) >> 1;
|
||||
if (appHandler->drawState.pixelData[x][y] != appHandler->drawState.touchType) {
|
||||
appHandler->drawState.pixelData[x][y] = appHandler->drawState.touchType;
|
||||
appHandler->drawState.lastModifiedX = x;
|
||||
appHandler->drawState.lastModifiedY = y;
|
||||
appHandler->drawState.lastModifiedX = x;
|
||||
appHandler->drawState.lastModifiedY = y;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -164,8 +164,8 @@ BOOL ov24_02254AD4(MemoPadAppHandler *appHandler) {
|
||||
u32 x, y;
|
||||
if (TouchScreen_GetTapState(&x, &y)) {
|
||||
if (((x - 16) < 156) & ((y - 16) < 150)) {
|
||||
x = (x - 16) >> 1;
|
||||
y = (y - 16) >> 1;
|
||||
x = (x - 16) >> 1;
|
||||
y = (y - 16) >> 1;
|
||||
appHandler->drawState.lastModifiedX = x;
|
||||
appHandler->drawState.lastModifiedY = y;
|
||||
return TRUE;
|
||||
@@ -197,8 +197,8 @@ void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1
|
||||
if ((x0 < 0x4e) && ((u32)offset < 0x4b)) {
|
||||
if (appHandler->drawState.touchType != appHandler->drawState.pixelData[x0][offset]) {
|
||||
appHandler->drawState.pixelData[x0][offset] = appHandler->drawState.touchType;
|
||||
appHandler->drawState.lastModifiedX = x0;
|
||||
appHandler->drawState.lastModifiedY = offset;
|
||||
appHandler->drawState.lastModifiedX = x0;
|
||||
appHandler->drawState.lastModifiedY = offset;
|
||||
ov24_02254D8C(appHandler->displayHandler, 3);
|
||||
}
|
||||
}
|
||||
@@ -220,8 +220,8 @@ void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1
|
||||
if ((y0 < 0x4b) && ((u32)offset < 0x4e)) {
|
||||
if (appHandler->drawState.touchType != appHandler->drawState.pixelData[offset][y0]) {
|
||||
appHandler->drawState.pixelData[offset][y0] = appHandler->drawState.touchType;
|
||||
appHandler->drawState.lastModifiedX = offset;
|
||||
appHandler->drawState.lastModifiedY = y0;
|
||||
appHandler->drawState.lastModifiedX = offset;
|
||||
appHandler->drawState.lastModifiedY = y0;
|
||||
ov24_02254D8C(appHandler->displayHandler, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState *
|
||||
ov20_022536F4(&(displayHandler->unk8), 0x10);
|
||||
GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN));
|
||||
displayHandler->drawState = drawState;
|
||||
displayHandler->config = ov20_02252D34();
|
||||
displayHandler->unk50 = ov20_02252D24();
|
||||
displayHandler->config = ov20_02252D34();
|
||||
displayHandler->unk50 = ov20_02252D24();
|
||||
GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN));
|
||||
*displayHandlerOut = displayHandler;
|
||||
return TRUE;
|
||||
@@ -46,12 +46,12 @@ BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState *
|
||||
|
||||
BOOL ov24_02254D00(MemoPadDisplayHandler *displayHandler) {
|
||||
static const WindowTemplate template = {
|
||||
.bgId = GF_BG_LYR_SUB_3,
|
||||
.left = 2,
|
||||
.top = 2,
|
||||
.width = 20,
|
||||
.height = 19,
|
||||
.palette = 0,
|
||||
.bgId = GF_BG_LYR_SUB_3,
|
||||
.left = 2,
|
||||
.top = 2,
|
||||
.width = 20,
|
||||
.height = 19,
|
||||
.palette = 0,
|
||||
.baseTile = 12,
|
||||
};
|
||||
displayHandler->window = AllocWindows(HEAP_ID_POKETCH_APP, 1);
|
||||
@@ -119,34 +119,34 @@ void ov24_02254DC8(void *arg0) {
|
||||
|
||||
void ov24_02254DDC(void *arg0, void *arg1) {
|
||||
static const BgTemplate template_7000 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0,
|
||||
.baseTile = 0,
|
||||
.size = 1,
|
||||
.colorMode = 0,
|
||||
.baseTile = 0,
|
||||
.size = 1,
|
||||
.colorMode = 0,
|
||||
.screenBase = GX_BG_SCRBASE_0x7000,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = 0,
|
||||
.priority = 2,
|
||||
.areaOver = 0,
|
||||
.dummy = 0,
|
||||
.mosaic = 0,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = 0,
|
||||
.priority = 2,
|
||||
.areaOver = 0,
|
||||
.dummy = 0,
|
||||
.mosaic = 0,
|
||||
};
|
||||
static const BgTemplate template_7800 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.size = 1,
|
||||
.colorMode = 0,
|
||||
.baseTile = 0,
|
||||
.size = 1,
|
||||
.colorMode = 0,
|
||||
.screenBase = GX_BG_SCRBASE_0x7800,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = 0,
|
||||
.priority = 3,
|
||||
.areaOver = 0,
|
||||
.dummy = 0,
|
||||
.mosaic = 0,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = 0,
|
||||
.priority = 3,
|
||||
.areaOver = 0,
|
||||
.dummy = 0,
|
||||
.mosaic = 0,
|
||||
};
|
||||
GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP));
|
||||
GXSDispCnt dispcnt;
|
||||
@@ -191,12 +191,12 @@ void ov24_02254F28(s32 arg0, void *arg1) {
|
||||
|
||||
void ov24_02254F40(u32 arg0, void *arg1) {
|
||||
MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1);
|
||||
MemoPadDrawState *drawState = displayHandler->drawState;
|
||||
MemoPadDrawState *drawState = displayHandler->drawState;
|
||||
if (drawState->touchType == TOUCH_TYPE_ERASE) {
|
||||
s32 width, height;
|
||||
width = height = 8;
|
||||
s32 x = drawState->lastModifiedX * 2 - 4;
|
||||
s32 y = drawState->lastModifiedY * 2 - 4;
|
||||
s32 x = drawState->lastModifiedX * 2 - 4;
|
||||
s32 y = drawState->lastModifiedY * 2 - 4;
|
||||
if (x < 0) {
|
||||
width += x;
|
||||
x = 0;
|
||||
@@ -215,10 +215,10 @@ void ov24_02254F40(u32 arg0, void *arg1) {
|
||||
}
|
||||
} else {
|
||||
s32 height = 2;
|
||||
s32 width = 2;
|
||||
s32 x = drawState->lastModifiedX * 2;
|
||||
s32 y = drawState->lastModifiedY * 2;
|
||||
s32 a = (x >> 3) + ((y >> 3) * 0x14);
|
||||
s32 width = 2;
|
||||
s32 x = drawState->lastModifiedX * 2;
|
||||
s32 y = drawState->lastModifiedY * 2;
|
||||
s32 a = (x >> 3) + ((y >> 3) * 0x14);
|
||||
FillWindowPixelRect(displayHandler->window, MEMO_PAD_PIXEL_TYPE_FILLED, x, y, width, height);
|
||||
GXS_LoadBG3Char((u8 *)(displayHandler->window->pixelBuffer) + a * 0x20, (a + 0xc) * 0x20, 0x20);
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ void ov52_021D7604(HeapID heapId, struct SaveData *save, BOOL set_trainerid) {
|
||||
sub_0206007C(save);
|
||||
|
||||
PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(save);
|
||||
u32 trainerid = MTRandom();
|
||||
u32 trainerid = MTRandom();
|
||||
|
||||
if (set_trainerid) {
|
||||
PlayerProfile_SetTrainerID(playerProfile, trainerid);
|
||||
|
||||
@@ -36,71 +36,71 @@ extern void *sub_02077A84(HeapID heapId, u32 param1, u32 param2, u32 param3, str
|
||||
extern void sub_0200E3A0(PMLCDTarget, int);
|
||||
|
||||
const struct WindowTemplate ov59_021D9DB8 = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 2,
|
||||
.top = 19,
|
||||
.width = 27,
|
||||
.height = 4,
|
||||
.palette = 6,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 2,
|
||||
.top = 19,
|
||||
.width = 27,
|
||||
.height = 4,
|
||||
.palette = 6,
|
||||
.baseTile = 877,
|
||||
};
|
||||
|
||||
const struct WindowTemplate ov59_021D9DA8 = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 2,
|
||||
.top = 3,
|
||||
.width = 6,
|
||||
.height = 4,
|
||||
.palette = 5,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 2,
|
||||
.top = 3,
|
||||
.width = 6,
|
||||
.height = 4,
|
||||
.palette = 5,
|
||||
.baseTile = 853,
|
||||
};
|
||||
|
||||
const struct WindowTemplate ov59_021D9DB0 = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 1,
|
||||
.top = 3,
|
||||
.width = 16,
|
||||
.height = 6,
|
||||
.palette = 5,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 1,
|
||||
.top = 3,
|
||||
.width = 16,
|
||||
.height = 6,
|
||||
.palette = 5,
|
||||
.baseTile = 781,
|
||||
};
|
||||
|
||||
const struct WindowTemplate ov59_021D9D90 = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 8,
|
||||
.top = 0,
|
||||
.width = 24,
|
||||
.height = 24,
|
||||
.palette = 5,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 8,
|
||||
.top = 0,
|
||||
.width = 24,
|
||||
.height = 24,
|
||||
.palette = 5,
|
||||
.baseTile = 301,
|
||||
};
|
||||
|
||||
const struct WindowTemplate ov59_021D9D98 = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 4,
|
||||
.top = 0,
|
||||
.width = 24,
|
||||
.height = 24,
|
||||
.palette = 5,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 4,
|
||||
.top = 0,
|
||||
.width = 24,
|
||||
.height = 24,
|
||||
.palette = 5,
|
||||
.baseTile = 301,
|
||||
};
|
||||
|
||||
const struct WindowTemplate ov59_021D9DA0 = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 2,
|
||||
.top = 3,
|
||||
.width = 14,
|
||||
.height = 10,
|
||||
.palette = 5,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 2,
|
||||
.top = 3,
|
||||
.width = 14,
|
||||
.height = 10,
|
||||
.palette = 5,
|
||||
.baseTile = 737,
|
||||
};
|
||||
|
||||
const u32 ov59_021D9DC0[3] = { NARC_intro_pokeball_button_2_NCGR, NARC_intro_pokeball_button_3_NCGR, 0xFFFF };
|
||||
|
||||
const struct GraphicsModes ov59_021D9DCC = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ const struct OverlayManagerTemplate ov59_021D9DDC = {
|
||||
.initFunc = ov59_TVInit,
|
||||
.mainFunc = ov59_TVMain,
|
||||
.exitFunc = ov59_TVExit,
|
||||
.ovly = SDK_OVERLAY_INVALID_ID
|
||||
.ovly = SDK_OVERLAY_INVALID_ID
|
||||
};
|
||||
|
||||
const struct ov59_CharStruct021D9DEC ov59_021D9DEC = {
|
||||
@@ -154,61 +154,61 @@ const struct ov59_CharStruct021D9E70 ov59_021D9E88 = {
|
||||
};
|
||||
|
||||
const struct BgTemplate ov59_021D9EA0 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 2048,
|
||||
.baseTile = 0,
|
||||
.baseTile = 0,
|
||||
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
const struct BgTemplate ov59_021D9EBC = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 2048,
|
||||
.baseTile = 0,
|
||||
.baseTile = 0,
|
||||
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 0,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 0,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
const u16 ov59_021D9ED8[0x10] = { 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C };
|
||||
|
||||
const struct ListMenuTemplate ov59_021D9EF8 = {
|
||||
.items = NULL,
|
||||
.moveCursorFunc = NULL,
|
||||
.itemPrintFunc = NULL,
|
||||
.window = NULL,
|
||||
.totalItems = 0,
|
||||
.maxShowed = 0,
|
||||
.header_X = 0,
|
||||
.item_X = 12,
|
||||
.cursor_X = 0,
|
||||
.upText_Y = 0,
|
||||
.cursorPal = 1,
|
||||
.fillValue = 15,
|
||||
.cursorShadowPal = 2,
|
||||
.lettersSpacing = 0,
|
||||
.items = NULL,
|
||||
.moveCursorFunc = NULL,
|
||||
.itemPrintFunc = NULL,
|
||||
.window = NULL,
|
||||
.totalItems = 0,
|
||||
.maxShowed = 0,
|
||||
.header_X = 0,
|
||||
.item_X = 12,
|
||||
.cursor_X = 0,
|
||||
.upText_Y = 0,
|
||||
.cursorPal = 1,
|
||||
.fillValue = 15,
|
||||
.cursorShadowPal = 2,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.fontId = 0,
|
||||
.cursorKind = 0,
|
||||
.unk_1C = 0
|
||||
.scrollMultiple = 0,
|
||||
.fontId = 0,
|
||||
.cursorKind = 0,
|
||||
.unk_1C = 0
|
||||
};
|
||||
|
||||
const struct ov59_ListStruct021D9E0C ov59_021D9F40[5] = {
|
||||
@@ -238,50 +238,50 @@ const struct ov59_ListStruct021D9E0C ov59_021D9F68[5] = {
|
||||
};
|
||||
|
||||
const struct GraphicsBanks ov59_021D9F18 = {
|
||||
.bg = GX_VRAM_BG_128_B,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_128_C,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.bg = GX_VRAM_BG_128_B,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_128_C,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE
|
||||
};
|
||||
|
||||
const struct ov59_GraphicsPaletteMap021D9F90 ov59_021D9F90 = {
|
||||
.map = {
|
||||
{ .charNum = 0,
|
||||
{ .charNum = 0,
|
||||
.palNum = 0 },
|
||||
// rowan sprite
|
||||
{
|
||||
.charNum = NARC_intro_rowan_front_NCGR,
|
||||
.palNum = NARC_intro_rowan_front_NCLR },
|
||||
.palNum = NARC_intro_rowan_front_NCLR },
|
||||
// boy sprites
|
||||
{
|
||||
.charNum = NARC_intro_lucas_walk_1_NCGR,
|
||||
.palNum = NARC_intro_lucas_walk_NCLR },
|
||||
{ .charNum = NARC_intro_lucas_walk_2_NCGR,
|
||||
.palNum = NARC_intro_lucas_walk_NCLR },
|
||||
{ .charNum = NARC_intro_lucas_walk_3_NCGR,
|
||||
{ .charNum = NARC_intro_lucas_walk_2_NCGR,
|
||||
.palNum = NARC_intro_lucas_walk_NCLR },
|
||||
{ .charNum = NARC_intro_lucas_walk_4_NCGR,
|
||||
{ .charNum = NARC_intro_lucas_walk_3_NCGR,
|
||||
.palNum = NARC_intro_lucas_walk_NCLR },
|
||||
{ .charNum = NARC_intro_lucas_walk_4_NCGR,
|
||||
.palNum = NARC_intro_lucas_walk_NCLR },
|
||||
// girl sprites
|
||||
{
|
||||
.charNum = NARC_intro_dawn_walk_1_NCGR,
|
||||
.palNum = NARC_intro_dawn_walk_NCLR },
|
||||
{ .charNum = NARC_intro_dawn_walk_2_NCGR,
|
||||
.palNum = NARC_intro_dawn_walk_NCLR },
|
||||
{ .charNum = NARC_intro_dawn_walk_3_NCGR,
|
||||
{ .charNum = NARC_intro_dawn_walk_2_NCGR,
|
||||
.palNum = NARC_intro_dawn_walk_NCLR },
|
||||
{ .charNum = NARC_intro_dawn_walk_4_NCGR,
|
||||
{ .charNum = NARC_intro_dawn_walk_3_NCGR,
|
||||
.palNum = NARC_intro_dawn_walk_NCLR },
|
||||
{ .charNum = NARC_intro_dawn_walk_4_NCGR,
|
||||
.palNum = NARC_intro_dawn_walk_NCLR },
|
||||
// barry sprite
|
||||
{
|
||||
.charNum = NARC_intro_barry_front_NCGR,
|
||||
.palNum = NARC_intro_barry_front_NCLR } }
|
||||
.palNum = NARC_intro_barry_front_NCLR } }
|
||||
};
|
||||
|
||||
const u8 ov59_021D9FE8[0x64] = {
|
||||
@@ -316,25 +316,25 @@ BOOL ov59_IntroInit(struct OverlayManager *overlayManager, u32 *status) {
|
||||
ov59_IntroOverlayData *data = (ov59_IntroOverlayData *)OverlayManager_CreateAndGetData(overlayManager, sizeof(ov59_IntroOverlayData), HEAP_ID_INTRO);
|
||||
memset((void *)data, 0, sizeof(ov59_IntroOverlayData));
|
||||
|
||||
data->heapId = HEAP_ID_INTRO;
|
||||
s32 *field18 = OverlayManager_GetField18(overlayManager);
|
||||
data->save = (struct SaveData *)field18[2]; //?
|
||||
data->options = Save_PlayerData_GetOptionsAddr(data->save);
|
||||
data->heapId = HEAP_ID_INTRO;
|
||||
s32 *field18 = OverlayManager_GetField18(overlayManager);
|
||||
data->save = (struct SaveData *)field18[2]; //?
|
||||
data->options = Save_PlayerData_GetOptionsAddr(data->save);
|
||||
data->nextControllerCounter = data->controllerCounter = 0;
|
||||
data->loadedOverlay = NULL;
|
||||
data->playerStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 0, 0, 7, data->options);
|
||||
data->rivalStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 3, 0, 7, data->options);
|
||||
data->scrnDataIndexMain = 0;
|
||||
data->spriteDataIndex0 = 0;
|
||||
data->spriteDataIndex1 = 0;
|
||||
data->scrnDataIndexSub = 0;
|
||||
data->tickTimer = 0;
|
||||
data->loadedOverlay = NULL;
|
||||
data->playerStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 0, 0, 7, data->options);
|
||||
data->rivalStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 3, 0, 7, data->options);
|
||||
data->scrnDataIndexMain = 0;
|
||||
data->spriteDataIndex0 = 0;
|
||||
data->spriteDataIndex1 = 0;
|
||||
data->scrnDataIndexSub = 0;
|
||||
data->tickTimer = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ov59_IntroMain(struct OverlayManager *overlayManager, u32 *status) {
|
||||
ov59_IntroOverlayData *data = (ov59_IntroOverlayData *)OverlayManager_GetData(overlayManager);
|
||||
BOOL ret = FALSE;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
switch (*status) {
|
||||
case 0:
|
||||
@@ -481,23 +481,23 @@ void ov59_IntroSetupBg(ov59_IntroOverlayData *data) {
|
||||
SetBothScreensModesAndDisable(&graphicsModes);
|
||||
|
||||
struct BgTemplate bgTemplateMain = ov59_021D9EA0;
|
||||
bgTemplateMain.screenBase = GX_BG_SCRBASE_0x7800;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x18000;
|
||||
bgTemplateMain.screenBase = GX_BG_SCRBASE_0x7800;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x18000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_0, &bgTemplateMain, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_0);
|
||||
|
||||
bgTemplateMain.screenBase = GX_BG_SCRBASE_0x7000;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x14000;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x14000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_1, &bgTemplateMain, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_1);
|
||||
|
||||
bgTemplateMain.screenBase = GX_BG_SCRBASE_0x6800;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x10000;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x10000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_2, &bgTemplateMain, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_2);
|
||||
|
||||
bgTemplateMain.screenBase = GX_BG_SCRBASE_0x6000;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x0c000;
|
||||
bgTemplateMain.charBase = GX_BG_CHARBASE_0x0c000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_3, &bgTemplateMain, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_3);
|
||||
|
||||
@@ -507,23 +507,23 @@ void ov59_IntroSetupBg(ov59_IntroOverlayData *data) {
|
||||
LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_6_OFFSET, data->heapId);
|
||||
|
||||
struct BgTemplate bgTemplateSub = ov59_021D9EBC;
|
||||
bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7800;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x18000;
|
||||
bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7800;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x18000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_0, &bgTemplateSub, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_0);
|
||||
|
||||
bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7000;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x14000;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x14000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_1, &bgTemplateSub, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_1);
|
||||
|
||||
bgTemplateSub.screenBase = GX_BG_SCRBASE_0x6800;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x10000;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x10000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_2, &bgTemplateSub, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_2);
|
||||
|
||||
bgTemplateSub.screenBase = GX_BG_SCRBASE_0x6000;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x0c000;
|
||||
bgTemplateSub.charBase = GX_BG_CHARBASE_0x0c000;
|
||||
InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_3, &bgTemplateSub, GF_BG_TYPE_TEXT);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_3);
|
||||
|
||||
@@ -574,9 +574,9 @@ void ov59_IntroSetupMsg(ov59_IntroOverlayData *data) {
|
||||
|
||||
data->messageFormat = MessageFormat_New(data->heapId);
|
||||
|
||||
data->displayMessageCounter = 0;
|
||||
data->displayMessageCounter = 0;
|
||||
data->displayControlMessageCounter = 0;
|
||||
data->createListCounter = 0;
|
||||
data->createListCounter = 0;
|
||||
}
|
||||
|
||||
void ov59_IntroDestroyMsg(ov59_IntroOverlayData *data) {
|
||||
@@ -673,10 +673,10 @@ BOOL ov59_FadeController(ov59_IntroOverlayData *data, u32 bgId, u32 param2) {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
reg_G2_BLDCNT = 0;
|
||||
reg_G2_BLDCNT = 0;
|
||||
reg_G2S_DB_BLDCNT = 0;
|
||||
data->fadeCounter = 0;
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
@@ -710,15 +710,15 @@ BOOL ov59_DisplayMessage(ov59_IntroOverlayData *data, u32 msgNo, BOOL autoAdvanc
|
||||
sub_02002B7C(0);
|
||||
|
||||
struct String *string = String_New(1024, data->heapId);
|
||||
data->string = String_New(1024, data->heapId);
|
||||
data->string = String_New(1024, data->heapId);
|
||||
ReadMsgDataIntoString(data->msgData, msgNo, string);
|
||||
BufferString(data->messageFormat, 0, data->playerStruct->name, data->selectedGender, 1, 2);
|
||||
BufferString(data->messageFormat, 1, data->rivalStruct->name, 0, 1, 2);
|
||||
StringExpandPlaceholders(data->messageFormat, data->string, string);
|
||||
String_Delete(string);
|
||||
|
||||
u32 delay = Options_GetTextFrameDelay(data->options);
|
||||
data->minTextSpacing = AddTextPrinterParameterized(&data->window, 1, data->string, 0, 0, delay, NULL);
|
||||
u32 delay = Options_GetTextFrameDelay(data->options);
|
||||
data->minTextSpacing = AddTextPrinterParameterized(&data->window, 1, data->string, 0, 0, delay, NULL);
|
||||
data->displayMessageCounter = 1;
|
||||
break;
|
||||
case 1:
|
||||
@@ -732,7 +732,7 @@ BOOL ov59_DisplayMessage(ov59_IntroOverlayData *data, u32 msgNo, BOOL autoAdvanc
|
||||
if (autoAdvance != FALSE || (gSystem.newKeys & PAD_BUTTON_A) == 1) {
|
||||
RemoveWindow(&data->window);
|
||||
data->displayMessageCounter = 0;
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -759,21 +759,21 @@ BOOL ov59_CreateListWithText(ov59_IntroOverlayData *data, u32 param1, u32 param2
|
||||
default:
|
||||
case 0:
|
||||
windowTemplate = &ov59_021D9DA8;
|
||||
listStruct = ov59_021D9E0C;
|
||||
listStruct = ov59_021D9E0C;
|
||||
menuItemsCount = 2;
|
||||
break;
|
||||
case 1:
|
||||
windowTemplate = &ov59_021D9DB0;
|
||||
listStruct = ov59_021D9E58;
|
||||
listStruct = ov59_021D9E58;
|
||||
menuItemsCount = 3;
|
||||
break;
|
||||
case 2:
|
||||
windowTemplate = &ov59_021D9DA0;
|
||||
if ((u8)gGameVersion == VERSION_DIAMOND) {
|
||||
listStruct = ov59_021D9F40;
|
||||
listStruct = ov59_021D9F40;
|
||||
menuItemsCount = 5;
|
||||
} else {
|
||||
listStruct = ov59_021D9F68;
|
||||
listStruct = ov59_021D9F68;
|
||||
menuItemsCount = 5;
|
||||
}
|
||||
break;
|
||||
@@ -784,12 +784,12 @@ BOOL ov59_CreateListWithText(ov59_IntroOverlayData *data, u32 param1, u32 param2
|
||||
ListMenuItems_AppendFromMsgData(data->listMenuItem, data->msgData, listStruct[i].msgNo, listStruct[i].val);
|
||||
}
|
||||
struct ListMenuTemplate template = ov59_021D9EF8;
|
||||
template.items = data->listMenuItem;
|
||||
template.totalItems = (u16)menuItemsCount;
|
||||
template.maxShowed = (u16)menuItemsCount;
|
||||
template.moveCursorFunc = ov59_PlaySelectSound;
|
||||
template.window = &data->listWindow;
|
||||
data->listMenu = ListMenuInit(&template, 0, 0, data->heapId);
|
||||
template.items = data->listMenuItem;
|
||||
template.totalItems = (u16)menuItemsCount;
|
||||
template.maxShowed = (u16)menuItemsCount;
|
||||
template.moveCursorFunc = ov59_PlaySelectSound;
|
||||
template.window = &data->listWindow;
|
||||
data->listMenu = ListMenuInit(&template, 0, 0, data->heapId);
|
||||
DrawFrameAndWindow1(template.window, TRUE, 985, 3);
|
||||
CopyWindowToVram(&data->listWindow);
|
||||
data->createListCounter = 1;
|
||||
@@ -805,7 +805,7 @@ BOOL ov59_CreateListWithText(ov59_IntroOverlayData *data, u32 param1, u32 param2
|
||||
ListMenuItems_Delete(data->listMenuItem);
|
||||
PlaySE(SEQ_SE_DP_SELECT);
|
||||
data->createListCounter = 0;
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -819,16 +819,16 @@ BOOL ov59_DisplayControlAdventureMessage(ov59_IntroOverlayData *data, u32 msgNo,
|
||||
ReadMsgDataIntoString(data->msgData, msgNo, data->string);
|
||||
struct WindowTemplate template;
|
||||
if (param2 == 1) {
|
||||
template = ov59_021D9D98;
|
||||
u32 count = sub_02002F90(data->string);
|
||||
template.top = (u8)(12 - count);
|
||||
template = ov59_021D9D98;
|
||||
u32 count = sub_02002F90(data->string);
|
||||
template.top = (u8)(12 - count);
|
||||
template.height = (u8)(count * 2);
|
||||
AddWindow(data->bgConfig, &data->window, &template);
|
||||
FillWindowPixelRect(&data->window, 0, 0, 0, 192, 192);
|
||||
AddTextPrinterParameterized2(&data->window, 0, data->string, 0, 0, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(1, 2, 0), NULL);
|
||||
} else {
|
||||
template = ov59_021D9D90;
|
||||
template.top = (u8)tilemapTop;
|
||||
template = ov59_021D9D90;
|
||||
template.top = (u8)tilemapTop;
|
||||
template.height = (u8)height;
|
||||
AddWindow(data->bgConfig, &data->window, &template);
|
||||
FillWindowPixelRect(&data->window, 0, 0, 0, 192, 192);
|
||||
@@ -862,7 +862,7 @@ BOOL ov59_DisplayControlAdventureMessage(ov59_IntroOverlayData *data, u32 msgNo,
|
||||
RemoveWindow(&data->window);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_0);
|
||||
data->displayControlMessageCounter = 0;
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -876,10 +876,10 @@ void ov59_LoadInitialTilemap(ov59_IntroOverlayData *data) {
|
||||
u32 subPal;
|
||||
if ((u8)gGameVersion == VERSION_DIAMOND) {
|
||||
mainPal = NARC_intro_main_background_diamond_NCLR;
|
||||
subPal = NARC_intro_sub_background_diamond_NCLR;
|
||||
subPal = NARC_intro_sub_background_diamond_NCLR;
|
||||
} else {
|
||||
mainPal = NARC_intro_main_background_pearl_NCLR;
|
||||
subPal = NARC_intro_sub_background_pearl_NCLR;
|
||||
subPal = NARC_intro_sub_background_pearl_NCLR;
|
||||
}
|
||||
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, mainPal, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_0_OFFSET, 0x60, data->heapId);
|
||||
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, subPal, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_0_OFFSET, 0xa0, data->heapId);
|
||||
@@ -1150,10 +1150,10 @@ BOOL ov59_MoveSprite(ov59_IntroOverlayData *data, enum GFBgLayer layer, u32 para
|
||||
}
|
||||
|
||||
void ov59_ResetPlayerAnimation(ov59_IntroOverlayData *data) {
|
||||
data->maleAnimCounter = 0;
|
||||
data->maleAnimTimer = 0;
|
||||
data->maleAnimCounter = 0;
|
||||
data->maleAnimTimer = 0;
|
||||
data->femaleAnimCounter = 0;
|
||||
data->femaleAnimTimer = 0;
|
||||
data->femaleAnimTimer = 0;
|
||||
}
|
||||
|
||||
void ov59_AnimatePlayerSprite(ov59_IntroOverlayData *data) {
|
||||
@@ -1210,10 +1210,10 @@ BOOL ov59_PlayerShrinkAnimation(ov59_IntroOverlayData *data) {
|
||||
const struct ov59_CharStruct021D9E70 *addr;
|
||||
if (data->selectedGender == PLAYER_GENDER_MALE) {
|
||||
charStruct = ov59_021D9E88;
|
||||
addr = &charStruct;
|
||||
addr = &charStruct;
|
||||
} else {
|
||||
charStruct2 = ov59_021D9E70;
|
||||
addr = &charStruct2;
|
||||
addr = &charStruct2;
|
||||
}
|
||||
if (addr->charData[data->spriteDataIndex2] == 0xFF) {
|
||||
ret = TRUE;
|
||||
@@ -1237,15 +1237,15 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) {
|
||||
data->unkA8 = 0;
|
||||
data->unkAC = 8;
|
||||
data->unkB0 = 0;
|
||||
*param1 = 1;
|
||||
*param1 = 1;
|
||||
break;
|
||||
case 1:
|
||||
Bg_GetXpos(data->bgConfig, GF_BG_LYR_MAIN_2); // result discarded?
|
||||
fx32 pos = Bg_GetYpos(data->bgConfig, GF_BG_LYR_SUB_1);
|
||||
|
||||
b0 = data->unkB0;
|
||||
ac = data->unkAC;
|
||||
u32 unk = b0 * (ac + ac * 8);
|
||||
b0 = data->unkB0;
|
||||
ac = data->unkAC;
|
||||
u32 unk = b0 * (ac + ac * 8);
|
||||
s32 unk2 = b0 * (b0 + b0 * 8);
|
||||
|
||||
s32 unk3 = unk - unk2 / 2; // some kind of Y coordinate
|
||||
@@ -1258,7 +1258,7 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) {
|
||||
} else {
|
||||
ToggleBgLayer(GF_BG_LYR_SUB_1, GX_PLANE_TOGGLE_OFF);
|
||||
data->unkB0 = 30;
|
||||
*param1 = 2;
|
||||
*param1 = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@@ -1269,15 +1269,15 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) {
|
||||
data->unkA8 = 0;
|
||||
data->unkAC = 9;
|
||||
data->unkB0 = 0;
|
||||
*param1 = 3;
|
||||
*param1 = 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
Bg_GetXpos(data->bgConfig, GF_BG_LYR_MAIN_2); // result discarded?
|
||||
fx32 pos2 = Bg_GetYpos(data->bgConfig, GF_BG_LYR_MAIN_2);
|
||||
|
||||
b0 = data->unkB0;
|
||||
ac = data->unkAC;
|
||||
b0 = data->unkB0;
|
||||
ac = data->unkAC;
|
||||
u32 unk4 = b0 * (ac + ac * 8);
|
||||
s32 unk5 = b0 * (b0 + b0 * 8);
|
||||
|
||||
@@ -1288,7 +1288,7 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) {
|
||||
data->unkA8 = 0;
|
||||
data->unkAC = 1;
|
||||
data->unkB0 = 0;
|
||||
*param1 = 4;
|
||||
*param1 = 4;
|
||||
} else {
|
||||
data->unkB0++;
|
||||
data->unkA8 = unk6;
|
||||
@@ -1304,8 +1304,8 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) {
|
||||
Bg_GetXpos(data->bgConfig, GF_BG_LYR_MAIN_2); // result discarded?
|
||||
fx32 pos3 = Bg_GetYpos(data->bgConfig, GF_BG_LYR_MAIN_2);
|
||||
|
||||
b0 = data->unkB0;
|
||||
ac = data->unkAC;
|
||||
b0 = data->unkB0;
|
||||
ac = data->unkAC;
|
||||
u32 unk8 = b0 * (ac + ac * 8);
|
||||
s32 unk9 = b0 * (b0 + b0 * 8);
|
||||
|
||||
@@ -1705,12 +1705,12 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
switch (data->listMenuInput) {
|
||||
case 1: // Control Info
|
||||
data->nextControllerCounter = 10;
|
||||
data->controllerCounter = 8;
|
||||
data->controllerCounter = 8;
|
||||
break;
|
||||
|
||||
case 2: // Adventure Info
|
||||
data->nextControllerCounter = 31;
|
||||
data->controllerCounter = 8;
|
||||
data->controllerCounter = 8;
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_0);
|
||||
break;
|
||||
|
||||
@@ -2206,7 +2206,7 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
if (ov59_DisplayMessage(data, narc_0341_00021, TRUE) != TRUE) {
|
||||
break;
|
||||
}
|
||||
data->selectedGender = PLAYER_GENDER_MALE;
|
||||
data->selectedGender = PLAYER_GENDER_MALE;
|
||||
data->controllerCounter = 67;
|
||||
break;
|
||||
|
||||
@@ -2301,8 +2301,8 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
|
||||
case 76: // load keyboard overlay (except this is not an overlay at all)
|
||||
data->playerStruct->gender = data->selectedGender;
|
||||
data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->playerStruct, data->heapId);
|
||||
data->controllerCounter = 77;
|
||||
data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->playerStruct, data->heapId);
|
||||
data->controllerCounter = 77;
|
||||
break;
|
||||
|
||||
case 77: // toggle bg layers and position, fade from black
|
||||
@@ -2344,14 +2344,14 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
switch (data->listMenuInput) {
|
||||
case 1:
|
||||
data->nextControllerCounter = 82;
|
||||
data->controllerCounter = 81;
|
||||
data->controllerCounter = 81;
|
||||
break;
|
||||
|
||||
case -2:
|
||||
case 2:
|
||||
String_SetEmpty(data->playerStruct->name);
|
||||
data->nextControllerCounter = 63;
|
||||
data->controllerCounter = 81;
|
||||
data->controllerCounter = 81;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -2440,13 +2440,13 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
u32 index;
|
||||
u32 msgNo;
|
||||
if ((u8)gGameVersion == VERSION_DIAMOND) {
|
||||
index = data->listMenuInput - 1;
|
||||
index = data->listMenuInput - 1;
|
||||
nameList = ov59_021D9F40;
|
||||
msgNo = nameList[index].msgNo;
|
||||
msgNo = nameList[index].msgNo;
|
||||
} else {
|
||||
index = data->listMenuInput - 1;
|
||||
index = data->listMenuInput - 1;
|
||||
nameList = ov59_021D9F68;
|
||||
msgNo = nameList[index].msgNo;
|
||||
msgNo = nameList[index].msgNo;
|
||||
}
|
||||
struct String *name = NewString_ReadMsgData(data->msgData, msgNo);
|
||||
StringCopy(data->rivalStruct->name, name);
|
||||
@@ -2464,7 +2464,7 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
break;
|
||||
|
||||
case 92: // load keyboard
|
||||
data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->rivalStruct, data->heapId);
|
||||
data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->rivalStruct, data->heapId);
|
||||
data->controllerCounter = 93;
|
||||
break;
|
||||
|
||||
@@ -2597,7 +2597,7 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) {
|
||||
break;
|
||||
|
||||
case 108: // load overaly 59 TV
|
||||
data->loadedOverlay = OverlayManager_New(&ov59_021D9DDC, 0, data->heapId);
|
||||
data->loadedOverlay = OverlayManager_New(&ov59_021D9DDC, 0, data->heapId);
|
||||
data->controllerCounter = 109;
|
||||
break;
|
||||
|
||||
|
||||
@@ -26,101 +26,101 @@ extern void BeginNormalPaletteFade(u32 pattern, u32 typeTop, u32 typeBottom, u16
|
||||
extern BOOL IsPaletteFadeFinished(void);
|
||||
|
||||
const struct WindowTemplate ov59_021DA04C = {
|
||||
.bgId = GF_BG_LYR_MAIN_2,
|
||||
.left = 0,
|
||||
.top = 0,
|
||||
.width = 32,
|
||||
.height = 24,
|
||||
.palette = 1,
|
||||
.bgId = GF_BG_LYR_MAIN_2,
|
||||
.left = 0,
|
||||
.top = 0,
|
||||
.width = 32,
|
||||
.height = 24,
|
||||
.palette = 1,
|
||||
.baseTile = 1,
|
||||
};
|
||||
|
||||
const struct GraphicsModes ov59_021DA054 = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D,
|
||||
};
|
||||
|
||||
const struct BgTemplate ov59_021DA080 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 2048,
|
||||
.baseTile = 0,
|
||||
.baseTile = 0,
|
||||
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
const struct BgTemplate ov59_021DA09C = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 2048,
|
||||
.baseTile = 0,
|
||||
.baseTile = 0,
|
||||
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0800,
|
||||
.charBase = GX_BG_CHARBASE_0x14000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x14000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
const struct BgTemplate ov59_021DA064 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 2048,
|
||||
.baseTile = 0,
|
||||
.baseTile = 0,
|
||||
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x1000,
|
||||
.charBase = GX_BG_CHARBASE_0x10000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x10000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
const struct BgTemplate ov59_021DA0B8 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 2048,
|
||||
.baseTile = 0,
|
||||
.baseTile = 0,
|
||||
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_256,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_256,
|
||||
.screenBase = GX_BG_SCRBASE_0x1800,
|
||||
.charBase = GX_BG_CHARBASE_0x20000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x20000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
const struct GraphicsBanks ov59_021DA0D4 = {
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE
|
||||
};
|
||||
|
||||
BOOL ov59_TVInit(struct OverlayManager *overlayManager, u32 *status) {
|
||||
@@ -129,13 +129,13 @@ BOOL ov59_TVInit(struct OverlayManager *overlayManager, u32 *status) {
|
||||
ov59_TVOverlayData *data = (ov59_TVOverlayData *)OverlayManager_CreateAndGetData(overlayManager, sizeof(ov59_TVOverlayData), HEAP_ID_INTRO_TV);
|
||||
memset((void *)data, 0, sizeof(ov59_TVOverlayData));
|
||||
data->heapId = HEAP_ID_INTRO_TV;
|
||||
data->unk24 = 0;
|
||||
data->unk24 = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ov59_TVMain(struct OverlayManager *overlayManager, u32 *status) {
|
||||
ov59_TVOverlayData *data = (ov59_TVOverlayData *)OverlayManager_GetData(overlayManager);
|
||||
BOOL ret = FALSE;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
switch (*status) {
|
||||
case 0:
|
||||
@@ -357,7 +357,7 @@ BOOL ov59_021D9C74(ov59_TVOverlayData *data, u32 msgNo, u32 param2, u32 param3)
|
||||
RemoveWindow(&data->window);
|
||||
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_2);
|
||||
data->unk0C = 0;
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -164,7 +164,7 @@ BOOL ov63_021DB5CC(UnkStruct63_021DB450 *param0, u32 param1, s32 param2) {
|
||||
param0->field_1D++;
|
||||
if (param0->field_1D >= 20) {
|
||||
param0->field_1D = 0;
|
||||
*state = 0;
|
||||
*state = 0;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -263,11 +263,11 @@ void ov63_021DB934(void) {
|
||||
|
||||
void ov63_021DB940(struct UnkStruct63_021DB450 *a0) {
|
||||
struct UnkStruct_02006D98_2 *r4 = sub_0201341C(a0);
|
||||
int sp0[3] = { 0, 0, 0 };
|
||||
sp0[0] = (sub_0200782C(r4, 0) - 0x80) * 0xAC;
|
||||
sp0[1] = (sub_0200782C(r4, 1) - 0x60) * 0xAC;
|
||||
sp0[2] = 0x40;
|
||||
a0->field_28 = sp0[0] + (*a0->field_20)[1];
|
||||
a0->field_2C = sp0[1] + (*a0->field_20)[2];
|
||||
a0->field_30 = sp0[2] + (*a0->field_20)[3];
|
||||
int sp0[3] = { 0, 0, 0 };
|
||||
sp0[0] = (sub_0200782C(r4, 0) - 0x80) * 0xAC;
|
||||
sp0[1] = (sub_0200782C(r4, 1) - 0x60) * 0xAC;
|
||||
sp0[2] = 0x40;
|
||||
a0->field_28 = sp0[0] + (*a0->field_20)[1];
|
||||
a0->field_2C = sp0[1] + (*a0->field_20)[2];
|
||||
a0->field_30 = sp0[2] + (*a0->field_20)[3];
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ s32 Ascii_StrToL(const s8 *str) {
|
||||
s32 length = Ascii_StrLen(str);
|
||||
s32 i;
|
||||
s32 pow10 = 1;
|
||||
s32 num = 0;
|
||||
s32 num = 0;
|
||||
|
||||
// Traverse from right to left
|
||||
for (i = length - 1; i >= 0; i--) {
|
||||
|
||||
@@ -48,35 +48,35 @@ static u32 Bag_GetItemPocket(Bag *bag, u16 itemId, ItemSlot **itemSlots, u32 *co
|
||||
switch (pocket) {
|
||||
case POCKET_KEY_ITEMS:
|
||||
*itemSlots = bag->keyItems;
|
||||
*countPtr = NUM_BAG_KEY_ITEMS;
|
||||
*countPtr = NUM_BAG_KEY_ITEMS;
|
||||
break;
|
||||
case POCKET_ITEMS:
|
||||
*itemSlots = bag->items;
|
||||
*countPtr = NUM_BAG_ITEMS;
|
||||
*countPtr = NUM_BAG_ITEMS;
|
||||
break;
|
||||
case POCKET_BERRIES:
|
||||
*itemSlots = bag->berries;
|
||||
*countPtr = NUM_BAG_BERRIES;
|
||||
*countPtr = NUM_BAG_BERRIES;
|
||||
break;
|
||||
case POCKET_MEDICINE:
|
||||
*itemSlots = bag->medicine;
|
||||
*countPtr = NUM_BAG_MEDICINE;
|
||||
*countPtr = NUM_BAG_MEDICINE;
|
||||
break;
|
||||
case POCKET_BALLS:
|
||||
*itemSlots = bag->balls;
|
||||
*countPtr = NUM_BAG_BALLS;
|
||||
*countPtr = NUM_BAG_BALLS;
|
||||
break;
|
||||
case POCKET_BATTLE_ITEMS:
|
||||
*itemSlots = bag->battleItems;
|
||||
*countPtr = NUM_BAG_BATTLE_ITEMS;
|
||||
*countPtr = NUM_BAG_BATTLE_ITEMS;
|
||||
break;
|
||||
case POCKET_MAIL:
|
||||
*itemSlots = bag->mail;
|
||||
*countPtr = NUM_BAG_MAIL;
|
||||
*countPtr = NUM_BAG_MAIL;
|
||||
break;
|
||||
case POCKET_TMHMS:
|
||||
*itemSlots = bag->TMsHMs;
|
||||
*countPtr = NUM_BAG_TMS_HMS;
|
||||
*countPtr = NUM_BAG_TMS_HMS;
|
||||
break;
|
||||
}
|
||||
return pocket;
|
||||
@@ -252,8 +252,8 @@ u16 Pocket_GetQuantity(ItemSlot *slots, u32 count, u16 itemId) {
|
||||
|
||||
static void SwapItemSlots(ItemSlot *a, ItemSlot *b) {
|
||||
ItemSlot c = *a;
|
||||
*a = *b;
|
||||
*b = c;
|
||||
*a = *b;
|
||||
*b = c;
|
||||
}
|
||||
|
||||
static void PocketCompaction(ItemSlot *slots, u32 count) {
|
||||
@@ -367,7 +367,7 @@ BagCursor *BagCursor_New(HeapID heapId) {
|
||||
|
||||
void BagCursor_Field_PocketGetPosition(BagCursor *cursor, u32 pocket, u8 *position, u8 *scroll) {
|
||||
*position = cursor->field.position[pocket];
|
||||
*scroll = cursor->field.scroll[pocket];
|
||||
*scroll = cursor->field.scroll[pocket];
|
||||
}
|
||||
|
||||
u16 BagCursor_Field_GetPocket(BagCursor *cursor) {
|
||||
@@ -376,7 +376,7 @@ u16 BagCursor_Field_GetPocket(BagCursor *cursor) {
|
||||
|
||||
void BagCursor_Field_PocketSetPosition(BagCursor *cursor, u32 pocket, u8 position, u8 scroll) {
|
||||
cursor->field.position[pocket] = position;
|
||||
cursor->field.scroll[pocket] = scroll;
|
||||
cursor->field.scroll[pocket] = scroll;
|
||||
}
|
||||
|
||||
void BagCursor_Field_SetPocket(BagCursor *cursor, u16 pocket) {
|
||||
@@ -385,7 +385,7 @@ void BagCursor_Field_SetPocket(BagCursor *cursor, u16 pocket) {
|
||||
|
||||
void BagCursor_Battle_PocketGetPosition(BagCursor *cursor, u32 pocket, u8 *position, u8 *scroll) {
|
||||
*position = cursor->battle.position[pocket];
|
||||
*scroll = cursor->battle.scroll[pocket];
|
||||
*scroll = cursor->battle.scroll[pocket];
|
||||
}
|
||||
|
||||
u16 BagCursor_Battle_GetLastUsedItem(BagCursor *cursor) {
|
||||
@@ -402,7 +402,7 @@ u16 BagCursor_Battle_GetPocket(BagCursor *cursor) {
|
||||
|
||||
void BagCursor_Battle_PocketSetPosition(BagCursor *cursor, u32 pocket, u8 position, u8 scroll) {
|
||||
cursor->battle.position[pocket] = position;
|
||||
cursor->battle.scroll[pocket] = scroll;
|
||||
cursor->battle.scroll[pocket] = scroll;
|
||||
}
|
||||
|
||||
void BagCursor_Battle_Init(BagCursor *cursor) {
|
||||
@@ -413,7 +413,7 @@ void BagCursor_Battle_Init(BagCursor *cursor) {
|
||||
}
|
||||
|
||||
void BagCursor_Battle_SetLastUsedItem(BagCursor *cursor, u16 itemId, u16 pocket) {
|
||||
cursor->battle.lastUsedItem = itemId;
|
||||
cursor->battle.lastUsedItem = itemId;
|
||||
cursor->battle.lastUsedPocket = pocket;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ void sub_0206E314(BagView *bagView, SaveData *save, u8 r2, BagCursor *cursor) {
|
||||
sub_0206E30C(bagView, r2);
|
||||
|
||||
bagView->saveData = save;
|
||||
bagView->cursor = cursor;
|
||||
bagView->unk66 = 0;
|
||||
bagView->cursor = cursor;
|
||||
bagView->unk66 = 0;
|
||||
}
|
||||
|
||||
void BagView_SetItem(BagView *bagView, ItemSlot *slot, u8 pocket, u8 idx) {
|
||||
bagView->pockets[idx].slot = slot;
|
||||
bagView->pockets[idx].slot = slot;
|
||||
bagView->pockets[idx].pocket = pocket;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ static u32 GetNumBattlePoints(SaveData *saveData) {
|
||||
}
|
||||
|
||||
BOOL TryFormatRegisteredKeyItemUseMessage(SaveData *saveData, String *dest, u32 itemId, HeapID heapId) {
|
||||
MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0007_bin, heapId);
|
||||
MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0007_bin, heapId);
|
||||
MessageFormat *messageFormat = MessageFormat_New(heapId);
|
||||
String *string;
|
||||
|
||||
@@ -169,9 +169,9 @@ void GetItemUseErrorMessage(PlayerProfile *playerProfile, String *dest, u16 item
|
||||
break;
|
||||
default:
|
||||
// Rowan’s words echoed... {STRVAR_1 3, 0}! There’s a time and place for everything! But not now.
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0199_bin, heapId);
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0199_bin, heapId);
|
||||
MessageFormat *messageFormat = MessageFormat_New(heapId);
|
||||
String *src = NewString_ReadMsgData(msgData, narc_0199_00036);
|
||||
String *src = NewString_ReadMsgData(msgData, narc_0199_00036);
|
||||
BufferPlayersName(messageFormat, 0, playerProfile);
|
||||
StringExpandPlaceholders(messageFormat, dest, src);
|
||||
String_Delete(src);
|
||||
|
||||
@@ -46,11 +46,11 @@ static void Bg_SetAffinePos(Background *bg, enum BgPosAdjustOp op, fx32 val);
|
||||
static void ApplyFlipFlagsToTile(BgConfig *bgConfig, u8 flags, u8 *tile);
|
||||
|
||||
static const u8 sTilemapWidthByBufferSize[] = {
|
||||
[GF_BG_SCR_SIZE_128x128] = 0x10,
|
||||
[GF_BG_SCR_SIZE_256x256] = 0x20,
|
||||
[GF_BG_SCR_SIZE_256x512] = 0x20,
|
||||
[GF_BG_SCR_SIZE_512x256] = 0x20,
|
||||
[GF_BG_SCR_SIZE_512x512] = 0x20,
|
||||
[GF_BG_SCR_SIZE_128x128] = 0x10,
|
||||
[GF_BG_SCR_SIZE_256x256] = 0x20,
|
||||
[GF_BG_SCR_SIZE_256x512] = 0x20,
|
||||
[GF_BG_SCR_SIZE_512x256] = 0x20,
|
||||
[GF_BG_SCR_SIZE_512x512] = 0x20,
|
||||
[GF_BG_SCR_SIZE_1024x1024] = 0x20,
|
||||
};
|
||||
|
||||
@@ -95,8 +95,8 @@ static void (*const sClearWindowTilemapFuncs[])(Window *) = {
|
||||
BgConfig *BgConfig_Alloc(HeapID heapId) {
|
||||
BgConfig *ret = AllocFromHeap(heapId, sizeof(BgConfig));
|
||||
memset(ret, 0, sizeof(BgConfig));
|
||||
ret->heapId = heapId;
|
||||
ret->scrollScheduled = 0; // redundant to above memset
|
||||
ret->heapId = heapId;
|
||||
ret->scrollScheduled = 0; // redundant to above memset
|
||||
ret->bufferTransferScheduled = 0; // redundant to above memset
|
||||
return ret;
|
||||
}
|
||||
@@ -231,10 +231,10 @@ void InitBgFromTemplate(BgConfig *bgConfig, u8 bgId, const BgTemplate *template,
|
||||
}
|
||||
|
||||
bgConfig->bgs[bgId].rotation = 0;
|
||||
bgConfig->bgs[bgId].xScale = FX32_ONE;
|
||||
bgConfig->bgs[bgId].yScale = FX32_ONE;
|
||||
bgConfig->bgs[bgId].centerX = 0;
|
||||
bgConfig->bgs[bgId].centerY = 0;
|
||||
bgConfig->bgs[bgId].xScale = FX32_ONE;
|
||||
bgConfig->bgs[bgId].yScale = FX32_ONE;
|
||||
bgConfig->bgs[bgId].centerX = 0;
|
||||
bgConfig->bgs[bgId].centerY = 0;
|
||||
|
||||
if (template->bufferSize != 0) {
|
||||
bgConfig->bgs[bgId].tilemapBuffer = AllocFromHeap(bgConfig->heapId, template->bufferSize);
|
||||
@@ -242,15 +242,15 @@ void InitBgFromTemplate(BgConfig *bgConfig, u8 bgId, const BgTemplate *template,
|
||||
MI_CpuClear16(bgConfig->bgs[bgId].tilemapBuffer, template->bufferSize);
|
||||
|
||||
bgConfig->bgs[bgId].bufferSize = template->bufferSize;
|
||||
bgConfig->bgs[bgId].baseTile = template->baseTile;
|
||||
bgConfig->bgs[bgId].baseTile = template->baseTile;
|
||||
} else {
|
||||
bgConfig->bgs[bgId].tilemapBuffer = NULL;
|
||||
bgConfig->bgs[bgId].bufferSize = 0;
|
||||
bgConfig->bgs[bgId].baseTile = 0;
|
||||
bgConfig->bgs[bgId].bufferSize = 0;
|
||||
bgConfig->bgs[bgId].baseTile = 0;
|
||||
}
|
||||
|
||||
bgConfig->bgs[bgId].size = template->size;
|
||||
bgConfig->bgs[bgId].mode = bgMode;
|
||||
bgConfig->bgs[bgId].size = template->size;
|
||||
bgConfig->bgs[bgId].mode = bgMode;
|
||||
bgConfig->bgs[bgId].colorMode = template->colorMode;
|
||||
|
||||
if (bgMode == GF_BG_TYPE_TEXT && template->colorMode == GX_BG_COLORMODE_16) {
|
||||
@@ -497,27 +497,27 @@ static u8 TranslateGFBgModePairToGXScreenSize(enum GFBgScreenSize size, enum GFB
|
||||
static void GetBgScreenDimensions(u32 screenSize, u8 *widthPtr, u8 *heightPtr) {
|
||||
switch (screenSize) {
|
||||
case GF_BG_SCR_SIZE_128x128:
|
||||
*widthPtr = 0x10;
|
||||
*widthPtr = 0x10;
|
||||
*heightPtr = 0x10;
|
||||
break;
|
||||
case GF_BG_SCR_SIZE_256x256:
|
||||
*widthPtr = 0x20;
|
||||
*widthPtr = 0x20;
|
||||
*heightPtr = 0x20;
|
||||
break;
|
||||
case GF_BG_SCR_SIZE_256x512:
|
||||
*widthPtr = 0x20;
|
||||
*widthPtr = 0x20;
|
||||
*heightPtr = 0x40;
|
||||
break;
|
||||
case GF_BG_SCR_SIZE_512x256:
|
||||
*widthPtr = 0x40;
|
||||
*widthPtr = 0x40;
|
||||
*heightPtr = 0x20;
|
||||
break;
|
||||
case GF_BG_SCR_SIZE_512x512:
|
||||
*widthPtr = 0x40;
|
||||
*widthPtr = 0x40;
|
||||
*heightPtr = 0x40;
|
||||
break;
|
||||
case GF_BG_SCR_SIZE_1024x1024:
|
||||
*widthPtr = 0x80;
|
||||
*widthPtr = 0x80;
|
||||
*heightPtr = 0x80;
|
||||
break;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ void BgCopyOrUncompressTilemapBufferRangeToVram(BgConfig *bgConfig, u8 bgId, con
|
||||
}
|
||||
|
||||
u32 uncompSize = MI_GetUncompressedSize(buffer);
|
||||
void *ptr = AllocFromHeapAtEnd(bgConfig->heapId, uncompSize);
|
||||
void *ptr = AllocFromHeapAtEnd(bgConfig->heapId, uncompSize);
|
||||
CopyOrUncompressTilemapData(buffer, ptr, bufferSize);
|
||||
LoadBgVramScr(bgId, ptr, baseTile * 2, uncompSize);
|
||||
FreeToHeap(ptr);
|
||||
@@ -787,7 +787,7 @@ void BG_LoadCharTilesData(BgConfig *bgConfig, u8 bgId, const void *data, u32 siz
|
||||
|
||||
static void BG_LoadCharPixelData(BgConfig *bgConfig, u8 bgId, const void *buffer, u32 size, u32 offset) {
|
||||
if (size == 0) {
|
||||
u32 uncompressedSize = MI_GetUncompressedSize(buffer);
|
||||
u32 uncompressedSize = MI_GetUncompressedSize(buffer);
|
||||
void *uncompressedBuffer = AllocFromHeapAtEnd(bgConfig->heapId, uncompressedSize);
|
||||
CopyOrUncompressTilemapData(buffer, uncompressedBuffer, size);
|
||||
LoadBgVramChar(bgId, uncompressedBuffer, offset, uncompressedSize);
|
||||
@@ -838,9 +838,9 @@ void BG_ClearCharDataRange(u8 bgId, u32 size, u32 offset, HeapID heapId) {
|
||||
|
||||
void BG_FillCharDataRange(BgConfig *bgConfig, enum GFBgLayer bgId, u32 fillValue, u32 ntiles, u32 offset) {
|
||||
void *buffer;
|
||||
u32 size = ntiles * bgConfig->bgs[bgId].tileSize;
|
||||
u32 size = ntiles * bgConfig->bgs[bgId].tileSize;
|
||||
u32 value = fillValue;
|
||||
buffer = AllocFromHeapAtEnd(bgConfig->heapId, size);
|
||||
buffer = AllocFromHeapAtEnd(bgConfig->heapId, size);
|
||||
|
||||
if (bgConfig->bgs[bgId].tileSize == TILE_SIZE_4BPP) {
|
||||
value = (value << 12) | (value << 8) | (value << 4) | (value << 0);
|
||||
@@ -890,9 +890,9 @@ static u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 size) {
|
||||
}
|
||||
|
||||
static u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height) {
|
||||
u8 coordType = 0;
|
||||
u16 tilemapIndex = 0;
|
||||
s16 adjustedWidth = width - 32;
|
||||
u8 coordType = 0;
|
||||
u16 tilemapIndex = 0;
|
||||
s16 adjustedWidth = width - 32;
|
||||
s16 adjustedHeight = height - 32;
|
||||
|
||||
if (x / 32) {
|
||||
@@ -1124,7 +1124,7 @@ void BgTilemapRectChangePalette(BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u8 widt
|
||||
if (j >= screenWidth) {
|
||||
break;
|
||||
}
|
||||
u16 pos = GetTileMapIndexFromCoords(j, i, bgConfig->bgs[bgId].size);
|
||||
u16 pos = GetTileMapIndexFromCoords(j, i, bgConfig->bgs[bgId].size);
|
||||
tilemapBuffer[pos] = (tilemapBuffer[pos] & 0xFFF) | (palette << 12);
|
||||
}
|
||||
}
|
||||
@@ -1286,29 +1286,29 @@ void BlitBitmapRect4Bit(const Bitmap *src, const Bitmap *dest, u16 srcX, u16 src
|
||||
} else {
|
||||
yEnd = height + srcY;
|
||||
}
|
||||
multiplierSrcY = ConvertPixelsToTiles(src->width);
|
||||
multiplierSrcY = ConvertPixelsToTiles(src->width);
|
||||
multiplierDestY = ConvertPixelsToTiles(dest->width);
|
||||
|
||||
if (colorKey == 0xFFFF) {
|
||||
for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) {
|
||||
for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) {
|
||||
pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsDest = GetPixelAddressFromBlit4bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY);
|
||||
|
||||
toOrr = (*pixelsSrc >> ((loopSrcX & 1) * 4)) & 0xF;
|
||||
toShift = (loopDestX & 1) * 4;
|
||||
toOrr = (*pixelsSrc >> ((loopSrcX & 1) * 4)) & 0xF;
|
||||
toShift = (loopDestX & 1) * 4;
|
||||
*pixelsDest = ((toOrr << toShift) | (*pixelsDest & (0xF0 >> toShift)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) {
|
||||
for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) {
|
||||
pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsDest = GetPixelAddressFromBlit4bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY);
|
||||
|
||||
toOrr = (*pixelsSrc >> ((loopSrcX & 1) * 4)) & 0xF;
|
||||
if (toOrr != colorKey) {
|
||||
toShift = (loopDestX & 1) * 4;
|
||||
toShift = (loopDestX & 1) * 4;
|
||||
*pixelsDest = (u8)((toOrr << toShift) | (*pixelsDest & (0xF0 >> toShift)));
|
||||
}
|
||||
}
|
||||
@@ -1333,13 +1333,13 @@ static void BlitBitmapRect8Bit(const struct Bitmap *src, const struct Bitmap *de
|
||||
} else {
|
||||
yEnd = height + srcY;
|
||||
}
|
||||
multiplierSrcY = ConvertPixelsToTiles(src->width);
|
||||
multiplierSrcY = ConvertPixelsToTiles(src->width);
|
||||
multiplierDestY = ConvertPixelsToTiles(dest->width);
|
||||
|
||||
if (colorKey == 0xFFFF) {
|
||||
for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) {
|
||||
for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) {
|
||||
pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsDest = GetPixelAddressFromBlit8bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY);
|
||||
|
||||
*pixelsDest = *pixelsSrc;
|
||||
@@ -1348,7 +1348,7 @@ static void BlitBitmapRect8Bit(const struct Bitmap *src, const struct Bitmap *de
|
||||
} else {
|
||||
for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) {
|
||||
for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) {
|
||||
pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY);
|
||||
pixelsDest = GetPixelAddressFromBlit8bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY);
|
||||
|
||||
if (*pixelsSrc != colorKey) {
|
||||
@@ -1403,7 +1403,7 @@ void FillBitmapRect8Bit(const Bitmap *surface, u16 x, u16 y, u16 width, u16 heig
|
||||
for (int i = y; i < yEnd; i++) {
|
||||
for (int j = x; j < xEnd; j++) {
|
||||
u8 *pixels = GetPixelAddressFromBlit8bpp(surface->pixels, j, i, blitWidth);
|
||||
*pixels = fillValue;
|
||||
*pixels = fillValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1417,16 +1417,16 @@ Window *AllocWindows(HeapID heapId, s32 num) {
|
||||
}
|
||||
|
||||
void InitWindow(Window *window) {
|
||||
window->bgConfig = NULL;
|
||||
window->bgId = GF_BG_LYR_UNALLOC;
|
||||
window->bgConfig = NULL;
|
||||
window->bgId = GF_BG_LYR_UNALLOC;
|
||||
window->tilemapLeft = 0;
|
||||
window->tilemapTop = 0;
|
||||
window->width = 0;
|
||||
window->height = 0;
|
||||
window->paletteNum = 0;
|
||||
window->baseTile = 0;
|
||||
window->tilemapTop = 0;
|
||||
window->width = 0;
|
||||
window->height = 0;
|
||||
window->paletteNum = 0;
|
||||
window->baseTile = 0;
|
||||
window->pixelBuffer = NULL;
|
||||
window->colorMode = GF_BG_CLR_4BPP;
|
||||
window->colorMode = GF_BG_CLR_4BPP;
|
||||
}
|
||||
|
||||
BOOL WindowIsInUse(const Window *window) {
|
||||
@@ -1447,16 +1447,16 @@ void AddWindowParameterized(BgConfig *bgConfig, Window *window, u8 bgId, u8 x, u
|
||||
if (buffer == NULL) {
|
||||
return;
|
||||
}
|
||||
window->bgConfig = bgConfig;
|
||||
window->bgId = bgId;
|
||||
window->bgConfig = bgConfig;
|
||||
window->bgId = bgId;
|
||||
window->tilemapLeft = x;
|
||||
window->tilemapTop = y;
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
window->paletteNum = paletteNum;
|
||||
window->baseTile = baseTile;
|
||||
window->tilemapTop = y;
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
window->paletteNum = paletteNum;
|
||||
window->baseTile = baseTile;
|
||||
window->pixelBuffer = buffer;
|
||||
window->colorMode = bgConfig->bgs[bgId].colorMode == GX_BG_COLORMODE_16 ? GF_BG_CLR_4BPP : GF_BG_CLR_8BPP;
|
||||
window->colorMode = bgConfig->bgs[bgId].colorMode == GX_BG_COLORMODE_16 ? GF_BG_CLR_4BPP : GF_BG_CLR_8BPP;
|
||||
}
|
||||
|
||||
void AddTextWindowTopLeftCorner(BgConfig *bgConfig, Window *window, u8 width, u8 height, u16 baseTile, u8 paletteNum) {
|
||||
@@ -1468,12 +1468,12 @@ void AddTextWindowTopLeftCorner(BgConfig *bgConfig, Window *window, u8 width, u8
|
||||
memset(ptr, paletteNum, size); // could cause a data protection abort if below is true
|
||||
|
||||
if (ptr != NULL) {
|
||||
window->bgConfig = bgConfig;
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
window->baseTile = baseTile;
|
||||
window->bgConfig = bgConfig;
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
window->baseTile = baseTile;
|
||||
window->pixelBuffer = ptr;
|
||||
window->colorMode = GF_BG_CLR_4BPP;
|
||||
window->colorMode = GF_BG_CLR_4BPP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,14 +1484,14 @@ void AddWindow(BgConfig *bgConfig, Window *window, const WindowTemplate *templat
|
||||
void RemoveWindow(Window *window) {
|
||||
FreeToHeap(window->pixelBuffer);
|
||||
|
||||
window->bgConfig = NULL;
|
||||
window->bgId = GF_BG_LYR_UNALLOC;
|
||||
window->bgConfig = NULL;
|
||||
window->bgId = GF_BG_LYR_UNALLOC;
|
||||
window->tilemapLeft = 0;
|
||||
window->tilemapTop = 0;
|
||||
window->width = 0;
|
||||
window->height = 0;
|
||||
window->paletteNum = 0;
|
||||
window->baseTile = 0;
|
||||
window->tilemapTop = 0;
|
||||
window->width = 0;
|
||||
window->height = 0;
|
||||
window->paletteNum = 0;
|
||||
window->baseTile = 0;
|
||||
window->pixelBuffer = NULL;
|
||||
}
|
||||
|
||||
@@ -1526,14 +1526,14 @@ void PutWindowTilemap(Window *window) {
|
||||
}
|
||||
|
||||
void PutWindowTilemapRectAnchoredTopLeft(Window *window, u8 width, u8 height) {
|
||||
u8 widthBak = window->width;
|
||||
u8 widthBak = window->width;
|
||||
u8 heightBak = window->height;
|
||||
|
||||
window->width = width;
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
sPutWindowTilemapFuncs[window->bgConfig->bgs[window->bgId].mode](window);
|
||||
|
||||
window->width = widthBak;
|
||||
window->width = widthBak;
|
||||
window->height = heightBak;
|
||||
}
|
||||
|
||||
@@ -1551,8 +1551,8 @@ static void PutWindowTilemap_TextMode(Window *window) {
|
||||
return;
|
||||
}
|
||||
|
||||
tile = window->baseTile;
|
||||
tilemapRight = window->tilemapLeft + window->width;
|
||||
tile = window->baseTile;
|
||||
tilemapRight = window->tilemapLeft + window->width;
|
||||
tilemapBottom = window->tilemapTop + window->height;
|
||||
|
||||
for (i = window->tilemapTop; i < tilemapBottom; i++) {
|
||||
@@ -1577,7 +1577,7 @@ static void PutWindowTilemap_AffineMode(Window *window) {
|
||||
tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size];
|
||||
|
||||
tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft;
|
||||
tile = window->baseTile;
|
||||
tile = window->baseTile;
|
||||
|
||||
for (i = 0; i < window->height; i++) {
|
||||
for (j = 0; j < window->width; j++) {
|
||||
@@ -1596,9 +1596,9 @@ static void ClearWindowTilemapText(Window *window) {
|
||||
if (window->bgConfig->bgs[window->bgId].tilemapBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer;
|
||||
tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size];
|
||||
tilemapRight = window->tilemapLeft + window->width;
|
||||
tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer;
|
||||
tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size];
|
||||
tilemapRight = window->tilemapLeft + window->width;
|
||||
tilemapBottom = window->tilemapTop + window->height;
|
||||
for (i = window->tilemapTop; i < tilemapBottom; i++) {
|
||||
for (j = window->tilemapLeft; j < tilemapRight; j++) {
|
||||
@@ -1617,7 +1617,7 @@ static void ClearWindowTilemapAffine(Window *window) {
|
||||
}
|
||||
|
||||
tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size];
|
||||
tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft;
|
||||
tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft;
|
||||
for (i = 0; i < window->height; i++) {
|
||||
for (j = 0; j < window->width; j++) {
|
||||
tilemap[j] = 0;
|
||||
@@ -1698,11 +1698,11 @@ void BlitBitmapRect(Window *window, void *src, u16 srcX, u16 srcY, u16 srcWidth,
|
||||
Bitmap bmpSrc, bmpDest;
|
||||
|
||||
bmpSrc.pixels = src;
|
||||
bmpSrc.width = srcWidth;
|
||||
bmpSrc.width = srcWidth;
|
||||
bmpSrc.height = srcHeight;
|
||||
|
||||
bmpDest.pixels = window->pixelBuffer;
|
||||
bmpDest.width = window->width * 8;
|
||||
bmpDest.width = window->width * 8;
|
||||
bmpDest.height = window->height * 8;
|
||||
|
||||
if (window->bgConfig->bgs[window->bgId].colorMode == GF_BG_CLR_4BPP) {
|
||||
@@ -1716,7 +1716,7 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width,
|
||||
Bitmap bmp;
|
||||
|
||||
bmp.pixels = window->pixelBuffer;
|
||||
bmp.width = window->width * 8;
|
||||
bmp.width = window->width * 8;
|
||||
bmp.height = window->height * 8;
|
||||
|
||||
if (window->bgConfig->bgs[window->bgId].colorMode == GF_BG_CLR_4BPP) {
|
||||
@@ -1738,7 +1738,7 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width,
|
||||
\
|
||||
src = glyphPixels + (srcY / 8 * 64) + (srcX / 8 * 32); \
|
||||
if (srcY == 0) { \
|
||||
destI = destY + srcY; \
|
||||
destI = destY + srcY; \
|
||||
tableBit = table & 0xFF; \
|
||||
} else { \
|
||||
destI = destY + srcY; \
|
||||
@@ -1753,14 +1753,14 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width,
|
||||
pixelData = *(u32 *)src; \
|
||||
tableFlag = (tableBit >> srcI) & 1; \
|
||||
for (srcJ = 0, destJ = destX + srcX; srcJ < srcWidth; srcJ++, destJ++) { \
|
||||
dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI, destWidth); \
|
||||
dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI, destWidth); \
|
||||
toOrr = (pixelData >> (srcJ * 4)) & 0xF; \
|
||||
if (toOrr != 0) { \
|
||||
bits = (destJ & 1) * 4; \
|
||||
bits = (destJ & 1) * 4; \
|
||||
toOrr = (toOrr << bits) | (*dest & (0xF0 >> bits)); \
|
||||
*dest = toOrr; \
|
||||
if (tableFlag) { \
|
||||
dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI + 1, destWidth); \
|
||||
dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI + 1, destWidth); \
|
||||
*dest = toOrr; \
|
||||
} \
|
||||
} \
|
||||
@@ -1786,7 +1786,7 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width,
|
||||
\
|
||||
src = glyphPixels + (srcY / 8 * 128) + (srcX / 8 * 64); \
|
||||
if (srcY == 0) { \
|
||||
destI = destY + srcY; \
|
||||
destI = destY + srcY; \
|
||||
tableBit = table & 0xFF; \
|
||||
} else { \
|
||||
destI = destY + srcY; \
|
||||
@@ -1801,12 +1801,12 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width,
|
||||
pixelData = (u8 *)src; \
|
||||
tableFlag = (tableBit >> srcI) & 1; \
|
||||
for (srcJ = 0, destJ = destX + srcX; srcJ < srcWidth; srcJ++, destJ++) { \
|
||||
dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI, destWidth); \
|
||||
dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI, destWidth); \
|
||||
toOrr = pixelData[srcJ]; \
|
||||
if (toOrr != 0) { \
|
||||
*dest = toOrr; \
|
||||
if (tableFlag) { \
|
||||
dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI + 1, destWidth); \
|
||||
dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI + 1, destWidth); \
|
||||
*dest = toOrr; \
|
||||
} \
|
||||
} \
|
||||
@@ -1827,8 +1827,8 @@ void CopyGlyphToWindow(Window *window, u8 *glyphPixels, u16 srcWidth, u16 srcHei
|
||||
u8 glyphSizeParam;
|
||||
|
||||
windowPixels = (u8 *)window->pixelBuffer;
|
||||
destWidth = (u16)(window->width * 8);
|
||||
destHeight = (u16)(window->height * 8);
|
||||
destWidth = (u16)(window->width * 8);
|
||||
destHeight = (u16)(window->height * 8);
|
||||
|
||||
// Don't overflow the window
|
||||
if (destWidth - destX < srcWidth) {
|
||||
@@ -1920,9 +1920,9 @@ static void ScrollWindow4bpp(Window *window, u8 direction, u8 y, u8 fillValue) {
|
||||
int i, j;
|
||||
|
||||
pixelBuffer = window->pixelBuffer;
|
||||
fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0);
|
||||
size = window->height * window->width * TILE_SIZE_4BPP;
|
||||
width = window->width;
|
||||
fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0);
|
||||
size = window->height * window->width * TILE_SIZE_4BPP;
|
||||
width = window->width;
|
||||
|
||||
switch (direction) {
|
||||
case 0: // up
|
||||
@@ -1970,9 +1970,9 @@ static void ScrollWindow8bpp(Window *window, u8 direction, u8 y, u8 fillValue) {
|
||||
int i, j;
|
||||
|
||||
pixelBuffer = window->pixelBuffer;
|
||||
fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0);
|
||||
size = window->height * window->width * TILE_SIZE_8BPP;
|
||||
width = window->width;
|
||||
fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0);
|
||||
size = window->height * window->width * TILE_SIZE_8BPP;
|
||||
width = window->width;
|
||||
|
||||
switch (direction) {
|
||||
case 0: // up
|
||||
@@ -2078,7 +2078,7 @@ NNSG2dPaletteData *LoadPaletteDataFromFile(void **pltt_ret, HeapID heapId, const
|
||||
void DoScheduledBgGpuUpdates(BgConfig *bgConfig) {
|
||||
BgConfig_HandleScheduledScrolls(bgConfig);
|
||||
BgConfig_HandleScheduledBufferTransfers(bgConfig);
|
||||
bgConfig->scrollScheduled = 0;
|
||||
bgConfig->scrollScheduled = 0;
|
||||
bgConfig->bufferTransferScheduled = 0;
|
||||
}
|
||||
|
||||
@@ -2228,16 +2228,16 @@ BOOL DoesPixelAtScreenXYMatchPtrVal(BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16
|
||||
}
|
||||
|
||||
tilemapIdx = GetTileMapIndexFromCoords(x >> 3, y >> 3, bgConfig->bgs[bgId].size);
|
||||
bgCharPtr = BgGetCharPtr(bgId);
|
||||
xPixOffs = x & 7;
|
||||
yPixOffs = y & 7;
|
||||
bgCharPtr = BgGetCharPtr(bgId);
|
||||
xPixOffs = x & 7;
|
||||
yPixOffs = y & 7;
|
||||
if (bgConfig->bgs[bgId].colorMode == GX_BG_COLORMODE_16) {
|
||||
u16 *tilemapBuffer = bgConfig->bgs[bgId].tilemapBuffer;
|
||||
u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40);
|
||||
u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40);
|
||||
|
||||
bgCharPtr += (tilemapBuffer[tilemapIdx] & 0x3FF) * TILE_SIZE_4BPP;
|
||||
for (i = 0; i < TILE_SIZE_4BPP; i++) {
|
||||
tile[i * 2] = bgCharPtr[i] & 0xF;
|
||||
tile[i * 2] = bgCharPtr[i] & 0xF;
|
||||
tile[i * 2 + 1] = bgCharPtr[i] >> 4;
|
||||
}
|
||||
ApplyFlipFlagsToTile(bgConfig, (tilemapBuffer[tilemapIdx] >> 10) & 3, tile);
|
||||
@@ -2249,7 +2249,7 @@ BOOL DoesPixelAtScreenXYMatchPtrVal(BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16
|
||||
} else {
|
||||
if (bgConfig->bgs[bgId].mode != GF_BG_TYPE_AFFINE) {
|
||||
u16 *tilemapBuffer = bgConfig->bgs[bgId].tilemapBuffer;
|
||||
u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40);
|
||||
u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40);
|
||||
|
||||
memcpy(tile, bgCharPtr + (tilemapBuffer[tilemapIdx] & 0x3FF) * TILE_SIZE_8BPP, TILE_SIZE_8BPP);
|
||||
ApplyFlipFlagsToTile(bgConfig, (tilemapBuffer[tilemapIdx] >> 10) & 3, tile);
|
||||
|
||||
@@ -38,48 +38,48 @@ extern void sub_0204AB0C(void);
|
||||
extern u16 GetMomSpawnId(void);
|
||||
|
||||
static const struct GraphicsBanks sBlackoutGraphicsBanks = {
|
||||
.bg = GX_VRAM_BG_128_B,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_128_C,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_64_E,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_16_I,
|
||||
.bg = GX_VRAM_BG_128_B,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_128_C,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_64_E,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_16_I,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_0_A,
|
||||
.texpltt = GX_VRAM_TEXPLTT_01_FG,
|
||||
.tex = GX_VRAM_TEX_0_A,
|
||||
.texpltt = GX_VRAM_TEXPLTT_01_FG,
|
||||
};
|
||||
|
||||
static const struct GraphicsModes sBlackoutGraphicsModes = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D,
|
||||
};
|
||||
|
||||
static const BgTemplate sBlackoutBgTemplate = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0xf800,
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x00000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
static const WindowTemplate sBlackoutWindowTemplate = {
|
||||
.bgId = GF_BG_LYR_MAIN_3,
|
||||
.left = 4,
|
||||
.top = 5,
|
||||
.width = 25,
|
||||
.height = 15,
|
||||
.palette = 13,
|
||||
.bgId = GF_BG_LYR_MAIN_3,
|
||||
.left = 4,
|
||||
.top = 5,
|
||||
.width = 25,
|
||||
.height = 15,
|
||||
.palette = 13,
|
||||
.baseTile = 0x01
|
||||
};
|
||||
|
||||
@@ -95,13 +95,13 @@ static void Blackout_DrawMessage(FieldSystem *fieldSystem, TaskManager *taskMana
|
||||
|
||||
GF_ASSERT(env != NULL);
|
||||
memset(env, 0, sizeof(BlackoutScreenEnvironment));
|
||||
env->state = 0;
|
||||
env->state = 0;
|
||||
env->fieldSystem = fieldSystem;
|
||||
env->bgConfig = BgConfig_Alloc(HEAP_ID_FIELD);
|
||||
env->bgConfig = BgConfig_Alloc(HEAP_ID_FIELD);
|
||||
|
||||
Blackout_InitDisplays(env->bgConfig);
|
||||
env->msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0328_bin, HEAP_ID_FIELD);
|
||||
env->msgFmt = MessageFormat_New(HEAP_ID_FIELD);
|
||||
env->msgFmt = MessageFormat_New(HEAP_ID_FIELD);
|
||||
|
||||
AddWindow(env->bgConfig, &env->window, &sBlackoutWindowTemplate);
|
||||
|
||||
@@ -172,7 +172,7 @@ static void Blackout_PrintMessage(BlackoutScreenEnvironment *environment, s32 ms
|
||||
StringExpandPlaceholders(environment->msgFmt, finStr, tmpStr);
|
||||
|
||||
u32 width = FontID_String_GetWidthMultiline(0, finStr, 0);
|
||||
x = (environment->window.width * 8 - width);
|
||||
x = (environment->window.width * 8 - width);
|
||||
x /= 2;
|
||||
x -= 4;
|
||||
|
||||
@@ -194,7 +194,7 @@ enum {
|
||||
|
||||
BOOL Task_Blackout(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
LocalFieldData *localFieldData;
|
||||
Location deathWarp;
|
||||
u16 deathSpawn;
|
||||
@@ -202,7 +202,7 @@ BOOL Task_Blackout(TaskManager *taskManager) {
|
||||
switch (*state) {
|
||||
case STATE_BLACKOUT_TASK_INIT:
|
||||
localFieldData = Save_LocalFieldData_Get(fieldSystem->saveData);
|
||||
deathSpawn = LocalFieldData_GetBlackoutSpawn(localFieldData);
|
||||
deathSpawn = LocalFieldData_GetBlackoutSpawn(localFieldData);
|
||||
GetDeathWarpData(deathSpawn, &deathWarp);
|
||||
GetSpecialSpawnWarpData(deathSpawn, LocalFieldData_GetSpecialSpawnWarpPtr(localFieldData));
|
||||
sub_02049160(taskManager, &deathWarp);
|
||||
|
||||
@@ -25,7 +25,7 @@ void DoBrightnessTransitionStep(BrightnessData *brightness) {
|
||||
}
|
||||
} else {
|
||||
brightness->currentBrightness = brightness->targetBrightness;
|
||||
transitionFinished = TRUE;
|
||||
transitionFinished = TRUE;
|
||||
}
|
||||
|
||||
if (brightness->screenMask & SCREEN_MASK_MAIN) {
|
||||
@@ -42,13 +42,13 @@ void DoBrightnessTransitionStep(BrightnessData *brightness) {
|
||||
void InitBrightnessTransition(BrightnessData *brightnessData, u16 stepCount, s16 targetBrightness, s16 startBrightness, GXBlendPlaneMask surfaceMask, u32 screenMask) {
|
||||
GF_ASSERT(!brightnessData->transitionActive);
|
||||
|
||||
brightnessData->transitionActive = TRUE;
|
||||
brightnessData->surfaceMask = (GXBlendPlaneMask)(u8)surfaceMask;
|
||||
brightnessData->screenMask = (u8)screenMask;
|
||||
brightnessData->stepCount = stepCount;
|
||||
brightnessData->targetBrightness = targetBrightness;
|
||||
brightnessData->transitionActive = TRUE;
|
||||
brightnessData->surfaceMask = (GXBlendPlaneMask)(u8)surfaceMask;
|
||||
brightnessData->screenMask = (u8)screenMask;
|
||||
brightnessData->stepCount = stepCount;
|
||||
brightnessData->targetBrightness = targetBrightness;
|
||||
brightnessData->currentBrightness = startBrightness;
|
||||
brightnessData->brightnessDiff = startBrightness - targetBrightness;
|
||||
brightnessData->brightnessDiff = startBrightness - targetBrightness;
|
||||
|
||||
if (brightnessData->brightnessDiff > 0) {
|
||||
brightnessData->transitionDirection = -1;
|
||||
@@ -57,9 +57,9 @@ void InitBrightnessTransition(BrightnessData *brightnessData, u16 stepCount, s16
|
||||
brightnessData->brightnessDiff *= -1;
|
||||
}
|
||||
|
||||
brightnessData->stepSizeInteger = brightnessData->brightnessDiff / stepCount;
|
||||
brightnessData->stepSizeInteger = brightnessData->brightnessDiff / stepCount;
|
||||
brightnessData->stepSizeFractional = brightnessData->brightnessDiff % stepCount;
|
||||
brightnessData->fractionalCount = 0;
|
||||
brightnessData->fractionalCount = 0;
|
||||
}
|
||||
|
||||
void StartBrightnessTransition(u16 stepCount, s16 targetBrightness, s16 startBrightness, GXBlendPlaneMask surfaceMask, u32 screenMask) {
|
||||
@@ -93,7 +93,7 @@ void ScreenBrightnessData_InitAll(void) {
|
||||
MI_CpuFill8(&sSubScreenBrightnessData, 0, sizeof(BrightnessData));
|
||||
|
||||
sMainScreenBrightnessData.transitionActive = FALSE;
|
||||
sSubScreenBrightnessData.transitionActive = FALSE;
|
||||
sSubScreenBrightnessData.transitionActive = FALSE;
|
||||
}
|
||||
|
||||
void InitScreenBrightnessData(u32 screenMask) {
|
||||
|
||||
@@ -20,7 +20,7 @@ GXBufferMode gG3dDepthBufferingMode = GX_BUFFERMODE_W;
|
||||
static Camera *sCameraPtr;
|
||||
|
||||
static void Camera_CalcLookAtPosFromTargetAndAngle(Camera *camera) {
|
||||
u16 negx = -camera->angle.x;
|
||||
u16 negx = -camera->angle.x;
|
||||
camera->lookAt.camPos.x = FX_Mul(FX_Mul(FX_SinIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x));
|
||||
camera->lookAt.camPos.z = FX_Mul(FX_Mul(FX_CosIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x));
|
||||
camera->lookAt.camPos.y = FX_Mul(FX_SinIdx(negx), camera->distance);
|
||||
@@ -28,7 +28,7 @@ static void Camera_CalcLookAtPosFromTargetAndAngle(Camera *camera) {
|
||||
}
|
||||
|
||||
static void Camera_CalcLookAtTargetFromPosAndAngle(Camera *camera) {
|
||||
u16 negx = -camera->angle.x;
|
||||
u16 negx = -camera->angle.x;
|
||||
camera->lookAt.camTarget.x = -FX_Mul(FX_Mul(FX_SinIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x));
|
||||
camera->lookAt.camTarget.z = -FX_Mul(FX_Mul(FX_CosIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x));
|
||||
camera->lookAt.camTarget.y = -FX_Mul(FX_SinIdx(negx), camera->distance);
|
||||
@@ -36,20 +36,20 @@ static void Camera_CalcLookAtTargetFromPosAndAngle(Camera *camera) {
|
||||
}
|
||||
|
||||
static void Camera_InitInternal(u16 perspectiveAngle, Camera *camera) {
|
||||
camera->perspectiveAngle = perspectiveAngle;
|
||||
camera->perspectiveAngle = perspectiveAngle;
|
||||
camera->perspective.fovySin = FX_SinIdx(perspectiveAngle);
|
||||
camera->perspective.fovyCos = FX_CosIdx(perspectiveAngle);
|
||||
camera->perspective.aspect = FX32_CONST(1.33333333); // 4x3
|
||||
camera->perspective.near = FX32_CONST(150);
|
||||
camera->perspective.far = FX32_CONST(900);
|
||||
camera->lookAt.camUp.x = 0;
|
||||
camera->lookAt.camUp.y = FX32_ONE;
|
||||
camera->lookAt.camUp.z = 0;
|
||||
camera->curTarget = NULL;
|
||||
camera->enableOffsetX = FALSE;
|
||||
camera->enableOffsetY = FALSE;
|
||||
camera->enableOffsetZ = FALSE;
|
||||
camera->history = NULL;
|
||||
camera->perspective.aspect = FX32_CONST(1.33333333); // 4x3
|
||||
camera->perspective.near = FX32_CONST(150);
|
||||
camera->perspective.far = FX32_CONST(900);
|
||||
camera->lookAt.camUp.x = 0;
|
||||
camera->lookAt.camUp.y = FX32_ONE;
|
||||
camera->lookAt.camUp.z = 0;
|
||||
camera->curTarget = NULL;
|
||||
camera->enableOffsetX = FALSE;
|
||||
camera->enableOffsetY = FALSE;
|
||||
camera->enableOffsetZ = FALSE;
|
||||
camera->history = NULL;
|
||||
}
|
||||
|
||||
static void Camera_VecResetCoordsIfOffsetComponentNotEnabled(Camera *camera, VecFx32 *vec) {
|
||||
@@ -68,7 +68,7 @@ static void Camera_GetVecFromSomeRingBufferMaybe(Camera *camera, const VecFx32 *
|
||||
if (camera->history == NULL) {
|
||||
*vecDest = *vecDefault;
|
||||
} else {
|
||||
s32 *idxPtr = &camera->history->readIdx;
|
||||
s32 *idxPtr = &camera->history->readIdx;
|
||||
s32 *idx2Ptr = &camera->history->writeIdx;
|
||||
if (!camera->history->overrideEnabled) {
|
||||
*vecDest = *vecDefault;
|
||||
@@ -78,9 +78,9 @@ static void Camera_GetVecFromSomeRingBufferMaybe(Camera *camera, const VecFx32 *
|
||||
} else {
|
||||
*vecDest = camera->history->vecs[camera->history->readIdx];
|
||||
}
|
||||
*idxPtr = (*idxPtr + 1) % camera->history->count;
|
||||
*idxPtr = (*idxPtr + 1) % camera->history->count;
|
||||
camera->history->vecs[*idx2Ptr] = *vecDefault;
|
||||
*idx2Ptr = (*idx2Ptr + 1) % camera->history->count;
|
||||
*idx2Ptr = (*idx2Ptr + 1) % camera->history->count;
|
||||
if (!camera->history->enableUpdateX) {
|
||||
vecDest->x = vecDefault->x;
|
||||
}
|
||||
@@ -99,20 +99,20 @@ void Camera_History_New(s32 count, s32 initialWriteIdx, s32 updateEnableFlags, H
|
||||
}
|
||||
GF_ASSERT(initialWriteIdx + 1 <= count);
|
||||
CameraHistory *history = AllocFromHeap(heapId, sizeof(CameraHistory));
|
||||
history->vecs = AllocFromHeap(heapId, sizeof(VecFx32) * count);
|
||||
history->vecs = AllocFromHeap(heapId, sizeof(VecFx32) * count);
|
||||
for (s32 i = 0; i < count; i++) {
|
||||
history->vecs[i].x = 0;
|
||||
history->vecs[i].y = 0;
|
||||
history->vecs[i].z = 0;
|
||||
}
|
||||
history->count = count;
|
||||
history->readIdx = 0;
|
||||
history->writeIdx = initialWriteIdx;
|
||||
history->writeIdxInit = initialWriteIdx;
|
||||
history->count = count;
|
||||
history->readIdx = 0;
|
||||
history->writeIdx = initialWriteIdx;
|
||||
history->writeIdxInit = initialWriteIdx;
|
||||
history->overrideEnabled = FALSE;
|
||||
history->enableUpdateX = FALSE;
|
||||
history->enableUpdateY = FALSE;
|
||||
history->enableUpdateZ = FALSE;
|
||||
history->enableUpdateX = FALSE;
|
||||
history->enableUpdateY = FALSE;
|
||||
history->enableUpdateZ = FALSE;
|
||||
if (updateEnableFlags & CAMERA_UPDATE_ENABLE_X) {
|
||||
history->enableUpdateX = TRUE;
|
||||
}
|
||||
@@ -174,15 +174,15 @@ void Camera_SetLookAtCamUp(VecFx32 *camUp, Camera *camera) {
|
||||
}
|
||||
|
||||
void Camera_SetFixedTarget(VecFx32 *target, Camera *camera) {
|
||||
camera->curTarget = target;
|
||||
camera->lastTarget = *target;
|
||||
camera->curTarget = target;
|
||||
camera->lastTarget = *target;
|
||||
camera->enableOffsetX = TRUE;
|
||||
camera->enableOffsetY = TRUE;
|
||||
camera->enableOffsetZ = TRUE;
|
||||
}
|
||||
|
||||
void Camera_ClearFixedTarget(Camera *camera) {
|
||||
camera->curTarget = NULL;
|
||||
camera->curTarget = NULL;
|
||||
camera->enableOffsetX = FALSE;
|
||||
camera->enableOffsetY = FALSE;
|
||||
camera->enableOffsetZ = FALSE;
|
||||
@@ -190,22 +190,22 @@ void Camera_ClearFixedTarget(Camera *camera) {
|
||||
|
||||
void Camera_SetPerspectiveClippingPlane(fx32 near, fx32 far, Camera *camera) {
|
||||
camera->perspective.near = near;
|
||||
camera->perspective.far = far,
|
||||
camera->perspective.far = far,
|
||||
Camera_ApplyPerspectiveType(camera->perspectiveType, camera);
|
||||
}
|
||||
|
||||
void Camera_Init_FromTargetDistanceAndAngle(VecFx32 *target, fx32 distance, CameraAngle *angle, u16 perspectiveAngle, u8 perspectiveType, BOOL setReference, Camera *camera) {
|
||||
Camera_InitInternal(perspectiveAngle, camera);
|
||||
camera->lookAt.camTarget = *target;
|
||||
camera->distance = distance;
|
||||
camera->angle = *angle;
|
||||
camera->distance = distance;
|
||||
camera->angle = *angle;
|
||||
Camera_CalcLookAtPosFromTargetAndAngle(camera);
|
||||
Camera_ApplyPerspectiveType(perspectiveType, camera);
|
||||
if (!setReference) {
|
||||
return;
|
||||
}
|
||||
camera->curTarget = target;
|
||||
camera->lastTarget = *target;
|
||||
camera->curTarget = target;
|
||||
camera->lastTarget = *target;
|
||||
camera->enableOffsetX = TRUE;
|
||||
camera->enableOffsetY = TRUE;
|
||||
camera->enableOffsetZ = TRUE;
|
||||
@@ -214,8 +214,8 @@ void Camera_Init_FromTargetDistanceAndAngle(VecFx32 *target, fx32 distance, Came
|
||||
void Camera_Init_FromPosDistanceAndAngle(VecFx32 *pos, fx32 distance, CameraAngle *angle, u16 perspectiveAngle, u8 perspectiveType, Camera *camera) {
|
||||
Camera_InitInternal(perspectiveAngle, camera);
|
||||
camera->lookAt.camPos = *pos;
|
||||
camera->distance = distance;
|
||||
camera->angle = *angle;
|
||||
camera->distance = distance;
|
||||
camera->angle = *angle;
|
||||
Camera_CalcLookAtTargetFromPosAndAngle(camera);
|
||||
Camera_ApplyPerspectiveType(perspectiveType, camera);
|
||||
}
|
||||
@@ -225,28 +225,28 @@ void Camera_Init_FromTargetAndPos(const VecFx32 *target, const VecFx32 *pos, u16
|
||||
Camera_InitInternal(perspectiveAngle, camera);
|
||||
|
||||
camera->lookAt.camTarget = *target;
|
||||
camera->lookAt.camPos = *pos;
|
||||
camera->lookAt.camPos = *pos;
|
||||
|
||||
VEC_Subtract(pos, target, &vec_from_pos_to_target);
|
||||
camera->distance = VEC_Mag(&vec_from_pos_to_target);
|
||||
VecFx32 sp24 = { 0, 0, 0 }; // unused
|
||||
VecFx32 sp18 = { 0, 0, 0 }; // unused
|
||||
VecFx32 sp0C = { 0, 0, 0 };
|
||||
VecFx32 sp24 = { 0, 0, 0 }; // unused
|
||||
VecFx32 sp18 = { 0, 0, 0 }; // unused
|
||||
VecFx32 sp0C = { 0, 0, 0 };
|
||||
VecFx32 sp00;
|
||||
|
||||
sp00.x = 0;
|
||||
sp00.y = 0;
|
||||
sp00.z = FX32_ONE;
|
||||
sp0C = vec_from_pos_to_target;
|
||||
sp0C.y = 0;
|
||||
sp00.x = 0;
|
||||
sp00.y = 0;
|
||||
sp00.z = FX32_ONE;
|
||||
sp0C = vec_from_pos_to_target;
|
||||
sp0C.y = 0;
|
||||
camera->angle.y = CalcAngleBetweenVecs(&sp00, &sp0C);
|
||||
|
||||
sp00.x = FX32_ONE;
|
||||
sp00.y = 0;
|
||||
sp00.z = 0;
|
||||
sp0C.x = vec_from_pos_to_target.z;
|
||||
sp0C.z = vec_from_pos_to_target.y;
|
||||
sp0C.y = 0;
|
||||
sp00.x = FX32_ONE;
|
||||
sp00.y = 0;
|
||||
sp00.z = 0;
|
||||
sp0C.x = vec_from_pos_to_target.z;
|
||||
sp0C.z = vec_from_pos_to_target.y;
|
||||
sp0C.y = 0;
|
||||
camera->angle.x = CalcAngleBetweenVecs(&sp00, &sp0C);
|
||||
|
||||
camera->angle.z = 0;
|
||||
@@ -255,8 +255,8 @@ void Camera_Init_FromTargetAndPos(const VecFx32 *target, const VecFx32 *pos, u16
|
||||
if (!setReference) {
|
||||
return;
|
||||
}
|
||||
camera->curTarget = target;
|
||||
camera->lastTarget = *target;
|
||||
camera->curTarget = target;
|
||||
camera->lastTarget = *target;
|
||||
camera->enableOffsetX = TRUE;
|
||||
camera->enableOffsetY = TRUE;
|
||||
camera->enableOffsetZ = TRUE;
|
||||
@@ -266,18 +266,18 @@ void Camera_ApplyPerspectiveType(u8 perspectiveType, Camera *camera) {
|
||||
if (perspectiveType == CAMERA_PERSPECTIVE_TYPE_PERSPECTIVE) {
|
||||
NNS_G3dGlbPerspective(camera->perspective.fovySin, camera->perspective.fovyCos, camera->perspective.aspect, camera->perspective.near, camera->perspective.far);
|
||||
camera->perspectiveType = CAMERA_PERSPECTIVE_TYPE_PERSPECTIVE;
|
||||
gG3dDepthBufferingMode = GX_BUFFERMODE_Z;
|
||||
gG3dDepthBufferingMode = GX_BUFFERMODE_Z;
|
||||
} else {
|
||||
fx32 y = FX_Mul(FX_Div(camera->perspective.fovySin, camera->perspective.fovyCos), camera->distance);
|
||||
fx32 x = FX_Mul(y, camera->perspective.aspect);
|
||||
NNS_G3dGlbOrtho(y, -y, -x, x, camera->perspective.near, camera->perspective.far);
|
||||
camera->perspectiveType = CAMERA_PERSPECTIVE_TYPE_ORTHOGRAPHIC;
|
||||
gG3dDepthBufferingMode = GX_BUFFERMODE_Z;
|
||||
gG3dDepthBufferingMode = GX_BUFFERMODE_Z;
|
||||
}
|
||||
}
|
||||
|
||||
void Camera_SetPerspectiveAngle(u16 perspectiveAngle, Camera *camera) {
|
||||
camera->perspectiveAngle = perspectiveAngle;
|
||||
camera->perspectiveAngle = perspectiveAngle;
|
||||
camera->perspective.fovySin = FX_SinIdx(camera->perspectiveAngle);
|
||||
camera->perspective.fovyCos = FX_CosIdx(camera->perspectiveAngle);
|
||||
Camera_ApplyPerspectiveType(camera->perspectiveType, camera);
|
||||
|
||||
@@ -19,49 +19,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen);
|
||||
extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32);
|
||||
|
||||
static const struct WindowTemplate sCommunicationErrorWindowTemplate = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.baseTile = 0x23,
|
||||
};
|
||||
|
||||
static const struct GraphicsModes sCommunicationErrorGraphicsModes = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D,
|
||||
};
|
||||
|
||||
static const struct BgTemplate sCommunicationErrorBgTemplate = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE,
|
||||
};
|
||||
|
||||
static const GraphicsBanks sCommunicationErrorGraphicsBanks = {
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
};
|
||||
|
||||
static void VBlankIntr(void);
|
||||
@@ -131,8 +131,8 @@ void ShowCommunicationError(HeapID heapId, u32 error, u32 errorCode) {
|
||||
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
|
||||
|
||||
MsgData *errorMessageData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0200_bin, heapId);
|
||||
String *errorMessageStr = String_New(384, heapId);
|
||||
String *tmpStr = String_New(384, heapId);
|
||||
String *errorMessageStr = String_New(384, heapId);
|
||||
String *tmpStr = String_New(384, heapId);
|
||||
ResetAllTextPrinters();
|
||||
MessageFormat *messageFormat = MessageFormat_New(heapId);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ void Save_Daycare_Init(Daycare *daycare) {
|
||||
memset(daycare, 0, sizeof(Daycare));
|
||||
ZeroBoxMonData(&daycare->mons[0].mon);
|
||||
ZeroBoxMonData(&daycare->mons[1].mon);
|
||||
daycare->egg_pid = 0;
|
||||
daycare->egg_pid = 0;
|
||||
daycare->egg_cycles = 0;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void DaycareMon_Extras_Init(DaycareMail *mail) {
|
||||
mail->nickname[i] = 0;
|
||||
}
|
||||
|
||||
mail->ot_name[0] = EOS;
|
||||
mail->ot_name[0] = EOS;
|
||||
mail->nickname[0] = EOS;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,18 +51,18 @@ static const u16 sNarcMsgCounts[EC_GROUP_MAX] = {
|
||||
EC_WORDS_UNION_COUNT,
|
||||
};
|
||||
|
||||
static const ecword_t sEasyChatHey[] = { EC_WORD_GREETINGS_HEY, EC_WORD_GREETINGS_HEY_2 };
|
||||
static const ecword_t sEasyChatHuh_[] = { EC_WORD_GREETINGS_HUH_, EC_WORD_GREETINGS_HUH__2 };
|
||||
static const ecword_t sEasyChatI[] = { EC_WORD_PEOPLE_I, EC_WORD_PEOPLE_I_2, EC_WORD_PEOPLE_I_3, EC_WORD_PEOPLE_I_4 };
|
||||
static const ecword_t sEasyChatKids[] = { EC_WORD_PEOPLE_KIDS, EC_WORD_PEOPLE_KIDS_2 };
|
||||
static const ecword_t sEasyChatNoWay[] = { EC_WORD_GREETINGS_NO_WAY, EC_WORD_FEELINGS_NO_WAY };
|
||||
static const ecword_t sEasyChatYou[] = { EC_WORD_PEOPLE_YOU, EC_WORD_PEOPLE_YOU_2 };
|
||||
static const ecword_t sEasyChatHey[] = { EC_WORD_GREETINGS_HEY, EC_WORD_GREETINGS_HEY_2 };
|
||||
static const ecword_t sEasyChatHuh_[] = { EC_WORD_GREETINGS_HUH_, EC_WORD_GREETINGS_HUH__2 };
|
||||
static const ecword_t sEasyChatI[] = { EC_WORD_PEOPLE_I, EC_WORD_PEOPLE_I_2, EC_WORD_PEOPLE_I_3, EC_WORD_PEOPLE_I_4 };
|
||||
static const ecword_t sEasyChatKids[] = { EC_WORD_PEOPLE_KIDS, EC_WORD_PEOPLE_KIDS_2 };
|
||||
static const ecword_t sEasyChatNoWay[] = { EC_WORD_GREETINGS_NO_WAY, EC_WORD_FEELINGS_NO_WAY };
|
||||
static const ecword_t sEasyChatYou[] = { EC_WORD_PEOPLE_YOU, EC_WORD_PEOPLE_YOU_2 };
|
||||
static const ecword_t sEasyChatAnticipation[] = { EC_WORD_ABILITY(ABILITY_ANTICIPATION), EC_WORD_FEELINGS_ANTICIPATION };
|
||||
static const ecword_t sEasyChatSimple[] = { EC_WORD_ABILITY(ABILITY_SIMPLE), EC_WORD_FEELINGS_SIMPLE };
|
||||
static const ecword_t sEasyChatWelcome[] = { EC_WORD_GREETINGS_WELCOME, EC_WORD_GREETINGS_WELCOME_2 };
|
||||
static const ecword_t sEasyChatWow[] = { EC_WORD_GREETINGS_WOW, EC_WORD_GREETINGS_WOW_2 };
|
||||
static const ecword_t sEasyChatPsychic[] = { EC_WORD_MOVE(MOVE_PSYCHIC), EC_WORD_TYPE(TYPE_PSYCHIC) };
|
||||
static const ecword_t sEasyChatOk[] = { EC_WORD_GREETINGS_OK, EC_WORD_GREETINGS_OK_2 };
|
||||
static const ecword_t sEasyChatSimple[] = { EC_WORD_ABILITY(ABILITY_SIMPLE), EC_WORD_FEELINGS_SIMPLE };
|
||||
static const ecword_t sEasyChatWelcome[] = { EC_WORD_GREETINGS_WELCOME, EC_WORD_GREETINGS_WELCOME_2 };
|
||||
static const ecword_t sEasyChatWow[] = { EC_WORD_GREETINGS_WOW, EC_WORD_GREETINGS_WOW_2 };
|
||||
static const ecword_t sEasyChatPsychic[] = { EC_WORD_MOVE(MOVE_PSYCHIC), EC_WORD_TYPE(TYPE_PSYCHIC) };
|
||||
static const ecword_t sEasyChatOk[] = { EC_WORD_GREETINGS_OK, EC_WORD_GREETINGS_OK_2 };
|
||||
|
||||
typedef struct ECIdenticalPhrases {
|
||||
const ecword_t *data;
|
||||
@@ -88,7 +88,7 @@ EasyChatManager *EasyChatManager_New(HeapID heapId) {
|
||||
EasyChatManager *ret = AllocFromHeap(heapId, sizeof(EasyChatManager));
|
||||
|
||||
for (s32 i = 0; i < EC_GROUP_MAX; i++) {
|
||||
ret->heapId = heapId; // inadvertently inside the loop
|
||||
ret->heapId = heapId; // inadvertently inside the loop
|
||||
ret->msgData[i] = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, sNarcMsgBanks[i], heapId);
|
||||
}
|
||||
return ret;
|
||||
@@ -145,7 +145,7 @@ void GetCategoryAndMsgNoByECWordIdx(u32 ecWord, u32 *category, u32 *msgNo) {
|
||||
count += sNarcMsgCounts[bank];
|
||||
if (wordId < count) {
|
||||
*category = bank;
|
||||
*msgNo = (wordId - (count - sNarcMsgCounts[bank]));
|
||||
*msgNo = (wordId - (count - sNarcMsgCounts[bank]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void Save_EasyChat_Init(SaveEasyChat *saveEasyChat) {
|
||||
u32 i;
|
||||
|
||||
saveEasyChat->greetings = 0;
|
||||
saveEasyChat->trendy = 0;
|
||||
saveEasyChat->trendy = 0;
|
||||
for (i = 0; i < NELEMS(sLanguageToGreetingMap); i++) {
|
||||
if (sLanguageToGreetingMap[i][0] == GAME_LANGUAGE) {
|
||||
Save_EasyChat_SetGreetingFlag(saveEasyChat, sLanguageToGreetingMap[i][1]);
|
||||
|
||||
@@ -86,7 +86,7 @@ static void sub_020473CC(FieldSystem *fieldSystem, BattleSetup *setup);
|
||||
static BOOL Task_StartBattle(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
BattleSetup *battleSetup = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -109,13 +109,13 @@ static void CallTask_StartBattle(TaskManager *taskManager, BattleSetup *setup) {
|
||||
|
||||
static Encounter *Encounter_New(BattleSetup *setup, s32 effect, s32 bgm, u32 *winFlag) {
|
||||
Encounter *encounter = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(Encounter));
|
||||
encounter->winFlag = winFlag;
|
||||
encounter->winFlag = winFlag;
|
||||
if (winFlag != NULL) {
|
||||
*winFlag = BATTLE_OUTCOME_NONE;
|
||||
}
|
||||
encounter->effect = effect;
|
||||
encounter->bgm = bgm;
|
||||
encounter->setup = setup;
|
||||
encounter->bgm = bgm;
|
||||
encounter->setup = setup;
|
||||
return encounter;
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ static void sub_020465E4(BattleSetup *setup, FieldSystem *fieldSystem) {
|
||||
|
||||
static BOOL Task_StartEncounter(TaskManager *taskManager) { // todo: better name
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -210,8 +210,8 @@ static void sub_0204671C(s32 flag, FieldSystem *fieldSystem) {
|
||||
|
||||
static BOOL Task_02046758(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
switch (*state) {
|
||||
case 0:
|
||||
sub_0204AEF8(taskManager, encounter->effect, encounter->bgm);
|
||||
@@ -242,8 +242,8 @@ static BOOL Task_02046758(TaskManager *taskManager) {
|
||||
|
||||
static BOOL Task_020467FC(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -266,8 +266,8 @@ static BOOL Task_020467FC(TaskManager *taskManager) {
|
||||
|
||||
static BOOL Task_02046878(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -308,21 +308,21 @@ static void CallTask_02046878(TaskManager *taskManager, BattleSetup *battleSetup
|
||||
void sub_02046948(TaskManager *taskManager, u32 param1, u32 *winFlag) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
BattleSetup *battleSetup = ov06_02244558(param1, fieldSystem);
|
||||
s32 effect = sub_020475A0(battleSetup);
|
||||
s32 bgm = sub_020475B0(battleSetup);
|
||||
s32 effect = sub_020475A0(battleSetup);
|
||||
s32 bgm = sub_020475B0(battleSetup);
|
||||
CallTask_02046878(taskManager, battleSetup, effect, bgm, winFlag);
|
||||
}
|
||||
|
||||
static WildEncounter *WildEncounter_New(BattleSetup *setup, s32 effect, s32 bgm, u32 *winFlag) {
|
||||
WildEncounter *encounter = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(WildEncounter));
|
||||
encounter->winFlag = winFlag;
|
||||
encounter->winFlag = winFlag;
|
||||
if (winFlag != NULL) {
|
||||
*winFlag = BATTLE_OUTCOME_NONE;
|
||||
}
|
||||
encounter->effect = effect;
|
||||
encounter->bgm = bgm;
|
||||
encounter->setup = setup;
|
||||
encounter->state = 0;
|
||||
encounter->bgm = bgm;
|
||||
encounter->setup = setup;
|
||||
encounter->state = 0;
|
||||
return encounter;
|
||||
}
|
||||
|
||||
@@ -429,9 +429,9 @@ static BOOL Task_WildEncounter(TaskManager *taskManager) {
|
||||
|
||||
static BOOL Task_SafariEncounter(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
u16 *safariBalls = LocalFieldData_GetSafariBallsCounter(Save_LocalFieldData_Get(fieldSystem->saveData));
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
u16 *safariBalls = LocalFieldData_GetSafariBallsCounter(Save_LocalFieldData_Get(fieldSystem->saveData));
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -452,7 +452,7 @@ static BOOL Task_SafariEncounter(TaskManager *taskManager) {
|
||||
sub_020465E4(encounter->setup, fieldSystem);
|
||||
if (encounter->setup->winFlag == BATTLE_OUTCOME_MON_CAUGHT) {
|
||||
SafariZone *safariZone = Save_SafariZone_Get(fieldSystem->saveData);
|
||||
Pokemon *pokemon = Party_GetMonByIndex(encounter->setup->party[BATTLER_ENEMY], 0);
|
||||
Pokemon *pokemon = Party_GetMonByIndex(encounter->setup->party[BATTLER_ENEMY], 0);
|
||||
sub_02060FE0(safariZone, pokemon);
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ static BOOL Task_SafariEncounter(TaskManager *taskManager) {
|
||||
}
|
||||
} else {
|
||||
PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
if (PCStorage_FindFirstBoxWithEmptySlot(pc) == NUM_BOXES && Party_GetCount(party) == PARTY_SIZE) {
|
||||
QueueScript(taskManager, 0x2276, NULL, NULL);
|
||||
}
|
||||
@@ -531,8 +531,8 @@ void SetupAndStartWildBattle(TaskManager *taskManager, u16 species, u8 level, u3
|
||||
|
||||
static BOOL Task_PalParkEncounter(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -583,7 +583,7 @@ void sub_02046F70(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
|
||||
void SetupAndStartFirstBattle(TaskManager *taskManager, u16 species, u8 level) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
BattleSetup *setup = BattleSetup_New(HEAP_ID_FIELD, BATTLE_TYPE_NONE);
|
||||
BattleSetup *setup = BattleSetup_New(HEAP_ID_FIELD, BATTLE_TYPE_NONE);
|
||||
BattleSetup_InitFromFieldSystem(setup, fieldSystem);
|
||||
|
||||
ov06_0223CD7C(fieldSystem, species, level, setup);
|
||||
@@ -596,9 +596,9 @@ void SetupAndStartFirstBattle(TaskManager *taskManager, u16 species, u8 level) {
|
||||
}
|
||||
|
||||
static BOOL Task_TutorialBattle(TaskManager *taskManager) {
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -638,7 +638,7 @@ void SetupAndStartTutorialBattle(TaskManager *taskManager) {
|
||||
BattleSetup *setup;
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
|
||||
setup = sub_02047814(HEAP_ID_FIELD, fieldSystem);
|
||||
setup = sub_02047814(HEAP_ID_FIELD, fieldSystem);
|
||||
encounter = Encounter_New(setup, sub_020475A0(setup), sub_020475B0(setup), NULL);
|
||||
|
||||
TaskManager_Call(taskManager, Task_TutorialBattle, encounter);
|
||||
@@ -665,8 +665,8 @@ void SetupAndStartTrainerBattle(TaskManager *taskManager, u32 opponentTrainer1,
|
||||
setup = BattleSetup_New(HEAP_ID_FIELD, battleType);
|
||||
BattleSetup_InitFromFieldSystem(setup, fieldSystem);
|
||||
|
||||
setup->trainerId[BATTLER_ENEMY] = opponentTrainer1;
|
||||
setup->trainerId[BATTLER_ENEMY2] = opponentTrainer2;
|
||||
setup->trainerId[BATTLER_ENEMY] = opponentTrainer1;
|
||||
setup->trainerId[BATTLER_ENEMY2] = opponentTrainer2;
|
||||
setup->trainerId[BATTLER_PLAYER2] = followerTrainerNum;
|
||||
|
||||
EnemyTrainerSet_Init(setup, fieldSystem->saveData, heapId);
|
||||
@@ -703,7 +703,7 @@ void sub_020471C0(TaskManager *taskManager, s32 target, s32 maxLevel, u32 flag)
|
||||
|
||||
sub_02047BC0(setup, fieldSystem, maxLevel);
|
||||
|
||||
encounter = Encounter_New(setup, sub_020475A0(setup), sub_020475B0(setup), NULL);
|
||||
encounter = Encounter_New(setup, sub_020475A0(setup), sub_020475B0(setup), NULL);
|
||||
encounter->unkC = target;
|
||||
|
||||
TaskManager_Call(taskManager, Task_020467FC, encounter);
|
||||
@@ -711,8 +711,8 @@ void sub_020471C0(TaskManager *taskManager, s32 target, s32 maxLevel, u32 flag)
|
||||
|
||||
static BOOL sub_02047220(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
Encounter *encounter = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
@@ -751,7 +751,7 @@ void sub_020472B0(FieldSystem *fieldSystem, Party *party, s32 battleType) {
|
||||
static void sub_020472F4(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
Pokemon *mon;
|
||||
u32 battleType = setup->flags;
|
||||
u32 winFlag = setup->winFlag;
|
||||
u32 winFlag = setup->winFlag;
|
||||
|
||||
if (battleType & BATTLE_TYPE_LINK || battleType & BATTLE_TYPE_TOWER) {
|
||||
return;
|
||||
@@ -785,7 +785,7 @@ static void sub_020472F4(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
static void sub_020473CC(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
Pokemon *mon;
|
||||
u32 battleType = setup->flags;
|
||||
u32 winFlag = setup->winFlag;
|
||||
u32 winFlag = setup->winFlag;
|
||||
|
||||
if (battleType & BATTLE_TYPE_LINK || battleType & BATTLE_TYPE_TOWER || battleType & BATTLE_TYPE_PAL_PARK) {
|
||||
return;
|
||||
|
||||
@@ -19,53 +19,53 @@
|
||||
#include "unk_02031734.h"
|
||||
|
||||
static const struct WindowTemplate sErrorMessageWindowTemplate = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.baseTile = 0x23
|
||||
};
|
||||
|
||||
static const struct HeapParam sErrorMessageHeapParams = {
|
||||
.size = 0x00020000,
|
||||
.size = 0x00020000,
|
||||
.arena = OS_ARENA_MAIN
|
||||
};
|
||||
|
||||
static const struct GraphicsModes sErrorMessageBgModeSet = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D
|
||||
};
|
||||
|
||||
static const struct BgTemplate sErrorMessageBgTemplate = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.mosaic = FALSE
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.mosaic = FALSE
|
||||
};
|
||||
|
||||
static const struct GraphicsBanks sErrorMessageBanksConfig = {
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
};
|
||||
|
||||
static u32 sErrorMessagePrinterLock;
|
||||
@@ -131,7 +131,7 @@ void PrintErrorMessageAndReset() {
|
||||
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
|
||||
|
||||
struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0200_bin, HEAP_ID_DEFAULT);
|
||||
struct String *str = String_New(6 << 6, HEAP_ID_DEFAULT);
|
||||
struct String *str = String_New(6 << 6, HEAP_ID_DEFAULT);
|
||||
|
||||
ResetAllTextPrinters();
|
||||
AddWindow(ptr, &buf, &sErrorMessageWindowTemplate);
|
||||
|
||||
@@ -1845,7 +1845,7 @@ u32 FieldSystem_GetWeather(FieldSystem *fieldSystem, u32 mapId) {
|
||||
return weatherType;
|
||||
}
|
||||
SysInfo_RTC *sysInfoRTC = Save_SysInfo_RTC_Get(fieldSystem->saveData);
|
||||
s32 dayOfYear = GF_RTC_GetDayOfYear(&sysInfoRTC->date) - 1;
|
||||
s32 dayOfYear = GF_RTC_GetDayOfYear(&sysInfoRTC->date) - 1;
|
||||
GF_ASSERT(dayOfYear >= 0 && dayOfYear < 366);
|
||||
if (sysInfoRTC->date.month > 2) {
|
||||
u32 year = sysInfoRTC->date.year;
|
||||
@@ -1863,7 +1863,7 @@ u32 FieldSystem_GetWeather(FieldSystem *fieldSystem, u32 mapId) {
|
||||
dayOfYear = 1;
|
||||
}
|
||||
weatherType -= WEATHER_UNKNOWN_24;
|
||||
u32 index = 5 * dayOfYear + weatherType;
|
||||
u32 index = 5 * dayOfYear + weatherType;
|
||||
weatherType = sWeatherTable[index];
|
||||
return weatherType;
|
||||
}
|
||||
|
||||
@@ -161,11 +161,11 @@ static char *sNarcFileList[] = {
|
||||
void ReadFromNarcMemberByPathAndId(void *dest, const char *path, s32 file_idx, u32 offset, u32 size) {
|
||||
FSFile file;
|
||||
register u32 chunk_starts[3];
|
||||
u32 btnf_size = 0;
|
||||
u32 btnf_size = 0;
|
||||
u32 chunk_size = 0;
|
||||
u32 file_start = 0;
|
||||
u32 file_end = 0;
|
||||
u16 num_files = 0;
|
||||
u32 file_end = 0;
|
||||
u16 num_files = 0;
|
||||
|
||||
FS_InitFile(&file);
|
||||
FS_OpenFile(&file, path);
|
||||
@@ -199,12 +199,12 @@ void ReadFromNarcMemberByPathAndId(void *dest, const char *path, s32 file_idx, u
|
||||
void *AllocAndReadFromNarcMemberByPathAndId(const char *path, s32 file_idx, HeapID heapId, u32 offset, u32 size, BOOL r4) {
|
||||
FSFile file;
|
||||
register u32 chunk_starts[3];
|
||||
u32 btnf_size = 0;
|
||||
u32 btnf_size = 0;
|
||||
u32 chunk_size = 0;
|
||||
u32 file_start = 0;
|
||||
u32 file_end = 0;
|
||||
u16 num_files = 0;
|
||||
void *dest = NULL;
|
||||
u32 file_end = 0;
|
||||
u16 num_files = 0;
|
||||
void *dest = NULL;
|
||||
|
||||
FS_InitFile(&file);
|
||||
FS_OpenFile(&file, path);
|
||||
@@ -271,11 +271,11 @@ void *AllocAtEndAndReadFromNarcMemberByIdPair(NarcId narc_id, s32 file_id, HeapI
|
||||
u32 GetNarcMemberSizeByIdPair(NarcId narc_id, s32 file_idx) {
|
||||
FSFile file;
|
||||
register u32 chunk_starts[3];
|
||||
u32 btnf_size = 0;
|
||||
u32 btnf_size = 0;
|
||||
u32 chunk_size = 0;
|
||||
u32 file_start = 0;
|
||||
u32 file_end = 0;
|
||||
u16 num_files = 0;
|
||||
u32 file_end = 0;
|
||||
u16 num_files = 0;
|
||||
|
||||
FS_InitFile(&file);
|
||||
FS_OpenFile(&file, sNarcFileList[narc_id]);
|
||||
|
||||
@@ -94,7 +94,7 @@ u32 FontFunc(u32 fontId, struct TextPrinter *printer) {
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&printer->subStructFields);
|
||||
|
||||
if (subStruct->hasGlyphIdBeenSet == 0) {
|
||||
subStruct->glyphId = fontId;
|
||||
subStruct->glyphId = fontId;
|
||||
subStruct->hasGlyphIdBeenSet = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,25 +44,25 @@ void sub_02015EF4(void) {
|
||||
}
|
||||
|
||||
void Main_SetVBlankIntrCB(void (*a0)(void *), void *a1) {
|
||||
gSystem.vBlankIntr = a0;
|
||||
gSystem.vBlankIntr = a0;
|
||||
gSystem.vBlankIntrArg = a1;
|
||||
}
|
||||
|
||||
void sub_02015F1C(void) {
|
||||
Main_ToggleHBlankInterrupt(FALSE);
|
||||
gSystem.hBlankIntr = NULL;
|
||||
gSystem.hBlankIntr = NULL;
|
||||
gSystem.hBlankIntrArg = NULL;
|
||||
}
|
||||
|
||||
BOOL Main_SetHBlankIntrCB(void (*a0)(void *), void *a1) {
|
||||
if (a0 == 0) {
|
||||
Main_ToggleHBlankInterrupt(FALSE);
|
||||
gSystem.hBlankIntr = NULL;
|
||||
gSystem.hBlankIntr = NULL;
|
||||
gSystem.hBlankIntrArg = NULL;
|
||||
return TRUE;
|
||||
} else if (gSystem.hBlankIntr == NULL) {
|
||||
gSystem.hBlankIntrArg = a1;
|
||||
gSystem.hBlankIntr = a0;
|
||||
gSystem.hBlankIntr = a0;
|
||||
Main_ToggleHBlankInterrupt(TRUE);
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -135,15 +135,15 @@ void InitSystemForTheGame(void) {
|
||||
GX_VBlankIntr(TRUE);
|
||||
FS_Init(1);
|
||||
sub_02022450();
|
||||
u32 size = FS_TryLoadTable(NULL, 0);
|
||||
u32 size = FS_TryLoadTable(NULL, 0);
|
||||
void *table = OS_AllocFromArenaLo(OS_ARENA_MAIN, size, 4);
|
||||
GF_ASSERT(table != NULL);
|
||||
FS_TryLoadTable(table, size);
|
||||
gSystem.vBlankIntr = NULL;
|
||||
gSystem.hBlankIntr = NULL;
|
||||
gSystem.unk10 = 0;
|
||||
gSystem.unk14 = 0;
|
||||
gSystem.unk2C = 0;
|
||||
gSystem.vBlankIntr = NULL;
|
||||
gSystem.hBlankIntr = NULL;
|
||||
gSystem.unk10 = 0;
|
||||
gSystem.unk14 = 0;
|
||||
gSystem.unk2C = 0;
|
||||
gSystem.screensFlipped = 0;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void *AllocAndReadFile(HeapID heapId, const char *path) {
|
||||
FS_InitFile(&file);
|
||||
if (FS_OpenFile(&file, path)) {
|
||||
u32 size = file.prop.file.bottom - file.prop.file.top;
|
||||
ret = AllocFromHeap(heapId, size);
|
||||
ret = AllocFromHeap(heapId, size);
|
||||
if (ret != NULL) {
|
||||
if (size != FS_ReadFile(&file, ret, (s32)size)) {
|
||||
FreeToHeapExplicit(heapId, ret);
|
||||
@@ -226,7 +226,7 @@ int GetFileCacheId(u32 hash) {
|
||||
int AddFileToCache(void *contents, u32 hash) {
|
||||
for (int i = 0; i < 128; i++) {
|
||||
if (sFileCache[i].contents == NULL) {
|
||||
sFileCache[i].contents = contents;
|
||||
sFileCache[i].contents = contents;
|
||||
sFileCache[i].name_hash = hash;
|
||||
return i;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ void ClearFileCache(void) {
|
||||
for (int i = 127; i > -1; i--) {
|
||||
if (sFileCache[i].contents != NULL) {
|
||||
FreeToHeap(sFileCache[i].contents);
|
||||
sFileCache[i].contents = NULL;
|
||||
sFileCache[i].contents = NULL;
|
||||
sFileCache[i].name_hash = 0;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ void *OpenFileCached(const s8 *str, HeapID heapId) {
|
||||
} else {
|
||||
strcpy(filenameBuf, str);
|
||||
}
|
||||
u32 hash = GetFilenameHash(filenameBuf);
|
||||
u32 hash = GetFilenameHash(filenameBuf);
|
||||
s32 cacheId = GetFileCacheId(hash);
|
||||
if (cacheId >= 0 && skipCache == 0) {
|
||||
ret = sFileCache[cacheId].contents;
|
||||
@@ -264,7 +264,7 @@ void *OpenFileCached(const s8 *str, HeapID heapId) {
|
||||
FS_InitFile(&file);
|
||||
if (FS_OpenFile(&file, (const char *)filenameBuf)) {
|
||||
u32 size = file.prop.file.bottom - file.prop.file.top;
|
||||
ret = AllocFromHeap(heapId, size);
|
||||
ret = AllocFromHeap(heapId, size);
|
||||
if (ret != NULL) {
|
||||
if (size != FS_ReadFile(&file, ret, (s32)size)) {
|
||||
FreeToHeap(ret);
|
||||
@@ -284,27 +284,27 @@ void *OpenFileCached(const s8 *str, HeapID heapId) {
|
||||
|
||||
void InitKeypadAndTouchpad(void) {
|
||||
TPCalibrateParam tp;
|
||||
gSystem.buttonMode = 0;
|
||||
gSystem.heldKeysRaw = 0;
|
||||
gSystem.newKeysRaw = 0;
|
||||
gSystem.newAndRepeatedKeysRaw = 0;
|
||||
gSystem.heldKeys = 0;
|
||||
gSystem.newKeys = 0;
|
||||
gSystem.newAndRepeatedKeys = 0;
|
||||
gSystem.keyRepeatCounter = 0;
|
||||
gSystem.buttonMode = 0;
|
||||
gSystem.heldKeysRaw = 0;
|
||||
gSystem.newKeysRaw = 0;
|
||||
gSystem.newAndRepeatedKeysRaw = 0;
|
||||
gSystem.heldKeys = 0;
|
||||
gSystem.newKeys = 0;
|
||||
gSystem.newAndRepeatedKeys = 0;
|
||||
gSystem.keyRepeatCounter = 0;
|
||||
gSystem.keyRepeatContinueDelay = 8;
|
||||
gSystem.keyRepeatStartDelay = 15;
|
||||
gSystem.touchX = 0;
|
||||
gSystem.touchY = 0;
|
||||
gSystem.touchNew = 0;
|
||||
gSystem.touchHeld = 0;
|
||||
gSystem.touchpadReadAuto = 0;
|
||||
gSystem.keyRepeatStartDelay = 15;
|
||||
gSystem.touchX = 0;
|
||||
gSystem.touchY = 0;
|
||||
gSystem.touchNew = 0;
|
||||
gSystem.touchHeld = 0;
|
||||
gSystem.touchpadReadAuto = 0;
|
||||
TP_Init();
|
||||
if (TP_GetUserInfo(&tp) == TRUE) {
|
||||
TP_SetCalibrateParam(&tp);
|
||||
} else {
|
||||
tp.x0 = 686;
|
||||
tp.y0 = 1420;
|
||||
tp.x0 = 686;
|
||||
tp.y0 = 1420;
|
||||
tp.xDotSize = 3621;
|
||||
tp.yDotSize = 4616;
|
||||
TP_SetCalibrateParam(&tp);
|
||||
@@ -327,11 +327,11 @@ void ReadKeypadAndTocuhpad(void) {
|
||||
TPData raw, calib;
|
||||
if (PAD_DetectFold()) {
|
||||
// Can't press any buttons while the lid is closed.
|
||||
gSystem.newKeys = 0;
|
||||
gSystem.heldKeys = 0;
|
||||
gSystem.newKeys = 0;
|
||||
gSystem.heldKeys = 0;
|
||||
gSystem.newAndRepeatedKeys = 0;
|
||||
gSystem.touchNew = 0;
|
||||
gSystem.touchHeld = 0;
|
||||
gSystem.touchNew = 0;
|
||||
gSystem.touchHeld = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ void ReadKeypadAndTocuhpad(void) {
|
||||
if (padRead != 0 && gSystem.heldKeysRaw == padRead) {
|
||||
if (--gSystem.keyRepeatCounter == 0) {
|
||||
gSystem.newAndRepeatedKeysRaw = padRead;
|
||||
gSystem.keyRepeatCounter = gSystem.keyRepeatContinueDelay;
|
||||
gSystem.keyRepeatCounter = gSystem.keyRepeatContinueDelay;
|
||||
}
|
||||
} else {
|
||||
gSystem.keyRepeatCounter = gSystem.keyRepeatStartDelay;
|
||||
@@ -357,8 +357,8 @@ void ReadKeypadAndTocuhpad(void) {
|
||||
gSystem.heldKeysRaw = padRead;
|
||||
|
||||
// Apply the button mode option to the read key input
|
||||
gSystem.newKeys = gSystem.newKeysRaw;
|
||||
gSystem.heldKeys = padRead;
|
||||
gSystem.newKeys = gSystem.newKeysRaw;
|
||||
gSystem.heldKeys = padRead;
|
||||
gSystem.newAndRepeatedKeys = gSystem.newAndRepeatedKeysRaw;
|
||||
ApplyButtonModeToInput();
|
||||
|
||||
@@ -395,7 +395,7 @@ void ReadKeypadAndTocuhpad(void) {
|
||||
else {
|
||||
calib.touch = 0;
|
||||
}
|
||||
gSystem.touchNew = (u16)((gSystem.touchHeld ^ calib.touch) & calib.touch);
|
||||
gSystem.touchNew = (u16)((gSystem.touchHeld ^ calib.touch) & calib.touch);
|
||||
gSystem.touchHeld = calib.touch;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ void ApplyButtonModeToInput(void) {
|
||||
|
||||
void SetKeyRepeatTimers(int continueDelay, int startDelay) {
|
||||
gSystem.keyRepeatContinueDelay = continueDelay;
|
||||
gSystem.keyRepeatStartDelay = startDelay;
|
||||
gSystem.keyRepeatStartDelay = startDelay;
|
||||
}
|
||||
|
||||
void SetSoftResetDisableMask(u8 a0) {
|
||||
|
||||
@@ -243,10 +243,10 @@ void *GfGfxLoader_LoadFromNarc(NarcId narcId, s32 memberNo, BOOL isCompressed, H
|
||||
void *dest2;
|
||||
if (isCompressed || allocAtEnd == TRUE) {
|
||||
u32 size = GetNarcMemberSizeByIdPair(narcId, memberNo);
|
||||
dest = AllocFromHeapAtEnd(heapId, size);
|
||||
dest = AllocFromHeapAtEnd(heapId, size);
|
||||
} else {
|
||||
u32 size = GetNarcMemberSizeByIdPair(narcId, memberNo);
|
||||
dest = AllocFromHeap(heapId, size);
|
||||
dest = AllocFromHeap(heapId, size);
|
||||
}
|
||||
if (dest != NULL) {
|
||||
ReadWholeNarcMemberByIdPair(dest, narcId, memberNo);
|
||||
|
||||
@@ -26,8 +26,8 @@ void GF_InitRTCWork(void) {
|
||||
RTC_Init();
|
||||
memset(&sGFRTCWork, 0, sizeof(sGFRTCWork)); // todo: figure out how to use memset
|
||||
sGFRTCWork.getDateTimeSuccess = FALSE;
|
||||
sGFRTCWork.getDateTimeLock = FALSE;
|
||||
sGFRTCWork.getDateTimeSleep = 0;
|
||||
sGFRTCWork.getDateTimeLock = FALSE;
|
||||
sGFRTCWork.getDateTimeSleep = 0;
|
||||
GF_RTC_GetDateTime(&sGFRTCWork);
|
||||
}
|
||||
|
||||
@@ -41,18 +41,18 @@ void GF_RTC_UpdateOnFrame(void) {
|
||||
}
|
||||
|
||||
void GF_RTC_GetDateTime_Callback(RTCResult result, void *data) {
|
||||
GF_RTC_Work *work = (GF_RTC_Work *)data;
|
||||
GF_RTC_Work *work = (GF_RTC_Work *)data;
|
||||
work->getDateTimeErrorCode = result;
|
||||
GF_ASSERT(result == RTC_RESULT_SUCCESS);
|
||||
work->getDateTimeSuccess = TRUE;
|
||||
work->date = work->date_async;
|
||||
work->time = work->time_async;
|
||||
work->getDateTimeLock = FALSE;
|
||||
work->date = work->date_async;
|
||||
work->time = work->time_async;
|
||||
work->getDateTimeLock = FALSE;
|
||||
}
|
||||
|
||||
void GF_RTC_GetDateTime(GF_RTC_Work *work) {
|
||||
work->getDateTimeLock = TRUE;
|
||||
RTCResult result = RTC_GetDateTimeAsync(&work->date_async, &work->time_async, GF_RTC_GetDateTime_Callback, work);
|
||||
work->getDateTimeLock = TRUE;
|
||||
RTCResult result = RTC_GetDateTimeAsync(&work->date_async, &work->time_async, GF_RTC_GetDateTime_Callback, work);
|
||||
work->getDateTimeErrorCode = result;
|
||||
GF_ASSERT(result == RTC_RESULT_SUCCESS);
|
||||
}
|
||||
@@ -109,9 +109,9 @@ s32 GF_RTC_GetDayOfYear(const RTCDate *date) {
|
||||
if (date->month >= RTC_MONTH_MARCH && IsLeapYear(date->year)) {
|
||||
days++;
|
||||
}
|
||||
date_stack = *date;
|
||||
date_stack = *date;
|
||||
date_stack.month = RTC_MONTH_JANUARY;
|
||||
date_stack.day = 1;
|
||||
date_stack.day = 1;
|
||||
RTC_ConvertDateToDay(&date_stack);
|
||||
RTC_ConvertDateToDay(date);
|
||||
return days;
|
||||
|
||||
@@ -23,23 +23,23 @@ void Save_HOF_RecordParty(struct HallOfFame *hof, struct Party *party, RTCDate *
|
||||
GF_ASSERT(hof->next_record < NUM_HOF_RECORDS);
|
||||
if (hof->num_total < 9999) {
|
||||
struct HOFParty *hof_party = &hof->parties[hof->next_record];
|
||||
int nmons = Party_GetCount(party);
|
||||
struct String *str = String_New(POKEMON_NAME_LENGTH + 1, HEAP_ID_DEFAULT);
|
||||
int nmons = Party_GetCount(party);
|
||||
struct String *str = String_New(POKEMON_NAME_LENGTH + 1, HEAP_ID_DEFAULT);
|
||||
MI_CpuClear16(hof_party->party, 6 * sizeof(struct HOFMon));
|
||||
int i, j;
|
||||
for (i = 0, j = 0; i < nmons; i++) {
|
||||
struct Pokemon *mon = Party_GetMonByIndex(party, i);
|
||||
BOOL lock = AcquireMonLock(mon);
|
||||
BOOL lock = AcquireMonLock(mon);
|
||||
if (!GetMonData(mon, MON_DATA_IS_EGG, NULL)) {
|
||||
hof_party->party[j].species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL);
|
||||
hof_party->party[j].level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
hof_party->party[j].form = (u8)GetMonData(mon, MON_DATA_FORM, NULL);
|
||||
hof_party->party[j].species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL);
|
||||
hof_party->party[j].level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
hof_party->party[j].form = (u8)GetMonData(mon, MON_DATA_FORM, NULL);
|
||||
hof_party->party[j].personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
||||
hof_party->party[j].otid = GetMonData(mon, MON_DATA_OTID, NULL);
|
||||
hof_party->party[j].moves[0] = (u16)GetMonData(mon, MON_DATA_MOVE1, NULL);
|
||||
hof_party->party[j].moves[1] = (u16)GetMonData(mon, MON_DATA_MOVE2, NULL);
|
||||
hof_party->party[j].moves[2] = (u16)GetMonData(mon, MON_DATA_MOVE3, NULL);
|
||||
hof_party->party[j].moves[3] = (u16)GetMonData(mon, MON_DATA_MOVE4, NULL);
|
||||
hof_party->party[j].otid = GetMonData(mon, MON_DATA_OTID, NULL);
|
||||
hof_party->party[j].moves[0] = (u16)GetMonData(mon, MON_DATA_MOVE1, NULL);
|
||||
hof_party->party[j].moves[1] = (u16)GetMonData(mon, MON_DATA_MOVE2, NULL);
|
||||
hof_party->party[j].moves[2] = (u16)GetMonData(mon, MON_DATA_MOVE3, NULL);
|
||||
hof_party->party[j].moves[3] = (u16)GetMonData(mon, MON_DATA_MOVE4, NULL);
|
||||
if (str != NULL) {
|
||||
GetMonData(mon, MON_DATA_NICKNAME_3, str);
|
||||
CopyStringToU16Array(str, hof_party->party[j].nickname, POKEMON_NAME_LENGTH + 1);
|
||||
@@ -47,15 +47,15 @@ void Save_HOF_RecordParty(struct HallOfFame *hof, struct Party *party, RTCDate *
|
||||
CopyStringToU16Array(str, hof_party->party[j].otname, PLAYER_NAME_LENGTH + 1);
|
||||
} else {
|
||||
hof_party->party[j].nickname[0] = EOS;
|
||||
hof_party->party[j].otname[0] = EOS;
|
||||
hof_party->party[j].otname[0] = EOS;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
ReleaseMonLock(mon, lock);
|
||||
}
|
||||
hof_party->year = (u16)date->year;
|
||||
hof_party->year = (u16)date->year;
|
||||
hof_party->month = (u8)date->month;
|
||||
hof_party->day = (u8)date->day;
|
||||
hof_party->day = (u8)date->day;
|
||||
hof->next_record++;
|
||||
if (hof->next_record >= NUM_HOF_RECORDS) {
|
||||
hof->next_record = 0;
|
||||
@@ -111,11 +111,11 @@ void Save_HOF_GetMonStatsByIndexPair(struct HallOfFame *hof, int a1, int a2, str
|
||||
hofno += NUM_HOF_RECORDS;
|
||||
}
|
||||
struct HOFMon *mon = &hof->parties[hofno].party[a2];
|
||||
dest->species = mon->species;
|
||||
dest->level = mon->level;
|
||||
dest->personality = mon->personality;
|
||||
dest->otid = mon->otid;
|
||||
dest->form = mon->form;
|
||||
dest->species = mon->species;
|
||||
dest->level = mon->level;
|
||||
dest->personality = mon->personality;
|
||||
dest->otid = mon->otid;
|
||||
dest->form = mon->form;
|
||||
CopyU16ArrayToString(dest->nickname, mon->nickname);
|
||||
CopyU16ArrayToString(dest->otname, mon->otname);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -132,8 +132,8 @@ void Save_HOF_GetClearDate(struct HallOfFame *hof, int a1, RTCDate *dest) {
|
||||
hofno += NUM_HOF_RECORDS;
|
||||
}
|
||||
struct HOFParty *party = &hof->parties[hofno];
|
||||
dest->year = party->year;
|
||||
dest->month = party->month;
|
||||
dest->day = party->day;
|
||||
dest->week = RTC_WEEK_SUNDAY;
|
||||
dest->year = party->year;
|
||||
dest->month = party->month;
|
||||
dest->day = party->day;
|
||||
dest->week = RTC_WEEK_SUNDAY;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ struct HeapInfo {
|
||||
|
||||
typedef struct MemoryBlock {
|
||||
u8 filler_00[12];
|
||||
u32 heapId : 8;
|
||||
u32 heapId : 8;
|
||||
u32 filler_0D : 24;
|
||||
} MemoryBlock;
|
||||
|
||||
@@ -54,14 +54,14 @@ void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 total
|
||||
+ totalNumHeaps,
|
||||
4);
|
||||
sHeapInfo.parentHeapHandles = sHeapInfo.heapHandles + (unk_size + 1);
|
||||
sHeapInfo.subHeapRawPtrs = (void **)(sHeapInfo.parentHeapHandles + unk_size);
|
||||
sHeapInfo.numMemBlocks = (u16 *)(sHeapInfo.subHeapRawPtrs + unk_size);
|
||||
sHeapInfo.heapIdxs = (u8 *)(sHeapInfo.numMemBlocks + totalNumHeaps);
|
||||
sHeapInfo.totalNumHeaps = (u16)totalNumHeaps;
|
||||
sHeapInfo.nTemplates = (u16)nTemplates;
|
||||
sHeapInfo.subHeapRawPtrs = (void **)(sHeapInfo.parentHeapHandles + unk_size);
|
||||
sHeapInfo.numMemBlocks = (u16 *)(sHeapInfo.subHeapRawPtrs + unk_size);
|
||||
sHeapInfo.heapIdxs = (u8 *)(sHeapInfo.numMemBlocks + totalNumHeaps);
|
||||
sHeapInfo.totalNumHeaps = (u16)totalNumHeaps;
|
||||
sHeapInfo.nTemplates = (u16)nTemplates;
|
||||
|
||||
sHeapInfo.unallocatedHeapId = (u16)unk_size;
|
||||
sHeapInfo.maxHeaps = (u16)unk_size;
|
||||
sHeapInfo.maxHeaps = (u16)unk_size;
|
||||
|
||||
for (i = 0; i < nTemplates; i++) {
|
||||
switch (templates[i].arena) {
|
||||
@@ -77,7 +77,7 @@ void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 total
|
||||
if (ptr != NULL) {
|
||||
|
||||
sHeapInfo.heapHandles[i] = NNS_FndCreateExpHeap(ptr, templates[i].size);
|
||||
sHeapInfo.heapIdxs[i] = (u8)i;
|
||||
sHeapInfo.heapIdxs[i] = (u8)i;
|
||||
} else {
|
||||
GF_ASSERT(0);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 total
|
||||
|
||||
for (i = nTemplates; i < unk_size + 1; i++) {
|
||||
sHeapInfo.heapHandles[i] = NULL;
|
||||
sHeapInfo.heapIdxs[i] = (u8)sHeapInfo.unallocatedHeapId;
|
||||
sHeapInfo.heapIdxs[i] = (u8)sHeapInfo.unallocatedHeapId;
|
||||
}
|
||||
|
||||
while (i < totalNumHeaps) {
|
||||
@@ -134,8 +134,8 @@ BOOL CreateHeapInternal(u32 parent, u32 child, u32 size, s32 alignment) {
|
||||
|
||||
if (sHeapInfo.heapHandles[i] != NULL) {
|
||||
sHeapInfo.parentHeapHandles[i] = parentHeap;
|
||||
sHeapInfo.subHeapRawPtrs[i] = newHeapAddr;
|
||||
sHeapInfo.heapIdxs[child] = (u8)i;
|
||||
sHeapInfo.subHeapRawPtrs[i] = newHeapAddr;
|
||||
sHeapInfo.heapIdxs[child] = (u8)i;
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -164,18 +164,18 @@ void DestroyHeap(HeapID heapId) {
|
||||
if (handle != NULL) {
|
||||
NNS_FndDestroyExpHeap(handle);
|
||||
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
NNSFndHeapHandle parentHeap = sHeapInfo.parentHeapHandles[index];
|
||||
void *childRaw = sHeapInfo.subHeapRawPtrs[index];
|
||||
void *childRaw = sHeapInfo.subHeapRawPtrs[index];
|
||||
if (parentHeap != NULL && childRaw != NULL) {
|
||||
NNS_FndFreeToExpHeap(parentHeap, childRaw);
|
||||
} else {
|
||||
GF_ASSERT(0);
|
||||
}
|
||||
|
||||
sHeapInfo.heapHandles[sHeapInfo.heapIdxs[heapId]] = NULL;
|
||||
sHeapInfo.heapHandles[sHeapInfo.heapIdxs[heapId]] = NULL;
|
||||
sHeapInfo.parentHeapHandles[sHeapInfo.heapIdxs[heapId]] = NULL;
|
||||
sHeapInfo.subHeapRawPtrs[sHeapInfo.heapIdxs[heapId]] = NULL;
|
||||
sHeapInfo.subHeapRawPtrs[sHeapInfo.heapIdxs[heapId]] = NULL;
|
||||
|
||||
sHeapInfo.heapIdxs[heapId] = (u8)sHeapInfo.unallocatedHeapId;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void *AllocFromHeap(HeapID heapId, u32 size) {
|
||||
void *ptr = NULL;
|
||||
if ((u32)heapId < sHeapInfo.totalNumHeaps) {
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, 4, heapId);
|
||||
ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, 4, heapId);
|
||||
}
|
||||
if (ptr != NULL) {
|
||||
sHeapInfo.numMemBlocks[heapId]++;
|
||||
@@ -223,7 +223,7 @@ void *AllocFromHeapAtEnd(HeapID heapId, u32 size) {
|
||||
void *ptr = NULL;
|
||||
if ((u32)heapId < sHeapInfo.totalNumHeaps) {
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, -4, heapId);
|
||||
ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, -4, heapId);
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
@@ -240,7 +240,7 @@ void FreeToHeap(void *ptr) {
|
||||
HeapID heapId = (HeapID)(((MemoryBlock *)ptr)->heapId);
|
||||
|
||||
if ((u32)heapId < sHeapInfo.totalNumHeaps) {
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
NNSFndHeapHandle heap = sHeapInfo.heapHandles[index];
|
||||
GF_ASSERT(heap != NULL);
|
||||
|
||||
@@ -263,7 +263,7 @@ void FreeToHeapExplicit(HeapID heapId, void *ptr) {
|
||||
GF_ASSERT(OS_GetProcMode() != OS_PROCMODE_IRQ);
|
||||
|
||||
if ((u32)heapId < sHeapInfo.totalNumHeaps) {
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
u8 index = sHeapInfo.heapIdxs[heapId];
|
||||
NNSFndHeapHandle heap = sHeapInfo.heapHandles[index];
|
||||
GF_ASSERT(heap != NULL);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "global.h"
|
||||
|
||||
void InitIGT(struct IGT *igt) {
|
||||
igt->hours = 0;
|
||||
igt->hours = 0;
|
||||
igt->minutes = 0;
|
||||
igt->seconds = 0;
|
||||
}
|
||||
@@ -15,7 +15,7 @@ void AddIGTSeconds(struct IGT *igt, u32 to_add) {
|
||||
}
|
||||
seconds = (u32)(igt->seconds + to_add);
|
||||
minutes = (u32)igt->minutes;
|
||||
hours = (u32)igt->hours;
|
||||
hours = (u32)igt->hours;
|
||||
if (seconds > 59) {
|
||||
minutes += seconds / 60;
|
||||
seconds %= 60;
|
||||
@@ -23,13 +23,13 @@ void AddIGTSeconds(struct IGT *igt, u32 to_add) {
|
||||
hours += minutes / 60;
|
||||
minutes %= 60;
|
||||
if (hours >= 999) {
|
||||
hours = 999;
|
||||
hours = 999;
|
||||
minutes = 59;
|
||||
seconds = 59;
|
||||
}
|
||||
}
|
||||
}
|
||||
igt->hours = (u16)hours;
|
||||
igt->hours = (u16)hours;
|
||||
igt->minutes = (u8)minutes;
|
||||
igt->seconds = (u8)seconds;
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ void GetItemDescIntoString(struct String *dest, u16 item_id, HeapID heapId) {
|
||||
u32 GetItemAttr(u16 item, u32 attr, HeapID heapId) {
|
||||
u32 ret;
|
||||
struct ItemData *itemData = (struct ItemData *)LoadItemDataOrGfx(item, 0, heapId);
|
||||
ret = GetItemAttr_PreloadedItemData(itemData, attr);
|
||||
ret = GetItemAttr_PreloadedItemData(itemData, attr);
|
||||
FreeToHeapExplicit(heapId, itemData);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -14,20 +14,20 @@ void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 onInit);
|
||||
|
||||
struct ListMenu *ListMenuInit(const struct ListMenuTemplate *template, u16 cursorPos, u16 itemsAbove, u8 heapId) {
|
||||
struct ListMenu *list = AllocFromHeap((HeapID)heapId, sizeof(struct ListMenu));
|
||||
list->template = *template;
|
||||
list->cursor = ListMenuCursorNew((HeapID)heapId);
|
||||
list->cursorPos = cursorPos;
|
||||
list->itemsAbove = itemsAbove;
|
||||
list->unk_30 = 0;
|
||||
list->unk_31 = 0;
|
||||
list->taskId = 0xFF;
|
||||
list->unk_33 = 0;
|
||||
list->heapId = heapId;
|
||||
list->cursorPal = list->template.cursorPal;
|
||||
list->fillValue = list->template.fillValue;
|
||||
list->template = *template;
|
||||
list->cursor = ListMenuCursorNew((HeapID)heapId);
|
||||
list->cursorPos = cursorPos;
|
||||
list->itemsAbove = itemsAbove;
|
||||
list->unk_30 = 0;
|
||||
list->unk_31 = 0;
|
||||
list->taskId = 0xFF;
|
||||
list->unk_33 = 0;
|
||||
list->heapId = heapId;
|
||||
list->cursorPal = list->template.cursorPal;
|
||||
list->fillValue = list->template.fillValue;
|
||||
list->cursorShadowPal = list->template.cursorShadowPal;
|
||||
list->lettersSpacing = list->template.lettersSpacing;
|
||||
list->fontId = list->template.fontId;
|
||||
list->lettersSpacing = list->template.lettersSpacing;
|
||||
list->fontId = list->template.fontId;
|
||||
list->overrideEnabled = FALSE;
|
||||
if (list->template.totalItems < list->template.maxShowed) {
|
||||
list->template.maxShowed = list->template.totalItems;
|
||||
@@ -63,15 +63,15 @@ s32 ListMenu_ProcessInput(struct ListMenu *list) {
|
||||
switch (list->template.scrollMultiple) {
|
||||
case LIST_NO_MULTIPLE_SCROLL:
|
||||
default:
|
||||
leftButton = FALSE;
|
||||
leftButton = FALSE;
|
||||
rightButton = FALSE;
|
||||
break;
|
||||
case LIST_MULTIPLE_SCROLL_DPAD:
|
||||
leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_LEFT_MASK);
|
||||
leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_LEFT_MASK);
|
||||
rightButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_RIGHT_MASK);
|
||||
break;
|
||||
case LIST_MULTIPLE_SCROLL_L_R:
|
||||
leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_L_MASK);
|
||||
leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_L_MASK);
|
||||
rightButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_R_MASK);
|
||||
break;
|
||||
}
|
||||
@@ -113,10 +113,10 @@ s32 ListMenuTestInputInternal(struct ListMenu *list, const struct ListMenuTempla
|
||||
if (template != NULL) {
|
||||
list->template = *template;
|
||||
}
|
||||
list->cursorPos = cursorPos;
|
||||
list->cursorPos = cursorPos;
|
||||
list->itemsAbove = itemsAbove;
|
||||
list->unk_30 = 0;
|
||||
list->unk_31 = 0;
|
||||
list->unk_30 = 0;
|
||||
list->unk_31 = 0;
|
||||
|
||||
if (input == REG_PAD_KEYINPUT_UP_MASK) {
|
||||
ListMenuChangeSelection(list, (u8)updateFlag, 1, FALSE);
|
||||
@@ -137,8 +137,8 @@ s32 ListMenuTestInput(struct ListMenu *list, const struct ListMenuTemplate *temp
|
||||
}
|
||||
|
||||
void ListMenuOverrideSetColors(struct ListMenu *list, u8 cursorPal, u8 fillValue, u8 cursorShadowPal) {
|
||||
list->cursorPal = cursorPal;
|
||||
list->fillValue = fillValue;
|
||||
list->cursorPal = cursorPal;
|
||||
list->fillValue = fillValue;
|
||||
list->cursorShadowPal = cursorShadowPal;
|
||||
list->overrideEnabled = TRUE;
|
||||
}
|
||||
@@ -310,8 +310,8 @@ void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u1
|
||||
|
||||
void ListMenuDrawCursor(struct ListMenu *list) {
|
||||
u8 yMultiplier = (u8)(GetFontAttribute((u8)list->template.fontId, 1) + list->template.itemVerticalPadding);
|
||||
u8 x = list->template.cursor_X;
|
||||
u8 y = (u8)(list->itemsAbove * yMultiplier + list->template.upText_Y);
|
||||
u8 x = list->template.cursor_X;
|
||||
u8 y = (u8)(list->itemsAbove * yMultiplier + list->template.upText_Y);
|
||||
switch (list->template.cursorKind) {
|
||||
case 0:
|
||||
ListMenuUpdateCursorObj(list->cursor, list->template.window, x, y);
|
||||
@@ -327,8 +327,8 @@ void ListMenuErasePrintedCursor(struct ListMenu *list, u16 itemsAbove) {
|
||||
switch (list->template.cursorKind) {
|
||||
case 0:
|
||||
u8 yMultiplier = (u8)(GetFontAttribute(list->template.fontId, 1) + list->template.itemVerticalPadding);
|
||||
u8 width = 8;
|
||||
u8 height = 16;
|
||||
u8 width = 8;
|
||||
u8 height = 16;
|
||||
FillWindowPixelRect(list->template.window,
|
||||
list->template.fillValue,
|
||||
list->template.cursor_X,
|
||||
@@ -349,7 +349,7 @@ u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, u8 movin
|
||||
u16 newRow;
|
||||
|
||||
itemsAbove = list->itemsAbove;
|
||||
cursorPos = list->cursorPos;
|
||||
cursorPos = list->cursorPos;
|
||||
|
||||
if (!movingDown) {
|
||||
if (list->template.maxShowed == 1) {
|
||||
@@ -376,7 +376,7 @@ u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, u8 movin
|
||||
}
|
||||
}
|
||||
list->itemsAbove = newRow;
|
||||
list->cursorPos = (u16)(cursorPos - 1);
|
||||
list->cursorPos = (u16)(cursorPos - 1);
|
||||
}
|
||||
} else {
|
||||
if (list->template.maxShowed == 1) {
|
||||
@@ -403,7 +403,7 @@ u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, u8 movin
|
||||
}
|
||||
}
|
||||
list->itemsAbove = newRow;
|
||||
list->cursorPos = (u16)(cursorPos + 1);
|
||||
list->cursorPos = (u16)(cursorPos + 1);
|
||||
}
|
||||
}
|
||||
return 2;
|
||||
@@ -422,8 +422,8 @@ void ListMenuScroll(struct ListMenu *list, u8 count, u8 movingDown) {
|
||||
ScrollWindow(list->template.window, 1, (u8)(count * yMultiplier), (u8)((list->template.fillValue << 4) | list->template.fillValue));
|
||||
ListMenuPrintEntries(list, list->cursorPos, 0, count);
|
||||
|
||||
y = (u16)((list->template.maxShowed * yMultiplier) + list->template.upText_Y);
|
||||
width = GetWindowWidth(list->template.window);
|
||||
y = (u16)((list->template.maxShowed * yMultiplier) + list->template.upText_Y);
|
||||
width = GetWindowWidth(list->template.window);
|
||||
height = GetWindowHeight(list->template.window);
|
||||
FillWindowPixelRect(list->template.window,
|
||||
list->template.fillValue,
|
||||
@@ -452,8 +452,8 @@ BOOL ListMenuChangeSelection(struct ListMenu *list, u8 updateCursorAndCallCallba
|
||||
u16 oldSelectedRow;
|
||||
u8 selectionChange, i, cursorCount;
|
||||
|
||||
oldSelectedRow = list->itemsAbove;
|
||||
cursorCount = 0;
|
||||
oldSelectedRow = list->itemsAbove;
|
||||
cursorCount = 0;
|
||||
selectionChange = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
do {
|
||||
|
||||
@@ -12,10 +12,10 @@ struct ListMenuItem *ListMenuItems_New(u32 count, HeapID heapId) {
|
||||
struct ListMenuItem *ret = AllocFromHeap(heapId, (count + 1) * sizeof(struct ListMenuItem));
|
||||
if (ret != NULL) {
|
||||
for (i = 0; i < count; i++) {
|
||||
ret[i].text = NULL;
|
||||
ret[i].text = NULL;
|
||||
ret[i].value = 0;
|
||||
}
|
||||
ret[i].text = (struct String *)-1u;
|
||||
ret[i].text = (struct String *)-1u;
|
||||
ret[i].value = (s32)heapId;
|
||||
}
|
||||
return ret;
|
||||
@@ -30,7 +30,7 @@ void ListMenuItems_AppendFromMsgData(struct ListMenuItem *items, struct MsgData
|
||||
HeapID heapId;
|
||||
struct ListMenuItem *newItem = ListMenuItems_SeekEnd(items, &heapId);
|
||||
if (newItem != NULL) {
|
||||
newItem->text = NewString_ReadMsgData(msgData, msgNo);
|
||||
newItem->text = NewString_ReadMsgData(msgData, msgNo);
|
||||
newItem->value = value;
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ void ListMenuItems_AddItem(struct ListMenuItem *items, struct String *str, s32 v
|
||||
HeapID heapId;
|
||||
struct ListMenuItem *newItem = ListMenuItems_SeekEnd(items, &heapId);
|
||||
if (newItem != NULL) {
|
||||
newItem->text = StringDup(str, heapId);
|
||||
newItem->text = StringDup(str, heapId);
|
||||
newItem->value = value;
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ void ListMenuItems_CopyItem(struct ListMenuItem *items, struct ListMenuItem *src
|
||||
HeapID heapId;
|
||||
struct ListMenuItem *newItem = ListMenuItems_SeekEnd(items, &heapId);
|
||||
if (newItem != NULL) {
|
||||
newItem->text = src->text;
|
||||
newItem->text = src->text;
|
||||
newItem->value = src->value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ extern u16 sub_0206B7BC(u16 species, u32 form, BOOL is_egg);
|
||||
|
||||
void Mail_Init(struct Mail *mail) {
|
||||
s32 i;
|
||||
mail->author_otId = 0;
|
||||
mail->author_gender = 0;
|
||||
mail->author_otId = 0;
|
||||
mail->author_gender = 0;
|
||||
mail->author_language = (u8)gGameLanguage;
|
||||
mail->author_version = (u8)gGameVersion;
|
||||
mail->mail_type = 0xFF;
|
||||
mail->author_version = (u8)gGameVersion;
|
||||
mail->mail_type = 0xFF;
|
||||
StringFillEOS(mail->author_name, 8);
|
||||
for (i = 0; i < 3; i++) {
|
||||
mail->unk_18[i].raw = 0xFFFF;
|
||||
@@ -55,21 +55,21 @@ void Mail_SetNewMessageDetails(struct Mail *mail, u8 type, u8 monIdx, struct Sav
|
||||
|
||||
Mail_Init(mail);
|
||||
mail->mail_type = type;
|
||||
party = SaveArray_Party_Get(save);
|
||||
profile = Save_PlayerData_GetProfileAddr(save);
|
||||
party = SaveArray_Party_Get(save);
|
||||
profile = Save_PlayerData_GetProfileAddr(save);
|
||||
|
||||
CopyU16StringArray(mail->author_name, PlayerProfile_GetNamePtr(profile));
|
||||
mail->author_gender = (u8)PlayerProfile_GetTrainerGender(profile);
|
||||
mail->author_otId = PlayerProfile_GetTrainerID(profile);
|
||||
mail->author_otId = PlayerProfile_GetTrainerID(profile);
|
||||
for (i = 0; monIdx < Party_GetCount(party); monIdx++) {
|
||||
union MailPatternData *ptr;
|
||||
pokemon = Party_GetMonByIndex(party, monIdx);
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
is_egg = (BOOL)GetMonData(pokemon, MON_DATA_IS_EGG, NULL);
|
||||
form = GetMonData(pokemon, MON_DATA_FORM, NULL);
|
||||
sp10 = sub_0206B6C8(pokemon);
|
||||
r7 = sub_0206B7BC(species, form, is_egg);
|
||||
ptr = &mail->unk_18[i];
|
||||
pokemon = Party_GetMonByIndex(party, monIdx);
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
is_egg = (BOOL)GetMonData(pokemon, MON_DATA_IS_EGG, NULL);
|
||||
form = GetMonData(pokemon, MON_DATA_FORM, NULL);
|
||||
sp10 = sub_0206B6C8(pokemon);
|
||||
r7 = sub_0206B7BC(species, form, is_egg);
|
||||
ptr = &mail->unk_18[i];
|
||||
ptr->bits.unk_0 = sp10;
|
||||
i++;
|
||||
ptr->bits.unk_C = r7;
|
||||
@@ -188,7 +188,7 @@ s32 Mailbox_CountMessages(struct Mail *mail, BOOL r1) {
|
||||
struct Mail *Mailbox_AllocAndFetchMailI(struct Mail *mail, BOOL r1, s32 idx, HeapID heapId) {
|
||||
struct Mail *ret;
|
||||
mail = Mailbox_GetPtrToSlotI(mail, r1, idx);
|
||||
ret = Mail_New(heapId);
|
||||
ret = Mail_New(heapId);
|
||||
if (mail != NULL) {
|
||||
Mail_Copy(mail, ret);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void MailMsg_Init(struct MailMessage *mailMsg) {
|
||||
void MailMsg_Init_WithBank(struct MailMessage *mailMsg, u16 bank) {
|
||||
s32 i;
|
||||
mailMsg->msg_bank = bank;
|
||||
mailMsg->msg_no = 0;
|
||||
mailMsg->msg_no = 0;
|
||||
for (i = 0; i < MAILMSG_FIELDS_MAX; i++) {
|
||||
mailMsg->fields[i] = EC_WORD_NULL;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ struct String *MailMsg_GetExpandedString(struct MailMessage *mailMsg, HeapID hea
|
||||
BufferECWord(messageFormat, (u32)i, mailMsg->fields[i]);
|
||||
}
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, sMessageBanks[mailMsg->msg_bank], heapId);
|
||||
ret = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, mailMsg->msg_no, heapId);
|
||||
ret = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, mailMsg->msg_no, heapId);
|
||||
DestroyMsgData(msgData);
|
||||
MessageFormat_Delete(messageFormat);
|
||||
return ret;
|
||||
@@ -115,8 +115,8 @@ u32 MailMsg_NumFields(u16 bank, u16 num) {
|
||||
u32 count;
|
||||
GF_ASSERT(bank < NELEMS(sMessageBanks));
|
||||
GF_ASSERT(num < MailMsg_NumMsgsInBank(bank));
|
||||
str = ReadMsgData_NewNarc_NewString(NARC_MSGDATA_MSG, sMessageBanks[bank], num, HEAP_ID_DEFAULT);
|
||||
cstr = String_c_str(str);
|
||||
str = ReadMsgData_NewNarc_NewString(NARC_MSGDATA_MSG, sMessageBanks[bank], num, HEAP_ID_DEFAULT);
|
||||
cstr = String_c_str(str);
|
||||
count = 0;
|
||||
while (*cstr != EOS) {
|
||||
if (*cstr == EXT_CTRL_CODE_BEGIN) {
|
||||
@@ -168,7 +168,7 @@ u32 MailMsg_NumMsgsInBank(u16 bank) {
|
||||
void MailMsg_SetMsgBankAndNum(struct MailMessage *mailMsg, u16 bank, u16 num) {
|
||||
GF_ASSERT(bank < NELEMS(sMessageBanks));
|
||||
mailMsg->msg_bank = bank;
|
||||
mailMsg->msg_no = num;
|
||||
mailMsg->msg_no = num;
|
||||
}
|
||||
|
||||
void MailMsg_SetFieldI(struct MailMessage *mailMsg, u32 idx, u16 word) {
|
||||
|
||||
@@ -48,7 +48,7 @@ extern struct OverlayManagerTemplate ov63_021DBE18;
|
||||
extern u8 SDK_STATIC_BSS_START[];
|
||||
|
||||
const int gGameLanguage = GAME_LANGUAGE;
|
||||
const int gGameVersion = GAME_VERSION;
|
||||
const int gGameVersion = GAME_VERSION;
|
||||
|
||||
__declspec(noreturn) void NitroMain(void) {
|
||||
InitSystemForTheGame();
|
||||
@@ -66,7 +66,7 @@ __declspec(noreturn) void NitroMain(void) {
|
||||
sub_02002C50(1, HEAP_ID_MAIN);
|
||||
sub_02002C50(3, HEAP_ID_MAIN);
|
||||
UNK_02016FA8.unk10 = -1;
|
||||
UNK_02016FA8.save = SaveData_New();
|
||||
UNK_02016FA8.save = SaveData_New();
|
||||
InitSoundData(Save_Chatot_Get(UNK_02016FA8.save), Save_PlayerData_GetOptionsAddr(UNK_02016FA8.save));
|
||||
Init_Timer3();
|
||||
if (sub_020337E8(3) == 3) {
|
||||
@@ -132,10 +132,10 @@ __declspec(noreturn) void NitroMain(void) {
|
||||
}
|
||||
|
||||
void sub_02000DF4(void) {
|
||||
UNK_02016FA8.mainOverlayId = SDK_OVERLAY_INVALID_ID;
|
||||
UNK_02016FA8.overlayManager = NULL;
|
||||
UNK_02016FA8.mainOverlayId = SDK_OVERLAY_INVALID_ID;
|
||||
UNK_02016FA8.overlayManager = NULL;
|
||||
UNK_02016FA8.queuedMainOverlayId = SDK_OVERLAY_INVALID_ID; // overlay invalid
|
||||
UNK_02016FA8.template = NULL;
|
||||
UNK_02016FA8.template = NULL;
|
||||
}
|
||||
|
||||
void Main_RunOverlayManager(void) {
|
||||
@@ -146,10 +146,10 @@ void Main_RunOverlayManager(void) {
|
||||
if (UNK_02016FA8.queuedMainOverlayId != SDK_OVERLAY_INVALID_ID) {
|
||||
HandleLoadOverlay(UNK_02016FA8.queuedMainOverlayId, 0);
|
||||
}
|
||||
UNK_02016FA8.mainOverlayId = UNK_02016FA8.queuedMainOverlayId;
|
||||
UNK_02016FA8.overlayManager = OverlayManager_New(UNK_02016FA8.template, &UNK_02016FA8.unk10, HEAP_ID_DEFAULT);
|
||||
UNK_02016FA8.mainOverlayId = UNK_02016FA8.queuedMainOverlayId;
|
||||
UNK_02016FA8.overlayManager = OverlayManager_New(UNK_02016FA8.template, &UNK_02016FA8.unk10, HEAP_ID_DEFAULT);
|
||||
UNK_02016FA8.queuedMainOverlayId = SDK_OVERLAY_INVALID_ID;
|
||||
UNK_02016FA8.template = NULL;
|
||||
UNK_02016FA8.template = NULL;
|
||||
}
|
||||
if (OverlayManager_Run(UNK_02016FA8.overlayManager)) {
|
||||
OverlayManager_Delete(UNK_02016FA8.overlayManager);
|
||||
@@ -163,7 +163,7 @@ void Main_RunOverlayManager(void) {
|
||||
void RegisterMainOverlay(FSOverlayID id, const struct OverlayManagerTemplate *template) {
|
||||
GF_ASSERT(UNK_02016FA8.template == NULL);
|
||||
UNK_02016FA8.queuedMainOverlayId = id;
|
||||
UNK_02016FA8.template = template;
|
||||
UNK_02016FA8.template = template;
|
||||
}
|
||||
|
||||
void sub_02000E9C(void) {
|
||||
|
||||
@@ -663,7 +663,7 @@ u8 MapHeader_GetMoveModelBank(u32 mapno) {
|
||||
u16 MapHeader_GetMatrixId(u32 mapno) {
|
||||
u16 ret;
|
||||
mapno = MapNumberBoundsCheck(mapno);
|
||||
ret = sMapHeaders[mapno].matrix_id;
|
||||
ret = sMapHeaders[mapno].matrix_id;
|
||||
// Spear Pillar
|
||||
if (ret == NARC_map_matrix_narc_0022_bin && gGameVersion == VERSION_PEARL) {
|
||||
ret = NARC_map_matrix_narc_0023_bin;
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
static void MapMatrix_MapMatrixData_Load(
|
||||
struct MapMatrixData *map_matrix, u16 file_id, u32 map_id) {
|
||||
map_matrix->width = 0;
|
||||
map_matrix->width = 0;
|
||||
map_matrix->height = 0;
|
||||
|
||||
s32 i;
|
||||
for (i = 0; i < MAP_MATRIX_MAX_SIZE; i++) {
|
||||
map_matrix->headers[i] = 0;
|
||||
map_matrix->headers[i] = 0;
|
||||
map_matrix->altitudes[i] = 0;
|
||||
map_matrix->maps.data[i] = 0;
|
||||
}
|
||||
@@ -24,13 +24,13 @@ static void MapMatrix_MapMatrixData_Load(
|
||||
}
|
||||
|
||||
void *buffer = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX, file_id, HEAP_ID_FIELD);
|
||||
u8 *cursor = (u8 *)buffer;
|
||||
u8 *cursor = (u8 *)buffer;
|
||||
|
||||
map_matrix->width = *(cursor++);
|
||||
map_matrix->height = *(cursor++);
|
||||
u8 has_headers_section = *(cursor++);
|
||||
map_matrix->width = *(cursor++);
|
||||
map_matrix->height = *(cursor++);
|
||||
u8 has_headers_section = *(cursor++);
|
||||
u8 has_altitudes_section = *(cursor++);
|
||||
u8 name_length = *(cursor++);
|
||||
u8 name_length = *(cursor++);
|
||||
|
||||
GF_ASSERT(name_length <= MAP_MATRIX_MAX_NAME_LENGTH);
|
||||
|
||||
@@ -61,8 +61,8 @@ static void MapMatrix_MapMatrixData_Load(
|
||||
struct MapMatrix *MapMatrix_New(void) {
|
||||
struct MapMatrix *map_matrix = AllocFromHeap(HEAP_ID_FIELD, sizeof(struct MapMatrix));
|
||||
|
||||
map_matrix->width = 0;
|
||||
map_matrix->height = 0;
|
||||
map_matrix->width = 0;
|
||||
map_matrix->height = 0;
|
||||
map_matrix->matrix_id = 0;
|
||||
|
||||
return map_matrix;
|
||||
@@ -74,8 +74,8 @@ void MapMatrix_Load(u16 map_id, struct MapMatrix *map_matrix) {
|
||||
MapMatrix_MapMatrixData_Load(&map_matrix->data, matrix_id, map_id);
|
||||
|
||||
map_matrix->matrix_id = (u8)matrix_id;
|
||||
map_matrix->height = map_matrix->data.height;
|
||||
map_matrix->width = map_matrix->data.width;
|
||||
map_matrix->height = map_matrix->data.height;
|
||||
map_matrix->width = map_matrix->data.width;
|
||||
}
|
||||
|
||||
void MapMatrix_Free(struct MapMatrix *map_matrix) {
|
||||
@@ -101,7 +101,7 @@ u8 MapMatrix_GetHeight(struct MapMatrix *map_matrix) {
|
||||
}
|
||||
|
||||
u16 MapMatrix_GetMapHeader(struct MapMatrix *map_matrix, s32 x, s32 y) {
|
||||
s32 width = map_matrix->width;
|
||||
s32 width = map_matrix->width;
|
||||
s32 height = map_matrix->height;
|
||||
|
||||
GF_ASSERT(x >= 0 && x < width);
|
||||
@@ -133,8 +133,8 @@ u32 MapMatrix_GetMapAltitude(
|
||||
|
||||
struct MapData *MapMatrix_MapData_New(HeapID heapId) {
|
||||
struct MapData *map_data = AllocFromHeap(heapId, sizeof(struct MapData));
|
||||
void *buffer = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX, 0, heapId);
|
||||
u8 *cursor = (u8 *)buffer;
|
||||
void *buffer = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX, 0, heapId);
|
||||
u8 *cursor = (u8 *)buffer;
|
||||
|
||||
cursor += 4;
|
||||
u8 name_length = *cursor;
|
||||
@@ -172,18 +172,18 @@ u16 GetMapData(s32 map_id, struct MapMatrix *map_matrix) {
|
||||
}
|
||||
|
||||
void sub_02034678(struct MapMatrix *map_matrix) {
|
||||
u16 *maps = map_matrix->data.maps.data;
|
||||
u16 *maps = map_matrix->data.maps.data;
|
||||
u8 *altitudes = map_matrix->data.altitudes;
|
||||
u8 width = map_matrix->width;
|
||||
u8 width = map_matrix->width;
|
||||
|
||||
if (map_matrix->matrix_id != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
maps[width * 0x15 + 0x17] = 0xB0;
|
||||
maps[width * 0x15 + 0x18] = 0xB0;
|
||||
maps[width * 0x16 + 0x17] = 0xB0;
|
||||
maps[width * 0x16 + 0x18] = 0xB0;
|
||||
maps[width * 0x15 + 0x17] = 0xB0;
|
||||
maps[width * 0x15 + 0x18] = 0xB0;
|
||||
maps[width * 0x16 + 0x17] = 0xB0;
|
||||
maps[width * 0x16 + 0x18] = 0xB0;
|
||||
altitudes[width * 0x15 + 0x17] = 2;
|
||||
altitudes[width * 0x15 + 0x18] = 2;
|
||||
altitudes[width * 0x16 + 0x17] = 2;
|
||||
@@ -192,7 +192,7 @@ void sub_02034678(struct MapMatrix *map_matrix) {
|
||||
|
||||
void sub_020346CC(struct MapMatrix *map_matrix) {
|
||||
u16 *maps = map_matrix->data.maps.data;
|
||||
u8 width = map_matrix->width;
|
||||
u8 width = map_matrix->width;
|
||||
|
||||
if (map_matrix->matrix_id != 0) {
|
||||
return;
|
||||
|
||||
@@ -160,7 +160,7 @@ void MapObjectManager_Delete(MapObjectManager *manager) {
|
||||
}
|
||||
|
||||
void sub_020573C8(MapObjectManager *manager, u32 unused, u32 mapId, u32 objectCount, ObjectEvent *objectEvents) {
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
|
||||
for (; count != 0; count--) {
|
||||
@@ -254,11 +254,11 @@ LocalMapObject *MapObject_Create(MapObjectManager *manager, u32 x, u32 y, u32 di
|
||||
}
|
||||
|
||||
LocalMapObject *MapObject_CreateFromObjectEventWithId(MapObjectManager *manager, u16 id, u32 objectEventCount, u32 mapNo, const ObjectEvent *events) {
|
||||
LocalMapObject *ret = NULL;
|
||||
LocalMapObject *ret = NULL;
|
||||
ObjectEvent *objectEvent = ObjectEvent_GetByID(id, objectEventCount, (ObjectEvent *)events);
|
||||
if (objectEvent != NULL) {
|
||||
// casts and typing required to match
|
||||
u32 eventFlag = ObjectEvent_GetEventFlag(objectEvent);
|
||||
u32 eventFlag = ObjectEvent_GetEventFlag(objectEvent);
|
||||
FieldSystem *fieldSystem = MapObjectManager_GetFieldSystem(manager);
|
||||
if (FieldSystem_FlagCheck(fieldSystem, (u16)eventFlag) == FALSE) {
|
||||
ret = MapObject_CreateFromObjectEvent(manager, objectEvent, mapNo);
|
||||
@@ -293,7 +293,7 @@ void MapObject_Remove(LocalMapObject *object) {
|
||||
}
|
||||
|
||||
void MapObject_Delete(LocalMapObject *object) {
|
||||
u32 eventFlag = MapObject_GetEventFlag(object);
|
||||
u32 eventFlag = MapObject_GetEventFlag(object);
|
||||
FieldSystem *fieldSystem = MapObject_GetFieldSystem(object);
|
||||
FieldSystem_FlagSet(fieldSystem, eventFlag);
|
||||
MapObject_Remove(object);
|
||||
@@ -315,8 +315,8 @@ void sub_020576A8(LocalMapObject *object) {
|
||||
}
|
||||
|
||||
void MapObjectManager_RemoveAllActiveObjects(MapObjectManager *manager) {
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
|
||||
do { // BUG: does not check for if count is zero, and will always execute at least once
|
||||
@@ -332,8 +332,8 @@ void MapObjectManager_RemoveAllActiveObjects(MapObjectManager *manager) {
|
||||
void sub_02057750(MapObjectManager *manager) {
|
||||
GF_ASSERT(sub_020587E0(manager) == TRUE);
|
||||
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
|
||||
do {
|
||||
@@ -350,8 +350,8 @@ void sub_02057750(MapObjectManager *manager) {
|
||||
void sub_020577A8(MapObjectManager *manager) {
|
||||
GF_ASSERT(sub_020587E0(manager) == TRUE);
|
||||
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
|
||||
do {
|
||||
@@ -403,29 +403,29 @@ void MapObjectManager_RestoreFromSave(MapObjectManager *manager, SavedMapObject
|
||||
}
|
||||
|
||||
static void SavedMapObject_InitFromLocalMapObject(FieldSystem *fieldSystem, LocalMapObject *localObject, SavedMapObject *savedObject) {
|
||||
savedObject->flags = MapObject_GetFlags(localObject);
|
||||
savedObject->flags2 = MapObject_GetFlags2(localObject);
|
||||
savedObject->objId = MapObject_GetID(localObject);
|
||||
savedObject->mapId = MapObject_GetMapID(localObject);
|
||||
savedObject->spriteId = MapObject_GetSpriteID(localObject);
|
||||
savedObject->movement = MapObject_GetMovement(localObject);
|
||||
savedObject->type = MapObject_GetType(localObject);
|
||||
savedObject->eventFlag = MapObject_GetEventFlag(localObject);
|
||||
savedObject->script = MapObject_GetScriptID(localObject);
|
||||
savedObject->flags = MapObject_GetFlags(localObject);
|
||||
savedObject->flags2 = MapObject_GetFlags2(localObject);
|
||||
savedObject->objId = MapObject_GetID(localObject);
|
||||
savedObject->mapId = MapObject_GetMapID(localObject);
|
||||
savedObject->spriteId = MapObject_GetSpriteID(localObject);
|
||||
savedObject->movement = MapObject_GetMovement(localObject);
|
||||
savedObject->type = MapObject_GetType(localObject);
|
||||
savedObject->eventFlag = MapObject_GetEventFlag(localObject);
|
||||
savedObject->script = MapObject_GetScriptID(localObject);
|
||||
savedObject->initialFacing = MapObject_GetInitialFacingDirection(localObject);
|
||||
savedObject->currentFacing = MapObject_GetFacingDirection(localObject);
|
||||
savedObject->nextFacing = MapObject_GetNextFacingDirection(localObject);
|
||||
savedObject->param[0] = MapObject_GetParam(localObject, 0);
|
||||
savedObject->param[1] = MapObject_GetParam(localObject, 1);
|
||||
savedObject->param[2] = MapObject_GetParam(localObject, 2);
|
||||
savedObject->xRange = MapObject_GetXRange(localObject);
|
||||
savedObject->yRange = MapObject_GetYRange(localObject);
|
||||
savedObject->initialX = MapObject_GetInitialX(localObject);
|
||||
savedObject->initialY = MapObject_GetInitialY(localObject);
|
||||
savedObject->initialZ = MapObject_GetInitialZ(localObject);
|
||||
savedObject->currentX = MapObject_GetCurrentX(localObject);
|
||||
savedObject->currentY = MapObject_GetCurrentY(localObject);
|
||||
savedObject->currentZ = MapObject_GetCurrentZ(localObject);
|
||||
savedObject->nextFacing = MapObject_GetNextFacingDirection(localObject);
|
||||
savedObject->param[0] = MapObject_GetParam(localObject, 0);
|
||||
savedObject->param[1] = MapObject_GetParam(localObject, 1);
|
||||
savedObject->param[2] = MapObject_GetParam(localObject, 2);
|
||||
savedObject->xRange = MapObject_GetXRange(localObject);
|
||||
savedObject->yRange = MapObject_GetYRange(localObject);
|
||||
savedObject->initialX = MapObject_GetInitialX(localObject);
|
||||
savedObject->initialY = MapObject_GetInitialY(localObject);
|
||||
savedObject->initialZ = MapObject_GetInitialZ(localObject);
|
||||
savedObject->currentX = MapObject_GetCurrentX(localObject);
|
||||
savedObject->currentY = MapObject_GetCurrentY(localObject);
|
||||
savedObject->currentZ = MapObject_GetCurrentZ(localObject);
|
||||
|
||||
VecFx32 coords;
|
||||
sub_02059E60(savedObject->currentX, savedObject->currentZ, &coords); // some kind of x y vec copy with convertion between int and fx32
|
||||
@@ -467,7 +467,7 @@ static void LocalMapObject_InitFromSavedMapObject(LocalMapObject *localObject, S
|
||||
MapObject_SetCurrentZ(localObject, savedObject->currentZ);
|
||||
|
||||
VecFx32 coords = {};
|
||||
coords.y = savedObject->vecY;
|
||||
coords.y = savedObject->vecY;
|
||||
MapObject_SetPositionVector(localObject, &coords);
|
||||
|
||||
memcpy(sub_020585B0(localObject), savedObject->unk30, 16);
|
||||
@@ -496,13 +496,13 @@ static void MapObject_ConvertXZToPositionVec(LocalMapObject *object) {
|
||||
VecFx32 position;
|
||||
MapObject_CopyPositionVector(object, &position);
|
||||
|
||||
u32 x = MapObject_GetCurrentX(object);
|
||||
u32 x = MapObject_GetCurrentX(object);
|
||||
position.x = x * FX32_CONST(16) + FX32_CONST(8);
|
||||
MapObject_SetPreviousX(object, x);
|
||||
|
||||
MapObject_SetPreviousY(object, MapObject_GetCurrentY(object));
|
||||
|
||||
u32 z = MapObject_GetCurrentZ(object);
|
||||
u32 z = MapObject_GetCurrentZ(object);
|
||||
position.z = z * FX32_CONST(16) + FX32_CONST(8);
|
||||
MapObject_SetPreviousZ(object, z);
|
||||
|
||||
@@ -518,17 +518,17 @@ void MapObject_CreateFromMultipleObjectEvents(MapObjectManager *manager, u32 map
|
||||
|
||||
MapObjectInitArgs *args = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(MapObjectInitArgs));
|
||||
GF_ASSERT(args != NULL);
|
||||
args->mapNo = mapNo;
|
||||
args->mapNo = mapNo;
|
||||
args->objectEventCount = objectEventCount;
|
||||
args->index = 0;
|
||||
args->manager = manager;
|
||||
args->objectEvents = objectEventsCopy;
|
||||
args->index = 0;
|
||||
args->manager = manager;
|
||||
args->objectEvents = objectEventsCopy;
|
||||
|
||||
MapObject_CreateFromInitArgs(args);
|
||||
}
|
||||
|
||||
static void MapObject_CreateFromInitArgs(MapObjectInitArgs *args) {
|
||||
FieldSystem *fieldSystem = MapObjectManager_GetFieldSystem(args->manager);
|
||||
FieldSystem *fieldSystem = MapObjectManager_GetFieldSystem(args->manager);
|
||||
ObjectEvent *objectEvents = args->objectEvents;
|
||||
|
||||
do { // must be do while due to initial check
|
||||
@@ -543,8 +543,8 @@ static void MapObject_CreateFromInitArgs(MapObjectInitArgs *args) {
|
||||
}
|
||||
|
||||
static LocalMapObject *MapObjectManager_GetFirstInactiveObject(MapObjectManager *manager) {
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
s32 i = 0;
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
|
||||
do {
|
||||
@@ -605,19 +605,19 @@ static void MapObject_InitFromObjectEvent(LocalMapObject *object, ObjectEvent *o
|
||||
static void MapObject_SetPositionVectorFromObjectEvent(LocalMapObject *object, ObjectEvent *objectEvent) {
|
||||
VecFx32 coords;
|
||||
|
||||
u16 x = ObjectEvent_GetXCoord(objectEvent);
|
||||
u16 x = ObjectEvent_GetXCoord(objectEvent);
|
||||
coords.x = x * FX32_CONST(16) + FX32_CONST(8);
|
||||
MapObject_SetInitialX(object, x);
|
||||
MapObject_SetPreviousX(object, x);
|
||||
MapObject_SetCurrentX(object, x);
|
||||
|
||||
coords.y = ObjectEvent_GetYCoord(objectEvent);
|
||||
u32 y = (coords.y >> 3) / FX32_ONE;
|
||||
u32 y = (coords.y >> 3) / FX32_ONE;
|
||||
MapObject_SetInitialY(object, y);
|
||||
MapObject_SetPreviousY(object, y);
|
||||
MapObject_SetCurrentY(object, y);
|
||||
|
||||
u16 z = ObjectEvent_GetZCoord(objectEvent);
|
||||
u16 z = ObjectEvent_GetZCoord(objectEvent);
|
||||
coords.z = z * FX32_CONST(16) + FX32_CONST(8);
|
||||
MapObject_SetInitialZ(object, z);
|
||||
MapObject_SetPreviousZ(object, z);
|
||||
@@ -647,7 +647,7 @@ static void sub_02057E90(LocalMapObject *object, MapObjectManager *manager) { //
|
||||
extern const UnkLMOCallbackStruct2 ov05_021F9080;
|
||||
|
||||
static void sub_02057F18(LocalMapObject *object) {
|
||||
u32 spriteId = MapObject_GetSpriteID(object);
|
||||
u32 spriteId = MapObject_GetSpriteID(object);
|
||||
UnkLMOCallbackStruct2 *unk = (spriteId == SPRITE_CAMERA_FOCUS) ? (UnkLMOCallbackStruct2 *)&ov05_021F9080 : sub_02058D4C(spriteId);
|
||||
|
||||
sub_02058684(object, sub_02058D38(unk));
|
||||
@@ -703,7 +703,7 @@ static LocalMapObject *MapObjectManager_GetFirstObjectWithIDAndMap(MapObjectMana
|
||||
LocalMapObject *MapObjectManager_GetFirstActiveObjectByID(MapObjectManager *manager, u32 id) {
|
||||
GF_ASSERT(manager != NULL);
|
||||
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects3(manager);
|
||||
do {
|
||||
if (MapObject_TestFlagsBits(objects, MAPOBJECTFLAG_ACTIVE) == TRUE && MapObject_CheckFlag25(objects) == FALSE && MapObject_GetID(objects) == id) {
|
||||
@@ -718,7 +718,7 @@ LocalMapObject *MapObjectManager_GetFirstActiveObjectByID(MapObjectManager *mana
|
||||
}
|
||||
|
||||
LocalMapObject *MapObjectManager_GetFirstActiveObjectWithMovement(MapObjectManager *manager, u32 movement) {
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
s32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects3(manager);
|
||||
|
||||
do {
|
||||
@@ -740,7 +740,7 @@ BOOL MapObjectManager_GetNextObjectWithFlagFromIndex(MapObjectManager *manager,
|
||||
}
|
||||
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects3(manager);
|
||||
LocalMapObject *object = objects + *index;
|
||||
LocalMapObject *object = objects + *index;
|
||||
do {
|
||||
(*index)++;
|
||||
|
||||
@@ -1079,13 +1079,13 @@ u32 MapObject_GetInitialFacingDirection(LocalMapObject *object) {
|
||||
|
||||
void MapObject_SetFacingDirectionDirect(LocalMapObject *object, u32 direction) {
|
||||
object->previousFacing = object->currentFacing;
|
||||
object->currentFacing = direction;
|
||||
object->currentFacing = direction;
|
||||
}
|
||||
|
||||
void MapObject_SetFacingDirection(LocalMapObject *object, u32 direction) {
|
||||
if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK7) == 0) {
|
||||
object->previousFacing = object->currentFacing;
|
||||
object->currentFacing = direction;
|
||||
object->currentFacing = direction;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ u32 MapObject_GetPreviousFacingDirection(LocalMapObject *object) {
|
||||
|
||||
void MapObject_SetNextFacingDirection(LocalMapObject *object, u32 direction) {
|
||||
object->nextFacingBackup = object->nextFacing;
|
||||
object->nextFacing = direction;
|
||||
object->nextFacing = direction;
|
||||
}
|
||||
|
||||
u32 MapObject_GetNextFacingDirection(LocalMapObject *object) {
|
||||
@@ -1365,7 +1365,7 @@ void sub_02058774(MapObjectManager *manager) {
|
||||
}
|
||||
|
||||
void MapObjectManager_PauseAllMovement(MapObjectManager *manager) {
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
do {
|
||||
if (MapObject_CheckActive(objects)) {
|
||||
@@ -1378,7 +1378,7 @@ void MapObjectManager_PauseAllMovement(MapObjectManager *manager) {
|
||||
}
|
||||
|
||||
void MapObjectManager_UnpauseAllMovement(MapObjectManager *manager) {
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
do {
|
||||
if (MapObject_CheckActive(objects)) {
|
||||
@@ -1851,7 +1851,7 @@ static u16 ObjectEvent_GetZCoord(ObjectEvent *objectEvent) {
|
||||
}
|
||||
|
||||
static ObjectEvent *ObjectEvent_GetByID(u16 id, s32 objectEventCount, ObjectEvent *objectEvents) {
|
||||
s32 i = 0;
|
||||
s32 i = 0;
|
||||
ObjectEvent *objectEvent = objectEvents;
|
||||
do {
|
||||
if (!ObjectEvent_ScriptIDIsUnset(objectEvent) && id == ObjectEvent_GetID(objectEvent)) {
|
||||
@@ -1927,7 +1927,7 @@ static UnkLMOCallbackStruct2 *sub_02058D4C(u32 spriteId) {
|
||||
}
|
||||
|
||||
LocalMapObject *MapObjectManager_GetFirstObjectWithXAndZ(MapObjectManager *manager, u32 x, u32 z) {
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
u32 count = MapObjectManager_GetObjectCount(manager);
|
||||
LocalMapObject *objects = MapObjectManager_GetObjects(manager);
|
||||
|
||||
do {
|
||||
|
||||
@@ -585,15 +585,15 @@ u32 MTRandom(void) {
|
||||
}
|
||||
|
||||
for (i = 0; i < 227; i++) {
|
||||
val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff);
|
||||
val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff);
|
||||
sMTRNG_State[i] = sMTRNG_State[i + 397] ^ (val >> 1) ^ sMTRNG_XOR[val & 0x1];
|
||||
}
|
||||
for (; i < 623; i++) {
|
||||
val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff);
|
||||
val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff);
|
||||
sMTRNG_State[i] = sMTRNG_State[i + -227] ^ (val >> 1) ^ sMTRNG_XOR[val & 0x1];
|
||||
}
|
||||
|
||||
val = (sMTRNG_State[623] & 0x80000000) | (sMTRNG_State[0] & 0x7fffffff);
|
||||
val = (sMTRNG_State[623] & 0x80000000) | (sMTRNG_State[0] & 0x7fffffff);
|
||||
sMTRNG_State[623] = sMTRNG_State[396] ^ (val >> 1) ^ sMTRNG_XOR[val & 0x1];
|
||||
|
||||
sMTRNG_Cycles = 0;
|
||||
@@ -665,7 +665,7 @@ s32 CircularDistance(s32 x1, s32 y1, s32 x2, s32 y2) {
|
||||
v2.z = 0;
|
||||
|
||||
VEC_Subtract(&v2, &v1, &v4);
|
||||
f2 = VEC_DotProduct(&v3, &v4);
|
||||
f2 = VEC_DotProduct(&v3, &v4);
|
||||
ret = f2 >> FX32_INT_SHIFT;
|
||||
ret = (ret < 0) ? -ret : ret;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ MessageFormat *MessageFormat_New_Custom(u32 nstr, u32 strlen, HeapID heapId) {
|
||||
GF_ASSERT(strlen != 0);
|
||||
MessageFormat *messageFormat = AllocFromHeapAtEnd(heapId, sizeof(MessageFormat));
|
||||
if (messageFormat != NULL) {
|
||||
messageFormat->count = nstr;
|
||||
messageFormat->count = nstr;
|
||||
messageFormat->heapId = heapId;
|
||||
messageFormat->buffer = String_New(strlen, heapId);
|
||||
if (messageFormat->buffer != NULL) {
|
||||
@@ -125,7 +125,7 @@ void BufferRivalsName(MessageFormat *messageFormat, u32 idx, struct SaveData *sa
|
||||
}
|
||||
|
||||
void BufferFriendsName(MessageFormat *messageFormat, u32 idx, struct SaveData *save) {
|
||||
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(save);
|
||||
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(save);
|
||||
struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0497_bin, messageFormat->heapId);
|
||||
if (PlayerProfile_GetTrainerGender(profile) == PLAYER_GENDER_MALE) {
|
||||
ReadMsgDataIntoString(msgData, narc_0497_00001, messageFormat->buffer); // Dawn
|
||||
@@ -518,8 +518,8 @@ void BufferSealNamePlural(MessageFormat *messageFormat, u32 idx, u32 seal) {
|
||||
}
|
||||
|
||||
void BufferLocationName(MessageFormat *messageFormat, u32 idx, u16 location) {
|
||||
u32 r6 = (u32)sub_02015CC0(location);
|
||||
u32 r4 = (u32)sub_02015CE0(location);
|
||||
u32 r6 = (u32)sub_02015CC0(location);
|
||||
u32 r4 = (u32)sub_02015CE0(location);
|
||||
struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, UNK_020ECE64[r6], messageFormat->heapId);
|
||||
if (msgData != NULL) {
|
||||
if (r4 < MsgDataGetCount(msgData)) {
|
||||
@@ -577,9 +577,9 @@ void BufferContestBackgroundName(MessageFormat *messageFormat, u32 idx, u32 bg)
|
||||
}
|
||||
|
||||
void BufferGroupName(MessageFormat *messageFormat, struct SaveData *save, u32 r5, u32 idx, u32 sp28) {
|
||||
void *r6 = sub_0202881C(save);
|
||||
u8 sp10 = sub_020287F8(r6, r5);
|
||||
u8 r7 = sub_02028804(r6, r5);
|
||||
void *r6 = sub_0202881C(save);
|
||||
u8 sp10 = sub_020287F8(r6, r5);
|
||||
u8 r7 = sub_02028804(r6, r5);
|
||||
struct String *r4 = String_New(64, HEAP_ID_4);
|
||||
CopyU16ArrayToString(r4, sub_020287A8(r6, r5, sp28));
|
||||
BufferString(messageFormat, idx, r4, sp10, 1, r7);
|
||||
@@ -614,7 +614,7 @@ void StringExpandPlaceholders(MessageFormat *messageFormat, struct String *dest,
|
||||
cstr = MsgArray_SkipControlCode(cstr);
|
||||
} else {
|
||||
const u16 *before = cstr;
|
||||
cstr = MsgArray_SkipControlCode(cstr);
|
||||
cstr = MsgArray_SkipControlCode(cstr);
|
||||
while (before < cstr) {
|
||||
StrAddChar(dest, *before++);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ void MoveRelearner_Delete(MoveRelearner *moveRelearner) {
|
||||
|
||||
u16 *MoveRelearner_GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId) {
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
||||
u8 form = GetMonData(mon, MON_DATA_FORM, NULL);
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
u8 form = GetMonData(mon, MON_DATA_FORM, NULL);
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
u16 moves[MAX_MON_MOVES];
|
||||
|
||||
for (u8 i = 0; i < MAX_MON_MOVES; ++i) {
|
||||
@@ -25,7 +25,7 @@ u16 *MoveRelearner_GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId) {
|
||||
}
|
||||
|
||||
u16 *tableFromFile = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2);
|
||||
u16 *returnTable = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2);
|
||||
u16 *returnTable = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2);
|
||||
|
||||
LoadLevelUpLearnset_HandleAlternateForm(species, form, tableFromFile);
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ static void ReadMsgData_ExistingNarc_ExistingString(NARC *narc, u32 group, u32 n
|
||||
NARC_ReadFromMember(narc, group, 8 * num + 4, 8, &alloc);
|
||||
Decrypt1(&alloc, num, sp10[1]);
|
||||
size = alloc.length * 2;
|
||||
buf = AllocFromHeapAtEnd(heapId, size);
|
||||
buf = AllocFromHeapAtEnd(heapId, size);
|
||||
if (buf != NULL) {
|
||||
NARC_ReadFromMember(narc, group, alloc.offset, size, buf);
|
||||
Decrypt2(buf, alloc.length, num);
|
||||
@@ -182,7 +182,7 @@ static struct String *ReadMsgData_ExistingNarc_NewString(NARC *narc, u32 group,
|
||||
dest = String_New(alloc.length, heapId);
|
||||
if (dest != NULL) {
|
||||
size = alloc.length * 2;
|
||||
buf = AllocFromHeapAtEnd(heapId, size);
|
||||
buf = AllocFromHeapAtEnd(heapId, size);
|
||||
if (buf != NULL) {
|
||||
NARC_ReadFromMember(narc, group, alloc.offset, size, buf);
|
||||
Decrypt2(buf, alloc.length, num);
|
||||
@@ -219,10 +219,10 @@ struct MsgData *NewMsgDataFromNarc(MsgDataLoadType type, NarcId narc_id, s32 fil
|
||||
} else {
|
||||
msgData->data.narc = NARC_New(narc_id, heapId);
|
||||
}
|
||||
msgData->type = (u16)type;
|
||||
msgData->type = (u16)type;
|
||||
msgData->narc_id = (u16)narc_id;
|
||||
msgData->file_id = (u16)file_id;
|
||||
msgData->heapId = (u16)heapId;
|
||||
msgData->heapId = (u16)heapId;
|
||||
}
|
||||
return msgData;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ void GetSpeciesNameIntoArray(u16 species, HeapID heapId, u16 *dest) {
|
||||
|
||||
struct String *ReadMsgData_ExpandPlaceholders(MessageFormat *messageFormat, struct MsgData *msgData, u32 msgno, HeapID heapId) {
|
||||
struct String *ret = NULL;
|
||||
struct String *r4 = String_New(1024, HEAP_ID_DEFAULT);
|
||||
struct String *r4 = String_New(1024, HEAP_ID_DEFAULT);
|
||||
struct String *r5;
|
||||
if (r4 != NULL) {
|
||||
r5 = NewString_ReadMsgData(msgData, msgno);
|
||||
|
||||
@@ -62,14 +62,14 @@ u32 GetNutAttr(struct NutData *nut, u32 attr) {
|
||||
|
||||
struct String *GetNutName(u32 berry_idx, HeapID heapId) {
|
||||
struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0373_bin, heapId);
|
||||
struct String *ret = NewString_ReadMsgData(msgData, berry_idx);
|
||||
struct String *ret = NewString_ReadMsgData(msgData, berry_idx);
|
||||
DestroyMsgData(msgData);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct String *GetNutDesc(u32 berry_idx, HeapID heapId) {
|
||||
struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0372_bin, heapId);
|
||||
struct String *ret = NewString_ReadMsgData(msgData, berry_idx);
|
||||
struct String *ret = NewString_ReadMsgData(msgData, berry_idx);
|
||||
DestroyMsgData(msgData);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ void Options_Copy(struct Options *src, struct Options *dest) {
|
||||
void Options_Init(struct Options *options) {
|
||||
MI_CpuFill8(options, 0, sizeof(struct Options));
|
||||
|
||||
options->textSpeed = 1; // mid speed
|
||||
options->textSpeed = 1; // mid speed
|
||||
options->soundMethod = 0; // stereo
|
||||
options->battleStyle = 0; // shift
|
||||
options->battleScene = 0; // on
|
||||
options->buttonMode = 0; // normal
|
||||
options->frame = 0; // frame 1
|
||||
options->buttonMode = 0; // normal
|
||||
options->frame = 0; // frame 1
|
||||
}
|
||||
|
||||
void Options_SetButtonModeOnMain(struct SaveData *save, u32 buttonMode) {
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
struct OverlayManager *OverlayManager_New(const struct OverlayManagerTemplate *template, s32 *a1, HeapID heapId) {
|
||||
struct OverlayManager *ret = (struct OverlayManager *)AllocFromHeap(heapId, sizeof(struct OverlayManager));
|
||||
ret->template = *template;
|
||||
ret->managerStatus = 0;
|
||||
ret->overlayStatus = 0;
|
||||
ret->unk18 = a1;
|
||||
ret->data = NULL;
|
||||
ret->save = NULL;
|
||||
ret->unk24 = 0;
|
||||
ret->template = *template;
|
||||
ret->managerStatus = 0;
|
||||
ret->overlayStatus = 0;
|
||||
ret->unk18 = a1;
|
||||
ret->data = NULL;
|
||||
ret->save = NULL;
|
||||
ret->unk24 = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ void sub_02002FEC(struct PaletteData *ptr) {
|
||||
void PaletteData_SetBuffers(
|
||||
struct PaletteData *paletteData, u32 index, void *unfadedBuf, void *fadedBuf, u32 size) {
|
||||
paletteData->pltt[index].unfadedBuf = unfadedBuf;
|
||||
paletteData->pltt[index].fadedBuf = fadedBuf;
|
||||
paletteData->pltt[index].bufSize = size;
|
||||
paletteData->pltt[index].fadedBuf = fadedBuf;
|
||||
paletteData->pltt[index].bufSize = size;
|
||||
}
|
||||
|
||||
void PaletteData_AllocBuffers(
|
||||
struct PaletteData *paletteData, u32 index, u32 size, HeapID heapId) {
|
||||
void *ptr = AllocFromHeap(heapId, size);
|
||||
void *ptr = AllocFromHeap(heapId, size);
|
||||
void *ptr2 = AllocFromHeap(heapId, size);
|
||||
|
||||
PaletteData_SetBuffers(paletteData, index, ptr, ptr2, size);
|
||||
@@ -151,7 +151,7 @@ u32 sub_02003210(struct PaletteData *paletteData,
|
||||
u16 color) {
|
||||
|
||||
u16 stc = param2;
|
||||
u32 r6 = 0;
|
||||
u32 r6 = 0;
|
||||
|
||||
for (u8 i = 0; i < 14; i++) {
|
||||
if (IsPaletteSelected(param1, i) != 1) {
|
||||
@@ -175,7 +175,7 @@ u32 sub_02003210(struct PaletteData *paletteData,
|
||||
}
|
||||
|
||||
param2 = stc;
|
||||
r6 = 1;
|
||||
r6 = 1;
|
||||
}
|
||||
|
||||
if (r6 == 1) {
|
||||
@@ -184,7 +184,7 @@ u32 sub_02003210(struct PaletteData *paletteData,
|
||||
paletteData->unk11a_e = 1;
|
||||
|
||||
paletteData->unk118_0 = 1;
|
||||
paletteData->unk11c = 0;
|
||||
paletteData->unk11c = 0;
|
||||
|
||||
SysTask_CreateOnMainQueue((SysTaskFunc)sub_02003464, (void *)paletteData, (u32)(-2));
|
||||
}
|
||||
@@ -232,16 +232,16 @@ void sub_020033A4(struct PaletteFadeControl *paletteFade,
|
||||
u16 color) {
|
||||
if (delay < 0) {
|
||||
paletteFade->deltaY = abs(delay) + 2;
|
||||
paletteFade->delay = 0;
|
||||
paletteFade->delay = 0;
|
||||
} else {
|
||||
paletteFade->deltaY = 2;
|
||||
paletteFade->delay = delay;
|
||||
paletteFade->delay = delay;
|
||||
}
|
||||
|
||||
paletteFade->selectedPalettes = selectedPalettes;
|
||||
paletteFade->y = startY;
|
||||
paletteFade->targetY = targetY;
|
||||
paletteFade->blendColor = color;
|
||||
paletteFade->y = startY;
|
||||
paletteFade->targetY = targetY;
|
||||
paletteFade->blendColor = color;
|
||||
|
||||
paletteFade->delayCounter = paletteFade->delay;
|
||||
|
||||
@@ -254,10 +254,10 @@ void sub_020033A4(struct PaletteFadeControl *paletteFade,
|
||||
|
||||
void sub_02003464(SysTask *task, struct PaletteData *param1) {
|
||||
if (param1->unk11c == 1) {
|
||||
param1->unk11c = 0;
|
||||
param1->unk11a_0 = 0;
|
||||
param1->unk11c = 0;
|
||||
param1->unk11a_0 = 0;
|
||||
param1->activeFadePalettes = 0;
|
||||
param1->unk11a_e = 0;
|
||||
param1->unk11a_e = 0;
|
||||
SysTask_Destroy(task);
|
||||
return;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ void sub_020035F8(
|
||||
for (u32 i = 0; i < numEntries; i++) {
|
||||
u8 lo = (u8)((src[i] & 0x1f) + ((((fadeCtrl->blendColor & 0x1f) - (src[i] & 0x1f)) * fadeCtrl->y) >> 4));
|
||||
|
||||
u8 hi = (u8)(((src[i] >> 10) & 0x1f) + (((((fadeCtrl->blendColor >> 10) & 0x1f) - ((src[i] >> 10) & 0x1f)) * fadeCtrl->y) >> 4));
|
||||
u8 hi = (u8)(((src[i] >> 10) & 0x1f) + (((((fadeCtrl->blendColor >> 10) & 0x1f) - ((src[i] >> 10) & 0x1f)) * fadeCtrl->y) >> 4));
|
||||
u8 mid = (u8)(((src[i] >> 5) & 0x1f) + (((((fadeCtrl->blendColor >> 5) & 0x1f) - ((src[i] >> 5) & 0x1f)) * fadeCtrl->y) >> 4));
|
||||
|
||||
dest[i] = (u16)((hi << 10) | (mid << 5) | lo);
|
||||
@@ -524,7 +524,7 @@ void BlendPalettes(u16 *src, u16 *dest, u16 selectedPalettes, u8 coeff, u16 blen
|
||||
|
||||
void BlendPalettesUnfaded(
|
||||
struct PaletteData *paletteData, u32 index, u16 selectedPalettes, u8 coeff, u16 blendColor) {
|
||||
u32 r4 = 0;
|
||||
u32 r4 = 0;
|
||||
BOOL r0 = FALSE;
|
||||
if (paletteData->pltt[index].unfadedBuf != 0 && paletteData->pltt[index].fadedBuf != 0) {
|
||||
r0 = TRUE;
|
||||
|
||||
@@ -74,7 +74,7 @@ void ReplacePartySlotWithMon(struct Party *party, int pos, struct Pokemon *pokem
|
||||
GF_ASSERT(pos >= 0);
|
||||
GF_ASSERT(pos < party->curCount);
|
||||
GF_ASSERT(pos < party->maxCount);
|
||||
r2 = (int)(GetMonData(&party->mons[pos], MON_DATA_SPECIES_EXISTS, NULL) - GetMonData(pokemon, MON_DATA_SPECIES_EXISTS, NULL));
|
||||
r2 = (int)(GetMonData(&party->mons[pos], MON_DATA_SPECIES_EXISTS, NULL) - GetMonData(pokemon, MON_DATA_SPECIES_EXISTS, NULL));
|
||||
party->mons[pos] = *pokemon;
|
||||
party->curCount += r2;
|
||||
}
|
||||
@@ -87,8 +87,8 @@ BOOL SwapSlotsInParty(struct Party *party, int pos1, int pos2) {
|
||||
GF_ASSERT(pos2 >= 0);
|
||||
GF_ASSERT(pos2 < party->curCount);
|
||||
GF_ASSERT(pos2 < party->maxCount);
|
||||
buffer = AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct Pokemon));
|
||||
*buffer = party->mons[pos1];
|
||||
buffer = AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct Pokemon));
|
||||
*buffer = party->mons[pos1];
|
||||
party->mons[pos1] = party->mons[pos2];
|
||||
party->mons[pos2] = *buffer;
|
||||
FreeToHeap(buffer);
|
||||
|
||||
@@ -15,9 +15,9 @@ void PlayTimerInit() {
|
||||
|
||||
void PlayTimerStart(struct IGT *igt) {
|
||||
sTimerActive = TRUE;
|
||||
sUnused = 0;
|
||||
sDuration = 0;
|
||||
sIGT_p = igt;
|
||||
sUnused = 0;
|
||||
sDuration = 0;
|
||||
sIGT_p = igt;
|
||||
|
||||
sTimer3Start = GetTimer3Count();
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ s32 GetOverlayLoadDestination(FSOverlayID id) {
|
||||
u8 *start;
|
||||
GF_ASSERT(FS_LoadOverlayInfo(&info, MI_PROCESSOR_ARM9, id) == TRUE);
|
||||
start = (u8 *)HW_ITCM_IMAGE;
|
||||
end = (u8 *)HW_ITCM_END;
|
||||
end = (u8 *)HW_ITCM_END;
|
||||
if (info.header.ram_address <= end && info.header.ram_address >= start) {
|
||||
return OVERLAY_LOAD_ITCM;
|
||||
}
|
||||
start = (u8 *)HW_DTCM;
|
||||
end = start + HW_DTCM_SIZE;
|
||||
end = start + HW_DTCM_SIZE;
|
||||
if (info.header.ram_address <= end && info.header.ram_address >= start) {
|
||||
return OVERLAY_LOAD_DTCM;
|
||||
}
|
||||
@@ -58,9 +58,9 @@ BOOL HandleLoadOverlay(FSOverlayID id, s32 a1) {
|
||||
for (r6 = 0; r6 < 8; r6++) {
|
||||
if (!r3[r6].active) {
|
||||
struct LoadedOverlay *ovly;
|
||||
ovly = &r3[r6];
|
||||
ovly = &r3[r6];
|
||||
ovly->active = TRUE;
|
||||
ovly->id = id;
|
||||
ovly->id = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ BOOL GetOverlayRamBounds(FSOverlayID id, void **start, void **end) {
|
||||
return FALSE;
|
||||
}
|
||||
*start = (void *)info.header.ram_address;
|
||||
*end = (char *)*start + (info.header.ram_size + info.header.bss_size);
|
||||
*end = (char *)*start + (info.header.ram_size + info.header.bss_size);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ s32 Pokedex_CountSeenShellosOrGastrodon_Internal(struct Pokedex *pokedex, u32 sp
|
||||
return 0;
|
||||
}
|
||||
u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1];
|
||||
BOOL r2 = CheckDexFlag(flags, 1);
|
||||
BOOL r0 = CheckDexFlag(flags, 2);
|
||||
BOOL r2 = CheckDexFlag(flags, 1);
|
||||
BOOL r0 = CheckDexFlag(flags, 2);
|
||||
return (r2 == r0) ? 1 : 2;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ BOOL Pokedex_HasSeenShellosOrGastrodonForm(struct Pokedex *pokedex, u32 species,
|
||||
return FALSE;
|
||||
}
|
||||
u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1];
|
||||
u32 r0 = (u32)Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species);
|
||||
u32 r0 = (u32)Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species);
|
||||
for (int i = 0; i < r0; i++) {
|
||||
BOOL r2 = CheckDexFlag(flags, (u16)(i + 1));
|
||||
if (r2 == state) {
|
||||
@@ -84,7 +84,7 @@ void Pokedex_SetSeenShellosOrGastrodonForm(struct Pokedex *pokedex, u32 species,
|
||||
return;
|
||||
}
|
||||
u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1];
|
||||
s32 r5 = Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species);
|
||||
s32 r5 = Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species);
|
||||
if (r5 < 2) {
|
||||
UpdateDexFlag(flags, (u16)(r5 + 1), (u8)state);
|
||||
if (r5 == 0) {
|
||||
@@ -131,7 +131,7 @@ void Pokedex_SetSeenBurmyOrWormadamForm(struct Pokedex *pokedex, u32 species, s3
|
||||
return;
|
||||
}
|
||||
u8 *flags = species == SPECIES_BURMY ? &pokedex->burmyWormadam[0] : &pokedex->burmyWormadam[1];
|
||||
s32 r5 = Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, species);
|
||||
s32 r5 = Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, species);
|
||||
if (r5 >= 3) {
|
||||
return;
|
||||
}
|
||||
@@ -317,13 +317,13 @@ BOOL Pokedex_SpeciesIsNotSinnohMythical(u16 species) {
|
||||
|
||||
void Save_Pokedex_Init(struct Pokedex *pokedex) {
|
||||
memset(pokedex, 0, sizeof(struct Pokedex));
|
||||
pokedex->magic = 0xBEEFCAFE;
|
||||
pokedex->magic = 0xBEEFCAFE;
|
||||
pokedex->unlockedNationalDex = 0;
|
||||
memset(pokedex->seenUnown, 0xFF, 28);
|
||||
pokedex->shellosGastrodon[0] = 0xFF;
|
||||
pokedex->shellosGastrodon[1] = 0xFF;
|
||||
pokedex->burmyWormadam[0] = 0xFF;
|
||||
pokedex->burmyWormadam[1] = 0xFF;
|
||||
pokedex->burmyWormadam[0] = 0xFF;
|
||||
pokedex->burmyWormadam[1] = 0xFF;
|
||||
Pokedex_InitSeenDeoxysFormsArray(pokedex);
|
||||
}
|
||||
|
||||
@@ -572,9 +572,9 @@ static inline void SetSeenGender(struct Pokedex *pokedex, u16 species, u8 gender
|
||||
}
|
||||
|
||||
void Pokedex_SetMonSeenFlag(struct Pokedex *pokedex, struct Pokemon *pokemon) {
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u32 personality = GetMonData(pokemon, MON_DATA_PERSONALITY, NULL);
|
||||
u32 gender = GetMonGender(pokemon);
|
||||
u32 gender = GetMonGender(pokemon);
|
||||
GF_ASSERT(pokedex->magic == 0xBEEFCAFE);
|
||||
if (DexSpeciesIsInvalid(species)) {
|
||||
return;
|
||||
@@ -600,10 +600,10 @@ void Pokedex_SetMonCaughtFlag(struct Pokedex *pokedex, struct Pokemon *pokemon)
|
||||
u32 gender; // r7
|
||||
u16 species; // r6
|
||||
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
language = GetMonData(pokemon, MON_DATA_GAME_LANGUAGE, NULL);
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
language = GetMonData(pokemon, MON_DATA_GAME_LANGUAGE, NULL);
|
||||
personality = GetMonData(pokemon, MON_DATA_PERSONALITY, NULL);
|
||||
gender = GetMonGender(pokemon);
|
||||
gender = GetMonGender(pokemon);
|
||||
GF_ASSERT(pokedex->magic == 0xBEEFCAFE);
|
||||
if (DexSpeciesIsInvalid(species)) {
|
||||
return;
|
||||
|
||||
@@ -200,7 +200,7 @@ BOOL AcquireMonLock(struct Pokemon *mon) {
|
||||
ret = TRUE;
|
||||
GF_ASSERT(!mon->box.box_lock);
|
||||
mon->box.party_lock = TRUE;
|
||||
mon->box.box_lock = TRUE;
|
||||
mon->box.box_lock = TRUE;
|
||||
DECRYPT_PTY(mon);
|
||||
DECRYPT_BOX(&mon->box);
|
||||
}
|
||||
@@ -210,9 +210,9 @@ BOOL AcquireMonLock(struct Pokemon *mon) {
|
||||
BOOL ReleaseMonLock(struct Pokemon *mon, BOOL decrypt_result) {
|
||||
BOOL ret = FALSE;
|
||||
if (mon->box.party_lock == TRUE && decrypt_result == TRUE) {
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
mon->box.party_lock = FALSE;
|
||||
mon->box.box_lock = FALSE;
|
||||
mon->box.box_lock = FALSE;
|
||||
ENCRYPT_PTY(mon);
|
||||
mon->box.checksum = CHECKSUM(&mon->box);
|
||||
ENCRYPT_BOX(&mon->box);
|
||||
@@ -224,7 +224,7 @@ BOOL AcquireBoxMonLock(struct BoxPokemon *mon) {
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!mon->box_lock) {
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
mon->box_lock = TRUE;
|
||||
DECRYPT_BOX(mon);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ BOOL AcquireBoxMonLock(struct BoxPokemon *mon) {
|
||||
BOOL ReleaseBoxMonLock(struct BoxPokemon *mon, BOOL decrypt_result) {
|
||||
BOOL ret = FALSE;
|
||||
if (mon->box_lock == TRUE && decrypt_result == TRUE) {
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
mon->box_lock = FALSE;
|
||||
mon->checksum = CHECKSUM(mon);
|
||||
ENCRYPT_BOX(mon);
|
||||
@@ -300,14 +300,14 @@ void CreateBoxMon(struct BoxPokemon *boxPokemon, int species, int level, int fix
|
||||
SetBoxMonData(boxPokemon, MON_DATA_SPDEF_IV, &fixedIV);
|
||||
} else {
|
||||
exp = LCRandom();
|
||||
iv = exp & 0x1F;
|
||||
iv = exp & 0x1F;
|
||||
SetBoxMonData(boxPokemon, MON_DATA_HP_IV, &iv);
|
||||
iv = (exp & 0x3E0) >> 5;
|
||||
SetBoxMonData(boxPokemon, MON_DATA_ATK_IV, &iv);
|
||||
iv = (exp & 0x7C00) >> 10;
|
||||
SetBoxMonData(boxPokemon, MON_DATA_DEF_IV, &iv);
|
||||
exp = LCRandom();
|
||||
iv = exp & 0x1F;
|
||||
iv = exp & 0x1F;
|
||||
SetBoxMonData(boxPokemon, MON_DATA_SPEED_IV, &iv);
|
||||
iv = (exp & 0x3E0) >> 5;
|
||||
SetBoxMonData(boxPokemon, MON_DATA_SPATK_IV, &iv);
|
||||
@@ -315,7 +315,7 @@ void CreateBoxMon(struct BoxPokemon *boxPokemon, int species, int level, int fix
|
||||
SetBoxMonData(boxPokemon, MON_DATA_SPDEF_IV, &iv);
|
||||
}
|
||||
exp = (u32)GetMonBaseStat(species, BASE_ABILITY_1);
|
||||
iv = (u32)GetMonBaseStat(species, BASE_ABILITY_2);
|
||||
iv = (u32)GetMonBaseStat(species, BASE_ABILITY_2);
|
||||
if (iv != 0) {
|
||||
if (fixedPersonality & 1) {
|
||||
SetBoxMonData(boxPokemon, MON_DATA_ABILITY, &iv);
|
||||
@@ -341,11 +341,11 @@ void CreateMonWithNature(struct Pokemon *pokemon, u16 species, u8 level, u8 fixe
|
||||
|
||||
// FIXME: stack storage of pokemon, fixedIv swapped
|
||||
void CreateMonWithGenderNatureLetter(struct Pokemon *pokemon, u16 species, u8 level, u8 fixedIv, u8 gender, u8 nature, u8 letter) {
|
||||
u32 pid = 0;
|
||||
u32 pid = 0;
|
||||
u16 test = 0;
|
||||
if (letter != 0 && letter < 29) {
|
||||
do {
|
||||
pid = (u32)(LCRandom() | (LCRandom() << 16));
|
||||
pid = (u32)(LCRandom() | (LCRandom() << 16));
|
||||
test = (u16)CALC_UNOWN_LETTER(pid);
|
||||
} while (nature != GetNatureFromPersonality(pid) || gender != GetGenderBySpeciesAndPersonality(species, pid) || test != letter - 1);
|
||||
} else {
|
||||
@@ -355,7 +355,7 @@ void CreateMonWithGenderNatureLetter(struct Pokemon *pokemon, u16 species, u8 le
|
||||
}
|
||||
|
||||
u32 GenPersonalityByGenderAndNature(u16 species, u8 gender, u8 nature) {
|
||||
int pid = nature;
|
||||
int pid = nature;
|
||||
u8 ratio = (u8)GetMonBaseStat(species, BASE_GENDER_RATIO);
|
||||
switch (ratio) {
|
||||
case MON_RATIO_MALE:
|
||||
@@ -382,7 +382,7 @@ void CreateMonWithFixedIVs(struct Pokemon *pokemon, int species, int level, int
|
||||
|
||||
void CalcMonLevelAndStats(struct Pokemon *pokemon) {
|
||||
BOOL decry = AcquireMonLock(pokemon);
|
||||
u32 level = (u32)CalcMonLevel(pokemon);
|
||||
u32 level = (u32)CalcMonLevel(pokemon);
|
||||
SetMonData(pokemon, MON_DATA_LEVEL, &level);
|
||||
CalcMonStats(pokemon);
|
||||
ReleaseMonLock(pokemon, decry);
|
||||
@@ -414,23 +414,23 @@ void CalcMonStats(struct Pokemon *pokemon) {
|
||||
int newSpatk;
|
||||
int newSpdef;
|
||||
BOOL decry = AcquireMonLock(pokemon);
|
||||
level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
maxHp = (int)GetMonData(pokemon, MON_DATA_MAXHP, NULL);
|
||||
hp = (int)GetMonData(pokemon, MON_DATA_HP, NULL);
|
||||
hpIv = (int)GetMonData(pokemon, MON_DATA_HP_IV, NULL);
|
||||
hpEv = (int)GetMonData(pokemon, MON_DATA_HP_EV, NULL);
|
||||
atkIv = (int)GetMonData(pokemon, MON_DATA_ATK_IV, NULL);
|
||||
atkEv = (int)GetMonData(pokemon, MON_DATA_ATK_EV, NULL);
|
||||
defIv = (int)GetMonData(pokemon, MON_DATA_DEF_IV, NULL);
|
||||
defEv = (int)GetMonData(pokemon, MON_DATA_DEF_EV, NULL);
|
||||
speedIv = (int)GetMonData(pokemon, MON_DATA_SPEED_IV, NULL);
|
||||
speedEv = (int)GetMonData(pokemon, MON_DATA_SPEED_EV, NULL);
|
||||
spatkIv = (int)GetMonData(pokemon, MON_DATA_SPATK_IV, NULL);
|
||||
spatkEv = (int)GetMonData(pokemon, MON_DATA_SPATK_EV, NULL);
|
||||
spdefIv = (int)GetMonData(pokemon, MON_DATA_SPDEF_IV, NULL);
|
||||
spdefEv = (int)GetMonData(pokemon, MON_DATA_SPDEF_EV, NULL);
|
||||
form = (int)GetMonData(pokemon, MON_DATA_FORM, NULL);
|
||||
species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
maxHp = (int)GetMonData(pokemon, MON_DATA_MAXHP, NULL);
|
||||
hp = (int)GetMonData(pokemon, MON_DATA_HP, NULL);
|
||||
hpIv = (int)GetMonData(pokemon, MON_DATA_HP_IV, NULL);
|
||||
hpEv = (int)GetMonData(pokemon, MON_DATA_HP_EV, NULL);
|
||||
atkIv = (int)GetMonData(pokemon, MON_DATA_ATK_IV, NULL);
|
||||
atkEv = (int)GetMonData(pokemon, MON_DATA_ATK_EV, NULL);
|
||||
defIv = (int)GetMonData(pokemon, MON_DATA_DEF_IV, NULL);
|
||||
defEv = (int)GetMonData(pokemon, MON_DATA_DEF_EV, NULL);
|
||||
speedIv = (int)GetMonData(pokemon, MON_DATA_SPEED_IV, NULL);
|
||||
speedEv = (int)GetMonData(pokemon, MON_DATA_SPEED_EV, NULL);
|
||||
spatkIv = (int)GetMonData(pokemon, MON_DATA_SPATK_IV, NULL);
|
||||
spatkEv = (int)GetMonData(pokemon, MON_DATA_SPATK_EV, NULL);
|
||||
spdefIv = (int)GetMonData(pokemon, MON_DATA_SPDEF_IV, NULL);
|
||||
spdefEv = (int)GetMonData(pokemon, MON_DATA_SPDEF_EV, NULL);
|
||||
form = (int)GetMonData(pokemon, MON_DATA_FORM, NULL);
|
||||
species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
|
||||
baseStats = (struct BaseStats *)AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct BaseStats));
|
||||
LoadMonBaseStats_HandleAlternateForm(species, form, baseStats);
|
||||
@@ -551,7 +551,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxmon, int attr, void *dest) {
|
||||
}
|
||||
|
||||
u32 GetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *dest) {
|
||||
u32 ret = 0;
|
||||
u32 ret = 0;
|
||||
PokemonDataBlockA *blockA = &GetSubstruct(boxmon, boxmon->pid, 0)->blockA;
|
||||
PokemonDataBlockB *blockB = &GetSubstruct(boxmon, boxmon->pid, 1)->blockB;
|
||||
PokemonDataBlockC *blockC = &GetSubstruct(boxmon, boxmon->pid, 2)->blockC;
|
||||
@@ -1254,7 +1254,7 @@ void SetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *value) {
|
||||
case MON_DATA_NICKNAME:
|
||||
for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++) {
|
||||
blockC->nickname[i] = VALUE(u16);
|
||||
value = (void *const)((char *)value + 2);
|
||||
value = (void *const)((char *)value + 2);
|
||||
}
|
||||
break;
|
||||
case MON_DATA_NICKNAME_4:
|
||||
@@ -1303,7 +1303,7 @@ void SetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *value) {
|
||||
case MON_DATA_OT_NAME:
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) {
|
||||
blockD->otTrainerName[i] = VALUE(u16);
|
||||
value = (void *)((char *)value + 2);
|
||||
value = (void *)((char *)value + 2);
|
||||
}
|
||||
break;
|
||||
case MON_DATA_OT_NAME_2:
|
||||
@@ -1352,10 +1352,10 @@ void SetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *value) {
|
||||
blockD->HGSS_Pokeball = VALUE(u16);
|
||||
break;
|
||||
case MON_DATA_IVS_WORD:
|
||||
blockB->hpIV = (VALUE(u32) >> 0) & 0x1F;
|
||||
blockB->atkIV = (VALUE(u32) >> 5) & 0x1F;
|
||||
blockB->defIV = (VALUE(u32) >> 10) & 0x1F;
|
||||
blockB->spdIV = (VALUE(u32) >> 15) & 0x1F;
|
||||
blockB->hpIV = (VALUE(u32) >> 0) & 0x1F;
|
||||
blockB->atkIV = (VALUE(u32) >> 5) & 0x1F;
|
||||
blockB->defIV = (VALUE(u32) >> 10) & 0x1F;
|
||||
blockB->spdIV = (VALUE(u32) >> 15) & 0x1F;
|
||||
blockB->spatkIV = (VALUE(u32) >> 20) & 0x1F;
|
||||
blockB->spdefIV = (VALUE(u32) >> 25) & 0x1F;
|
||||
break;
|
||||
@@ -1839,7 +1839,7 @@ void FreeMonPersonal(struct BaseStats *personal) {
|
||||
int GetMonBaseStat_HandleFormConversion(int species, int form, enum BaseStat attr) {
|
||||
int ret;
|
||||
struct BaseStats *personal = AllocAndLoadMonPersonal(ResolveMonForm(species, form), HEAP_ID_DEFAULT);
|
||||
ret = GetPersonalAttr(personal, attr);
|
||||
ret = GetPersonalAttr(personal, attr);
|
||||
FreeMonPersonal(personal);
|
||||
return ret;
|
||||
}
|
||||
@@ -1847,18 +1847,18 @@ int GetMonBaseStat_HandleFormConversion(int species, int form, enum BaseStat att
|
||||
int GetMonBaseStat(int species, enum BaseStat attr) {
|
||||
int ret;
|
||||
struct BaseStats *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT);
|
||||
ret = GetPersonalAttr(personal, attr);
|
||||
ret = GetPersonalAttr(personal, attr);
|
||||
FreeMonPersonal(personal);
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 GetPercentProgressTowardsNextLevel(struct Pokemon *pokemon) {
|
||||
BOOL decry = AcquireMonLock(pokemon);
|
||||
BOOL decry = AcquireMonLock(pokemon);
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
u32 lo = GetMonExpBySpeciesAndLevel(species, level);
|
||||
u32 hi = GetMonExpBySpeciesAndLevel(species, level + 1);
|
||||
u32 cur = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL);
|
||||
u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
u32 lo = GetMonExpBySpeciesAndLevel(species, level);
|
||||
u32 hi = GetMonExpBySpeciesAndLevel(species, level + 1);
|
||||
u32 cur = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL);
|
||||
ReleaseMonLock(pokemon, decry);
|
||||
return (u8)(100 * (cur - lo) / (hi - lo));
|
||||
}
|
||||
@@ -1869,15 +1869,15 @@ u32 CalcMonExpToNextLevel(struct Pokemon *pokemon) {
|
||||
|
||||
u32 CalcBoxMonExpToNextLevel(struct BoxPokemon *boxmon) {
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
u16 level = (u16)(CalcBoxMonLevel(boxmon) + 1);
|
||||
u32 cur = GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL);
|
||||
u32 hi = GetMonExpBySpeciesAndLevel(species, level);
|
||||
u16 level = (u16)(CalcBoxMonLevel(boxmon) + 1);
|
||||
u32 cur = GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL);
|
||||
u32 hi = GetMonExpBySpeciesAndLevel(species, level);
|
||||
return hi - cur;
|
||||
}
|
||||
|
||||
u32 GetMonBaseExperienceAtCurrentLevel(struct Pokemon *pokemon) {
|
||||
int species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
int level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
int level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
return GetMonExpBySpeciesAndLevel(species, level);
|
||||
}
|
||||
|
||||
@@ -1907,9 +1907,9 @@ int CalcMonLevel(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
int CalcBoxMonLevel(struct BoxPokemon *boxmon) {
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
int species = (int)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
int exp = (int)GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL);
|
||||
int exp = (int)GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL);
|
||||
ReleaseBoxMonLock(boxmon, decry);
|
||||
return CalcLevelBySpeciesAndExp((u16)species, (u32)exp);
|
||||
}
|
||||
@@ -1917,7 +1917,7 @@ int CalcBoxMonLevel(struct BoxPokemon *boxmon) {
|
||||
int CalcLevelBySpeciesAndExp(u16 species, u32 exp) {
|
||||
int level;
|
||||
struct BaseStats *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT);
|
||||
level = CalcLevelBySpeciesAndExp_PreloadedPersonal(personal, species, exp);
|
||||
level = CalcLevelBySpeciesAndExp_PreloadedPersonal(personal, species, exp);
|
||||
FreeMonPersonal(personal);
|
||||
return level;
|
||||
}
|
||||
@@ -1940,7 +1940,7 @@ u8 GetMonNature(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
u8 GetBoxMonNature(struct BoxPokemon *boxmon) {
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
ReleaseBoxMonLock(boxmon, decry);
|
||||
return GetNatureFromPersonality(personality);
|
||||
@@ -1988,8 +1988,8 @@ void MonApplyFriendshipMod(struct Pokemon *pokemon, u32 kind, u32 location) {
|
||||
return;
|
||||
}
|
||||
|
||||
effect = (u8)GetItemAttr((u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL), 1, HEAP_ID_DEFAULT);
|
||||
r4 = 0;
|
||||
effect = (u8)GetItemAttr((u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL), 1, HEAP_ID_DEFAULT);
|
||||
r4 = 0;
|
||||
friendship = (s16)GetMonData(pokemon, MON_DATA_FRIENDSHIP, NULL);
|
||||
if (friendship >= 100) {
|
||||
r4++;
|
||||
@@ -2022,8 +2022,8 @@ u8 GetMonGender(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
u8 GetBoxMonGender(struct BoxPokemon *boxmon) {
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
ReleaseBoxMonLock(boxmon, decry);
|
||||
return GetGenderBySpeciesAndPersonality(species, personality);
|
||||
@@ -2031,7 +2031,7 @@ u8 GetBoxMonGender(struct BoxPokemon *boxmon) {
|
||||
|
||||
u8 GetGenderBySpeciesAndPersonality(u16 species, u32 pid) {
|
||||
struct BaseStats *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT);
|
||||
u8 gender = GetGenderBySpeciesAndPersonality_PreloadedPersonal(personal, species, pid);
|
||||
u8 gender = GetGenderBySpeciesAndPersonality_PreloadedPersonal(personal, species, pid);
|
||||
FreeMonPersonal(personal);
|
||||
return gender;
|
||||
}
|
||||
@@ -2061,7 +2061,7 @@ u8 MonIsShiny(struct Pokemon *pokemon) {
|
||||
|
||||
u8 BoxMonIsShiny(struct BoxPokemon *boxmon) {
|
||||
u32 otid = GetBoxMonData(boxmon, MON_DATA_OTID, NULL);
|
||||
u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
return CalcShininessByOtIdAndPersonality(otid, pid);
|
||||
}
|
||||
|
||||
@@ -2074,8 +2074,8 @@ u32 GenerateShinyPersonality(u32 otid) {
|
||||
u16 r6;
|
||||
u16 r5;
|
||||
otid = (u32)((((otid & 0xFFFF0000) >> 16) ^ (otid & 0xFFFF)) >> 3u);
|
||||
r6 = (u16)(LCRandom() & 7);
|
||||
r5 = (u16)(LCRandom() & 7);
|
||||
r6 = (u16)(LCRandom() & 7);
|
||||
r5 = (u16)(LCRandom() & 7);
|
||||
for (r4 = 0; r4 < 13; r4++) {
|
||||
if (MaskOfFlagNo(r4) & otid) {
|
||||
if (LCRandom() & 1) {
|
||||
@@ -2096,10 +2096,10 @@ void sub_02068B68(struct SomeDrawPokemonStruct *spC, struct Pokemon *pokemon, u8
|
||||
}
|
||||
|
||||
void sub_02068B70(struct SomeDrawPokemonStruct *spC, struct BoxPokemon *boxmon, u8 sp10) {
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL);
|
||||
u8 gender = GetBoxMonGender(boxmon);
|
||||
u8 shiny = BoxMonIsShiny(boxmon);
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL);
|
||||
u8 gender = GetBoxMonGender(boxmon);
|
||||
u8 shiny = BoxMonIsShiny(boxmon);
|
||||
u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
u8 form;
|
||||
if (species == SPECIES_EGG) {
|
||||
@@ -2224,8 +2224,8 @@ u8 sub_02068E14(struct Pokemon *pokemon, u32 a1) {
|
||||
|
||||
u8 sub_02068E1C(struct BoxPokemon *boxmon, u32 a1) {
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL);
|
||||
u8 gender = GetBoxMonGender(boxmon);
|
||||
u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
u8 gender = GetBoxMonGender(boxmon);
|
||||
u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
u8 form;
|
||||
if (species == SPECIES_EGG) {
|
||||
if (GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) {
|
||||
@@ -2249,78 +2249,78 @@ u8 sub_02068E88(int species, u8 gender, u32 a1, u8 form, u32 pid) {
|
||||
if (form > 2) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 / 2 + 0x48 + form * 2);
|
||||
break;
|
||||
case SPECIES_WORMADAM:
|
||||
if (form > 2) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 / 2 + 0x4E + form * 2);
|
||||
break;
|
||||
case SPECIES_SHELLOS:
|
||||
if (form > 1) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 + 0x54 + form);
|
||||
break;
|
||||
case SPECIES_GASTRODON:
|
||||
if (form > 1) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 + 0x58 + form);
|
||||
break;
|
||||
case SPECIES_CHERRIM:
|
||||
if (form > 1) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 + 0x5C + form);
|
||||
break;
|
||||
case SPECIES_ARCEUS:
|
||||
if (form > 17) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 / 2 + 0x60 + 2 * form);
|
||||
break;
|
||||
case SPECIES_CASTFORM:
|
||||
if (form > 3) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 * 2 + 0x40 + form);
|
||||
break;
|
||||
case SPECIES_DEOXYS:
|
||||
if (form > 3) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 / 2 + form * 2);
|
||||
break;
|
||||
case SPECIES_UNOWN:
|
||||
if (form >= 28) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(a1 / 2 + 0x8 + form * 2);
|
||||
break;
|
||||
case SPECIES_EGG:
|
||||
if (form > 1) {
|
||||
form = 0;
|
||||
}
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = (s32)(0x84 + form);
|
||||
break;
|
||||
case SPECIES_MANAPHY_EGG:
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT_O;
|
||||
fileId = 0x84;
|
||||
break;
|
||||
default:
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT;
|
||||
narc = NARC_POKETOOL_POKEGRA_HEIGHT;
|
||||
fileId = (s32)(4 * species + a1 + (gender != MON_FEMALE ? 1 : 0));
|
||||
break;
|
||||
}
|
||||
@@ -2333,7 +2333,7 @@ void sub_02068FE0(struct SomeDrawPokemonStruct *a0, u16 a1, int a2) {
|
||||
a0->unk0 = NARC_POKETOOL_TRGRA_TRFGRA;
|
||||
} else {
|
||||
a0->unk0 = NARC_POKETOOL_TRGRA_TRBGRA;
|
||||
a1 = (u16)sub_0206AA30(a1);
|
||||
a1 = (u16)sub_0206AA30(a1);
|
||||
}
|
||||
a0->unk2 = (u16)(a1 * 2);
|
||||
a0->unk4 = (u16)(a1 * 2 + 1);
|
||||
@@ -2396,11 +2396,11 @@ struct BoxPokemon *sub_020690E4(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
BOOL sub_020690E8(struct Pokemon *pokemon) {
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u8 level = (u8)(GetMonData(pokemon, MON_DATA_LEVEL, NULL) + 1);
|
||||
u32 exp = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL);
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u8 level = (u8)(GetMonData(pokemon, MON_DATA_LEVEL, NULL) + 1);
|
||||
u32 exp = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL);
|
||||
u32 growthrate = (u32)GetMonBaseStat(species, BASE_GROWTH_RATE);
|
||||
u32 maxexp = GetExpByGrowthRateAndLevel((int)growthrate, 100);
|
||||
u32 maxexp = GetExpByGrowthRateAndLevel((int)growthrate, 100);
|
||||
if (exp > maxexp) {
|
||||
exp = maxexp;
|
||||
SetMonData(pokemon, MON_DATA_EXPERIENCE, &exp);
|
||||
@@ -2429,12 +2429,12 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
struct Evolution *evoTable;
|
||||
u8 r1;
|
||||
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
heldItem = (u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL);
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
heldItem = (u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL);
|
||||
personality = GetMonData(pokemon, MON_DATA_PERSONALITY, NULL);
|
||||
beauty = (u8)GetMonData(pokemon, MON_DATA_BEAUTY, NULL);
|
||||
pid_hi = (u16)((personality & 0xFFFF0000) >> 16);
|
||||
r1 = (u8)GetItemAttr(heldItem, 1, HEAP_ID_DEFAULT);
|
||||
beauty = (u8)GetMonData(pokemon, MON_DATA_BEAUTY, NULL);
|
||||
pid_hi = (u16)((personality & 0xFFFF0000) >> 16);
|
||||
r1 = (u8)GetItemAttr(heldItem, 1, HEAP_ID_DEFAULT);
|
||||
if (species != SPECIES_KADABRA && r1 == HOLD_EFFECT_NO_EVOLVE && context != 3) {
|
||||
return SPECIES_NONE;
|
||||
}
|
||||
@@ -2445,7 +2445,7 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
LoadMonEvolutionTable(species, evoTable);
|
||||
switch (context) {
|
||||
case 0:
|
||||
level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
friendship = (u16)GetMonData(pokemon, MON_DATA_FRIENDSHIP, NULL);
|
||||
for (i = 0; i < 7; i++) {
|
||||
switch (evoTable[i].method) {
|
||||
@@ -2453,25 +2453,25 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
break;
|
||||
case EVO_FRIENDSHIP:
|
||||
if (friendship >= 220) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_FRIENDSHIP;
|
||||
}
|
||||
break;
|
||||
case EVO_FRIENDSHIP_DAY:
|
||||
if (IsNighttime() == 0 && friendship >= 220) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_FRIENDSHIP_DAY;
|
||||
}
|
||||
break;
|
||||
case EVO_FRIENDSHIP_NIGHT:
|
||||
if (IsNighttime() == 1 && friendship >= 220) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_FRIENDSHIP_NIGHT;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL:
|
||||
if (evoTable[i].param <= level) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL;
|
||||
}
|
||||
break;
|
||||
@@ -2483,37 +2483,37 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
break;
|
||||
case EVO_LEVEL_ATK_GT_DEF:
|
||||
if (evoTable[i].param <= level && GetMonData(pokemon, MON_DATA_ATK, NULL) > GetMonData(pokemon, MON_DATA_DEF, NULL)) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_ATK_GT_DEF;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_ATK_EQ_DEF:
|
||||
if (evoTable[i].param <= level && GetMonData(pokemon, MON_DATA_ATK, NULL) == GetMonData(pokemon, MON_DATA_DEF, NULL)) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_ATK_EQ_DEF;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_ATK_LT_DEF:
|
||||
if (evoTable[i].param <= level && GetMonData(pokemon, MON_DATA_ATK, NULL) < GetMonData(pokemon, MON_DATA_DEF, NULL)) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_ATK_LT_DEF;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_PID_LO:
|
||||
if (evoTable[i].param <= level && pid_hi % 10 < 5) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_PID_LO;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_PID_HI:
|
||||
if (evoTable[i].param <= level && pid_hi % 10 >= 5) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_PID_HI;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_NINJASK:
|
||||
if (evoTable[i].param <= level) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_NINJASK;
|
||||
}
|
||||
break;
|
||||
@@ -2522,7 +2522,7 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
break;
|
||||
case EVO_BEAUTY:
|
||||
if (evoTable[i].param <= beauty) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_BEAUTY;
|
||||
}
|
||||
break;
|
||||
@@ -2532,55 +2532,55 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
break;
|
||||
case EVO_ITEM_DAY:
|
||||
if (IsNighttime() == 0 && evoTable[i].param == heldItem) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_ITEM_DAY;
|
||||
}
|
||||
break;
|
||||
case EVO_ITEM_NIGHT:
|
||||
if (IsNighttime() == 1 && evoTable[i].param == heldItem) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_ITEM_NIGHT;
|
||||
}
|
||||
break;
|
||||
case EVO_HAS_MOVE:
|
||||
if (MonHasMove(pokemon, evoTable[i].param) == TRUE) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_HAS_MOVE;
|
||||
}
|
||||
break;
|
||||
case EVO_OTHER_PARTY_MON:
|
||||
if (party != NULL && Party_HasMon(party, evoTable[i].param) == 1) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_OTHER_PARTY_MON;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_MALE:
|
||||
if (GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_MALE && evoTable[i].param <= level) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_MALE;
|
||||
}
|
||||
break;
|
||||
case EVO_LEVEL_FEMALE:
|
||||
if (GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_FEMALE && evoTable[i].param <= level) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_LEVEL_FEMALE;
|
||||
}
|
||||
break;
|
||||
case EVO_CORONET:
|
||||
if (usedItem == evoTable[i].method) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_CORONET;
|
||||
}
|
||||
break;
|
||||
case EVO_ETERNA:
|
||||
if (usedItem == evoTable[i].method) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_ETERNA;
|
||||
}
|
||||
break;
|
||||
case EVO_ROUTE217:
|
||||
if (usedItem == evoTable[i].method) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_ROUTE217;
|
||||
}
|
||||
break;
|
||||
@@ -2594,12 +2594,12 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
for (i = 0; i < 7; i++) {
|
||||
switch (evoTable[i].method) {
|
||||
case EVO_TRADE:
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_TRADE;
|
||||
break;
|
||||
case EVO_TRADE_ITEM:
|
||||
if (heldItem == evoTable[i].param) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = EVO_TRADE_ITEM;
|
||||
}
|
||||
break;
|
||||
@@ -2613,17 +2613,17 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u
|
||||
case 3:
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (evoTable[i].method == EVO_STONE && usedItem == evoTable[i].param) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = 0;
|
||||
break;
|
||||
}
|
||||
if (evoTable[i].method == EVO_STONE_MALE && GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_MALE && usedItem == evoTable[i].param) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = 0;
|
||||
break;
|
||||
}
|
||||
if (evoTable[i].method == EVO_STONE_FEMALE && GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_FEMALE && usedItem == evoTable[i].param) {
|
||||
target = evoTable[i].target;
|
||||
target = evoTable[i].target;
|
||||
*method_ret = 0;
|
||||
break;
|
||||
}
|
||||
@@ -2674,10 +2674,10 @@ void InitBoxMonMoveset(struct BoxPokemon *boxmon) {
|
||||
u8 level;
|
||||
u16 move;
|
||||
levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16));
|
||||
decry = AcquireBoxMonLock(boxmon);
|
||||
species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
form = GetBoxMonData(boxmon, MON_DATA_FORM, NULL);
|
||||
level = (u8)CalcBoxMonLevel(boxmon);
|
||||
decry = AcquireBoxMonLock(boxmon);
|
||||
species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
form = GetBoxMonData(boxmon, MON_DATA_FORM, NULL);
|
||||
level = (u8)CalcBoxMonLevel(boxmon);
|
||||
LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset);
|
||||
for (i = 0; levelUpLearnset[i] != LEVEL_UP_LEARNSET_END; i++) {
|
||||
if ((levelUpLearnset[i] & LEVEL_UP_LEARNSET_LEVEL_MASK) > (level << LEVEL_UP_LEARNSET_LEVEL_SHIFT)) {
|
||||
@@ -2730,13 +2730,13 @@ void sub_02069718(struct BoxPokemon *boxmon, u16 move) {
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
moves[i] = (u16)GetBoxMonData(boxmon, MON_DATA_MOVE1 + i + 1, NULL);
|
||||
pp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + i + 1, NULL);
|
||||
ppUp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + i + 1, NULL);
|
||||
pp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + i + 1, NULL);
|
||||
ppUp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + i + 1, NULL);
|
||||
}
|
||||
|
||||
moves[3] = move;
|
||||
pp[3] = (u8)GetWazaAttr(move, MOVEATTR_PP);
|
||||
ppUp[3] = 0;
|
||||
pp[3] = (u8)GetWazaAttr(move, MOVEATTR_PP);
|
||||
ppUp[3] = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
SetBoxMonData(boxmon, MON_DATA_MOVE1 + i, &moves[i]);
|
||||
@@ -2757,16 +2757,16 @@ void BoxMonSetMoveInSlot(struct BoxPokemon *boxmon, u16 move, u8 slot) {
|
||||
|
||||
SetBoxMonData(boxmon, MON_DATA_MOVE1 + slot, &move);
|
||||
ppUp = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot, NULL);
|
||||
pp = (u8)WazaGetMaxPp(move, ppUp);
|
||||
pp = (u8)WazaGetMaxPp(move, ppUp);
|
||||
SetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot, &pp);
|
||||
}
|
||||
|
||||
u32 sub_02069818(struct Pokemon *pokemon, u32 *r5, u16 *sp0) {
|
||||
u32 ret = 0;
|
||||
u32 ret = 0;
|
||||
u16 *levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16));
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u32 form = GetMonData(pokemon, MON_DATA_FORM, NULL);
|
||||
u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL);
|
||||
u32 form = GetMonData(pokemon, MON_DATA_FORM, NULL);
|
||||
u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL);
|
||||
LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset);
|
||||
|
||||
if (levelUpLearnset[*r5] == 0xFFFF) {
|
||||
@@ -2799,11 +2799,11 @@ void sub_020698E8(struct BoxPokemon *boxmon, int slot1, int slot2) {
|
||||
u8 ppUp[2];
|
||||
|
||||
moves[0] = (u16)GetBoxMonData(boxmon, MON_DATA_MOVE1 + slot1, NULL);
|
||||
pp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot1, NULL);
|
||||
ppUp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot1, NULL);
|
||||
pp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot1, NULL);
|
||||
ppUp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot1, NULL);
|
||||
moves[1] = (u16)GetBoxMonData(boxmon, MON_DATA_MOVE1 + slot2, NULL);
|
||||
pp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot2, NULL);
|
||||
ppUp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot2, NULL);
|
||||
pp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot2, NULL);
|
||||
ppUp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot2, NULL);
|
||||
|
||||
SetBoxMonData(boxmon, MON_DATA_MOVE1 + slot1, &moves[1]);
|
||||
SetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot1, &pp[1]);
|
||||
@@ -2819,14 +2819,14 @@ void sub_020699A4(struct Pokemon *pokemon, u32 slot) {
|
||||
u8 ppUp;
|
||||
for (; slot < 3; slot++) {
|
||||
move = (u16)GetMonData(pokemon, (int)(MON_DATA_MOVE1 + slot + 1), NULL);
|
||||
pp = (u8)GetMonData(pokemon, (int)(MON_DATA_MOVE1PP + slot + 1), NULL);
|
||||
pp = (u8)GetMonData(pokemon, (int)(MON_DATA_MOVE1PP + slot + 1), NULL);
|
||||
ppUp = (u8)GetMonData(pokemon, (int)(MON_DATA_MOVE1PPUP + slot + 1), NULL);
|
||||
SetMonData(pokemon, (int)(MON_DATA_MOVE1 + slot), &move);
|
||||
SetMonData(pokemon, (int)(MON_DATA_MOVE1PP + slot), &pp);
|
||||
SetMonData(pokemon, (int)(MON_DATA_MOVE1PPUP + slot), &ppUp);
|
||||
}
|
||||
move = MOVE_NONE;
|
||||
pp = 0;
|
||||
pp = 0;
|
||||
ppUp = 0;
|
||||
SetMonData(pokemon, MON_DATA_MOVE1 + 3, &move);
|
||||
SetMonData(pokemon, MON_DATA_MOVE1PP + 3, &pp);
|
||||
@@ -2945,7 +2945,7 @@ void Party_GivePokerusAtRandom(struct Party *party) {
|
||||
case 0x8000:
|
||||
case 0xC000:
|
||||
do {
|
||||
idx = LCRandom() % count;
|
||||
idx = LCRandom() % count;
|
||||
pokemon = Party_GetMonByIndex(party, idx);
|
||||
} while (GetMonData(pokemon, MON_DATA_SPECIES, NULL) == SPECIES_NONE || GetMonData(pokemon, MON_DATA_IS_EGG, NULL));
|
||||
if (!Party_MaskMonsWithPokerus(party, (u8)MaskOfFlagNo(idx))) {
|
||||
@@ -2964,9 +2964,9 @@ void Party_GivePokerusAtRandom(struct Party *party) {
|
||||
}
|
||||
|
||||
u8 Party_MaskMonsWithPokerus(struct Party *party, u8 mask) {
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
u32 flag = 1;
|
||||
u8 ret = 0;
|
||||
u8 ret = 0;
|
||||
struct Pokemon *pokemon;
|
||||
if (mask != 0) {
|
||||
do {
|
||||
@@ -3071,8 +3071,8 @@ void Pokemon_UpdateArceusForm(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
void BoxMon_UpdateArceusForm(struct BoxPokemon *boxmon) {
|
||||
u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
u32 ability = GetBoxMonData(boxmon, MON_DATA_ABILITY, NULL);
|
||||
u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
u32 ability = GetBoxMonData(boxmon, MON_DATA_ABILITY, NULL);
|
||||
u32 heldItem = GetBoxMonData(boxmon, MON_DATA_HELD_ITEM, NULL);
|
||||
u32 form;
|
||||
if (species == SPECIES_ARCEUS && ability == ABILITY_MULTITYPE) {
|
||||
@@ -3165,11 +3165,11 @@ void sub_0206A094(struct Pokemon *pokemon, u32 a1, u32 a2) {
|
||||
u16 item1;
|
||||
u16 item2;
|
||||
if (!(a1 & 0x81)) {
|
||||
chance = (u32)(LCRandom() % 100);
|
||||
chance = (u32)(LCRandom() % 100);
|
||||
species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0);
|
||||
form = (u16)GetMonData(pokemon, MON_DATA_FORM, 0);
|
||||
item1 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_1);
|
||||
item2 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_2);
|
||||
form = (u16)GetMonData(pokemon, MON_DATA_FORM, 0);
|
||||
item1 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_1);
|
||||
item2 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_2);
|
||||
if (item1 == item2 && item1 != ITEM_NONE) {
|
||||
SetMonData(pokemon, MON_DATA_HELD_ITEM, &item1);
|
||||
} else {
|
||||
@@ -3190,7 +3190,7 @@ BOOL sub_0206A13C(struct Pokemon *pokemon, u32 a1) {
|
||||
|
||||
BOOL sub_0206A144(struct BoxPokemon *boxmon, u32 a1) {
|
||||
u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL);
|
||||
int form = (int)GetBoxMonData(boxmon, MON_DATA_FORM, NULL);
|
||||
int form = (int)GetBoxMonData(boxmon, MON_DATA_FORM, NULL);
|
||||
return sub_0206A16C(species, form, a1);
|
||||
}
|
||||
|
||||
@@ -3221,9 +3221,9 @@ void sub_0206A1C4(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
void sub_0206A1CC(struct BoxPokemon *boxmon) {
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
int species = (int)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
int pid = (int)GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
BOOL decry = AcquireBoxMonLock(boxmon);
|
||||
int species = (int)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL);
|
||||
int pid = (int)GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL);
|
||||
int ability1 = (int)GetMonBaseStat(species, BASE_ABILITY_1);
|
||||
int ability2 = (int)GetMonBaseStat(species, BASE_ABILITY_2);
|
||||
|
||||
@@ -3252,11 +3252,11 @@ void sub_0206A23C(struct Pokemon *r5, u32 personality) {
|
||||
|
||||
sp4 = AllocMonZeroed(HEAP_ID_DEFAULT);
|
||||
CopyPokemonToPokemon(r5, sp4);
|
||||
r4 = &GetSubstruct(&sp4->box, r5->box.pid, 0)->blockA;
|
||||
r6 = &GetSubstruct(&sp4->box, r5->box.pid, 1)->blockB;
|
||||
r7 = &GetSubstruct(&sp4->box, r5->box.pid, 2)->blockC;
|
||||
sp8 = &GetSubstruct(&sp4->box, r5->box.pid, 3)->blockD;
|
||||
spC = &GetSubstruct(&r5->box, personality, 0)->blockA;
|
||||
r4 = &GetSubstruct(&sp4->box, r5->box.pid, 0)->blockA;
|
||||
r6 = &GetSubstruct(&sp4->box, r5->box.pid, 1)->blockB;
|
||||
r7 = &GetSubstruct(&sp4->box, r5->box.pid, 2)->blockC;
|
||||
sp8 = &GetSubstruct(&sp4->box, r5->box.pid, 3)->blockD;
|
||||
spC = &GetSubstruct(&r5->box, personality, 0)->blockA;
|
||||
sp10 = &GetSubstruct(&r5->box, personality, 1)->blockB;
|
||||
sp14 = &GetSubstruct(&r5->box, personality, 2)->blockC;
|
||||
sp18 = &GetSubstruct(&r5->box, personality, 3)->blockD;
|
||||
@@ -3264,11 +3264,11 @@ void sub_0206A23C(struct Pokemon *r5, u32 personality) {
|
||||
DECRYPT_BOX(&sp4->box);
|
||||
DECRYPT_PTY(r5);
|
||||
DECRYPT_BOX(&r5->box);
|
||||
r5->box.pid = personality;
|
||||
*spC = *r4;
|
||||
*sp10 = *r6;
|
||||
*sp14 = *r7;
|
||||
*sp18 = *sp8;
|
||||
r5->box.pid = personality;
|
||||
*spC = *r4;
|
||||
*sp10 = *r6;
|
||||
*sp14 = *r7;
|
||||
*sp18 = *sp8;
|
||||
r5->box.checksum = CHECKSUM(&r5->box);
|
||||
ENCRYPT_BOX(&r5->box);
|
||||
ENCRYPT_PTY(r5);
|
||||
@@ -3459,13 +3459,13 @@ BOOL sub_0206A998(struct Pokemon *pokemon) {
|
||||
}
|
||||
|
||||
BOOL sub_0206A9AC(struct BoxPokemon *boxmon, PlayerProfile *sb2, HeapID heapId) {
|
||||
u32 myId = PlayerProfile_GetTrainerID(sb2);
|
||||
u32 otId = GetBoxMonData(boxmon, MON_DATA_OTID, NULL);
|
||||
u32 myGender = PlayerProfile_GetTrainerGender(sb2);
|
||||
u32 otGender = GetBoxMonData(boxmon, MON_DATA_MET_GENDER, NULL);
|
||||
u32 myId = PlayerProfile_GetTrainerID(sb2);
|
||||
u32 otId = GetBoxMonData(boxmon, MON_DATA_OTID, NULL);
|
||||
u32 myGender = PlayerProfile_GetTrainerGender(sb2);
|
||||
u32 otGender = GetBoxMonData(boxmon, MON_DATA_MET_GENDER, NULL);
|
||||
struct String *r7 = PlayerProfile_GetPlayerName_NewString(sb2, heapId);
|
||||
struct String *r6 = String_New(PLAYER_NAME_LENGTH + 1, heapId);
|
||||
BOOL ret = FALSE;
|
||||
BOOL ret = FALSE;
|
||||
GetBoxMonData(boxmon, MON_DATA_OT_NAME_2, r6);
|
||||
if (myId == otId && myGender == otGender && String_Compare(r7, r6) == 0) {
|
||||
ret = TRUE;
|
||||
|
||||
@@ -32,7 +32,7 @@ void PCStorage_InitializeBoxes(struct PCStorage *pc) {
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
pc->unlockedWallpapers = 0;
|
||||
pc->unlockedWallpapers = 0;
|
||||
struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0014_bin, HEAP_ID_DEFAULT);
|
||||
if (msgData != NULL) {
|
||||
for (i = 0; i < NUM_BOXES; i++) {
|
||||
@@ -129,7 +129,7 @@ BOOL PCStorage_FindFirstEmptySlot(struct PCStorage *pc, int *boxno, int *slotno)
|
||||
do {
|
||||
while (j < (int)MONS_PER_BOX) {
|
||||
if (!GetBoxMonData(&pc->boxes[i][j], MON_DATA_SPECIES_EXISTS, NULL)) {
|
||||
*boxno = i;
|
||||
*boxno = i;
|
||||
*slotno = j;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -26,17 +26,17 @@ void Save_Poketch_Init(struct Poketch *poketch) {
|
||||
for (i = 0; i < 32; i++) {
|
||||
poketch->unlockedApps[i] = 0;
|
||||
}
|
||||
poketch->numApps = 0;
|
||||
poketch->selectedApp = 0;
|
||||
poketch->isGiven = 0;
|
||||
poketch->color = 0;
|
||||
poketch->numApps = 0;
|
||||
poketch->selectedApp = 0;
|
||||
poketch->isGiven = 0;
|
||||
poketch->color = 0;
|
||||
poketch->pedometerActive = 0;
|
||||
poketch->stepCounter = 0;
|
||||
poketch->alarmActive = 0;
|
||||
poketch->alarmHour = 0;
|
||||
poketch->alarmMinute = 0;
|
||||
poketch->calendarMonth = 1; // January
|
||||
poketch->calendarFlags = 0;
|
||||
poketch->stepCounter = 0;
|
||||
poketch->alarmActive = 0;
|
||||
poketch->alarmHour = 0;
|
||||
poketch->alarmMinute = 0;
|
||||
poketch->calendarMonth = 1; // January
|
||||
poketch->calendarFlags = 0;
|
||||
for (i = 0; i < 6; i++) {
|
||||
poketch->markingMapPos[i][0] = sMarkingMapInitialPos[i][0];
|
||||
poketch->markingMapPos[i][1] = sMarkingMapInitialPos[i][1];
|
||||
@@ -80,7 +80,7 @@ PoketchApp Save_Poketch_GetSelectedApp(struct Poketch *poketch) {
|
||||
}
|
||||
|
||||
PoketchApp Save_Poketch_CycleNextApp(struct Poketch *poketch) {
|
||||
PoketchApp app = (PoketchApp)poketch->selectedApp;
|
||||
PoketchApp app = (PoketchApp)poketch->selectedApp;
|
||||
PoketchApp prev = app;
|
||||
|
||||
while (1) {
|
||||
@@ -125,12 +125,12 @@ BOOL Save_Poketch_GetAlarmState(struct Poketch *poketch) {
|
||||
|
||||
void Save_Poketch_GetAlarmSetTime(struct Poketch *poketch, u32 *hour_p, u32 *min_p) {
|
||||
*hour_p = poketch->alarmHour;
|
||||
*min_p = poketch->alarmMinute;
|
||||
*min_p = poketch->alarmMinute;
|
||||
}
|
||||
|
||||
void Save_Poketch_SetAlarm(struct Poketch *poketch, BOOL enabled, u32 hour, u32 minute) {
|
||||
poketch->alarmActive = enabled;
|
||||
poketch->alarmHour = hour;
|
||||
poketch->alarmHour = hour;
|
||||
poketch->alarmMinute = minute;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ void Save_Poketch_PokemonHistoryGetSlotN(struct Poketch *poketch, s32 i, u32 *sp
|
||||
GF_ASSERT(i < 12);
|
||||
GF_ASSERT(poketch->pokemonHistory[i][0] != SPECIES_NONE);
|
||||
*species_p = poketch->pokemonHistory[i][0];
|
||||
*form_p = poketch->pokemonHistory[i][1];
|
||||
*form_p = poketch->pokemonHistory[i][1];
|
||||
}
|
||||
|
||||
struct Poketch *Save_Poketch_Get(struct SaveData *save) {
|
||||
|
||||
@@ -37,7 +37,7 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
if (gTextFlags.canABSpeedUpPrint != 0) {
|
||||
if ((gSystem.newKeys & 3) || (gSystem.touchNew != 0 && gTextFlags.unk0_4)) {
|
||||
subStruct->hasPrintBeenSpedUp = 1;
|
||||
printer->delayCounter = 0;
|
||||
printer->delayCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
}
|
||||
|
||||
printer->delayCounter = printer->textSpeedBottom;
|
||||
currentChar = *printer->printerTemplate.currentChar.raw;
|
||||
currentChar = *printer->printerTemplate.currentChar.raw;
|
||||
printer->printerTemplate.currentChar.raw++;
|
||||
|
||||
GF_ASSERT(currentChar != 0xF100);
|
||||
@@ -55,7 +55,7 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
return 1;
|
||||
case CHAR_LF:
|
||||
printer->printerTemplate.currentX = printer->printerTemplate.x;
|
||||
s32 fontAttribute = GetFontAttribute(printer->printerTemplate.fontId, 1);
|
||||
s32 fontAttribute = GetFontAttribute(printer->printerTemplate.fontId, 1);
|
||||
|
||||
printer->printerTemplate.currentY += printer->printerTemplate.lineSpacing + fontAttribute;
|
||||
|
||||
@@ -71,7 +71,7 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
u16 field = (u16)MsgArray_ControlCodeGetField(
|
||||
printer->printerTemplate.currentChar.raw, 0);
|
||||
if (field == 0xff) {
|
||||
u8 r2 = printer->printerTemplate.unk4;
|
||||
u8 r2 = printer->printerTemplate.unk4;
|
||||
printer->printerTemplate.unk4 = (u8)((printer->printerTemplate.fgColor - 1) / 2 + 100);
|
||||
|
||||
if (!(r2 >= 100 && r2 < 107)) {
|
||||
@@ -86,7 +86,7 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
}
|
||||
}
|
||||
|
||||
printer->printerTemplate.fgColor = (u8)(field * 2 + 1);
|
||||
printer->printerTemplate.fgColor = (u8)(field * 2 + 1);
|
||||
printer->printerTemplate.shadowColor = (u8)(field * 2 + 2);
|
||||
|
||||
GenerateFontHalfRowLookupTable(printer->printerTemplate.fgColor,
|
||||
@@ -112,7 +112,7 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
printer->delayCounter = (u8)MsgArray_ControlCodeGetField(
|
||||
printer->printerTemplate.currentChar.raw, 0);
|
||||
printer->printerTemplate.currentChar.raw = MsgArray_SkipControlCode(printer->printerTemplate.currentChar.raw);
|
||||
printer->state = 6;
|
||||
printer->state = 6;
|
||||
|
||||
return 3;
|
||||
case 0x202:
|
||||
@@ -211,16 +211,16 @@ u32 RenderText(struct TextPrinter *printer) {
|
||||
printer->printerTemplate.window, printer->printerTemplate.bgColor);
|
||||
printer->printerTemplate.currentX = printer->printerTemplate.x;
|
||||
printer->printerTemplate.currentY = printer->printerTemplate.y;
|
||||
printer->state = 0;
|
||||
printer->state = 0;
|
||||
}
|
||||
|
||||
return 3;
|
||||
case 3:
|
||||
if (TextPrinterWaitWithDownArrow(printer) != 0) {
|
||||
TextPrinterClearDownArrow(printer);
|
||||
printer->scrollDistance = (u8)(GetFontAttribute(printer->printerTemplate.fontId, 1) + printer->printerTemplate.lineSpacing);
|
||||
printer->scrollDistance = (u8)(GetFontAttribute(printer->printerTemplate.fontId, 1) + printer->printerTemplate.lineSpacing);
|
||||
printer->printerTemplate.currentX = printer->printerTemplate.x;
|
||||
printer->state = 4;
|
||||
printer->state = 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
@@ -276,7 +276,7 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *printer) {
|
||||
}
|
||||
|
||||
subStruct->downArrowYPosIdx = 0;
|
||||
subStruct->downArrowDelay = 0;
|
||||
subStruct->downArrowDelay = 0;
|
||||
}
|
||||
|
||||
void TextPrinterDrawDownArrow(struct TextPrinter *printer) {
|
||||
@@ -292,10 +292,10 @@ void TextPrinterDrawDownArrow(struct TextPrinter *printer) {
|
||||
}
|
||||
|
||||
u8 bg_id = GetWindowBgId(printer->printerTemplate.window);
|
||||
u8 x = GetWindowX(printer->printerTemplate.window);
|
||||
u8 y = GetWindowY(printer->printerTemplate.window);
|
||||
u8 x = GetWindowX(printer->printerTemplate.window);
|
||||
u8 y = GetWindowY(printer->printerTemplate.window);
|
||||
u8 width = GetWindowWidth(printer->printerTemplate.window);
|
||||
u16 r6 = unk00;
|
||||
u16 r6 = unk00;
|
||||
|
||||
FillBgTilemapRect(printer->printerTemplate.window->bgConfig,
|
||||
bg_id,
|
||||
@@ -338,10 +338,10 @@ void TextPrinterDrawDownArrow(struct TextPrinter *printer) {
|
||||
|
||||
void TextPrinterClearDownArrow(struct TextPrinter *printer) {
|
||||
u8 bg_id = GetWindowBgId(printer->printerTemplate.window);
|
||||
u8 x = GetWindowX(printer->printerTemplate.window);
|
||||
u8 y = GetWindowY(printer->printerTemplate.window);
|
||||
u8 x = GetWindowX(printer->printerTemplate.window);
|
||||
u8 y = GetWindowY(printer->printerTemplate.window);
|
||||
u8 width = GetWindowWidth(printer->printerTemplate.window);
|
||||
u16 r6 = unk00;
|
||||
u16 r6 = unk00;
|
||||
|
||||
FillBgTilemapRect(printer->printerTemplate.window->bgConfig,
|
||||
bg_id,
|
||||
@@ -413,7 +413,7 @@ void TextFlags_SetCanABSpeedUpPrint(BOOL param0) {
|
||||
|
||||
void sub_02002B7C(s32 param0) {
|
||||
gTextFlags.autoScroll = param0 & 1;
|
||||
gTextFlags.unk0_5 = (param0 >> 1) & 1;
|
||||
gTextFlags.unk0_5 = (param0 >> 1) & 1;
|
||||
}
|
||||
|
||||
void sub_02002BB8(u32 param0) {
|
||||
|
||||
@@ -285,12 +285,12 @@ void BlitRect4Bit(u8 *srcPixels,
|
||||
u16 height) {
|
||||
struct Bitmap src;
|
||||
src.pixels = srcPixels;
|
||||
src.width = srcWidth;
|
||||
src.width = srcWidth;
|
||||
src.height = srcHeight;
|
||||
|
||||
struct Bitmap dst;
|
||||
dst.pixels = dstPixels;
|
||||
dst.width = dstWidth;
|
||||
dst.width = dstWidth;
|
||||
dst.height = dstHeight;
|
||||
|
||||
BlitBitmapRect4Bit(&src, &dst, srcX, srcY, dstX, dstY, width, height, 0);
|
||||
@@ -298,9 +298,9 @@ void BlitRect4Bit(u8 *srcPixels,
|
||||
|
||||
void sub_0200D18C(struct Window *window, u16 fill_value) {
|
||||
HeapID heapId = BgConfig_GetHeapId(window->bgConfig);
|
||||
u8 bg_id = GetWindowBgId(window);
|
||||
u8 bg_id = GetWindowBgId(window);
|
||||
|
||||
void *ptr = AllocFromHeap(heapId, 0x180);
|
||||
void *ptr = AllocFromHeap(heapId, 0x180);
|
||||
void *charptr = BgGetCharPtr((u8)bg_id);
|
||||
|
||||
NNSG2dCharacterData *pCharData;
|
||||
@@ -449,8 +449,8 @@ void DrawWindowCorner(struct Window *window, u16 fillValue, u8 paletteNum) {
|
||||
u8 bg_id;
|
||||
|
||||
bg_id = GetWindowBgId(window);
|
||||
x = (u16)(GetWindowX(window) - 7);
|
||||
y = GetWindowY(window);
|
||||
x = (u16)(GetWindowX(window) - 7);
|
||||
y = GetWindowY(window);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 6; j++) {
|
||||
@@ -546,11 +546,11 @@ WaitingIcon *WaitingIcon_New(struct Window *window, u32 param1) {
|
||||
BlitRect4Bit(pCharData->pRawData, 0, 0, 0x10, 0x80, waitingIcon->unk004[0], 0x10, 0x80, 0, 0, 0x10, 0x80);
|
||||
FreeToHeap(r5);
|
||||
|
||||
waitingIcon->window = window;
|
||||
waitingIcon->window = window;
|
||||
waitingIcon->fillValue = (u16)param1;
|
||||
waitingIcon->unk486 = 0;
|
||||
waitingIcon->unk487 = 0;
|
||||
waitingIcon->unk488 = 0;
|
||||
waitingIcon->unk486 = 0;
|
||||
waitingIcon->unk487 = 0;
|
||||
waitingIcon->unk488 = 0;
|
||||
|
||||
sub_0200CA60((SysTaskFunc)sub_0200DB7C, waitingIcon, 0);
|
||||
sub_0200D980(waitingIcon, 1);
|
||||
@@ -560,8 +560,8 @@ WaitingIcon *WaitingIcon_New(struct Window *window, u32 param1) {
|
||||
|
||||
void sub_0200D980(WaitingIcon *waitingIcon, u32 param1) {
|
||||
u8 bg_id = GetWindowBgId(waitingIcon->window);
|
||||
u8 x = GetWindowX(waitingIcon->window);
|
||||
u8 y = GetWindowY(waitingIcon->window);
|
||||
u8 x = GetWindowX(waitingIcon->window);
|
||||
u8 y = GetWindowY(waitingIcon->window);
|
||||
u8 width = GetWindowWidth(waitingIcon->window);
|
||||
|
||||
if (param1 == 2) {
|
||||
@@ -619,7 +619,7 @@ void sub_0200DC24(WaitingIcon *waitingIcon) {
|
||||
}
|
||||
|
||||
PokepicManager *DrawPokemonPicFromSpecies(struct BgConfig *bg_config, u8 bg_id, u8 param2, u8 param3, u8 param4, u16 numTiles, u16 species, u8 gender, HeapID heapId) {
|
||||
s32 heap = heapId; // weirdness needed for matching
|
||||
s32 heap = heapId; // weirdness needed for matching
|
||||
struct UnkStruct_0200CABC_2 *r4 = sub_0200DD70(bg_config, bg_id, param2, param3, (HeapID)heap);
|
||||
sub_0200DDAC(r4, (HeapID)heap);
|
||||
sub_0200DDD8(r4);
|
||||
@@ -632,7 +632,7 @@ PokepicManager *DrawPokemonPicFromSpecies(struct BgConfig *bg_config, u8 bg_id,
|
||||
}
|
||||
|
||||
PokepicManager *DrawPokemonPicFromMon(struct BgConfig *bg_config, u8 bg_id, u8 param2, u8 param3, u8 param4, u16 numTiles, struct Pokemon *mon, HeapID heapId) {
|
||||
s32 heap = heapId; // weirdness needed for matching
|
||||
s32 heap = heapId; // weirdness needed for matching
|
||||
struct UnkStruct_0200CABC_2 *r4 = sub_0200DD70(bg_config, bg_id, param2, param3, (HeapID)heap);
|
||||
sub_0200DDAC(r4, (HeapID)heap);
|
||||
sub_0200DDD8(r4);
|
||||
@@ -672,10 +672,10 @@ struct UnkStruct_0200CABC_2 *sub_0200DD70(
|
||||
struct UnkStruct_0200CABC_2 *res = sub_0201B6C8(sub_020061E8((SysTaskFunc)sub_0200DCF8, 0x170, 0, heapId));
|
||||
|
||||
res->pokepicManager.unk00 = 0;
|
||||
res->bgConfig = bg_config;
|
||||
res->bgId = bg_id;
|
||||
res->x = param2;
|
||||
res->y = param3;
|
||||
res->bgConfig = bg_config;
|
||||
res->bgId = bg_id;
|
||||
res->x = param2;
|
||||
res->y = param3;
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -718,7 +718,7 @@ void sub_0200DE30(struct UnkStruct_0200CABC_2 *param0, u8 param1, u8 param2) {
|
||||
};
|
||||
((u16 *)UNK_020ECEC0)[0] = (u16)((param1 + 5) * 8);
|
||||
((u16 *)UNK_020ECEC0)[1] = (u16)((param2 + 5) * 8);
|
||||
param0->unk164 = ov05_021D9820(param0, UNK_020ECEC0);
|
||||
param0->unk164 = ov05_021D9820(param0, UNK_020ECEC0);
|
||||
sub_0201FDEC(param0->unk000);
|
||||
GfGfx_EngineBTogglePlanes(0x10, GX_PLANE_TOGGLE_ON);
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ void Chatot_Decode(s8 *dest, const s8 *data) {
|
||||
s8 val2;
|
||||
|
||||
for (dest_i = 0, i = 0; i < 1000; i++, dest_i += 2) {
|
||||
val = (u8)(data[i] & 0xF);
|
||||
val2 = transform(val);
|
||||
val = (u8)(data[i] & 0xF);
|
||||
val2 = transform(val);
|
||||
dest[dest_i + 0] = (s8)(val2 << 4);
|
||||
val = (u8)(data[i] >> 4);
|
||||
val2 = transform(val);
|
||||
val = (u8)(data[i] >> 4);
|
||||
val2 = transform(val);
|
||||
dest[dest_i + 1] = (s8)(val2 << 4);
|
||||
}
|
||||
}
|
||||
@@ -69,11 +69,11 @@ void Chatot_Encode(struct SaveChatotSoundClip *chatot, const s8 *data) {
|
||||
chatot->exists = TRUE;
|
||||
|
||||
for (src_i = 0; src_i < 2000; src_i += 2) {
|
||||
val = data[src_i + 0];
|
||||
val2 = untransform(val);
|
||||
val = data[src_i + 0];
|
||||
val2 = untransform(val);
|
||||
chatot->data[i] = (s8)val2;
|
||||
|
||||
val = data[src_i + 1];
|
||||
val = data[src_i + 1];
|
||||
val2 = untransform(val);
|
||||
chatot->data[i] |= val2 << 4;
|
||||
|
||||
|
||||
112
arm9/src/save.c
112
arm9/src/save.c
@@ -21,10 +21,10 @@ static SaveData *sSaveDataPtr;
|
||||
struct SaveData *SaveData_New(void) {
|
||||
struct SaveData *save = AllocFromHeap(HEAP_ID_1, sizeof(struct SaveData));
|
||||
MI_CpuClearFast(save, sizeof(struct SaveData));
|
||||
sSaveDataPtr = save;
|
||||
save->flashOkay = SaveDetectFlash();
|
||||
save->saveFileExists = 0;
|
||||
save->isNewGame = 1;
|
||||
sSaveDataPtr = save;
|
||||
save->flashOkay = SaveDetectFlash();
|
||||
save->saveFileExists = 0;
|
||||
save->isNewGame = 1;
|
||||
save->largeSectorChanged = 1;
|
||||
MATH_CRC16InitTable(&save->crcTable);
|
||||
SaveData_InitSubstructs(save->arrayHeaders);
|
||||
@@ -37,7 +37,7 @@ struct SaveData *SaveData_New(void) {
|
||||
case 2:
|
||||
Save_LoadDynamicRegion(save);
|
||||
save->saveFileExists = 1;
|
||||
save->isNewGame = 0;
|
||||
save->isNewGame = 0;
|
||||
break;
|
||||
case 0:
|
||||
case 3:
|
||||
@@ -89,7 +89,7 @@ BOOL sub_020226FC(struct SaveData *save) {
|
||||
}
|
||||
if (Save_LoadDynamicRegion(save)) {
|
||||
save->saveFileExists = 1;
|
||||
save->isNewGame = 0;
|
||||
save->isNewGame = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -110,7 +110,7 @@ int SaveGame(struct SaveData *save) {
|
||||
int ret = sub_02023044(save);
|
||||
if (ret == 2) {
|
||||
save->saveFileExists = 1;
|
||||
save->isNewGame = 0;
|
||||
save->isNewGame = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ void sub_020227A0(struct SaveData *save, int a1) {
|
||||
}
|
||||
|
||||
void Save_InitDynamicRegion(struct SaveData *save) {
|
||||
save->isNewGame = 1;
|
||||
save->isNewGame = 1;
|
||||
save->largeSectorChanged = 1;
|
||||
Save_InitDynamicRegion_Internal(save->dynamic_region, save->arrayHeaders);
|
||||
}
|
||||
@@ -177,9 +177,9 @@ void sub_0202287C(struct SaveData *save) {
|
||||
}
|
||||
|
||||
void sub_0202288C(struct UnkStruct_0202288C *header) {
|
||||
header->unk_0 = 0;
|
||||
header->unk_0 = 0;
|
||||
header->offset = 0;
|
||||
header->size = 0;
|
||||
header->size = 0;
|
||||
}
|
||||
|
||||
u16 sub_02022898(struct SaveData *save, void *data, u32 size) {
|
||||
@@ -201,7 +201,7 @@ struct SaveChunkFooter *sub_020228B8(struct SaveData *save, u8 *offset, int idx)
|
||||
struct SaveSlotSpec *spec;
|
||||
|
||||
spec = &save->saveSlotSpecs[idx];
|
||||
r4 = offset + spec->offset;
|
||||
r4 = offset + spec->offset;
|
||||
GF_ASSERT(spec->size != 0);
|
||||
return (struct SaveChunkFooter *)(r4 + spec->size - 20);
|
||||
}
|
||||
@@ -210,9 +210,9 @@ BOOL sub_020228E0(struct SaveData *save, void *data, int idx) {
|
||||
struct SaveChunkFooter *r4;
|
||||
struct SaveSlotSpec *spec;
|
||||
|
||||
spec = &save->saveSlotSpecs[idx];
|
||||
r4 = sub_020228B8(save, data, idx);
|
||||
u32 size = spec->size;
|
||||
spec = &save->saveSlotSpecs[idx];
|
||||
r4 = sub_020228B8(save, data, idx);
|
||||
u32 size = spec->size;
|
||||
u32 offset = spec->offset;
|
||||
if (r4->size != size) {
|
||||
return FALSE;
|
||||
@@ -228,25 +228,25 @@ BOOL sub_020228E0(struct SaveData *save, void *data, int idx) {
|
||||
|
||||
void sub_0202293C(struct UnkStruct_0202288C *r5, struct SaveData *save, void *data, int idx) {
|
||||
struct SaveChunkFooter *r4;
|
||||
r4 = sub_020228B8(save, data, idx);
|
||||
r5->unk_0 = sub_020228E0(save, data, idx);
|
||||
r4 = sub_020228B8(save, data, idx);
|
||||
r5->unk_0 = sub_020228E0(save, data, idx);
|
||||
r5->offset = r4->unk_0;
|
||||
r5->size = r4->offset;
|
||||
r5->size = r4->offset;
|
||||
}
|
||||
|
||||
void sub_02022968(struct SaveData *save, void *data, int idx) {
|
||||
struct SaveChunkFooter *r4;
|
||||
struct SaveSlotSpec *spec;
|
||||
|
||||
spec = &save->saveSlotSpecs[idx];
|
||||
r4 = sub_020228B8(save, data, idx);
|
||||
data = (void *)((u8 *)data + spec->offset);
|
||||
r4->unk_0 = save->unk_20214;
|
||||
spec = &save->saveSlotSpecs[idx];
|
||||
r4 = sub_020228B8(save, data, idx);
|
||||
data = (void *)((u8 *)data + spec->offset);
|
||||
r4->unk_0 = save->unk_20214;
|
||||
r4->offset = save->unk_20218[idx];
|
||||
r4->size = spec->size;
|
||||
r4->magic = 0x20060623;
|
||||
r4->size = spec->size;
|
||||
r4->magic = 0x20060623;
|
||||
r4->unk_10 = (u8)idx;
|
||||
r4->crc = sub_02022898(save, data, spec->size);
|
||||
r4->crc = sub_02022898(save, data, spec->size);
|
||||
}
|
||||
|
||||
int sub_020229B8(u32 x, u32 y) {
|
||||
@@ -264,7 +264,7 @@ int sub_020229B8(u32 x, u32 y) {
|
||||
|
||||
int sub_020229F0(struct UnkStruct_0202288C *r7, struct UnkStruct_0202288C *r6, u32 *r5, u32 *r4) {
|
||||
int sp0 = sub_020229B8(r7->offset, r6->offset);
|
||||
int r0 = sub_020229B8(r7->size, r6->size);
|
||||
int r0 = sub_020229B8(r7->size, r6->size);
|
||||
if (r7->unk_0 != 0 && r6->unk_0 != 0) {
|
||||
if (sp0 > 0) {
|
||||
GF_ASSERT(r0 > 0);
|
||||
@@ -301,7 +301,7 @@ int sub_020229F0(struct UnkStruct_0202288C *r7, struct UnkStruct_0202288C *r6, u
|
||||
}
|
||||
|
||||
void sub_02022AA0(struct SaveData *save, struct UnkStruct_0202288C *a1, struct UnkStruct_0202288C *a2, u32 a3, u32 a4) {
|
||||
save->unk_20214 = a1[a3].offset;
|
||||
save->unk_20214 = a1[a3].offset;
|
||||
save->unk_20218[0] = a1[a3].size;
|
||||
save->unk_20218[1] = a2[a4].size;
|
||||
save->unk_20220[0] = (u8)a3;
|
||||
@@ -405,13 +405,13 @@ int sub_02022D54(struct SaveData *save, int chunk, u8 slot) {
|
||||
|
||||
int sub_02022D94(struct SaveData *save, int chunk, u8 slot) {
|
||||
struct SaveSlotSpec *header = &save->saveSlotSpecs[chunk];
|
||||
u32 size = header->size;
|
||||
u32 size = header->size;
|
||||
return FlashWriteChunkInternal(GetChunkOffsetFromCurrentSaveSlot(slot, header) + size - 20, save->dynamic_region + header->offset + size - 20, 20);
|
||||
}
|
||||
|
||||
int sub_02022DC8(struct SaveData *save, int chunk, u8 slot) {
|
||||
struct SaveSlotSpec *header = &save->saveSlotSpecs[chunk];
|
||||
u32 size = header->size;
|
||||
u32 size = header->size;
|
||||
return FlashWriteChunkInternal(GetChunkOffsetFromCurrentSaveSlot(slot, header) + size - 12, save->dynamic_region + header->offset + size - 12, 8);
|
||||
}
|
||||
|
||||
@@ -420,24 +420,24 @@ void sub_02022DFC(struct SaveData *save, struct AsyncWriteManager *a1, int a2) {
|
||||
a1->unk_1C[i] = save->unk_20218[i];
|
||||
save->unk_20218[i]++;
|
||||
}
|
||||
a1->state = 0;
|
||||
a1->state = 0;
|
||||
a1->rollbackCounter = 0;
|
||||
if (a2 == 2) {
|
||||
if (save->largeSectorChanged) {
|
||||
a1->rollbackCounter = 1;
|
||||
a1->count = save->unk_20214;
|
||||
a1->count = save->unk_20214;
|
||||
save->unk_20214++;
|
||||
a1->unk_4 = 0;
|
||||
a1->curSector = 0;
|
||||
a1->unk_4 = 0;
|
||||
a1->curSector = 0;
|
||||
a1->numSectors = 2;
|
||||
} else {
|
||||
a1->unk_4 = 0;
|
||||
a1->curSector = 0;
|
||||
a1->unk_4 = 0;
|
||||
a1->curSector = 0;
|
||||
a1->numSectors = 1;
|
||||
}
|
||||
} else {
|
||||
a1->unk_4 = a2;
|
||||
a1->curSector = a2;
|
||||
a1->unk_4 = a2;
|
||||
a1->curSector = a2;
|
||||
a1->numSectors = a2 + 1;
|
||||
}
|
||||
sub_02016444(1);
|
||||
@@ -509,8 +509,8 @@ void sub_02022F80(struct SaveData *save, struct AsyncWriteManager *a1, int a2) {
|
||||
for (i = a1->unk_4; i < a1->numSectors; i++) {
|
||||
save->unk_20220[i] = (u8)(save->unk_20220[i] == 0);
|
||||
}
|
||||
save->saveFileExists = 1;
|
||||
save->isNewGame = 0;
|
||||
save->saveFileExists = 1;
|
||||
save->isNewGame = 0;
|
||||
save->largeSectorChanged = 0;
|
||||
}
|
||||
sub_02016454(1);
|
||||
@@ -559,15 +559,15 @@ u32 SaveArray_sizeof(int idx) {
|
||||
|
||||
void SaveData_InitSubstructs(struct SaveArrayHeader *headers) {
|
||||
const struct SaveChunkHeader *sch = UNK_020EE700;
|
||||
s32 offset = 0;
|
||||
s32 offset = 0;
|
||||
GF_ASSERT(UNK_020EE6DC == 36);
|
||||
for (int i = 0; i < UNK_020EE6DC; i++) {
|
||||
GF_ASSERT(i == sch[i].id);
|
||||
headers[i].id = sch[i].id;
|
||||
headers[i].size = SaveArray_sizeof(i);
|
||||
headers[i].id = sch[i].id;
|
||||
headers[i].size = SaveArray_sizeof(i);
|
||||
headers[i].offset = (u32)offset;
|
||||
headers[i].crc = 0;
|
||||
headers[i].slot = (u16)sch[i].linkedId;
|
||||
headers[i].crc = 0;
|
||||
headers[i].slot = (u16)sch[i].linkedId;
|
||||
offset += headers[i].size;
|
||||
if (i == UNK_020EE6DC - 1 || sch[i].linkedId != sch[i + 1].linkedId) {
|
||||
offset += 20;
|
||||
@@ -577,12 +577,12 @@ void SaveData_InitSubstructs(struct SaveArrayHeader *headers) {
|
||||
}
|
||||
|
||||
void sub_02023160(struct SaveSlotSpec *spec, struct SaveArrayHeader *headers) {
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
int sp4 = 0;
|
||||
u32 r12 = 0;
|
||||
int j = 0;
|
||||
int j = 0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
spec[i].id = (u8)i;
|
||||
spec[i].id = (u8)i;
|
||||
spec[i].size = 0;
|
||||
while (i == headers[j].slot && j < UNK_020EE6DC) {
|
||||
spec[i].size += headers[j].size;
|
||||
@@ -590,8 +590,8 @@ void sub_02023160(struct SaveSlotSpec *spec, struct SaveArrayHeader *headers) {
|
||||
}
|
||||
spec[i].size += 20;
|
||||
spec[i].firstPage = (u8)sp4;
|
||||
spec[i].offset = r12;
|
||||
spec[i].numPages = (u8)((spec[i].size + 0xFFF) / 0x1000);
|
||||
spec[i].offset = r12;
|
||||
spec[i].numPages = (u8)((spec[i].size + 0xFFF) / 0x1000);
|
||||
sp4 += spec[i].numPages;
|
||||
r12 += spec[i].size;
|
||||
}
|
||||
@@ -611,11 +611,11 @@ void Save_InitDynamicRegion_Internal(u8 *dynamic_region, struct SaveArrayHeader
|
||||
|
||||
void CreateChunkFooter(struct SaveData *save, u8 *data, int id, u32 size) {
|
||||
struct SaveArrayFooter *footer = (struct SaveArrayFooter *)(data + size);
|
||||
footer->magic = 0x20060623;
|
||||
footer->saveno = save->unk_204A4 + 1;
|
||||
footer->size = size;
|
||||
footer->idx = (u16)id;
|
||||
footer->crc = MATH_CalcCRC16CCITT(&save->crcTable, data, size + 14);
|
||||
footer->magic = 0x20060623;
|
||||
footer->saveno = save->unk_204A4 + 1;
|
||||
footer->size = size;
|
||||
footer->idx = (u16)id;
|
||||
footer->crc = MATH_CalcCRC16CCITT(&save->crcTable, data, size + 14);
|
||||
}
|
||||
|
||||
BOOL ValidateChunk(struct SaveData *save, u8 *data, int id, u32 size) {
|
||||
@@ -681,8 +681,8 @@ u8 *ReadSaveFileFromFlash(struct SaveData *save, HeapID heapId, int idx, int *re
|
||||
spC = ValidateChunk(save, r6, idx, sch->sizeFunc());
|
||||
sp8 = sub_020232B4(r6, sch->sizeFunc());
|
||||
FlashLoadChunk((u32)((sch->linkedId + 0x40) << 12), r6, sp10);
|
||||
r7 = ValidateChunk(save, r6, idx, sch->sizeFunc());
|
||||
sp4 = sub_020232B4(r6, sch->sizeFunc());
|
||||
r7 = ValidateChunk(save, r6, idx, sch->sizeFunc());
|
||||
sp4 = sub_020232B4(r6, sch->sizeFunc());
|
||||
*ret_p = 1;
|
||||
if (spC == 1 && r7 == 0) {
|
||||
save->unk_204A0 = 0;
|
||||
@@ -708,7 +708,7 @@ u8 *ReadSaveFileFromFlash(struct SaveData *save, HeapID heapId, int idx, int *re
|
||||
FlashLoadChunk((u32)((sch->linkedId + 0x40) << 12), r6, sp10);
|
||||
return r6;
|
||||
}
|
||||
*ret_p = 2;
|
||||
*ret_p = 2;
|
||||
save->unk_204A0 = 0;
|
||||
save->unk_204A4 = 0;
|
||||
return r6;
|
||||
|
||||
@@ -19,49 +19,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen);
|
||||
extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32);
|
||||
|
||||
static const struct WindowTemplate sSaveDataReadErrorWindowTemplate = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.baseTile = 0x23,
|
||||
};
|
||||
|
||||
static const struct GraphicsModes sSaveDataReadErrorGraphicsModes = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D,
|
||||
};
|
||||
|
||||
static const struct BgTemplate sSaveDataReadErrorBgTemplate = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE,
|
||||
};
|
||||
|
||||
static const struct GraphicsBanks sSaveDataReadErrorGraphicsBanks = {
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
};
|
||||
|
||||
void ShowSaveDataReadError(HeapID heapId) {
|
||||
@@ -102,7 +102,7 @@ void ShowSaveDataReadError(HeapID heapId) {
|
||||
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
|
||||
|
||||
struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0005_bin, heapId);
|
||||
struct String *str = String_New(384, heapId);
|
||||
struct String *str = String_New(384, heapId);
|
||||
|
||||
ResetAllTextPrinters();
|
||||
|
||||
@@ -163,7 +163,7 @@ void ShowGBACartRemovedError(HeapID heapId) {
|
||||
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
|
||||
|
||||
struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0005_bin, heapId);
|
||||
struct String *str = String_New(384, heapId);
|
||||
struct String *str = String_New(384, heapId);
|
||||
|
||||
ResetAllTextPrinters();
|
||||
|
||||
|
||||
@@ -19,49 +19,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen);
|
||||
extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32);
|
||||
|
||||
static const struct WindowTemplate sSaveDataWriteErrorWindowTemplate = {
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.bgId = GF_BG_LYR_MAIN_0,
|
||||
.left = 3,
|
||||
.top = 3,
|
||||
.width = 26,
|
||||
.height = 18,
|
||||
.palette = 1,
|
||||
.baseTile = 0x23,
|
||||
};
|
||||
|
||||
static const struct GraphicsModes sSaveDataWriteErrorGraphicsModes = {
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
.dispMode = GX_DISPMODE_GRAPHICS,
|
||||
.bgMode = GX_BGMODE_0,
|
||||
.subMode = GX_BGMODE_0,
|
||||
._2d3dMode = GX_BG0_AS_2D,
|
||||
};
|
||||
|
||||
static const struct BgTemplate sSaveDataWriteErrorBgTemplate = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.bufferSize = 0x800,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.baseTile = 0,
|
||||
.size = GF_BG_SCR_SIZE_256x256,
|
||||
.colorMode = GX_BG_COLORMODE_16,
|
||||
.screenBase = GX_BG_SCRBASE_0x0000,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE,
|
||||
.charBase = GX_BG_CHARBASE_0x18000,
|
||||
.bgExtPltt = GX_BG_EXTPLTT_01,
|
||||
.priority = 1,
|
||||
.areaOver = GX_BG_AREAOVER_XLU,
|
||||
.dummy = 0,
|
||||
.mosaic = FALSE,
|
||||
};
|
||||
|
||||
static const struct GraphicsBanks sSaveDataWriteErrorGraphicsBanks = {
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.bg = GX_VRAM_BG_256_AB,
|
||||
.bgextpltt = GX_VRAM_BGEXTPLTT_NONE,
|
||||
.subbg = GX_VRAM_SUB_BG_NONE,
|
||||
.subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE,
|
||||
.obj = GX_VRAM_OBJ_NONE,
|
||||
.objextpltt = GX_VRAM_OBJEXTPLTT_NONE,
|
||||
.subobj = GX_VRAM_SUB_OBJ_NONE,
|
||||
.subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
.tex = GX_VRAM_TEX_NONE,
|
||||
.texpltt = GX_VRAM_TEXPLTT_NONE,
|
||||
};
|
||||
|
||||
void ShowSaveDataWriteError(HeapID heapId, u32 err_no) {
|
||||
@@ -110,7 +110,7 @@ void ShowSaveDataWriteError(HeapID heapId, u32 err_no) {
|
||||
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
|
||||
|
||||
struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0006_bin, heapId);
|
||||
struct String *str = String_New(384, heapId);
|
||||
struct String *str = String_New(384, heapId);
|
||||
|
||||
ResetAllTextPrinters();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ void Save_SysInfo_InitFromSystem(struct SaveSysInfo *unk) {
|
||||
OS_GetMacAddress(unk->macAddr);
|
||||
OS_GetOwnerInfo(&info);
|
||||
unk->birthMonth = info.birthday.month;
|
||||
unk->birthDay = info.birthday.day;
|
||||
unk->birthDay = info.birthday.day;
|
||||
}
|
||||
|
||||
BOOL Save_SysInfo_MacAddressIsMine(struct SaveSysInfo *unk) {
|
||||
@@ -80,10 +80,10 @@ void sub_02023834(struct SaveSysInfo *unk, u32 val) {
|
||||
void Save_SysInfo_RTC_Init(SysInfo_RTC *sub) {
|
||||
sub->field_00 = 1;
|
||||
GF_RTC_CopyDateTime(&sub->date, &sub->time);
|
||||
sub->daysSinceNitroEpoch = RTC_ConvertDateToDay(&sub->date);
|
||||
sub->daysSinceNitroEpoch = RTC_ConvertDateToDay(&sub->date);
|
||||
sub->secondsSinceNitroEpoch = RTC_ConvertDateTimeToSecond(&sub->date, &sub->time);
|
||||
sub->field_2C = 0;
|
||||
sub->field_34 = 0;
|
||||
sub->field_2C = 0;
|
||||
sub->field_34 = 0;
|
||||
}
|
||||
|
||||
BOOL sub_02023874(SysInfo_RTC *sub) {
|
||||
|
||||
1286
arm9/src/scrcmd.c
1286
arm9/src/scrcmd.c
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@ extern void sub_0208089C(struct Pokemon *pokemon, PlayerProfile *player, u32 a2,
|
||||
BOOL ScrCmd_Unk0253(struct ScriptContext *ctx) // 0253
|
||||
{
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
|
||||
if (unk == 0) {
|
||||
sub_0205F224(state);
|
||||
@@ -41,9 +41,9 @@ BOOL ScrCmd_Unk0253(struct ScriptContext *ctx) // 0253
|
||||
|
||||
BOOL ScrCmd_Unk0254(struct ScriptContext *ctx) // 0254
|
||||
{
|
||||
void *unk = sub_02022528(ctx->fieldSystem->saveData);
|
||||
void *unk = sub_02022528(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *pokemon = AllocMonZeroed(HEAP_ID_32);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
u16 eggs = sub_0202C000(unk);
|
||||
if (eggs == 6) {
|
||||
@@ -59,10 +59,10 @@ BOOL ScrCmd_Unk0254(struct ScriptContext *ctx) // 0254
|
||||
|
||||
BOOL ScrCmd_Unk0255(struct ScriptContext *ctx) // 0255
|
||||
{
|
||||
void *unk = sub_02022528(ctx->fieldSystem->saveData);
|
||||
struct PCStorage *pc = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData);
|
||||
void *unk = sub_02022528(ctx->fieldSystem->saveData);
|
||||
struct PCStorage *pc = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *pokemon = AllocMonZeroed(HEAP_ID_32);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData);
|
||||
struct Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); // unused
|
||||
|
||||
for (s32 i = 0; i < PARTY_SIZE; i++) {
|
||||
@@ -83,7 +83,7 @@ BOOL ScrCmd_Unk0255(struct ScriptContext *ctx) // 0255
|
||||
|
||||
BOOL ScrCmd_Unk0256(struct ScriptContext *ctx) // 0256
|
||||
{
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx));
|
||||
|
||||
switch (unk) {
|
||||
|
||||
@@ -106,7 +106,7 @@ BOOL ScrCmd_ClearAmitySquareSteps(struct ScriptContext *ctx) // 0215
|
||||
|
||||
BOOL ScrCmd_CheckAmitySquareSteps(struct ScriptContext *ctx) // 0216
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = sub_0205F55C(state);
|
||||
@@ -116,8 +116,8 @@ BOOL ScrCmd_CheckAmitySquareSteps(struct ScriptContext *ctx) // 0216
|
||||
BOOL ScrCmd_GetAmitySquareAccessory(struct ScriptContext *ctx) // 0217
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 rand = (u16)(LCRandom() % 100);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 rand = (u16)(LCRandom() % 100);
|
||||
|
||||
u32 j;
|
||||
if (rand < 15) {
|
||||
|
||||
@@ -17,7 +17,7 @@ extern void sub_0204B9A0(struct FieldSystem *);
|
||||
extern void sub_0204B4FC(struct FieldSystem *, LocalMapObject *berryTree);
|
||||
|
||||
BOOL ScrCmd_GetBerryTreeGrowth(struct ScriptContext *ctx) { // 017D
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
|
||||
*ret_ptr = sub_0204B5FC(ctx->fieldSystem, *berryTree);
|
||||
@@ -27,7 +27,7 @@ BOOL ScrCmd_GetBerryTreeGrowth(struct ScriptContext *ctx) { // 017D
|
||||
|
||||
BOOL ScrCmd_GetBerryTreeType(struct ScriptContext *ctx) { // 017E
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = sub_0204B63C(ctx->fieldSystem, *berryTree);
|
||||
|
||||
@@ -36,7 +36,7 @@ BOOL ScrCmd_GetBerryTreeType(struct ScriptContext *ctx) { // 017E
|
||||
|
||||
BOOL ScrCmd_GetBerryTreeMulch(struct ScriptContext *ctx) { // 017F
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = sub_0204B660(ctx->fieldSystem, *berryTree);
|
||||
|
||||
@@ -45,7 +45,7 @@ BOOL ScrCmd_GetBerryTreeMulch(struct ScriptContext *ctx) { // 017F
|
||||
|
||||
BOOL ScrCmd_GetBerryTreeWater(struct ScriptContext *ctx) { // 0180
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = sub_0204B684(ctx->fieldSystem, *berryTree);
|
||||
|
||||
@@ -54,7 +54,7 @@ BOOL ScrCmd_GetBerryTreeWater(struct ScriptContext *ctx) { // 0180
|
||||
|
||||
BOOL ScrCmd_GetBerryTreeAmount(struct ScriptContext *ctx) { // 0181
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = sub_0204B6A4(ctx->fieldSystem, *berryTree);
|
||||
|
||||
@@ -63,7 +63,7 @@ BOOL ScrCmd_GetBerryTreeAmount(struct ScriptContext *ctx) { // 0181
|
||||
|
||||
BOOL ScrCmd_SetBerryTreeMulch(struct ScriptContext *ctx) { // 0182
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
u16 mulchVal = ScriptGetVar(ctx);
|
||||
u16 mulchVal = ScriptGetVar(ctx);
|
||||
|
||||
sub_0204B57C(ctx->fieldSystem, *berryTree, mulchVal);
|
||||
|
||||
@@ -72,9 +72,9 @@ BOOL ScrCmd_SetBerryTreeMulch(struct ScriptContext *ctx) { // 0182
|
||||
|
||||
BOOL ScrCmd_SetBerryTreeType(struct ScriptContext *ctx) // 0183 - todo: PlantBerryTree?
|
||||
{
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
struct GameStats *gameStats = Save_GameStats_Get(ctx->fieldSystem->saveData);
|
||||
u16 treeType = ScriptGetVar(ctx);
|
||||
u16 treeType = ScriptGetVar(ctx);
|
||||
|
||||
sub_0204B5A8(ctx->fieldSystem, *berryTree, treeType);
|
||||
GameStats_Inc(gameStats, 3);
|
||||
@@ -104,7 +104,7 @@ BOOL ScrCmd_Unk0184(struct ScriptContext *ctx) // 0184 - todo: SetBerryTreeWater
|
||||
BOOL ScrCmd_TakeBerryTreeBerries(struct ScriptContext *ctx) // 0185
|
||||
{
|
||||
struct GameStats *gameStats = Save_GameStats_Get(ctx->fieldSystem->saveData);
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED);
|
||||
|
||||
sub_0204B4FC(ctx->fieldSystem, *berryTree);
|
||||
GameStats_AddSpecial(gameStats, 0);
|
||||
|
||||
@@ -12,12 +12,12 @@ extern void ov05_021E29C8(struct FieldSystem *arg, Window *coinBox);
|
||||
BOOL ScrCmd_ShowCoinBox(struct ScriptContext *ctx) // 0075
|
||||
{
|
||||
struct FieldSystem *sav_ptr = ctx->fieldSystem;
|
||||
u16 xVal = ScriptGetVar(ctx);
|
||||
u16 yVal = ScriptGetVar(ctx);
|
||||
Window **coinBoxPtr = (Window **)FieldSysGetAttrAddr(sav_ptr, SCRIPTENV_COIN_BOX);
|
||||
u16 xVal = ScriptGetVar(ctx);
|
||||
u16 yVal = ScriptGetVar(ctx);
|
||||
Window **coinBoxPtr = (Window **)FieldSysGetAttrAddr(sav_ptr, SCRIPTENV_COIN_BOX);
|
||||
|
||||
Window *coinBox = ov05_021E2950(ctx->fieldSystem, (u8)xVal, (u8)yVal);
|
||||
*coinBoxPtr = coinBox;
|
||||
*coinBoxPtr = coinBox;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ BOOL ScrCmd_UpdateCoinBox(struct ScriptContext *ctx) // 0077
|
||||
BOOL ScrCmd_GetCoins(struct ScriptContext *ctx) // 0078 - todo: CheckCoins instead?
|
||||
{
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = CheckCoins(coins_ptr);
|
||||
|
||||
@@ -51,7 +51,7 @@ BOOL ScrCmd_GetCoins(struct ScriptContext *ctx) // 0078 - todo: CheckCoins inste
|
||||
BOOL ScrCmd_GiveCoins(struct ScriptContext *ctx) // 0079
|
||||
{
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData);
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
|
||||
GiveCoins(coins_ptr, amount);
|
||||
|
||||
@@ -61,7 +61,7 @@ BOOL ScrCmd_GiveCoins(struct ScriptContext *ctx) // 0079
|
||||
BOOL ScrCmd_TakeCoinsImmediate(struct ScriptContext *ctx) // 0080 - todo: TakeCoins instead?
|
||||
{
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData);
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
|
||||
TakeCoins(coins_ptr, amount);
|
||||
|
||||
@@ -71,7 +71,7 @@ BOOL ScrCmd_TakeCoinsImmediate(struct ScriptContext *ctx) // 0080 - todo: TakeCo
|
||||
BOOL ScrCmd_TakeCoinsAddress(struct ScriptContext *ctx) // 02A8 - todo: TakeCoinsVar instead?
|
||||
{
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData);
|
||||
u16 *amount = ScriptGetVarPointer(ctx);
|
||||
u16 *amount = ScriptGetVarPointer(ctx);
|
||||
|
||||
TakeCoins(coins_ptr, *amount);
|
||||
|
||||
@@ -81,14 +81,14 @@ BOOL ScrCmd_TakeCoinsAddress(struct ScriptContext *ctx) // 02A8 - todo: TakeCoin
|
||||
BOOL ScrCmd_HasEnoughCoinsImmediate(struct ScriptContext *ctx) // 0274 - todo: CanAffordCoins?
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
struct SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
struct SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
// Created, but discarded.
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
u32 amount = ScriptReadWord(ctx);
|
||||
u16 coins = CheckCoins(coins_ptr);
|
||||
u16 coins = CheckCoins(coins_ptr);
|
||||
|
||||
if (coins < amount) {
|
||||
*ret_ptr = 0;
|
||||
@@ -102,14 +102,14 @@ BOOL ScrCmd_HasEnoughCoinsImmediate(struct ScriptContext *ctx) // 0274 - todo: C
|
||||
BOOL ScrCmd_HasEnoughCoinsAddress(struct ScriptContext *ctx) // 02A9 - todo: CanAffordCoinsVar?
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
struct SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
struct SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
// Created, but discarded
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
u16 amount = *ScriptGetVarPointer(ctx);
|
||||
u16 coins = CheckCoins(coins_ptr);
|
||||
u16 coins = CheckCoins(coins_ptr);
|
||||
|
||||
if (coins < amount) {
|
||||
*ret_ptr = 0;
|
||||
@@ -123,8 +123,8 @@ BOOL ScrCmd_HasEnoughCoinsAddress(struct ScriptContext *ctx) // 02A9 - todo: Can
|
||||
BOOL ScrCmd_CanGiveCoins(struct ScriptContext *ctx) // 0276
|
||||
{
|
||||
u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
|
||||
*ret_ptr = (u16)CanGiveCoins(coins_ptr, amount);
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ extern u32 ov05_021ED644(struct Daycare *daycare);
|
||||
|
||||
BOOL ScrCmd_GetDaycarePokemonNames(struct ScriptContext *ctx) // 016D
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
struct Daycare *daycare = Save_Daycare_Get(save);
|
||||
struct Daycare *daycare = Save_Daycare_Get(save);
|
||||
|
||||
ov05_021ED4E0(daycare, *messageFormat);
|
||||
|
||||
@@ -33,9 +33,9 @@ BOOL ScrCmd_GetDaycarePokemonNames(struct ScriptContext *ctx) // 016D
|
||||
BOOL ScrCmd_GetDaycareStatus(struct ScriptContext *ctx) // 016E
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
|
||||
*ret_ptr = ov05_021ED5EC(daycare);
|
||||
|
||||
@@ -53,10 +53,10 @@ BOOL ScrCmd_DeleteDaycareEgg(struct ScriptContext *ctx) // 01A8
|
||||
BOOL ScrCmd_GiveDaycareEgg(struct ScriptContext *ctx) // 01A9
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
struct Daycare *daycare = SaveArray_Get(fieldSystem->saveData, 8);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
struct Daycare *daycare = SaveArray_Get(fieldSystem->saveData, 8);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
|
||||
ov05_Daycare_GiveEggToPlayer(daycare, party, player);
|
||||
|
||||
@@ -66,12 +66,12 @@ BOOL ScrCmd_GiveDaycareEgg(struct ScriptContext *ctx) // 01A9
|
||||
BOOL ScrCmd_Unk01A4(struct ScriptContext *ctx) // 01A4
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = ov05_021EC71C(party, *messageFormat, daycare, (u8)idx);
|
||||
|
||||
@@ -81,11 +81,11 @@ BOOL ScrCmd_Unk01A4(struct ScriptContext *ctx) // 01A4
|
||||
BOOL ScrCmd_Unk01AA(struct ScriptContext *ctx) // 01AA
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
|
||||
*ret_ptr = ov05_021EC854(daycare, (u8)idx, *messageFormat);
|
||||
|
||||
@@ -94,11 +94,11 @@ BOOL ScrCmd_Unk01AA(struct ScriptContext *ctx) // 01AA
|
||||
|
||||
BOOL ScrCmd_GetDaycareLevel(struct ScriptContext *ctx) // 01AE
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
|
||||
*ret_ptr = ov05_021EC864(daycare, idx, *messageFormat);
|
||||
|
||||
@@ -108,11 +108,11 @@ BOOL ScrCmd_GetDaycareLevel(struct ScriptContext *ctx) // 01AE
|
||||
BOOL ScrCmd_Unk01AF(struct ScriptContext *ctx) // 01AF
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u16 unused = ScriptReadHalfword(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u16 unused = ScriptReadHalfword(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = ov05_021ED5C4(party, idx, *messageFormat);
|
||||
|
||||
@@ -122,10 +122,10 @@ BOOL ScrCmd_Unk01AF(struct ScriptContext *ctx) // 01AF
|
||||
BOOL ScrCmd_Unk01B0(struct ScriptContext *ctx) // 01B0
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
struct SaveData *save = fieldSystem->saveData;
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
|
||||
ov05_021EC57C(party, (u8)idx, daycare, save);
|
||||
|
||||
@@ -134,13 +134,13 @@ BOOL ScrCmd_Unk01B0(struct ScriptContext *ctx) // 01B0
|
||||
|
||||
BOOL ScrCmd_Unk01BC(struct ScriptContext *ctx) // 01BC
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u16 idx1 = ScriptGetVar(ctx);
|
||||
u16 idx2 = ScriptGetVar(ctx);
|
||||
u16 idx3 = ScriptGetVar(ctx);
|
||||
u16 idx4 = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = Save_Daycare_Get(save);
|
||||
u16 idx1 = ScriptGetVar(ctx);
|
||||
u16 idx2 = ScriptGetVar(ctx);
|
||||
u16 idx3 = ScriptGetVar(ctx);
|
||||
u16 idx4 = ScriptGetVar(ctx);
|
||||
struct Daycare *daycare = Save_Daycare_Get(save);
|
||||
|
||||
ov05_021ED52C(daycare, (u8)idx1, (u8)idx2, (u8)idx3, (u8)idx4, *messageFormat);
|
||||
|
||||
@@ -149,8 +149,8 @@ BOOL ScrCmd_Unk01BC(struct ScriptContext *ctx) // 01BC
|
||||
|
||||
BOOL ScrCmd_Unk01BE(struct ScriptContext *ctx) // 01BE
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
|
||||
*ret_ptr = (u16)ov05_021ED644(daycare);
|
||||
@@ -160,8 +160,8 @@ BOOL ScrCmd_Unk01BE(struct ScriptContext *ctx) // 01BE
|
||||
|
||||
BOOL ScrCmd_Unk01BF(struct ScriptContext *ctx) // 01BF - todo: SaveEggPID?
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Daycare *daycare = SaveArray_Get(save, 8);
|
||||
|
||||
*ret_ptr = (u16)Save_Daycare_GetEggPID(daycare);
|
||||
|
||||
@@ -40,7 +40,7 @@ const u8 UNK_020F457F[8] = {
|
||||
BOOL ScrCmd_HasSinnohDex(struct ScriptContext *ctx) // 0157
|
||||
{
|
||||
struct Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = (u16)Pokedex_GetSinnohDexFlag(pokedex);
|
||||
|
||||
@@ -58,9 +58,9 @@ BOOL ScrCmd_GiveSinnohDex(struct ScriptContext *ctx) // 0158
|
||||
|
||||
BOOL ScrCmd_HasRunningShoes(struct ScriptContext *ctx) // 0159
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk_sav_ptr = Save_LocalFieldData_Get(ctx->fieldSystem->saveData);
|
||||
void *unk = sub_02034E20(unk_sav_ptr);
|
||||
void *unk = sub_02034E20(unk_sav_ptr);
|
||||
|
||||
*ret_ptr = (u16)sub_02055474(unk);
|
||||
|
||||
@@ -70,7 +70,7 @@ BOOL ScrCmd_HasRunningShoes(struct ScriptContext *ctx) // 0159
|
||||
BOOL ScrCmd_GiveRunningShoes(struct ScriptContext *ctx) // 015A
|
||||
{
|
||||
void *unk_sav_ptr = Save_LocalFieldData_Get(ctx->fieldSystem->saveData);
|
||||
void *unk = sub_02034E20(unk_sav_ptr);
|
||||
void *unk = sub_02034E20(unk_sav_ptr);
|
||||
|
||||
sub_02055488(unk, 1);
|
||||
|
||||
@@ -102,7 +102,7 @@ BOOL ScrCmd_GiveBadge(struct ScriptContext *ctx) // 015C
|
||||
|
||||
BOOL ScrCmd_HasBag(struct ScriptContext *ctx) // 015E
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = (u16)sub_0205ECE0(state);
|
||||
@@ -118,7 +118,7 @@ BOOL ScrCmd_GetTotalEarnedBadges(struct ScriptContext *ctx) // 015D - todo: Coun
|
||||
u16 badges;
|
||||
for (i = 0, badges = 0; i < 8; i++) {
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData);
|
||||
BOOL has_badge = PlayerProfile_TestBadgeFlag(player, UNK_020F457F[i]);
|
||||
BOOL has_badge = PlayerProfile_TestBadgeFlag(player, UNK_020F457F[i]);
|
||||
if (has_badge == TRUE) {
|
||||
badges++;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ BOOL ScrCmd_GiveBag(struct ScriptContext *ctx) // 015F
|
||||
|
||||
BOOL ScrCmd_Unk0160(struct ScriptContext *ctx) // 0160 - todo: HasPartner? CheckPartner?
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = (u16)Save_VarsFlags_CheckHaveFollower(state);
|
||||
@@ -167,7 +167,7 @@ BOOL ScrCmd_Unk0162(struct ScriptContext *ctx) // 0162 - todo: RemovePartner? Cl
|
||||
|
||||
BOOL ScrCmd_Unk0163(struct ScriptContext *ctx) // 0163 - todo: GetSteps? CheckSteps? GetStepFlag? CheckStepFlag?
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = (u16)sub_0205ED6C(state);
|
||||
@@ -195,7 +195,7 @@ BOOL ScrCmd_Unk0165(struct ScriptContext *ctx) // 0165 - todo: ClearStepFlag?
|
||||
|
||||
BOOL ScrCmd_CheckGameCompleted(struct ScriptContext *ctx) // 0166
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = (u16)sub_0205ED0C(state);
|
||||
@@ -215,7 +215,7 @@ BOOL ScrCmd_SetGameCompleted(struct ScriptContext *ctx) // 0167
|
||||
BOOL ScrCmd_GetSetStrength(struct ScriptContext *ctx) // 01CF - todo: Strength?
|
||||
{
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u8 option = ScriptReadByte(ctx);
|
||||
u8 option = ScriptReadByte(ctx);
|
||||
u16 *ret_ptr;
|
||||
|
||||
switch (option) {
|
||||
@@ -226,7 +226,7 @@ BOOL ScrCmd_GetSetStrength(struct ScriptContext *ctx) // 01CF - todo: Strength?
|
||||
sub_0205F264(state, 0);
|
||||
break;
|
||||
case 2: // get whether strength is on or off
|
||||
ret_ptr = ScriptGetVarPointer(ctx);
|
||||
ret_ptr = ScriptGetVarPointer(ctx);
|
||||
*ret_ptr = (u16)sub_0205F264(state, 2);
|
||||
break;
|
||||
default:
|
||||
@@ -240,7 +240,7 @@ BOOL ScrCmd_GetSetStrength(struct ScriptContext *ctx) // 01CF - todo: Strength?
|
||||
BOOL ScrCmd_GetSetFlash(struct ScriptContext *ctx) // 01D0 - todo Flash?
|
||||
{
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u8 option = ScriptReadByte(ctx);
|
||||
u8 option = ScriptReadByte(ctx);
|
||||
u16 *ret_ptr;
|
||||
|
||||
switch (option) {
|
||||
@@ -251,7 +251,7 @@ BOOL ScrCmd_GetSetFlash(struct ScriptContext *ctx) // 01D0 - todo Flash?
|
||||
sub_0205F284(state);
|
||||
break;
|
||||
case 2: // get whether flash is on or off
|
||||
ret_ptr = ScriptGetVarPointer(ctx);
|
||||
ret_ptr = ScriptGetVarPointer(ctx);
|
||||
*ret_ptr = (u16)sub_0205F294(state);
|
||||
break;
|
||||
default:
|
||||
@@ -265,7 +265,7 @@ BOOL ScrCmd_GetSetFlash(struct ScriptContext *ctx) // 01D0 - todo Flash?
|
||||
BOOL ScrCmd_GetSetDefog(struct ScriptContext *ctx) // 01D1 - todo: Defog
|
||||
{
|
||||
struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u8 option = ScriptReadByte(ctx);
|
||||
u8 option = ScriptReadByte(ctx);
|
||||
u16 *ret_ptr;
|
||||
|
||||
switch (option) {
|
||||
@@ -276,7 +276,7 @@ BOOL ScrCmd_GetSetDefog(struct ScriptContext *ctx) // 01D1 - todo: Defog
|
||||
sub_0205F2B4(state);
|
||||
break;
|
||||
case 2: // get whether defog is on or off
|
||||
ret_ptr = ScriptGetVarPointer(ctx);
|
||||
ret_ptr = ScriptGetVarPointer(ctx);
|
||||
*ret_ptr = (u16)sub_0205F2C4(state);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -49,14 +49,14 @@ BOOL ScrCmd_GetFossilPokemon(struct ScriptContext *ctx) // 01F4
|
||||
BOOL ScrCmd_GetFossilMinimumAmount(struct ScriptContext *ctx) // 01F5
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr1 = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr2 = ScriptGetVarPointer(ctx);
|
||||
u16 needed_amount = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr1 = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr2 = ScriptGetVarPointer(ctx);
|
||||
u16 needed_amount = ScriptGetVar(ctx);
|
||||
|
||||
*ret_ptr1 = 0;
|
||||
*ret_ptr2 = 0;
|
||||
|
||||
u8 i = 0;
|
||||
u8 i = 0;
|
||||
u16 total = 0;
|
||||
for (; i < 7; i++) {
|
||||
total += Bag_GetQuantity(Save_Bag_Get(fieldSystem->saveData), gFossilPokemonMap[i][0], HEAP_ID_4);
|
||||
|
||||
@@ -9,10 +9,10 @@ BOOL ScrCmd_GiveItem(struct ScriptContext *ctx) // 007B
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 *item_was_added = ScriptGetVarPointer(ctx);
|
||||
struct Bag *bag = Save_Bag_Get(fieldSystem->saveData);
|
||||
struct Bag *bag = Save_Bag_Get(fieldSystem->saveData);
|
||||
|
||||
*item_was_added = (u16)Bag_AddItem(bag, item_id, quantity, HEAP_ID_4);
|
||||
|
||||
@@ -23,10 +23,10 @@ BOOL ScrCmd_TakeItem(struct ScriptContext *ctx) // 007C
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 *item_was_taken = ScriptGetVarPointer(ctx);
|
||||
struct Bag *bag = Save_Bag_Get(fieldSystem->saveData);
|
||||
struct Bag *bag = Save_Bag_Get(fieldSystem->saveData);
|
||||
|
||||
*item_was_taken = (u16)Bag_TakeItem(bag, item_id, quantity, HEAP_ID_4);
|
||||
|
||||
@@ -37,9 +37,9 @@ BOOL ScrCmd_HasSpaceForItem(struct ScriptContext *ctx) // 007D
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 *has_space = ScriptGetVarPointer(ctx);
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 *has_space = ScriptGetVarPointer(ctx);
|
||||
struct Bag *bag = Save_Bag_Get(fieldSystem->saveData);
|
||||
|
||||
*has_space = (u16)Bag_HasSpaceForItem(bag, item_id, quantity, HEAP_ID_4);
|
||||
@@ -51,9 +51,9 @@ BOOL ScrCmd_HasItem(struct ScriptContext *ctx) // 007E
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 *has_item = ScriptGetVarPointer(ctx);
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 quantity = ScriptGetVar(ctx);
|
||||
u16 *has_item = ScriptGetVarPointer(ctx);
|
||||
struct Bag *bag = Save_Bag_Get(fieldSystem->saveData);
|
||||
|
||||
*has_item = (u16)Bag_HasItem(bag, item_id, quantity, HEAP_ID_FIELD);
|
||||
@@ -65,7 +65,7 @@ BOOL ScrCmd_ItemIdIsTMOrHM(struct ScriptContext *ctx) // 007F
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 item_id = ScriptGetVar(ctx);
|
||||
u16 *is_tm_or_hm = ScriptGetVarPointer(ctx);
|
||||
|
||||
*is_tm_or_hm = (u16)sub_02054CB0(item_id);
|
||||
|
||||
@@ -351,7 +351,7 @@ BOOL ScrCmd_NormalMart(ScriptContext *ctx) // 0147 - todo: Pokemart?
|
||||
u16 whichMart = ScriptGetVar(ctx);
|
||||
s32 param;
|
||||
u16 martItems[64];
|
||||
u8 martIdx = 0;
|
||||
u8 martIdx = 0;
|
||||
u8 badgeCount = 0;
|
||||
u8 i;
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ BOOL ScrCmd_HasEnoughMoneyImmediate(struct ScriptContext *ctx) // 0071 - todo: C
|
||||
{
|
||||
struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
u32 amount = ScriptReadWord(ctx);
|
||||
u32 money = PlayerProfile_GetMoney(player);
|
||||
u32 money = PlayerProfile_GetMoney(player);
|
||||
|
||||
if (money < amount) {
|
||||
*ret_ptr = 0;
|
||||
@@ -64,10 +64,10 @@ BOOL ScrCmd_HasEnoughMoneyAddress(struct ScriptContext *ctx) // 01AB - todo: Can
|
||||
{
|
||||
struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
u16 amount = ScriptGetVar(ctx);
|
||||
u32 money = PlayerProfile_GetMoney(player);
|
||||
u32 money = PlayerProfile_GetMoney(player);
|
||||
|
||||
if (money < amount) {
|
||||
*ret_ptr = 0;
|
||||
@@ -81,9 +81,9 @@ BOOL ScrCmd_HasEnoughMoneyAddress(struct ScriptContext *ctx) // 01AB - todo: Can
|
||||
BOOL ScrCmd_ShowMoneyBox(struct ScriptContext *ctx) // 0072
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 xVal = ScriptGetVar(ctx);
|
||||
u16 yVal = ScriptGetVar(ctx);
|
||||
Window **moneyBox = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
u16 xVal = ScriptGetVar(ctx);
|
||||
u16 yVal = ScriptGetVar(ctx);
|
||||
Window **moneyBox = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
|
||||
*moneyBox = ov05_021E27E8(ctx->fieldSystem, (u8)xVal, (u8)yVal);
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@ extern void sub_02038864(struct FieldSystem *, MoveRelearner *moveRelearner);
|
||||
extern BOOL sub_0203BC04(struct ScriptContext *ctx);
|
||||
|
||||
BOOL ScrCmd_Unk01C6(struct ScriptContext *ctx) { // 01C6 - todo: MoveInfo?
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
struct UnkStruct_02037CF0 **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA);
|
||||
*runningAppData = sub_02037CF0(HEAP_ID_32, ctx->fieldSystem, (u8)unk);
|
||||
*runningAppData = sub_02037CF0(HEAP_ID_32, ctx->fieldSystem, (u8)unk);
|
||||
|
||||
SetupNativeScript(ctx, sub_0203BC04);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_Unk01C7(struct ScriptContext *ctx) { // 01C7 - todo: StoreMove?
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct UnkStruct_02037CF0 **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA);
|
||||
GF_ASSERT(*runningAppData != NULL);
|
||||
|
||||
@@ -44,11 +44,11 @@ BOOL ScrCmd_Unk021E(struct ScriptContext *ctx) // 021E
|
||||
}
|
||||
|
||||
BOOL ScrCmd_Unk021F(struct ScriptContext *ctx) { // 021F
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32);
|
||||
u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32);
|
||||
|
||||
*ret_ptr = (u16)MoveRelearner_IsValidMove(eligibleMoves);
|
||||
FreeToHeap(eligibleMoves);
|
||||
@@ -58,17 +58,17 @@ BOOL ScrCmd_Unk021F(struct ScriptContext *ctx) { // 021F
|
||||
|
||||
void sub_02045E74(struct ScriptContext *ctx, u8 a1, struct Pokemon *pokemon, u16 *eligibleMoves) {
|
||||
MoveRelearner **moveRelearnerPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA);
|
||||
MoveRelearner *moveRelearner = MoveRelearner_New(HEAP_ID_32);
|
||||
*moveRelearnerPtr = moveRelearner;
|
||||
MoveRelearner *moveRelearner = MoveRelearner_New(HEAP_ID_32);
|
||||
*moveRelearnerPtr = moveRelearner;
|
||||
|
||||
moveRelearner->mon = pokemon;
|
||||
|
||||
struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem);
|
||||
struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem);
|
||||
moveRelearner->profile = Save_PlayerData_GetProfileAddr(save);
|
||||
|
||||
moveRelearner->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData);
|
||||
moveRelearner->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData);
|
||||
moveRelearner->eligibleMoves = eligibleMoves;
|
||||
moveRelearner->unk15 = a1;
|
||||
moveRelearner->unk15 = a1;
|
||||
sub_02038864(ctx->fieldSystem, moveRelearner);
|
||||
|
||||
SetupNativeScript(ctx, sub_0203BC04);
|
||||
@@ -83,10 +83,10 @@ BOOL ScrCmd_Unk0220(struct ScriptContext *ctx) // 0220
|
||||
|
||||
BOOL ScrCmd_Unk0221(struct ScriptContext *ctx) // 0221 - todo: RememberMove?
|
||||
{
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32);
|
||||
u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32);
|
||||
|
||||
sub_02045E74(ctx, 1, pokemon, eligibleMoves);
|
||||
return TRUE;
|
||||
@@ -94,14 +94,14 @@ BOOL ScrCmd_Unk0221(struct ScriptContext *ctx) // 0221 - todo: RememberMove?
|
||||
|
||||
BOOL ScrCmd_Unk0224(struct ScriptContext *ctx) // 0224 - todo: TeachMove?
|
||||
{
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
u16 move = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
u16 move = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
|
||||
u16 *eligibleMoves = AllocFromHeap(HEAP_ID_32, 2 * sizeof(u16));
|
||||
eligibleMoves[0] = move;
|
||||
eligibleMoves[1] = 0xFFFF;
|
||||
eligibleMoves[0] = move;
|
||||
eligibleMoves[1] = 0xFFFF;
|
||||
|
||||
sub_02045E74(ctx, 0, pokemon, eligibleMoves);
|
||||
return TRUE;
|
||||
@@ -115,9 +115,9 @@ BOOL ScrCmd_Unk0222(struct ScriptContext *ctx) // 0222 - todo: DummyMoveCmd?
|
||||
|
||||
BOOL ScrCmd_Unk0223(struct ScriptContext *ctx) // 0223 - todo: RememberMoveResponse? - destroys the MoveRelearner - find better name
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
MoveRelearner **moveRelearnerPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA);
|
||||
MoveRelearner *moveRelearner = *moveRelearnerPtr;
|
||||
MoveRelearner *moveRelearner = *moveRelearnerPtr;
|
||||
|
||||
GF_ASSERT(moveRelearner != NULL);
|
||||
|
||||
@@ -133,9 +133,9 @@ BOOL ScrCmd_Unk0223(struct ScriptContext *ctx) // 0223 - todo: RememberMoveRespo
|
||||
|
||||
BOOL ScrCmd_Unk0225(struct ScriptContext *ctx) // 0225 - todo: TeachMoveResponse? - destroys the MoveRelearner - find better name
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
MoveRelearner **moveRelearnerPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA);
|
||||
MoveRelearner *moveRelearner = *moveRelearnerPtr;
|
||||
MoveRelearner *moveRelearner = *moveRelearnerPtr;
|
||||
|
||||
GF_ASSERT(moveRelearner != NULL);
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ static String *sub_02040AE4(u32 msg_no, HeapID heapId);
|
||||
|
||||
BOOL ScrCmd_GetPlayerName(ScriptContext *ctx) // 00CD - todo: BufferPlayerName? TextPlayerName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
|
||||
BufferPlayersName(*messageFormat, idx, player);
|
||||
|
||||
@@ -41,9 +41,9 @@ BOOL ScrCmd_GetPlayerName(ScriptContext *ctx) // 00CD - todo: BufferPlayerName?
|
||||
|
||||
BOOL ScrCmd_GetRivalName(ScriptContext *ctx) // 00CE - todo: BufferRivalName? TextRivalName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
|
||||
BufferRivalsName(*messageFormat, idx, fieldSystem->saveData);
|
||||
|
||||
@@ -52,9 +52,9 @@ BOOL ScrCmd_GetRivalName(ScriptContext *ctx) // 00CE - todo: BufferRivalName? Te
|
||||
|
||||
BOOL ScrCmd_GetFriendName(ScriptContext *ctx) // 00CF - todo: BufferFriendName? TextFriendName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
|
||||
BufferFriendsName(*messageFormat, idx, fieldSystem->saveData);
|
||||
|
||||
@@ -63,12 +63,12 @@ BOOL ScrCmd_GetFriendName(ScriptContext *ctx) // 00CF - todo: BufferFriendName?
|
||||
|
||||
BOOL ScrCmd_GetPokemonName(ScriptContext *ctx) // 00D0 - todo: BufferPartyPokemonName? TextPartyPokemonName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Pokemon *mon = Party_GetMonByIndex(party, mon_idx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Pokemon *mon = Party_GetMonByIndex(party, mon_idx);
|
||||
|
||||
BufferBoxMonSpeciesName(*messageFormat, idx, &mon->box);
|
||||
|
||||
@@ -77,10 +77,10 @@ BOOL ScrCmd_GetPokemonName(ScriptContext *ctx) // 00D0 - todo: BufferPartyPokemo
|
||||
|
||||
BOOL ScrCmd_GetItemName(ScriptContext *ctx) // 00D1 - todo: BufferItemName? TextItemName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
|
||||
BufferItemName(*messageFormat, idx, item);
|
||||
|
||||
@@ -89,10 +89,10 @@ BOOL ScrCmd_GetItemName(ScriptContext *ctx) // 00D1 - todo: BufferItemName? Text
|
||||
|
||||
BOOL ScrCmd_GetPocketName(ScriptContext *ctx) // 00D2 - todo: BufferPocketName? TextPocketName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 pocket = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 pocket = ScriptGetVar(ctx);
|
||||
|
||||
BufferPocketName(*messageFormat, idx, pocket);
|
||||
|
||||
@@ -101,11 +101,11 @@ BOOL ScrCmd_GetPocketName(ScriptContext *ctx) // 00D2 - todo: BufferPocketName?
|
||||
|
||||
BOOL ScrCmd_GetTMHMMoveName(ScriptContext *ctx) // 00D3 - todo: BufferTMHMName? BufferMachineName? TextTMHMName? TextMachineName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 tmhm = ScriptGetVar(ctx);
|
||||
u16 move = TMHMGetMove(tmhm);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 tmhm = ScriptGetVar(ctx);
|
||||
u16 move = TMHMGetMove(tmhm);
|
||||
|
||||
BufferMoveName(*messageFormat, idx, move);
|
||||
|
||||
@@ -114,10 +114,10 @@ BOOL ScrCmd_GetTMHMMoveName(ScriptContext *ctx) // 00D3 - todo: BufferTMHMName?
|
||||
|
||||
BOOL ScrCmd_GetMoveName(ScriptContext *ctx) // 00D4 - todo: BufferMoveName? TextMoveName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 move = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 move = ScriptGetVar(ctx);
|
||||
|
||||
BufferMoveName(*messageFormat, idx, move);
|
||||
|
||||
@@ -127,9 +127,9 @@ BOOL ScrCmd_GetMoveName(ScriptContext *ctx) // 00D4 - todo: BufferMoveName? Text
|
||||
BOOL ScrCmd_Unk00D5(ScriptContext *ctx) // 00D5 - todo: BufferNumber? TextNumber?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
u32 digits = sub_02054C14(unk);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
u32 digits = sub_02054C14(unk);
|
||||
|
||||
BufferIntegerAsString(*messageFormat, idx, unk, digits, PRINTING_MODE_RIGHT_ALIGN, TRUE);
|
||||
|
||||
@@ -138,11 +138,11 @@ BOOL ScrCmd_Unk00D5(ScriptContext *ctx) // 00D5 - todo: BufferNumber? TextNumber
|
||||
|
||||
BOOL ScrCmd_Unk0280(ScriptContext *ctx) // 0280 - todo: BufferNumberSpecial? need more info
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
enum PrintingMode printingMode = (enum PrintingMode)ScriptReadByte(ctx);
|
||||
u8 digits = ScriptReadByte(ctx);
|
||||
u8 digits = ScriptReadByte(ctx);
|
||||
if (printingMode == PRINTING_MODE_LEFT_ALIGN) {
|
||||
digits = (u8)sub_02054C14(unk);
|
||||
}
|
||||
@@ -154,12 +154,12 @@ BOOL ScrCmd_Unk0280(ScriptContext *ctx) // 0280 - todo: BufferNumberSpecial? nee
|
||||
|
||||
BOOL ScrCmd_GetPokemonNickname(ScriptContext *ctx) // 00D6 - todo: BufferPartyPokemonNickname? TextPartyPokemonNickname?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
|
||||
BufferBoxMonNickname(*messageFormat, idx, &pokemon->box);
|
||||
|
||||
@@ -168,14 +168,14 @@ BOOL ScrCmd_GetPokemonNickname(ScriptContext *ctx) // 00D6 - todo: BufferPartyPo
|
||||
|
||||
BOOL ScrCmd_Unk0251(ScriptContext *ctx) // 0251 - todo: BufferBoxPokemonNickname? TextBoxPokemonNickname?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 box_mon_idx = ScriptGetVar(ctx);
|
||||
s32 box_no = box_mon_idx / 30;
|
||||
s32 slot_no = box_mon_idx % 30;
|
||||
BoxPokemon *box_mon = PCStorage_GetMonByIndexPair(pc, box_no, slot_no);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 box_mon_idx = ScriptGetVar(ctx);
|
||||
s32 box_no = box_mon_idx / 30;
|
||||
s32 slot_no = box_mon_idx % 30;
|
||||
BoxPokemon *box_mon = PCStorage_GetMonByIndexPair(pc, box_no, slot_no);
|
||||
|
||||
BufferBoxMonNickname(*messageFormat, idx, box_mon);
|
||||
|
||||
@@ -185,8 +185,8 @@ BOOL ScrCmd_Unk0251(ScriptContext *ctx) // 0251 - todo: BufferBoxPokemonNickname
|
||||
BOOL ScrCmd_GetPoketchAppName(ScriptContext *ctx) // 00D7 - todo: BufferPoketchAppName? TextPoketchAppName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 app = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 app = ScriptGetVar(ctx);
|
||||
|
||||
BufferPoketchAppName(*messageFormat, idx, app);
|
||||
|
||||
@@ -196,8 +196,8 @@ BOOL ScrCmd_GetPoketchAppName(ScriptContext *ctx) // 00D7 - todo: BufferPoketchA
|
||||
BOOL ScrCmd_GetTrainerClassName(ScriptContext *ctx) // 00D8 - todo: BufferTrainerClassName? TextTrainerClassName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 trainer_class = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 trainer_class = ScriptGetVar(ctx);
|
||||
|
||||
BufferTrainerClassName(*messageFormat, idx, trainer_class);
|
||||
|
||||
@@ -206,14 +206,14 @@ BOOL ScrCmd_GetTrainerClassName(ScriptContext *ctx) // 00D8 - todo: BufferTraine
|
||||
|
||||
BOOL ScrCmd_Unk00D9(ScriptContext *ctx) // 00D9 - todo: BufferPlayerTrainerClassName? TextPlayerTrainerClassName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u32 gender = PlayerProfile_GetTrainerGender(player);
|
||||
u32 avatar = PlayerProfile_GetAvatar(player);
|
||||
u32 trainer_class = sub_020536D0(gender, avatar, 2);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u32 gender = PlayerProfile_GetTrainerGender(player);
|
||||
u32 avatar = PlayerProfile_GetAvatar(player);
|
||||
u32 trainer_class = sub_020536D0(gender, avatar, 2);
|
||||
|
||||
BufferTrainerClassNameWithArticle(*messageFormat, idx, trainer_class);
|
||||
|
||||
@@ -223,11 +223,11 @@ BOOL ScrCmd_Unk00D9(ScriptContext *ctx) // 00D9 - todo: BufferPlayerTrainerClass
|
||||
BOOL ScrCmd_Unk00DA(ScriptContext *ctx) // 00DA - todo: BufferPokemonSpeciesName? TextPokemonSpeciesName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 msg_no = ScriptGetVar(ctx);
|
||||
u16 unk1 = ScriptReadHalfword(ctx);
|
||||
u8 unk2 = ScriptReadByte(ctx);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 msg_no = ScriptGetVar(ctx);
|
||||
u16 unk1 = ScriptReadHalfword(ctx);
|
||||
u8 unk2 = ScriptReadByte(ctx);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
|
||||
BufferString(*messageFormat, idx, str, unk1, unk2, 2);
|
||||
String_Delete(str);
|
||||
@@ -238,7 +238,7 @@ BOOL ScrCmd_Unk00DA(ScriptContext *ctx) // 00DA - todo: BufferPokemonSpeciesName
|
||||
static String *sub_02040AE4(u32 msg_no, HeapID heapId) // todo: GetPokemonSpeciesName?
|
||||
{
|
||||
MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0362_bin, heapId);
|
||||
String *ret = NewString_ReadMsgData(msg_data, msg_no);
|
||||
String *ret = NewString_ReadMsgData(msg_data, msg_no);
|
||||
DestroyMsgData(msg_data);
|
||||
|
||||
return ret;
|
||||
@@ -247,10 +247,10 @@ static String *sub_02040AE4(u32 msg_no, HeapID heapId) // todo: GetPokemonSpecie
|
||||
BOOL ScrCmd_GetPlayerStarterName(ScriptContext *ctx) // 00DB - todo: BufferPlayerStarterSpecies?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 msg_no = Save_VarsFlags_GetStarter(state);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 msg_no = Save_VarsFlags_GetStarter(state);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
|
||||
BufferString(*messageFormat, idx, str, 0, 1, 2);
|
||||
String_Delete(str);
|
||||
@@ -261,10 +261,10 @@ BOOL ScrCmd_GetPlayerStarterName(ScriptContext *ctx) // 00DB - todo: BufferPlaye
|
||||
BOOL ScrCmd_GetRivalStarterName(ScriptContext *ctx) // 00DC - todo: BufferRivalStarterSpecies?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 msg_no = sub_0205F398(state);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 msg_no = sub_0205F398(state);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
|
||||
BufferString(*messageFormat, idx, str, 0, 1, 2);
|
||||
String_Delete(str);
|
||||
@@ -275,10 +275,10 @@ BOOL ScrCmd_GetRivalStarterName(ScriptContext *ctx) // 00DC - todo: BufferRivalS
|
||||
BOOL ScrCmd_GetCounterpartStarterName(ScriptContext *ctx) // 00DD - todo: BufferFriendStarterSpecies?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 msg_no = sub_0205F3C0(state);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 msg_no = sub_0205F3C0(state);
|
||||
String *str = sub_02040AE4(msg_no, HEAP_ID_4);
|
||||
|
||||
BufferString(*messageFormat, idx, str, 0, 1, 2);
|
||||
String_Delete(str);
|
||||
@@ -289,8 +289,8 @@ BOOL ScrCmd_GetCounterpartStarterName(ScriptContext *ctx) // 00DD - todo: Buffer
|
||||
BOOL ScrCmd_GetDecorationName(ScriptContext *ctx) // 00DF - todo: BufferDecorationName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 decoration = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 decoration = ScriptGetVar(ctx);
|
||||
|
||||
BufferDecorationName(*messageFormat, idx, decoration);
|
||||
|
||||
@@ -300,8 +300,8 @@ BOOL ScrCmd_GetDecorationName(ScriptContext *ctx) // 00DF - todo: BufferDecorati
|
||||
BOOL ScrCmd_GetUndergroundTrapName(ScriptContext *ctx) // 00E0 - todo: BufferUndergroundTrapName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_trap = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_trap = ScriptGetVar(ctx);
|
||||
|
||||
BufferUndergroundTrapName(*messageFormat, idx, underground_trap);
|
||||
|
||||
@@ -311,8 +311,8 @@ BOOL ScrCmd_GetUndergroundTrapName(ScriptContext *ctx) // 00E0 - todo: BufferUnd
|
||||
BOOL ScrCmd_GetUndergroundItemName(ScriptContext *ctx) // 00E1 - todo: BufferUndergroundItemName? BufferTreasureName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_item = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_item = ScriptGetVar(ctx);
|
||||
|
||||
BufferUndergroundItemName(*messageFormat, idx, underground_item);
|
||||
|
||||
@@ -321,10 +321,10 @@ BOOL ScrCmd_GetUndergroundItemName(ScriptContext *ctx) // 00E1 - todo: BufferUnd
|
||||
|
||||
BOOL ScrCmd_GetMapName(ScriptContext *ctx) // 00E2 - todo: BufferMapName?
|
||||
{
|
||||
String *str = String_New(22, HEAP_ID_4);
|
||||
String *str = String_New(22, HEAP_ID_4);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 map_no = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 map_no = ScriptGetVar(ctx);
|
||||
|
||||
sub_02064E60(map_no, HEAP_ID_4, str);
|
||||
BufferString(*messageFormat, idx, str, 0, 1, 2);
|
||||
@@ -336,10 +336,10 @@ BOOL ScrCmd_GetMapName(ScriptContext *ctx) // 00E2 - todo: BufferMapName?
|
||||
BOOL ScrCmd_GetBerryName(ScriptContext *ctx) // 017B - todo: BufferBerryName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 berry = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
String *nut_name = GetNutName((u16)(berry - FIRST_BERRY_IDX), HEAP_ID_32);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 berry = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
String *nut_name = GetNutName((u16)(berry - FIRST_BERRY_IDX), HEAP_ID_32);
|
||||
|
||||
BufferString(*messageFormat, idx, nut_name, 0, unk < 2, 2);
|
||||
String_Delete(nut_name);
|
||||
@@ -350,8 +350,8 @@ BOOL ScrCmd_GetBerryName(ScriptContext *ctx) // 017B - todo: BufferBerryName?
|
||||
BOOL ScrCmd_GetNatureName(ScriptContext *ctx) // 017C - todo: BufferNatureName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 nature = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 nature = ScriptGetVar(ctx);
|
||||
|
||||
BufferNatureName(*messageFormat, idx, nature);
|
||||
|
||||
@@ -361,8 +361,8 @@ BOOL ScrCmd_GetNatureName(ScriptContext *ctx) // 017C - todo: BufferNatureName?
|
||||
BOOL ScrCmd_GetFashionName(ScriptContext *ctx) // 0261 - todo: BufferAccessoryName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 fashion = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 fashion = ScriptGetVar(ctx);
|
||||
|
||||
BufferFashionName(*messageFormat, idx, fashion);
|
||||
|
||||
@@ -372,10 +372,10 @@ BOOL ScrCmd_GetFashionName(ScriptContext *ctx) // 0261 - todo: BufferAccessoryNa
|
||||
BOOL ScrCmd_GetWhiteRockInscription(ScriptContext *ctx) // 0272 - todo: BufferWhiteRockInscription?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
String *str = String_New(11, HEAP_ID_FIELD);
|
||||
UnkStruct_02024E64 *unk = sub_02024EB4(ctx->fieldSystem->saveData);
|
||||
u16 *unk_buffer = sub_02024F0C(unk);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
String *str = String_New(11, HEAP_ID_FIELD);
|
||||
UnkStruct_02024E64 *unk = sub_02024EB4(ctx->fieldSystem->saveData);
|
||||
u16 *unk_buffer = sub_02024F0C(unk);
|
||||
|
||||
CopyU16ArrayToString(str, unk_buffer);
|
||||
BufferString(*messageFormat, idx, str, 0, 0, gGameLanguage);
|
||||
@@ -386,14 +386,14 @@ BOOL ScrCmd_GetWhiteRockInscription(ScriptContext *ctx) // 0272 - todo: BufferWh
|
||||
|
||||
BOOL ScrCmd_GetPokemonMoveName(ScriptContext *ctx) // 01CB - todo: BufferPartyPokemonMoveName?
|
||||
{
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
u16 mon_move_idx = ScriptGetVar(ctx);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
u16 move = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + mon_move_idx, NULL);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 mon_idx = ScriptGetVar(ctx);
|
||||
u16 mon_move_idx = ScriptGetVar(ctx);
|
||||
Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx);
|
||||
u16 move = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + mon_move_idx, NULL);
|
||||
|
||||
BufferMoveName(*messageFormat, idx, move);
|
||||
|
||||
@@ -403,9 +403,9 @@ BOOL ScrCmd_GetPokemonMoveName(ScriptContext *ctx) // 01CB - todo: BufferPartyPo
|
||||
BOOL ScrCmd_GetRibbonName(ScriptContext *ctx) // 0232 - todo: BufferRibbonName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u8 unk = (u8)ScriptGetVar(ctx);
|
||||
u16 ribbon = (u16)sub_0207FC5C(unk, 3);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u8 unk = (u8)ScriptGetVar(ctx);
|
||||
u16 ribbon = (u16)sub_0207FC5C(unk, 3);
|
||||
|
||||
BufferRibbonNameOrDesc(*messageFormat, idx, ribbon);
|
||||
|
||||
@@ -415,8 +415,8 @@ BOOL ScrCmd_GetRibbonName(ScriptContext *ctx) // 0232 - todo: BufferRibbonName?
|
||||
BOOL ScrCmd_GetSealName(ScriptContext *ctx) // 02B3 - todo: BufferSealName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 seal = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 seal = ScriptGetVar(ctx);
|
||||
|
||||
BufferSealName(*messageFormat, idx, (u16)(seal - 1));
|
||||
|
||||
@@ -426,8 +426,8 @@ BOOL ScrCmd_GetSealName(ScriptContext *ctx) // 02B3 - todo: BufferSealName?
|
||||
BOOL ScrCmd_GetItemNameWithIndefArticle(ScriptContext *ctx) // 02C4 - todo: BufferIndefItemName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
|
||||
BufferItemNameWithIndefArticle(*messageFormat, idx, item);
|
||||
|
||||
@@ -437,8 +437,8 @@ BOOL ScrCmd_GetItemNameWithIndefArticle(ScriptContext *ctx) // 02C4 - todo: Buff
|
||||
BOOL ScrCmd_GetItemNamePlural(ScriptContext *ctx) // 02C5 - todo: BufferPluralItemName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
|
||||
BufferItemNamePlural(*messageFormat, idx, item);
|
||||
|
||||
@@ -448,8 +448,8 @@ BOOL ScrCmd_GetItemNamePlural(ScriptContext *ctx) // 02C5 - todo: BufferPluralIt
|
||||
BOOL ScrCmd_GetDecorationNameWithArticle(ScriptContext *ctx) // 02C6 - todo: BufferIndefDecorationName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 decoration = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 decoration = ScriptGetVar(ctx);
|
||||
|
||||
BufferDecorationNameWithArticle(*messageFormat, idx, decoration);
|
||||
|
||||
@@ -459,8 +459,8 @@ BOOL ScrCmd_GetDecorationNameWithArticle(ScriptContext *ctx) // 02C6 - todo: Buf
|
||||
BOOL ScrCmd_GetUndergroundTrapNameWithArticle(ScriptContext *ctx) // 02C7 - todo: BufferIndefTrapName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_trap = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_trap = ScriptGetVar(ctx);
|
||||
|
||||
BufferUndergroundTrapNameWithArticle(*messageFormat, idx, underground_trap);
|
||||
|
||||
@@ -470,8 +470,8 @@ BOOL ScrCmd_GetUndergroundTrapNameWithArticle(ScriptContext *ctx) // 02C7 - todo
|
||||
BOOL ScrCmd_GetUndergroundItemNameWithArticle(ScriptContext *ctx) // 02C8 - todo: BufferIndefUndergroundItemName? BufferIndefTreasureName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_item = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 underground_item = ScriptGetVar(ctx);
|
||||
|
||||
BufferUndergroundItemNameWithArticle(*messageFormat, idx, underground_item);
|
||||
|
||||
@@ -481,10 +481,10 @@ BOOL ScrCmd_GetUndergroundItemNameWithArticle(ScriptContext *ctx) // 02C8 - todo
|
||||
BOOL ScrCmd_Unk02C9(ScriptContext *ctx) // 02C9 - todo: BufferIndefSpeciesName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptReadHalfword(ctx);
|
||||
u8 unused2 = ScriptReadByte(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptReadHalfword(ctx);
|
||||
u8 unused2 = ScriptReadByte(ctx);
|
||||
|
||||
BufferSpeciesNameWithArticle(*messageFormat, idx, species);
|
||||
|
||||
@@ -494,9 +494,9 @@ BOOL ScrCmd_Unk02C9(ScriptContext *ctx) // 02C9 - todo: BufferIndefSpeciesName?
|
||||
BOOL ScrCmd_Unk02CA(ScriptContext *ctx) // 02CA - todo: BufferIndefFriendStarterSpecies?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 species = sub_0205F3C0(state);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData);
|
||||
u32 species = sub_0205F3C0(state);
|
||||
|
||||
BufferSpeciesNameWithArticle(*messageFormat, idx, species);
|
||||
|
||||
@@ -506,8 +506,8 @@ BOOL ScrCmd_Unk02CA(ScriptContext *ctx) // 02CA - todo: BufferIndefFriendStarter
|
||||
BOOL ScrCmd_GetFashionNameWithArticle(ScriptContext *ctx) // 02CB - todo: BufferIndefAccessoryName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 fashion = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 fashion = ScriptGetVar(ctx);
|
||||
|
||||
BufferFashionNameWithArticle(*messageFormat, idx, fashion);
|
||||
|
||||
@@ -517,8 +517,8 @@ BOOL ScrCmd_GetFashionNameWithArticle(ScriptContext *ctx) // 02CB - todo: Buffer
|
||||
BOOL ScrCmd_Unk02CC(ScriptContext *ctx) // 02CC - todo: BufferIndefTrainerClassName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 trainer_class = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 trainer_class = ScriptGetVar(ctx);
|
||||
|
||||
BufferTrainerClassNameWithArticle(*messageFormat, idx, trainer_class);
|
||||
|
||||
@@ -528,8 +528,8 @@ BOOL ScrCmd_Unk02CC(ScriptContext *ctx) // 02CC - todo: BufferIndefTrainerClassN
|
||||
BOOL ScrCmd_GetSealNamePlural(ScriptContext *ctx) // 02CD - todo: BufferPluralSealName?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 seal = ScriptGetVar(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u16 seal = ScriptGetVar(ctx);
|
||||
|
||||
BufferSealNamePlural(*messageFormat, idx, (u16)(seal - 1));
|
||||
|
||||
@@ -539,7 +539,7 @@ BOOL ScrCmd_GetSealNamePlural(ScriptContext *ctx) // 02CD - todo: BufferPluralSe
|
||||
BOOL ScrCmd_CapitalizeFirstChar(ScriptContext *ctx) // 02CE - todo CapitalizeText?
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
u8 idx = ScriptReadByte(ctx);
|
||||
|
||||
MessageFormat_UpperFirstChar(*messageFormat, idx);
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ extern u16 sub_02054DEC(struct SaveData *save);
|
||||
|
||||
BOOL ScrCmd_GiveMon(struct ScriptContext *ctx) // 0096 - todo: GivePokemon?
|
||||
{
|
||||
u32 mapSec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId);
|
||||
u32 mapSec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId);
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 level = ScriptGetVar(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
u16 *varPtr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
*varPtr = (u16)GiveMon(HEAP_ID_FIELD, fieldSystem->saveData, species, (u8)level, item, mapSec, 12);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 level = ScriptGetVar(ctx);
|
||||
u16 item = ScriptGetVar(ctx);
|
||||
u16 *varPtr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
*varPtr = (u16)GiveMon(HEAP_ID_FIELD, fieldSystem->saveData, species, (u8)level, item, mapSec, 12);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ BOOL ScrCmd_GetPartyMonSpecies(struct ScriptContext *ctx) // 0198 - todo: GetPar
|
||||
u16 *ret_ptr;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *mon_slot = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); // for some reason this is *required* for matching, cannot use ScriptGetVarPointer here
|
||||
ret_ptr = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx));
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, *mon_slot);
|
||||
u16 *mon_slot = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); // for some reason this is *required* for matching, cannot use ScriptGetVarPointer here
|
||||
ret_ptr = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx));
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, *mon_slot);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
if (party_mon_is_egg == FALSE) {
|
||||
@@ -54,17 +54,17 @@ BOOL ScrCmd_GetPartyMonSpecies(struct ScriptContext *ctx) // 0198 - todo: GetPar
|
||||
BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext *ctx) // 0199 - todo: CheckPartyPokemonTraded?
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
struct SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
struct SaveData *save = FieldSystem_GetSaveData(fieldSystem);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(save);
|
||||
|
||||
u16 *mon_slot = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, *mon_slot);
|
||||
|
||||
u16 party_mon_otid = (u16)GetMonData(party_mon, MON_DATA_OTID, NULL);
|
||||
u16 player_otid = (u16)PlayerProfile_GetTrainerID(player);
|
||||
u16 player_otid = (u16)PlayerProfile_GetTrainerID(player);
|
||||
if (party_mon_otid == player_otid) {
|
||||
*ret_ptr = 0;
|
||||
} else {
|
||||
@@ -77,11 +77,11 @@ BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext *ctx) // 0199 - todo: CheckPa
|
||||
BOOL ScrCmd_GiveEgg(struct ScriptContext *ctx) // 0097
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(fieldSystem->saveData);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
u8 party_count = (u8)Party_GetCount(party);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(fieldSystem->saveData);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u16 unk = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
u8 party_count = (u8)Party_GetCount(party);
|
||||
|
||||
if (party_count < PARTY_SIZE) {
|
||||
struct Pokemon *egg = AllocMonZeroed(HEAP_ID_FIELD);
|
||||
@@ -99,9 +99,9 @@ BOOL ScrCmd_GiveEgg(struct ScriptContext *ctx) // 0097
|
||||
|
||||
BOOL ScrCmd_SetPartyMonMove(struct ScriptContext *ctx) // 0098 - todo: ReplacePartyPokemonMove?
|
||||
{
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 move_slot = ScriptGetVar(ctx);
|
||||
u16 move = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 move_slot = ScriptGetVar(ctx);
|
||||
u16 move = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
PartyMonSetMoveInSlot(party, mon_slot, move_slot, move);
|
||||
@@ -112,11 +112,11 @@ BOOL ScrCmd_SetPartyMonMove(struct ScriptContext *ctx) // 0098 - todo: ReplacePa
|
||||
BOOL ScrCmd_PartyMonHasMove(struct ScriptContext *ctx) // 0099
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 required_move = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 required_move = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = 0;
|
||||
|
||||
@@ -135,13 +135,13 @@ BOOL ScrCmd_PartyMonHasMove(struct ScriptContext *ctx) // 0099
|
||||
BOOL ScrCmd_FindPartyMonWithMove(struct ScriptContext *ctx) // 009A - todo: CheckMoveInParty?
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 required_move = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 required_move = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
u8 i;
|
||||
for (i = 0, *ret_ptr = PARTY_SIZE; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -158,9 +158,9 @@ BOOL ScrCmd_FindPartyMonWithMove(struct ScriptContext *ctx) // 009A - todo: Chec
|
||||
|
||||
BOOL ScrCmd_SurvivePsn(struct ScriptContext *ctx) // 01F7
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)SurvivePoisoning(party_mon);
|
||||
@@ -173,13 +173,13 @@ BOOL ScrCmd_CountPartyMonsAtOrBelowLevel(struct ScriptContext *ctx) // 01F6
|
||||
u8 i;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 highest_level = ScriptGetVar(ctx);
|
||||
party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 highest_level = ScriptGetVar(ctx);
|
||||
party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
u8 mons;
|
||||
for (i = 0, mons = 0, *ret_ptr = 0; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -198,10 +198,10 @@ BOOL ScrCmd_CountPartyMonsAtOrBelowLevel(struct ScriptContext *ctx) // 01F6
|
||||
BOOL ScrCmd_GetPartyMonLevel(struct ScriptContext *ctx) // 0278
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = 0;
|
||||
|
||||
@@ -216,16 +216,16 @@ BOOL ScrCmd_GetPartyMonLevel(struct ScriptContext *ctx) // 0278
|
||||
BOOL ScrCmd_GetPartyMonNature(struct ScriptContext *ctx) // 0212
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
if (mon_slot >= party_count) {
|
||||
*ret_ptr = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -241,13 +241,13 @@ BOOL ScrCmd_GetPartyMonNature(struct ScriptContext *ctx) // 0212
|
||||
BOOL ScrCmd_FindPartyMonWithNature(struct ScriptContext *ctx) // 0213 - todo: CheckNatureInParty
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 required_nature = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 required_nature = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
u8 i;
|
||||
for (i = 0, *ret_ptr = 0xFF; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -266,10 +266,10 @@ BOOL ScrCmd_FindPartyMonWithNature(struct ScriptContext *ctx) // 0213 - todo: Ch
|
||||
BOOL ScrCmd_GetPartyMonFriendship(struct ScriptContext *ctx) // 01B9
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)GetMonData(party_mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
return FALSE;
|
||||
@@ -278,16 +278,16 @@ BOOL ScrCmd_GetPartyMonFriendship(struct ScriptContext *ctx) // 01B9
|
||||
BOOL ScrCmd_AddPartyMonFriendship(struct ScriptContext *ctx) // 01BA
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 friendship_to_add = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 map_sec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 friendship_to_add = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 map_sec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
u16 friendship = (u16)GetMonData(party_mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
|
||||
if (friendship_to_add != 0) {
|
||||
u16 party_mon_held_item = (u16)GetMonData(party_mon, MON_DATA_HELD_ITEM, NULL);
|
||||
u16 party_mon_held_item = (u16)GetMonData(party_mon, MON_DATA_HELD_ITEM, NULL);
|
||||
u32 held_item_hold_effect = GetItemAttr(party_mon_held_item, ITEMATTR_HOLD_EFFECT, HEAP_ID_FIELD);
|
||||
if (held_item_hold_effect == HOLD_EFFECT_FRIENDSHIP_UP) {
|
||||
friendship_to_add = (u16)((friendship_to_add * 150) / 100);
|
||||
@@ -317,10 +317,10 @@ BOOL ScrCmd_AddPartyMonFriendship(struct ScriptContext *ctx) // 01BA
|
||||
BOOL ScrCmd_SubtractPartyMonFriendship(struct ScriptContext *ctx) // 01BB
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 friendship_to_deplete = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 friendship_to_deplete = ScriptGetVar(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
u16 friendship = (u16)GetMonData(party_mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
if (friendship_to_deplete > friendship) {
|
||||
@@ -336,10 +336,10 @@ BOOL ScrCmd_SubtractPartyMonFriendship(struct ScriptContext *ctx) // 01BB
|
||||
|
||||
BOOL ScrCmd_GetPartyMonContestCondition(struct ScriptContext *ctx) // 0281
|
||||
{
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 contest_condition_id = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 contest_condition_id = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)GetMonData(party_mon, MON_DATA_COOL + contest_condition_id, NULL);
|
||||
@@ -357,11 +357,11 @@ BOOL ScrCmd_GetLeadingPartyMonSlot(struct ScriptContext *ctx) // 0247
|
||||
BOOL ScrCmd_GetPartyMonTypes(struct ScriptContext *ctx) // 0248
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *type1 = ScriptGetVarPointer(ctx);
|
||||
u16 *type2 = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *type1 = ScriptGetVarPointer(ctx);
|
||||
u16 *type2 = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*type1 = (u16)GetMonData(party_mon, MON_DATA_TYPE_1, NULL);
|
||||
*type2 = (u16)GetMonData(party_mon, MON_DATA_TYPE_2, NULL);
|
||||
@@ -371,8 +371,8 @@ BOOL ScrCmd_GetPartyMonTypes(struct ScriptContext *ctx) // 0248
|
||||
BOOL ScrCmd_CountPartyMons(struct ScriptContext *ctx) // 0177
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
|
||||
*ret_ptr = (u16)Party_GetCount(party);
|
||||
return FALSE;
|
||||
@@ -384,11 +384,11 @@ BOOL ScrCmd_CountPartyMons_OmitEggs(struct ScriptContext *ctx) // 019A
|
||||
s32 i;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
s32 party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
s32 party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
for (i = 0, non_egg_mons = 0; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -407,15 +407,15 @@ BOOL ScrCmd_CountAvailablePartyMons_IgnoreSlot(struct ScriptContext *ctx) // 019
|
||||
s32 party_count;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
slot_to_ignore = ScriptGetVar(ctx);
|
||||
party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
slot_to_ignore = ScriptGetVar(ctx);
|
||||
party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
u32 available_mons;
|
||||
s32 i;
|
||||
for (i = 0, available_mons = 0; i < party_count; i++) {
|
||||
if (i != slot_to_ignore) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -438,14 +438,14 @@ BOOL ScrCmd_CountAvailablePartyAndPCMons(struct ScriptContext *ctx) // 019C
|
||||
struct PCStorage *pc;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
|
||||
party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
pc = SaveArray_PCStorage_Get(fieldSystem->saveData);
|
||||
party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
u32 mons;
|
||||
s32 i;
|
||||
for (i = 0, mons = 0; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -467,12 +467,12 @@ BOOL ScrCmd_GetPartyEggCount(struct ScriptContext *ctx) // 019D
|
||||
u32 eggs_in_party;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
s32 i;
|
||||
for (i = 0, eggs_in_party = 0; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -491,11 +491,11 @@ BOOL ScrCmd_CheckPartyForPokerus(struct ScriptContext *ctx) // 0119
|
||||
u16 i;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
party_count = (u16)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
party_count = (u16)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
for (i = 0, *ret_ptr = 0; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_has_pokerus = (BOOL)GetMonData(party_mon, MON_DATA_POKERUS, NULL);
|
||||
@@ -510,9 +510,9 @@ BOOL ScrCmd_CheckPartyForPokerus(struct ScriptContext *ctx) // 0119
|
||||
|
||||
BOOL ScrCmd_GetPartyMonGender(struct ScriptContext *ctx) // 011A
|
||||
{
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)GetMonData(party_mon, MON_DATA_GENDER, NULL);
|
||||
@@ -525,10 +525,10 @@ BOOL ScrCmd_CountPartyMonMoves(struct ScriptContext *ctx) // 01C8
|
||||
u8 moves;
|
||||
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
if (party_mon_is_egg) {
|
||||
@@ -565,10 +565,10 @@ BOOL ScrCmd_CountPartyMonMoves(struct ScriptContext *ctx) // 01C8
|
||||
BOOL ScrCmd_ForgetPartyMonMove(struct ScriptContext *ctx) // 01C9
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 move_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 move_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
sub_020699A4(party_mon, move_slot);
|
||||
|
||||
@@ -578,11 +578,11 @@ BOOL ScrCmd_ForgetPartyMonMove(struct ScriptContext *ctx) // 01C9
|
||||
BOOL ScrCmd_GetPartyMonMove(struct ScriptContext *ctx) // 01CA
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 move_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 move_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)GetMonData(party_mon, MON_DATA_MOVE1 + move_slot, NULL);
|
||||
return FALSE;
|
||||
@@ -591,10 +591,10 @@ BOOL ScrCmd_GetPartyMonMove(struct ScriptContext *ctx) // 01CA
|
||||
BOOL ScrCmd_GetPartyMonHeldItem(struct ScriptContext *ctx) // 01EE
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)GetMonData(party_mon, MON_DATA_HELD_ITEM, NULL);
|
||||
return FALSE;
|
||||
@@ -603,9 +603,9 @@ BOOL ScrCmd_GetPartyMonHeldItem(struct ScriptContext *ctx) // 01EE
|
||||
BOOL ScrCmd_ResetPartyMonHeldItem(struct ScriptContext *ctx) // 01F0
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
u16 party_mon_held_item = ITEM_NONE;
|
||||
SetMonData(party_mon, MON_DATA_HELD_ITEM, &party_mon_held_item);
|
||||
@@ -616,13 +616,13 @@ BOOL ScrCmd_ResetPartyMonHeldItem(struct ScriptContext *ctx) // 01F0
|
||||
BOOL ScrCmd_CheckPartyForSpecies(struct ScriptContext *ctx) // 01C0
|
||||
{
|
||||
struct FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 species = ScriptGetVar(ctx);
|
||||
u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
|
||||
u8 i;
|
||||
for (i = 0, *ret_ptr = 0; i < party_count; i++) {
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Party *party = SaveArray_Party_Get(fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
@@ -640,9 +640,9 @@ BOOL ScrCmd_CheckPartyForSpecies(struct ScriptContext *ctx) // 01C0
|
||||
|
||||
BOOL ScrCmd_CountPartyMonRibbons(struct ScriptContext *ctx) // 022E
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
u16 ribbon_idx;
|
||||
@@ -664,9 +664,9 @@ BOOL ScrCmd_CountTotalPartyRibbons(struct ScriptContext *ctx) // 022F
|
||||
u16 ribbon_idx;
|
||||
u16 ribbons;
|
||||
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 party_count = (u16)Party_GetCount(SaveArray_Party_Get(ctx->fieldSystem->saveData));
|
||||
party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
for (ribbon_idx = 0, ribbons = 0; ribbon_idx < 80; ribbon_idx++) {
|
||||
for (u16 i = 0; i < party_count; i++) {
|
||||
@@ -693,10 +693,10 @@ BOOL ScrCmd_CountTotalPartyRibbons(struct ScriptContext *ctx) // 022F
|
||||
|
||||
BOOL ScrCmd_PartyMonHasRibbon(struct ScriptContext *ctx) // 0230
|
||||
{
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 ribbon_idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 ribbon_idx = ScriptGetVar(ctx);
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
*ret_ptr = (u16)GetMonData(party_mon, sub_0207FC5C((u8)ribbon_idx, 0), NULL);
|
||||
@@ -705,10 +705,10 @@ BOOL ScrCmd_PartyMonHasRibbon(struct ScriptContext *ctx) // 0230
|
||||
|
||||
BOOL ScrCmd_GivePartyMonRibbon(struct ScriptContext *ctx) // 0231
|
||||
{
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 ribbon_idx = ScriptGetVar(ctx);
|
||||
u8 mon_has_ribbon = TRUE;
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
u16 mon_slot = ScriptGetVar(ctx);
|
||||
u16 ribbon_idx = ScriptGetVar(ctx);
|
||||
u8 mon_has_ribbon = TRUE;
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot);
|
||||
|
||||
SetMonData(party_mon, (s32)sub_0207FC5C((u8)ribbon_idx, 0), &mon_has_ribbon);
|
||||
@@ -720,8 +720,8 @@ BOOL ScrCmd_CheckPartyForBadEgg(struct ScriptContext *ctx) // 02B7
|
||||
{
|
||||
u16 ribbon_idx;
|
||||
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 party_count = (u16)Party_GetCount(SaveArray_Party_Get(ctx->fieldSystem->saveData));
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 party_count = (u16)Party_GetCount(SaveArray_Party_Get(ctx->fieldSystem->saveData));
|
||||
struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
|
||||
|
||||
// BUG: Probably a copy-paste fail. Checks if your party has a Bad Egg in it,
|
||||
@@ -729,7 +729,7 @@ BOOL ScrCmd_CheckPartyForBadEgg(struct ScriptContext *ctx) // 02B7
|
||||
for (ribbon_idx = 0; ribbon_idx < 80; ribbon_idx++) {
|
||||
for (u16 i = 0; i < party_count; i++) {
|
||||
struct Pokemon *party_mon = Party_GetMonByIndex(party, i);
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL);
|
||||
if (party_mon_is_egg) {
|
||||
BOOL party_mon_is_bad_egg = (BOOL)GetMonData(party_mon, MON_DATA_CHECKSUM_FAILED, NULL);
|
||||
if (party_mon_is_bad_egg) {
|
||||
|
||||
@@ -28,11 +28,11 @@ const u16 gGameCornerPrizes[19][2] = {
|
||||
|
||||
BOOL ScrCmd_GetPrizeItemIdAndCost(struct ScriptContext *ctx) // 02A6
|
||||
{
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
u16 *prize_item_id = ScriptGetVarPointer(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
u16 *prize_item_id = ScriptGetVarPointer(ctx);
|
||||
u16 *prize_cost_in_coins = ScriptGetVarPointer(ctx);
|
||||
|
||||
*prize_item_id = gGameCornerPrizes[idx][0];
|
||||
*prize_item_id = gGameCornerPrizes[idx][0];
|
||||
*prize_cost_in_coins = gGameCornerPrizes[idx][1];
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -17,7 +17,7 @@ extern BOOL sub_02005670(void);
|
||||
|
||||
BOOL ScrCmd_Unk02AE(struct ScriptContext *ctx) // 02AE
|
||||
{
|
||||
u16 unk0 = ScriptReadHalfword(ctx);
|
||||
u16 unk0 = ScriptReadHalfword(ctx);
|
||||
u16 *unk1 = ScriptGetVarPointer(ctx);
|
||||
|
||||
*unk1 = sub_02005410(unk0);
|
||||
@@ -141,7 +141,7 @@ BOOL sub_02041540(struct ScriptContext *ctx) {
|
||||
|
||||
BOOL ScrCmd_PlayCry(struct ScriptContext *ctx) // 004C
|
||||
{
|
||||
u16 unk0 = ScriptGetVar(ctx);
|
||||
u16 unk0 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
sub_02005578(unk0);
|
||||
return FALSE;
|
||||
|
||||
@@ -13,10 +13,10 @@ extern BOOL sub_020260C4(void *, u16, u16);
|
||||
BOOL ScrCmd_GiveSecretBaseDecoration(struct ScriptContext *ctx) // 0083
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk2 = sub_02026CC4(save);
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk2 = sub_02026CC4(save);
|
||||
|
||||
*ret_ptr = (u16)sub_02025D6C(unk2, unk1);
|
||||
|
||||
@@ -25,8 +25,8 @@ BOOL ScrCmd_GiveSecretBaseDecoration(struct ScriptContext *ctx) // 0083
|
||||
|
||||
BOOL ScrCmd_TakeSecretBaseDecoration(struct ScriptContext *ctx) // 0084
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -35,10 +35,10 @@ BOOL ScrCmd_TakeSecretBaseDecoration(struct ScriptContext *ctx) // 0084
|
||||
BOOL ScrCmd_HasSpaceForDecoration(struct ScriptContext *ctx) // 0085
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk2 = sub_02026CC4(save);
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk2 = sub_02026CC4(save);
|
||||
|
||||
*ret_ptr = (u16)sub_02025D94(unk2, unk1);
|
||||
|
||||
@@ -47,8 +47,8 @@ BOOL ScrCmd_HasSpaceForDecoration(struct ScriptContext *ctx) // 0085
|
||||
|
||||
BOOL ScrCmd_GetDecorationCount(struct ScriptContext *ctx) // 0086 - somewhat unsure on name, was originally CheckGoods
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -57,10 +57,10 @@ BOOL ScrCmd_GetDecorationCount(struct ScriptContext *ctx) // 0086 - somewhat uns
|
||||
BOOL ScrCmd_GiveUndergroundTrap(struct ScriptContext *ctx) // 0087
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk2 = sub_02026CC4(save);
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unused = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk2 = sub_02026CC4(save);
|
||||
|
||||
*ret_ptr = (u16)sub_02026298(unk2, unk1);
|
||||
|
||||
@@ -69,8 +69,8 @@ BOOL ScrCmd_GiveUndergroundTrap(struct ScriptContext *ctx) // 0087
|
||||
|
||||
BOOL ScrCmd_TakeUndergroundTrap(struct ScriptContext *ctx) // 0088
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -78,8 +78,8 @@ BOOL ScrCmd_TakeUndergroundTrap(struct ScriptContext *ctx) // 0088
|
||||
|
||||
BOOL ScrCmd_HasSpaceForTrap(struct ScriptContext *ctx) // 0089
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -87,8 +87,8 @@ BOOL ScrCmd_HasSpaceForTrap(struct ScriptContext *ctx) // 0089
|
||||
|
||||
BOOL ScrCmd_GetTrapCount(struct ScriptContext *ctx) // 008A
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -97,18 +97,18 @@ BOOL ScrCmd_GetTrapCount(struct ScriptContext *ctx) // 008A
|
||||
BOOL ScrCmd_GiveTreasure(struct ScriptContext *ctx) // 008B
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unused3 = sub_02026CC4(save);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unused3 = sub_02026CC4(save);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_TakeTreasure(struct ScriptContext *ctx) // 008C
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -116,8 +116,8 @@ BOOL ScrCmd_TakeTreasure(struct ScriptContext *ctx) // 008C
|
||||
|
||||
BOOL ScrCmd_HasSpaceForTreasure(struct ScriptContext *ctx) // 008D
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -125,8 +125,8 @@ BOOL ScrCmd_HasSpaceForTreasure(struct ScriptContext *ctx) // 008D
|
||||
|
||||
BOOL ScrCmd_GetTreasureCount(struct ScriptContext *ctx) // 008E
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -135,10 +135,10 @@ BOOL ScrCmd_GetTreasureCount(struct ScriptContext *ctx) // 008E
|
||||
BOOL ScrCmd_GiveUndergroundSphere(struct ScriptContext *ctx) // 008F
|
||||
{
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unk2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk3 = sub_02026CC4(save);
|
||||
u16 unk1 = ScriptGetVar(ctx);
|
||||
u16 unk2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
void *unk3 = sub_02026CC4(save);
|
||||
|
||||
*ret_ptr = (u16)sub_020260C4(unk3, unk1, unk2);
|
||||
|
||||
@@ -147,8 +147,8 @@ BOOL ScrCmd_GiveUndergroundSphere(struct ScriptContext *ctx) // 008F
|
||||
|
||||
BOOL ScrCmd_TakeUndergroundSphere(struct ScriptContext *ctx) // 0090
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -156,8 +156,8 @@ BOOL ScrCmd_TakeUndergroundSphere(struct ScriptContext *ctx) // 0090
|
||||
|
||||
BOOL ScrCmd_HasSpaceForSphere(struct ScriptContext *ctx) // 0091
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
@@ -165,8 +165,8 @@ BOOL ScrCmd_HasSpaceForSphere(struct ScriptContext *ctx) // 0091
|
||||
|
||||
BOOL ScrCmd_GetSphereCount(struct ScriptContext *ctx) // 0092
|
||||
{
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 unused1 = ScriptGetVar(ctx);
|
||||
u16 unused2 = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -13,21 +13,21 @@ extern BOOL sub_020612F8(struct FieldSystem *);
|
||||
|
||||
BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D
|
||||
{
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT);
|
||||
struct UnkSaveStruct_020286F8 *unk_sav_ptr = sub_0202881C(ctx->fieldSystem->saveData);
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
struct SaveData *save = ctx->fieldSystem->saveData;
|
||||
|
||||
u16 option = ScriptReadHalfword(ctx);
|
||||
switch (option) {
|
||||
case 0: { // check if group ID exists
|
||||
u16 unk_var = ScriptGetVar(ctx);
|
||||
u16 unk_var = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = (u16)sub_02028828(unk_sav_ptr, unk_var);
|
||||
return FALSE;
|
||||
}
|
||||
case 1: { // check if group ID is accessible
|
||||
u16 unk_var = ScriptGetVar(ctx);
|
||||
u16 unk_var = ScriptGetVar(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
*ret_ptr = (u16)sub_02028840(unk_sav_ptr, unk_var);
|
||||
@@ -35,27 +35,27 @@ BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D
|
||||
}
|
||||
case 2: { // writes group ID to string buffer
|
||||
u16 unk_var = ScriptGetVar(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
|
||||
BufferGroupName(*messageFormat, save, unk_var, idx, 0);
|
||||
break;
|
||||
}
|
||||
case 3: { // writes group leader name to string buffer
|
||||
u16 unk_var = ScriptGetVar(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
u16 idx = ScriptGetVar(ctx);
|
||||
|
||||
BufferGroupName(*messageFormat, save, unk_var, idx, 1);
|
||||
break;
|
||||
}
|
||||
case 4: { // opens keyboard, 2 if group id exists, 1 if cancel, 0 otherwise
|
||||
u16 *unk_str_ptr = sub_020287A8(unk_sav_ptr, 0, 0);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
u16 *ret_ptr = ScriptGetVarPointer(ctx);
|
||||
|
||||
CreateNamingScreen(ctx->taskManager, NAMINGSCREEN_GROUP, 0, PLAYER_NAME_LENGTH, 0, unk_str_ptr, ret_ptr); // should be GROUP_NAME_LENGTH?
|
||||
return TRUE;
|
||||
}
|
||||
case 5: { // enter in group id (whatever this means, needs more investigation)
|
||||
u16 src_idx = ScriptGetVar(ctx);
|
||||
u16 src_idx = ScriptGetVar(ctx);
|
||||
BOOL unk_bool = sub_02028828(unk_sav_ptr, 1);
|
||||
|
||||
sub_02028700(unk_sav_ptr, src_idx, 1);
|
||||
@@ -67,7 +67,7 @@ BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D
|
||||
}
|
||||
case 6: { // create a group
|
||||
struct String *player_name = String_New(64, HEAP_ID_32);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData);
|
||||
PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData);
|
||||
|
||||
PlayerName_FlatToString(player, player_name);
|
||||
sub_020287C0(unk_sav_ptr, 0, 1, player_name);
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, u32 cmdCount) {
|
||||
int i;
|
||||
|
||||
ctx->mode = 0;
|
||||
ctx->scriptPtr = NULL;
|
||||
ctx->mode = 0;
|
||||
ctx->scriptPtr = NULL;
|
||||
ctx->stackDepth = 0;
|
||||
ctx->nativePtr = NULL;
|
||||
ctx->cmdTable = cmdTable;
|
||||
ctx->cmdCount = cmdCount;
|
||||
ctx->nativePtr = NULL;
|
||||
ctx->cmdTable = cmdTable;
|
||||
ctx->cmdCount = cmdCount;
|
||||
|
||||
for (i = 0; i < NELEMS(ctx->data); i++) {
|
||||
ctx->data[i] = 0;
|
||||
@@ -25,17 +25,17 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, u32 cmdCount)
|
||||
|
||||
u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr) {
|
||||
ctx->scriptPtr = ptr;
|
||||
ctx->mode = 1;
|
||||
ctx->mode = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void SetupNativeScript(struct ScriptContext *ctx, BOOL (*ptr)(struct ScriptContext *)) {
|
||||
ctx->mode = 2;
|
||||
ctx->mode = 2;
|
||||
ctx->nativePtr = ptr;
|
||||
}
|
||||
|
||||
void StopScript(struct ScriptContext *ctx) {
|
||||
ctx->mode = 0;
|
||||
ctx->mode = 0;
|
||||
ctx->scriptPtr = 0;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ void ScriptJump(struct ScriptContext *ctx, const u8 *ptr) {
|
||||
}
|
||||
|
||||
u8 ScriptCall(struct ScriptContext *ctx, const u8 *ptr) {
|
||||
u8 ret = ScriptPush(ctx, ctx->scriptPtr);
|
||||
u8 ret = ScriptPush(ctx, ctx->scriptPtr);
|
||||
ctx->scriptPtr = ptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ BOOL HasEnoughAlivePokemonForDoubleBattle(struct Party *party) {
|
||||
}
|
||||
|
||||
void GiveAllMonsTheSinnohChampRibbon(struct Party *party) {
|
||||
u8 var = 1;
|
||||
u8 var = 1;
|
||||
int partyCount = Party_GetCount(party);
|
||||
|
||||
for (int i = 0; i < partyCount; i++) {
|
||||
@@ -145,8 +145,8 @@ void GiveAllMonsTheSinnohChampRibbon(struct Party *party) {
|
||||
int ApplyPoisonStep(struct Party *party, int location) {
|
||||
u32 hp;
|
||||
int numPoisoned = 0;
|
||||
int numHealed = 0;
|
||||
int partyCount = Party_GetCount(party);
|
||||
int numHealed = 0;
|
||||
int partyCount = Party_GetCount(party);
|
||||
|
||||
for (int i = 0; i < partyCount; i++) {
|
||||
struct Pokemon *mon = Party_GetMonByIndex(party, i);
|
||||
|
||||
@@ -81,8 +81,8 @@ void sub_02003C40(void) {
|
||||
|
||||
void sub_02003CE8(int a0) {
|
||||
struct SoundData *sdat = GetSoundDataPointer();
|
||||
sdat->unk_BCCFC = 0;
|
||||
UNK_02107070 = (u32)a0;
|
||||
sdat->unk_BCCFC = 0;
|
||||
UNK_02107070 = (u32)a0;
|
||||
}
|
||||
|
||||
BOOL sub_02003D04(void) {
|
||||
@@ -188,7 +188,7 @@ void *sub_02003D38(u32 a0) {
|
||||
|
||||
int GF_Snd_SaveState(int *level_p) {
|
||||
struct SoundData *sdat = GetSoundDataPointer();
|
||||
int level = NNS_SndHeapSaveState(sdat->heap);
|
||||
int level = NNS_SndHeapSaveState(sdat->heap);
|
||||
GF_ASSERT(level != -1);
|
||||
if (level_p != NULL) {
|
||||
*level_p = level;
|
||||
|
||||
@@ -39,7 +39,7 @@ void CopyU16StringArray(u16 *dest, const u16 *src) {
|
||||
while (c != EOS) {
|
||||
src++;
|
||||
*dest = c;
|
||||
c = *src;
|
||||
c = *src;
|
||||
dest++;
|
||||
}
|
||||
*dest = EOS;
|
||||
@@ -115,12 +115,12 @@ u16 *StringFillEOS(u16 *dest, u32 num) {
|
||||
u16 *ConvertUIntToDecimalString(u16 *dest, u32 value, enum PrintingMode mode, u32 n) {
|
||||
for (u32 x = (u32)gPowersOfTen[n - 1]; x != 0; x = x / 10) {
|
||||
u16 res = (u16)(value / x);
|
||||
value = value - x * res;
|
||||
value = value - x * res;
|
||||
if (mode == PRINTING_MODE_LEADING_ZEROS) {
|
||||
*dest = res >= 10 ? (u16)CHAR_JP_QUESTION_MARK : gDigitTable[res];
|
||||
dest++;
|
||||
} else if (res != 0 || x == 1) {
|
||||
mode = PRINTING_MODE_LEADING_ZEROS;
|
||||
mode = PRINTING_MODE_LEADING_ZEROS;
|
||||
*dest = res >= 10 ? (u16)CHAR_JP_QUESTION_MARK : gDigitTable[res];
|
||||
dest++;
|
||||
} else if (mode == PRINTING_MODE_RIGHT_ALIGN) {
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
struct TaskManager *Task_New(struct FieldSystem *fieldSystem, TaskFunc taskFunc, void *env) {
|
||||
struct TaskManager *taskManager = AllocFromHeapAtEnd(HEAP_ID_32, sizeof(struct TaskManager));
|
||||
taskManager->prev = NULL;
|
||||
taskManager->func = taskFunc;
|
||||
taskManager->state = 0;
|
||||
taskManager->env = env;
|
||||
taskManager->unk10 = NULL;
|
||||
taskManager->unk14 = NULL;
|
||||
taskManager->fieldSystem = fieldSystem;
|
||||
taskManager->unk1C = AllocFromHeapAtEnd(HEAP_ID_32, 4);
|
||||
taskManager->prev = NULL;
|
||||
taskManager->func = taskFunc;
|
||||
taskManager->state = 0;
|
||||
taskManager->env = env;
|
||||
taskManager->unk10 = NULL;
|
||||
taskManager->unk14 = NULL;
|
||||
taskManager->fieldSystem = fieldSystem;
|
||||
taskManager->unk1C = AllocFromHeapAtEnd(HEAP_ID_32, 4);
|
||||
return taskManager;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ void FieldSystem_CreateTask(struct FieldSystem *fieldSystem, TaskFunc taskFunc,
|
||||
}
|
||||
|
||||
void TaskManager_Jump(struct TaskManager *taskManager, TaskFunc taskFunc, void *env) {
|
||||
taskManager->func = taskFunc;
|
||||
taskManager->func = taskFunc;
|
||||
taskManager->state = 0;
|
||||
taskManager->env = env;
|
||||
taskManager->env = env;
|
||||
if (taskManager->unk14 != NULL || taskManager->unk14 != NULL) {
|
||||
FreeToHeap(taskManager->unk14);
|
||||
taskManager->unk10 = NULL;
|
||||
@@ -35,8 +35,8 @@ void TaskManager_Jump(struct TaskManager *taskManager, TaskFunc taskFunc, void *
|
||||
}
|
||||
|
||||
void TaskManager_Call(struct TaskManager *taskManager, TaskFunc taskFunc, void *env) {
|
||||
struct TaskManager *taskManager2 = Task_New(taskManager->fieldSystem, taskFunc, env);
|
||||
taskManager2->prev = taskManager;
|
||||
struct TaskManager *taskManager2 = Task_New(taskManager->fieldSystem, taskFunc, env);
|
||||
taskManager2->prev = taskManager;
|
||||
taskManager->fieldSystem->taskManager = taskManager2;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ BOOL sub_020464A4(void *r0) {
|
||||
|
||||
BOOL sub_020464B8(struct TaskManager *taskManager) {
|
||||
struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
u32 *r4_2 = TaskManager_GetEnvironment(taskManager);
|
||||
u32 *r4_2 = TaskManager_GetEnvironment(taskManager);
|
||||
switch (r4_2[0]) {
|
||||
case 0:
|
||||
sub_020373D4(fieldSystem, (struct OverlayManagerTemplate *)r4_2[1], (void *)r4_2[2]); // FIXME: typing is wrong
|
||||
@@ -95,9 +95,9 @@ BOOL sub_020464B8(struct TaskManager *taskManager) {
|
||||
|
||||
void sub_02046500(struct TaskManager *taskManager, u32 r5, u32 r4) {
|
||||
u32 *r2 = AllocFromHeapAtEnd(HEAP_ID_32, 3 * sizeof(u32));
|
||||
r2[0] = 0;
|
||||
r2[1] = r5;
|
||||
r2[2] = r4;
|
||||
r2[0] = 0;
|
||||
r2[1] = r5;
|
||||
r2[2] = r4;
|
||||
TaskManager_Call(taskManager, sub_020464B8, r2);
|
||||
}
|
||||
|
||||
|
||||
134
arm9/src/text.c
134
arm9/src/text.c
@@ -86,66 +86,66 @@ void sub_0201BD7C(u8 textPrinterNumber) {
|
||||
u16 AddTextPrinterParameterized(struct Window *window, u8 fontId, struct String *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)) {
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
|
||||
printerTemplate.window = window;
|
||||
printerTemplate.window = window;
|
||||
printerTemplate.currentChar.wrapped = str;
|
||||
printerTemplate.fontId = fontId;
|
||||
printerTemplate.x = (u8)x;
|
||||
printerTemplate.y = (u8)y;
|
||||
printerTemplate.currentX = (u8)x;
|
||||
printerTemplate.currentY = (u8)y;
|
||||
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = gFonts[fontId].fgColor;
|
||||
printerTemplate.bgColor = gFonts[fontId].bgColor;
|
||||
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
|
||||
printerTemplate.unk2 = 0;
|
||||
printerTemplate.unk3 = 0;
|
||||
printerTemplate.unk4 = 255;
|
||||
printerTemplate.fontId = fontId;
|
||||
printerTemplate.x = (u8)x;
|
||||
printerTemplate.y = (u8)y;
|
||||
printerTemplate.currentX = (u8)x;
|
||||
printerTemplate.currentY = (u8)y;
|
||||
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = gFonts[fontId].fgColor;
|
||||
printerTemplate.bgColor = gFonts[fontId].bgColor;
|
||||
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
|
||||
printerTemplate.unk2 = 0;
|
||||
printerTemplate.unk3 = 0;
|
||||
printerTemplate.unk4 = 255;
|
||||
return AddTextPrinter(&printerTemplate, speed, callback);
|
||||
}
|
||||
|
||||
u16 AddTextPrinterParameterized2(struct Window *window, u8 fontId, struct String *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)) {
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
|
||||
printerTemplate.window = window;
|
||||
printerTemplate.window = window;
|
||||
printerTemplate.currentChar.wrapped = str;
|
||||
printerTemplate.fontId = fontId;
|
||||
printerTemplate.x = (u8)x;
|
||||
printerTemplate.y = (u8)y;
|
||||
printerTemplate.currentX = (u8)x;
|
||||
printerTemplate.currentY = (u8)y;
|
||||
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = (u8)(colors >> 16);
|
||||
printerTemplate.shadowColor = (u8)(colors >> 8);
|
||||
printerTemplate.bgColor = (u8)colors;
|
||||
printerTemplate.unk2 = 0;
|
||||
printerTemplate.unk3 = 0;
|
||||
printerTemplate.unk4 = 255;
|
||||
printerTemplate.fontId = fontId;
|
||||
printerTemplate.x = (u8)x;
|
||||
printerTemplate.y = (u8)y;
|
||||
printerTemplate.currentX = (u8)x;
|
||||
printerTemplate.currentY = (u8)y;
|
||||
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = (u8)(colors >> 16);
|
||||
printerTemplate.shadowColor = (u8)(colors >> 8);
|
||||
printerTemplate.bgColor = (u8)colors;
|
||||
printerTemplate.unk2 = 0;
|
||||
printerTemplate.unk3 = 0;
|
||||
printerTemplate.unk4 = 255;
|
||||
return AddTextPrinter(&printerTemplate, speed, callback);
|
||||
}
|
||||
|
||||
u16 AddTextPrinterParameterized3(struct Window *window, u32 fontId, struct String *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, u8 (*callback)(struct TextPrinterTemplate *, u16)) {
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
|
||||
printerTemplate.window = window;
|
||||
printerTemplate.window = window;
|
||||
printerTemplate.currentChar.wrapped = str;
|
||||
printerTemplate.fontId = (u8)fontId;
|
||||
printerTemplate.x = (u8)x;
|
||||
printerTemplate.y = (u8)y;
|
||||
printerTemplate.currentX = (u8)x;
|
||||
printerTemplate.currentY = (u8)y;
|
||||
printerTemplate.letterSpacing = (u8)letterSpacing;
|
||||
printerTemplate.lineSpacing = (u8)lineSpacing;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = (u8)(colors >> 16);
|
||||
printerTemplate.shadowColor = (u8)(colors >> 8);
|
||||
printerTemplate.bgColor = (u8)colors;
|
||||
printerTemplate.unk2 = 0;
|
||||
printerTemplate.unk3 = 0;
|
||||
printerTemplate.unk4 = 255;
|
||||
printerTemplate.fontId = (u8)fontId;
|
||||
printerTemplate.x = (u8)x;
|
||||
printerTemplate.y = (u8)y;
|
||||
printerTemplate.currentX = (u8)x;
|
||||
printerTemplate.currentY = (u8)y;
|
||||
printerTemplate.letterSpacing = (u8)letterSpacing;
|
||||
printerTemplate.lineSpacing = (u8)lineSpacing;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = (u8)(colors >> 16);
|
||||
printerTemplate.shadowColor = (u8)(colors >> 8);
|
||||
printerTemplate.bgColor = (u8)colors;
|
||||
printerTemplate.unk2 = 0;
|
||||
printerTemplate.unk3 = 0;
|
||||
printerTemplate.unk4 = 255;
|
||||
return AddTextPrinter(&printerTemplate, speed, callback);
|
||||
}
|
||||
|
||||
@@ -156,31 +156,31 @@ u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (*
|
||||
|
||||
struct TextPrinter *printer = (struct TextPrinter *)AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct TextPrinter));
|
||||
|
||||
printer->active = TRUE;
|
||||
printer->state = 0;
|
||||
printer->active = TRUE;
|
||||
printer->state = 0;
|
||||
printer->textSpeedBottom = (u8)speed;
|
||||
printer->delayCounter = 0;
|
||||
printer->scrollDistance = 0;
|
||||
printer->Unk29 = 0;
|
||||
printer->delayCounter = 0;
|
||||
printer->scrollDistance = 0;
|
||||
printer->Unk29 = 0;
|
||||
|
||||
for (s32 i = 0; i < 7; i++) {
|
||||
printer->subStructFields[i] = 0;
|
||||
}
|
||||
|
||||
printer->printerTemplate = *printerTemplate;
|
||||
printer->printerTemplate = *printerTemplate;
|
||||
printer->printerTemplate.currentChar.raw = String_c_str(printer->printerTemplate.currentChar.wrapped);
|
||||
printer->callback = callback;
|
||||
UNK_021C570C = 0;
|
||||
printer->callback = callback;
|
||||
UNK_021C570C = 0;
|
||||
sub_0201C1A8(printer);
|
||||
if (speed != 0xff && speed != 0) {
|
||||
printer->textSpeedBottom--;
|
||||
printer->textSpeedTop = 1;
|
||||
printer->textSpeedTop = 1;
|
||||
printer->minLetterSpacing = sub_0201BCC8((SysTaskFunc)RunTextPrinter, printer, 1);
|
||||
return printer->minLetterSpacing;
|
||||
} else {
|
||||
u32 j = 0;
|
||||
u32 j = 0;
|
||||
printer->textSpeedBottom = 0;
|
||||
printer->textSpeedTop = 0;
|
||||
printer->textSpeedTop = 0;
|
||||
GenerateFontHalfRowLookupTable(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor);
|
||||
for (; j < 0x400; ++j) {
|
||||
if (RenderFont(printer) == 1) {
|
||||
@@ -265,16 +265,16 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) {
|
||||
}
|
||||
|
||||
void DecompressGlyphTile(const u16 *src, u16 *dst) {
|
||||
dst[0] = sFontHalfRowLookupTable[(u32)src[0] >> 8];
|
||||
dst[1] = sFontHalfRowLookupTable[(u8)src[0]];
|
||||
dst[2] = sFontHalfRowLookupTable[(u32)src[1] >> 8];
|
||||
dst[3] = sFontHalfRowLookupTable[(u8)src[1]];
|
||||
dst[4] = sFontHalfRowLookupTable[(u32)src[2] >> 8];
|
||||
dst[5] = sFontHalfRowLookupTable[(u8)src[2]];
|
||||
dst[6] = sFontHalfRowLookupTable[(u32)src[3] >> 8];
|
||||
dst[7] = sFontHalfRowLookupTable[(u8)src[3]];
|
||||
dst[8] = sFontHalfRowLookupTable[(u32)src[4] >> 8];
|
||||
dst[9] = sFontHalfRowLookupTable[(u8)src[4]];
|
||||
dst[0] = sFontHalfRowLookupTable[(u32)src[0] >> 8];
|
||||
dst[1] = sFontHalfRowLookupTable[(u8)src[0]];
|
||||
dst[2] = sFontHalfRowLookupTable[(u32)src[1] >> 8];
|
||||
dst[3] = sFontHalfRowLookupTable[(u8)src[1]];
|
||||
dst[4] = sFontHalfRowLookupTable[(u32)src[2] >> 8];
|
||||
dst[5] = sFontHalfRowLookupTable[(u8)src[2]];
|
||||
dst[6] = sFontHalfRowLookupTable[(u32)src[3] >> 8];
|
||||
dst[7] = sFontHalfRowLookupTable[(u8)src[3]];
|
||||
dst[8] = sFontHalfRowLookupTable[(u32)src[4] >> 8];
|
||||
dst[9] = sFontHalfRowLookupTable[(u8)src[4]];
|
||||
dst[10] = sFontHalfRowLookupTable[(u32)src[5] >> 8];
|
||||
dst[11] = sFontHalfRowLookupTable[(u8)src[5]];
|
||||
dst[12] = sFontHalfRowLookupTable[(u32)src[6] >> 8];
|
||||
@@ -303,7 +303,7 @@ void sub_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2, u32 param
|
||||
printer->Unk2C = sub_0201C1B0();
|
||||
}
|
||||
u16 *r6 = printer->Unk2C + param3 * 24 * 8;
|
||||
u16 r2 = (u16)((GetWindowWidth(window) - 3) * 8);
|
||||
u16 r2 = (u16)((GetWindowWidth(window) - 3) * 8);
|
||||
BlitBitmapRectToWindow(window, r6, 0, 0, 24, 32, r2, 0, 24, 32);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ static BOOL timer3_needReset;
|
||||
static vu64 timer3_counter;
|
||||
|
||||
void Init_Timer3() {
|
||||
timer3_counter = 0;
|
||||
timer3_counter = 0;
|
||||
timer3_needReset = FALSE;
|
||||
|
||||
OS_SetTimerControl(OS_TIMER_3, 0);
|
||||
@@ -40,7 +40,7 @@ void CountUpTimer3() {
|
||||
u64 internal_GetTimer3Count() {
|
||||
OSIntrMode intr_mode = OS_DisableInterrupts();
|
||||
|
||||
vu16 timer3 = reg_OS_TM3CNT_L;
|
||||
vu16 timer3 = reg_OS_TM3CNT_L;
|
||||
vu64 counter = timer3_counter & 0x0000ffffffffffff;
|
||||
|
||||
if (reg_OS_IF & OS_IE_TIMER3 && !(timer3 & 0x8000)) {
|
||||
|
||||
@@ -22,7 +22,7 @@ void EnemyTrainerSet_Init(BattleSetup *setup, struct SaveData *save, HeapID heap
|
||||
s32 i;
|
||||
struct String *str;
|
||||
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0559_bin, heapId);
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0559_bin, heapId);
|
||||
rivalName = GetRivalNamePtr(sub_02024EC0(save));
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (setup->trainerId[i] != 0) {
|
||||
@@ -266,7 +266,7 @@ void CreateNPCTrainerParty(BattleSetup *setup, s32 party_id, HeapID heapId) {
|
||||
// state
|
||||
seed_bak = GetLCRNGSeed();
|
||||
Party_InitWithMaxSize(setup->party[party_id], PARTY_SIZE);
|
||||
data = (union TrainerMon *)AllocFromHeap(heapId, sizeof(union TrainerMon) * PARTY_SIZE);
|
||||
data = (union TrainerMon *)AllocFromHeap(heapId, sizeof(union TrainerMon) * PARTY_SIZE);
|
||||
pokemon = AllocMonZeroed(heapId);
|
||||
TrainerData_ReadTrPoke(setup->trainerId[party_id], data);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ extern void NNS_SndPlayerSetPlayerVolume(u32, u8);
|
||||
|
||||
void sub_020040F4(u8 param0) {
|
||||
u8 *ptr = sub_02003D38(5);
|
||||
*ptr = param0;
|
||||
*ptr = param0;
|
||||
}
|
||||
|
||||
u8 sub_02004104(void) {
|
||||
@@ -63,7 +63,7 @@ u8 sub_02004104(void) {
|
||||
|
||||
void sub_02004110(u16 param0) {
|
||||
u16 *ptr = sub_02003D38(9);
|
||||
*ptr = param0;
|
||||
*ptr = param0;
|
||||
|
||||
sub_02004130(0);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ u16 sub_02004124(void) {
|
||||
|
||||
void sub_02004130(u16 param0) {
|
||||
u16 *ptr = sub_02003D38(10);
|
||||
*ptr = param0;
|
||||
*ptr = param0;
|
||||
}
|
||||
|
||||
u16 sub_02004140(void) {
|
||||
@@ -87,15 +87,15 @@ u16 sub_02004140(void) {
|
||||
|
||||
void sub_0200414C(u16 param0) {
|
||||
u16 *ptr = sub_02003D38(31);
|
||||
*ptr = param0;
|
||||
*ptr = param0;
|
||||
}
|
||||
|
||||
void sub_0200415C(u8 param0) {
|
||||
u8 *ptr = sub_02003D38(20);
|
||||
u8 *ptr = sub_02003D38(20);
|
||||
u8 *ptr2 = sub_02003D38(21);
|
||||
|
||||
if (param0 < 51) {
|
||||
*ptr = param0;
|
||||
*ptr = param0;
|
||||
*ptr2 = 0;
|
||||
} else {
|
||||
*ptr2 = param0;
|
||||
@@ -342,7 +342,7 @@ void sub_02004568(int seqNo, u16 param1) {
|
||||
}
|
||||
|
||||
void sub_020045C4(int seqNo, u32 param1) {
|
||||
u8 *ptr = sub_02003D38(18);
|
||||
u8 *ptr = sub_02003D38(18);
|
||||
u16 *ptr2 = sub_02003D38(31);
|
||||
|
||||
if (*ptr != 1 && param1 != 0) {
|
||||
@@ -471,14 +471,14 @@ void sub_020047C8(u8 param0, u8 param1) {
|
||||
int r4;
|
||||
if (param0 == 1) {
|
||||
ptr = sub_02003D38(11);
|
||||
r4 = 0;
|
||||
r4 = 0;
|
||||
} else {
|
||||
if (param0 != 7) {
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = sub_02003D38(12);
|
||||
r4 = 7;
|
||||
r4 = 7;
|
||||
}
|
||||
|
||||
if (param1 == 0) {
|
||||
@@ -490,10 +490,10 @@ void sub_020047C8(u8 param0, u8 param1) {
|
||||
}
|
||||
|
||||
void sub_02004810(void) {
|
||||
u8 *ptr = sub_02003D38(11);
|
||||
u8 *ptr = sub_02003D38(11);
|
||||
u8 *ptr2 = sub_02003D38(12);
|
||||
*ptr = 0;
|
||||
*ptr2 = 0;
|
||||
*ptr = 0;
|
||||
*ptr2 = 0;
|
||||
}
|
||||
|
||||
void GF_SndPlayerMoveVolume(int playerNo, s32 param1, s32 param2) {
|
||||
@@ -589,7 +589,7 @@ u32 GF_MIC_DoSamplingAsync(u32 param0, u32 param1, u32 param2, u32 param3) {
|
||||
|
||||
void *sub_02004930(u32 param0) {
|
||||
GetSoundDataPointer();
|
||||
u8 *ptr = sub_02003D38(15);
|
||||
u8 *ptr = sub_02003D38(15);
|
||||
u8 *ptr2 = sub_02003D38(16);
|
||||
GF_ASSERT(param0 == 14 || param0 == 15);
|
||||
GF_ASSERT(param0 != 14 || *ptr != 0);
|
||||
@@ -604,14 +604,14 @@ void *sub_02004930(u32 param0) {
|
||||
|
||||
BOOL sub_02004984(u32 param0) {
|
||||
GetSoundDataPointer();
|
||||
u8 *ptr = sub_02003D38(15);
|
||||
u8 *ptr = sub_02003D38(15);
|
||||
u8 *ptr2 = sub_02003D38(16);
|
||||
GF_ASSERT(param0 == 14 || param0 == 15);
|
||||
|
||||
if (param0 == 14) {
|
||||
if (*ptr == 0) {
|
||||
u32 *r4 = sub_02003D38(0);
|
||||
*r4 = NNS_SndWaveOutAllocChannel(param0);
|
||||
*r4 = NNS_SndWaveOutAllocChannel(param0);
|
||||
if (*r4 == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -622,7 +622,7 @@ BOOL sub_02004984(u32 param0) {
|
||||
} else {
|
||||
if (*ptr2 == 0) {
|
||||
u32 *r6 = sub_02003D38(1);
|
||||
*r6 = NNS_SndWaveOutAllocChannel(param0);
|
||||
*r6 = NNS_SndWaveOutAllocChannel(param0);
|
||||
if (*r6 == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -638,7 +638,7 @@ BOOL sub_02004984(u32 param0) {
|
||||
|
||||
void sub_02004A04(u32 param0) {
|
||||
GetSoundDataPointer();
|
||||
u8 *ptr = sub_02003D38(15);
|
||||
u8 *ptr = sub_02003D38(15);
|
||||
u8 *ptr2 = sub_02003D38(16);
|
||||
if (param0 != 14 && param0 != 15) {
|
||||
GF_AssertFail();
|
||||
@@ -732,7 +732,7 @@ u32 sub_02004B30(u32 param0, s32 param1, s32 param2, u32 param3, HeapID heapId)
|
||||
|
||||
if (param3 == 14) {
|
||||
void *ptr = AllocFromHeap(heapId, r6);
|
||||
*r4 = ptr;
|
||||
*r4 = ptr;
|
||||
if (ptr == NULL) {
|
||||
GF_AssertFail();
|
||||
return 0;
|
||||
@@ -764,22 +764,22 @@ u32 sub_02004B30(u32 param0, s32 param1, s32 param2, u32 param3, HeapID heapId)
|
||||
u32 ret = sub_02004A6C(&st8, param3);
|
||||
sub_02004AF8(param3, param1);
|
||||
u8 *r0 = sub_02003D38(14);
|
||||
*r0 = 1;
|
||||
*r0 = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sub_02004C1C(u8 *param0, u32 param1) {
|
||||
for (u32 r5 = 0; r5 < param1 / 2; r5++) {
|
||||
u8 r4 = param0[r5];
|
||||
param0[r5] = param0[param1 - 1 - r5];
|
||||
u8 r4 = param0[r5];
|
||||
param0[r5] = param0[param1 - 1 - r5];
|
||||
param0[param1 - 1 - r5] = r4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_02004C3C(u32 param0) {
|
||||
GetSoundDataPointer();
|
||||
u8 *ptr = sub_02003D38(14);
|
||||
u8 *ptr = sub_02003D38(14);
|
||||
void **ptr2 = sub_02003D38(33);
|
||||
|
||||
GF_ASSERT(param0 == 14 || param0 == 15);
|
||||
@@ -815,7 +815,7 @@ void sub_02004CB4(void) {
|
||||
|
||||
MI_CpuFill8(sub_02003D38(4), 0, 0x1c);
|
||||
|
||||
void *r4 = sub_02003D38(3);
|
||||
void *r4 = sub_02003D38(3);
|
||||
void *st8 = sub_02003D38(4);
|
||||
|
||||
NNS_SndCaptureStartEffect(r4, 0x1000, 0, 0x55F0, 2, sub_02005068, st8);
|
||||
@@ -1003,7 +1003,7 @@ void sub_02004F70(
|
||||
s32 r1;
|
||||
int i, j;
|
||||
u32 r12 = sub_02004F28(1, param0, param3);
|
||||
r1 = (s32)r12 - 100;
|
||||
r1 = (s32)r12 - 100;
|
||||
if (r1 < 0) {
|
||||
r1 = 0;
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ void sub_02004F70(
|
||||
void sub_02005068(s16 *param0, s16 *param1, u32 param2, u32 param3, void *param4) {
|
||||
s16 st10[8][2];
|
||||
s16(*st0)[2] = param4;
|
||||
u8 *r7 = sub_02003D38(19);
|
||||
u8 *r7 = sub_02003D38(19);
|
||||
|
||||
int r0;
|
||||
int i, j;
|
||||
|
||||
@@ -30,7 +30,7 @@ u32 sub_020051F4(u16 param0) {
|
||||
}
|
||||
|
||||
u32 sub_0200521C(u16 param0) {
|
||||
u8 r4 = sub_020048D0(param0);
|
||||
u8 r4 = sub_020048D0(param0);
|
||||
int playerNo = sub_02004018(r4);
|
||||
|
||||
u32 ret;
|
||||
@@ -238,7 +238,7 @@ void sub_0200554C(u32 param0) {
|
||||
}
|
||||
|
||||
u32 sub_02005578(u16 species) {
|
||||
u8 *r4 = sub_02003D38(17);
|
||||
u8 *r4 = sub_02003D38(17);
|
||||
struct SaveChatotSoundClip **r0 = sub_02003D38(35);
|
||||
|
||||
if (species != SPECIES_CHATOT) {
|
||||
@@ -311,8 +311,8 @@ u32 sub_020056AC(u32 param0, u16 param1, s32 param2, s32 param3, HeapID heapId)
|
||||
s32 st1c, st18;
|
||||
u8 *st14 = sub_02003D38(15);
|
||||
u8 *st10 = sub_02003D38(16);
|
||||
u8 *r4 = sub_02003D38(17);
|
||||
u8 *stc = sub_02003D38(29);
|
||||
u8 *r4 = sub_02003D38(17);
|
||||
u8 *stc = sub_02003D38(29);
|
||||
sub_02003D38(35);
|
||||
|
||||
st1c = 64 + (param2 / 2);
|
||||
@@ -502,7 +502,7 @@ void sub_02005AE0(u32 param0, HeapID heapId) {
|
||||
ptr[0] = param0;
|
||||
u32 r0 = (u32)SysTask_CreateOnMainQueue((SysTaskFunc)sub_02005B2C, (void *)ptr, 0); // TODO: fix this func
|
||||
ptr[1] = r0;
|
||||
*r6 = r0;
|
||||
*r6 = r0;
|
||||
}
|
||||
|
||||
void sub_02005B2C(SysTask *task, s32 *param1) {
|
||||
|
||||
@@ -304,12 +304,12 @@ extern void NNS_G2dDrawSpriteFast(s16 param0,
|
||||
|
||||
struct UnkStruct_02006D98 *sub_02006D98(HeapID heapId) {
|
||||
struct UnkStruct_02006D98 *ptr = AllocFromHeap(heapId, sizeof(struct UnkStruct_02006D98));
|
||||
ptr->heapId = heapId;
|
||||
ptr->unk2E0 = 0;
|
||||
ptr->unk29C = 0;
|
||||
ptr->unk2A0 = 0x8000;
|
||||
ptr->unk2A4 = 0;
|
||||
ptr->unk2A8 = 0x80;
|
||||
ptr->heapId = heapId;
|
||||
ptr->unk2E0 = 0;
|
||||
ptr->unk29C = 0;
|
||||
ptr->unk2A0 = 0x8000;
|
||||
ptr->unk2A4 = 0;
|
||||
ptr->unk2A8 = 0x80;
|
||||
|
||||
ptr->unk2AC = AllocFromHeap(heapId, 0x8000);
|
||||
|
||||
@@ -332,10 +332,10 @@ struct UnkStruct_02006D98 *sub_02006D98(HeapID heapId) {
|
||||
NNSG2dCharacterData *stc;
|
||||
NNS_G2dGetUnpackedCharacterData(st4, &stc);
|
||||
|
||||
ptr->unk2B8.pixelFmt = stc->pixelFmt;
|
||||
ptr->unk2B8.mapingType = stc->mapingType;
|
||||
ptr->unk2B8.pixelFmt = stc->pixelFmt;
|
||||
ptr->unk2B8.mapingType = stc->mapingType;
|
||||
ptr->unk2B8.characterFmt = stc->characterFmt;
|
||||
st8 = stc->pRawData;
|
||||
st8 = stc->pRawData;
|
||||
|
||||
sub_02008A74(st8);
|
||||
MI_CpuFill8(ptr->unk2AC, *st8, 0x8000);
|
||||
@@ -423,11 +423,11 @@ void sub_02006ED4(struct UnkStruct_02006D98 *param0) {
|
||||
0);
|
||||
|
||||
if (param0->unk000[st18].unk54_1 != 0) {
|
||||
int r6 = param0->unk000[st18].unk44 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][0];
|
||||
int r6 = param0->unk000[st18].unk44 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][0];
|
||||
int r12 = param0->unk000[st18].unk46;
|
||||
int r1 = param0->unk000[st18].unk45 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][1];
|
||||
int r7 = param0->unk000[st18].unk47;
|
||||
int r0 = r12 + r6;
|
||||
int r1 = param0->unk000[st18].unk45 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][1];
|
||||
int r7 = param0->unk000[st18].unk47;
|
||||
int r0 = r12 + r6;
|
||||
|
||||
NNS_G2dDrawSpriteFast((s16)(param0->unk000[st18].unk24 - 40 + param0->unk000[st18].unk44 + param0->unk000[st18].unk2C),
|
||||
(s16)(param0->unk000[st18].unk26 - 40 + param0->unk000[st18].unk45 + param0->unk000[st18].unk2E - param0->unk000[st18].unk6C.unk2),
|
||||
@@ -565,23 +565,23 @@ struct UnkStruct_02006D98_2 *sub_020073E8(struct UnkStruct_02006D98 *param0,
|
||||
param0->unk000[param6].unk00_8 = 1;
|
||||
param0->unk000[param6].unk00_1 = param5;
|
||||
|
||||
param0->unk000[param6].unk04 = *param1;
|
||||
param0->unk000[param6].unk14 = *param1;
|
||||
param0->unk000[param6].unk24 = (s16)param2;
|
||||
param0->unk000[param6].unk26 = (s16)param3;
|
||||
param0->unk000[param6].unk28 = param4;
|
||||
param0->unk000[param6].unk34 = 0x100;
|
||||
param0->unk000[param6].unk36 = 0x100;
|
||||
param0->unk000[param6].unk54_2 = 0x1f;
|
||||
param0->unk000[param6].unk50_0 = 0x1f;
|
||||
param0->unk000[param6].unk50_5 = 0x1f;
|
||||
param0->unk000[param6].unk50_a = 0x1f;
|
||||
param0->unk000[param6].unk50_f = 0x10;
|
||||
param0->unk000[param6].unk50_14 = 0x10;
|
||||
param0->unk000[param6].unk50_19 = 0x10;
|
||||
param0->unk000[param6].unk68 = param8;
|
||||
param0->unk000[param6].unk6C.unk4 = (s16)param2;
|
||||
param0->unk000[param6].unk6C.unk6 = (s16)param3;
|
||||
param0->unk000[param6].unk04 = *param1;
|
||||
param0->unk000[param6].unk14 = *param1;
|
||||
param0->unk000[param6].unk24 = (s16)param2;
|
||||
param0->unk000[param6].unk26 = (s16)param3;
|
||||
param0->unk000[param6].unk28 = param4;
|
||||
param0->unk000[param6].unk34 = 0x100;
|
||||
param0->unk000[param6].unk36 = 0x100;
|
||||
param0->unk000[param6].unk54_2 = 0x1f;
|
||||
param0->unk000[param6].unk50_0 = 0x1f;
|
||||
param0->unk000[param6].unk50_5 = 0x1f;
|
||||
param0->unk000[param6].unk50_a = 0x1f;
|
||||
param0->unk000[param6].unk50_f = 0x10;
|
||||
param0->unk000[param6].unk50_14 = 0x10;
|
||||
param0->unk000[param6].unk50_19 = 0x10;
|
||||
param0->unk000[param6].unk68 = param8;
|
||||
param0->unk000[param6].unk6C.unk4 = (s16)param2;
|
||||
param0->unk000[param6].unk6C.unk6 = (s16)param3;
|
||||
param0->unk000[param6].unk6C.unk0_2 = 1;
|
||||
param0->unk000[param6].unk6C.unk0_3 = 1;
|
||||
param0->unk000[param6].unk6C.unk0_4 = 1;
|
||||
@@ -700,15 +700,15 @@ void sub_02007558(struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2) {
|
||||
param0->unk00_8 = 1;
|
||||
break;
|
||||
case 31:
|
||||
param0->unk4C = param2;
|
||||
param0->unk4C = param2;
|
||||
param0->unk00_8 = 1;
|
||||
break;
|
||||
case 32:
|
||||
param0->unk48 = (u8)param2;
|
||||
param0->unk48 = (u8)param2;
|
||||
param0->unk00_8 = 1;
|
||||
break;
|
||||
case 33:
|
||||
param0->unk49 = (u8)param2;
|
||||
param0->unk49 = (u8)param2;
|
||||
param0->unk00_8 = 1;
|
||||
break;
|
||||
case 34:
|
||||
@@ -737,7 +737,7 @@ void sub_02007558(struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2) {
|
||||
break;
|
||||
case 42:
|
||||
param0->unk6C.unk0_0 = (u16)param2;
|
||||
param0->unk00_8 = 1;
|
||||
param0->unk00_8 = 1;
|
||||
break;
|
||||
case 43:
|
||||
param0->unk6C.unk0_2 = (u16)param2;
|
||||
@@ -1054,20 +1054,20 @@ void sub_020079E0(struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2) {
|
||||
void sub_02007E40(
|
||||
struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2, u32 param3, u32 param4) {
|
||||
param0->unk54_1 = 1;
|
||||
param0->unk44 = (u8)param1;
|
||||
param0->unk45 = (u8)param2;
|
||||
param0->unk46 = (u8)param3;
|
||||
param0->unk47 = (u8)param4;
|
||||
param0->unk44 = (u8)param1;
|
||||
param0->unk45 = (u8)param2;
|
||||
param0->unk46 = (u8)param3;
|
||||
param0->unk47 = (u8)param4;
|
||||
}
|
||||
|
||||
void sub_02007E68(
|
||||
struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2, u32 param3, u32 param4) {
|
||||
param0->unk54_C = 1;
|
||||
param0->unk48 = (u8)param1;
|
||||
param0->unk49 = (u8)param2;
|
||||
param0->unk4A = 0;
|
||||
param0->unk4B = (u8)param3;
|
||||
param0->unk4C = param4;
|
||||
param0->unk48 = (u8)param1;
|
||||
param0->unk49 = (u8)param2;
|
||||
param0->unk4A = 0;
|
||||
param0->unk4B = (u8)param3;
|
||||
param0->unk4C = param4;
|
||||
}
|
||||
|
||||
void sub_02007E98(
|
||||
@@ -1078,21 +1078,21 @@ void sub_02007E98(
|
||||
}
|
||||
|
||||
param0->unk000[i].unk54_C = 1;
|
||||
param0->unk000[i].unk48 = (u8)param1;
|
||||
param0->unk000[i].unk49 = (u8)param2;
|
||||
param0->unk000[i].unk4A = 0;
|
||||
param0->unk000[i].unk4B = (u8)param3;
|
||||
param0->unk000[i].unk4C = param4;
|
||||
param0->unk000[i].unk48 = (u8)param1;
|
||||
param0->unk000[i].unk49 = (u8)param2;
|
||||
param0->unk000[i].unk4A = 0;
|
||||
param0->unk000[i].unk4B = (u8)param3;
|
||||
param0->unk000[i].unk4C = param4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_02007EEC(struct UnkStruct_02006D98_2 *param0) {
|
||||
param0->unk54_C = 0;
|
||||
param0->unk48 = 0;
|
||||
param0->unk49 = 0;
|
||||
param0->unk4A = 0;
|
||||
param0->unk4B = 0;
|
||||
param0->unk4C = 0;
|
||||
param0->unk48 = 0;
|
||||
param0->unk49 = 0;
|
||||
param0->unk4A = 0;
|
||||
param0->unk4B = 0;
|
||||
param0->unk4C = 0;
|
||||
param0->unk00_8 = 1;
|
||||
}
|
||||
|
||||
@@ -1189,8 +1189,8 @@ void sub_020080E0(struct UnkStruct_02006D98_2 *param0) {
|
||||
}
|
||||
|
||||
void sub_0200813C(struct UnkStruct_02006D98_2 *param0) {
|
||||
param0->unk04 = param0->unk14;
|
||||
param0->unk6C = param0->unk78;
|
||||
param0->unk04 = param0->unk14;
|
||||
param0->unk6C = param0->unk78;
|
||||
param0->unk00_7 = 1;
|
||||
param0->unk00_8 = 1;
|
||||
}
|
||||
@@ -1214,9 +1214,9 @@ void sub_020081C4(struct UnkStruct_02006D98 *param0) {
|
||||
param0->unk2E1 = 0;
|
||||
NNS_G2dInitImageProxy(¶m0->unk260);
|
||||
|
||||
param0->unk2B8.H = 0x20;
|
||||
param0->unk2B8.W = 0x20;
|
||||
param0->unk2B8.szByte = param0->unk2A0;
|
||||
param0->unk2B8.H = 0x20;
|
||||
param0->unk2B8.W = 0x20;
|
||||
param0->unk2B8.szByte = param0->unk2A0;
|
||||
param0->unk2B8.pRawData = param0->unk2AC;
|
||||
|
||||
NNS_G2dLoadImage2DMapping(
|
||||
@@ -1227,7 +1227,7 @@ void sub_020081C4(struct UnkStruct_02006D98 *param0) {
|
||||
param0->unk2E2 = 0;
|
||||
NNS_G2dInitImagePaletteProxy(¶m0->unk284);
|
||||
|
||||
param0->unk2D0.szByte = param0->unk2A8;
|
||||
param0->unk2D0.szByte = param0->unk2A8;
|
||||
param0->unk2D0.pRawData = param0->unk2B0;
|
||||
|
||||
NNS_G2dLoadPalette(
|
||||
@@ -1264,13 +1264,13 @@ void sub_020082A8(struct UnkStruct_02006D98 *param0) {
|
||||
for (st54 = 0; st54 < 4; st54++) {
|
||||
if (param0->unk000[st54].unk00_0 != 0 && param0->unk000[st54].unk00_7 != 0) {
|
||||
param0->unk000[st54].unk00_7 = 0;
|
||||
st48 = 1;
|
||||
st4c = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st54].unk04.field_00,
|
||||
st48 = 1;
|
||||
st4c = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st54].unk04.field_00,
|
||||
param0->unk000[st54].unk04.field_02,
|
||||
param0->heapId);
|
||||
NNS_G2dGetUnpackedCharacterData(st4c, &st58);
|
||||
param0->unk2B8.pixelFmt = st58->pixelFmt;
|
||||
param0->unk2B8.mapingType = st58->mapingType;
|
||||
param0->unk2B8.pixelFmt = st58->pixelFmt;
|
||||
param0->unk2B8.mapingType = st58->mapingType;
|
||||
param0->unk2B8.characterFmt = st58->characterFmt;
|
||||
|
||||
st50 = st58->pRawData;
|
||||
@@ -1371,13 +1371,13 @@ void sub_020086F4(struct UnkStruct_02006D98 *param0) {
|
||||
for (st14 = 0; st14 < 4; st14++) {
|
||||
if (param0->unk000[st14].unk00_0 != 0 && param0->unk000[st14].unk00_8 != 0) {
|
||||
param0->unk000[st14].unk00_8 = 0;
|
||||
stc = 1;
|
||||
st10 = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st14].unk04.field_00,
|
||||
stc = 1;
|
||||
st10 = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st14].unk04.field_00,
|
||||
param0->unk000[st14].unk04.field_04,
|
||||
param0->heapId);
|
||||
NNS_G2dGetUnpackedPaletteData(st10, &st18);
|
||||
param0->unk2D0.fmt = st18->fmt;
|
||||
r1 = st18->pRawData;
|
||||
r1 = st18->pRawData;
|
||||
for (r7 = 0; r7 < 0x10; r7++) {
|
||||
param0->unk2B0[st14 * 0x10 + r7] = r1[r7];
|
||||
param0->unk2B4[st14 * 0x10 + r7] = r1[r7];
|
||||
@@ -1400,7 +1400,7 @@ void sub_020086F4(struct UnkStruct_02006D98 *param0) {
|
||||
|
||||
if (param0->unk000[st14].unk00_0 != 0 && param0->unk000[st14].unk54_C != 0) {
|
||||
if (param0->unk000[st14].unk4A == 0) {
|
||||
stc = 1;
|
||||
stc = 1;
|
||||
param0->unk000[st14].unk4A = param0->unk000[st14].unk4B;
|
||||
BlendPalette(param0->unk2B4 + st14 * 0x10,
|
||||
param0->unk2B0 + st14 * 0x10,
|
||||
@@ -1453,7 +1453,7 @@ void sub_02008904(u8 *param0, u32 param1, u32 param2) {
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
st10 = UNK_02105AE8[i];
|
||||
r1 = 0;
|
||||
r1 = 0;
|
||||
while (st10[r1].unk0 != 0xff) {
|
||||
r0 = (u8)(st10[r1].unk0 + ((param1 & 0xf) - 8));
|
||||
r4 = (u8)(st10[r1].unk1 + (((param1 & 0xf0) >> 4) - 8));
|
||||
@@ -1478,7 +1478,7 @@ void sub_02008904(u8 *param0, u32 param1, u32 param2) {
|
||||
if (param2 != 0) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
st10 = UNK_02105AE8[i];
|
||||
r1 = 0;
|
||||
r1 = 0;
|
||||
while (st10[r1].unk0 != 0xff) {
|
||||
r0 = (u8)(st10[r1].unk0 - 14 + ((param1 & 0xf) - 8) + 0x50);
|
||||
r4 = (u8)(st10[r1].unk1 + (((param1 & 0xf0) >> 4) - 8));
|
||||
|
||||
@@ -34,7 +34,7 @@ void sub_02008AA4(struct UnkStruct_0200BB14_sub *param0,
|
||||
struct UnkStruct_02008DEC_sub *st10;
|
||||
|
||||
struct UnkStruct_02008DEC_sub *stc = NULL;
|
||||
struct UnkStruct_02008DEC_sub *r4 = NULL;
|
||||
struct UnkStruct_02008DEC_sub *r4 = NULL;
|
||||
struct UnkStruct_02008DEC_sub *st8 = NULL;
|
||||
|
||||
GF_ASSERT(param9);
|
||||
@@ -117,8 +117,8 @@ struct UnkStruct_02008AA4_1 *sub_02008BE0(struct UnkStruct_02008AA4_2 *param0,
|
||||
}
|
||||
|
||||
struct UnkStruct_02008AA4_1 *r6 = AllocFromHeap(heapId, sizeof(struct UnkStruct_02008AA4_1));
|
||||
r6->unk00 = AllocFromHeap(heapId, r4 * sizeof(struct UnkStruct_0200BB14_sub));
|
||||
r6->unk04 = r4;
|
||||
r6->unk00 = AllocFromHeap(heapId, r4 * sizeof(struct UnkStruct_0200BB14_sub));
|
||||
r6->unk04 = r4;
|
||||
|
||||
for (int r7 = 0; r7 < r6->unk04; r7++) {
|
||||
sub_02008AA4(&r6->unk00[r7],
|
||||
|
||||
@@ -35,8 +35,8 @@ extern s32 NNS_G2dGetImagePaletteLocation(u32, u32);
|
||||
|
||||
struct UnkStruct_02008DEC_1 *sub_02008DEC(u32 param0, s32 param1, HeapID heapId) {
|
||||
struct UnkStruct_02008DEC_1 *ptr = AllocFromHeap(heapId, sizeof(struct UnkStruct_02008DEC_1));
|
||||
ptr->unk00 = sub_02020C44(param0, heapId);
|
||||
ptr->unk04 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub));
|
||||
ptr->unk00 = sub_02020C44(param0, heapId);
|
||||
ptr->unk04 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub));
|
||||
memset(ptr->unk04, 0, param0 * sizeof(struct UnkStruct_02008DEC_sub));
|
||||
ptr->unk08 = (s32)param0;
|
||||
ptr->unk0C = 0;
|
||||
@@ -226,8 +226,8 @@ void sub_02009168(struct UnkStruct_02008DEC_1 *param0,
|
||||
GF_ASSERT(param1);
|
||||
GF_ASSERT(param1->unk04 == 1);
|
||||
|
||||
s32 r6 = sub_02009530(param1);
|
||||
u32 r7 = sub_020095E4(param1);
|
||||
s32 r6 = sub_02009530(param1);
|
||||
u32 r7 = sub_020095E4(param1);
|
||||
u32 st24 = sub_02009610(param1);
|
||||
sub_02009490(param0, param1);
|
||||
|
||||
@@ -360,9 +360,9 @@ void sub_020093DC(struct UnkStruct_02008DEC_1 *param0,
|
||||
|
||||
struct UnkStruct_02008DEC_5 *sub_02009424(s32 param0, HeapID heapId) {
|
||||
struct UnkStruct_02008DEC_5 *r4 = AllocFromHeap(heapId, sizeof(struct UnkStruct_02008DEC_5));
|
||||
r4->unk00 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub *));
|
||||
r4->unk04 = param0;
|
||||
r4->unk08 = 0;
|
||||
r4->unk00 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub *));
|
||||
r4->unk04 = param0;
|
||||
r4->unk08 = 0;
|
||||
|
||||
return r4;
|
||||
}
|
||||
@@ -524,7 +524,7 @@ void sub_020096B4(struct UnkStruct_02008DEC_2 *param0) {
|
||||
FreeToHeap(param0->unk00_4);
|
||||
}
|
||||
param0->unk00_4 = NULL;
|
||||
param0->unk04 = 0;
|
||||
param0->unk04 = 0;
|
||||
}
|
||||
|
||||
s32 sub_020096CC(struct UnkStruct_02008DEC_2 *param0) {
|
||||
@@ -719,7 +719,7 @@ void sub_02009978(struct UnkStruct_02008DEC_1 *param0,
|
||||
u32 param8,
|
||||
HeapID heapId,
|
||||
BOOL param10) {
|
||||
void *r1 = GfGfxLoader_LoadFromNarc(param2, param3, param4, heapId, param10);
|
||||
void *r1 = GfGfxLoader_LoadFromNarc(param2, param3, param4, heapId, param10);
|
||||
param1->unk00 = sub_02020CD4(param0->unk00, r1, param5);
|
||||
param1->unk04 = param8;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ void sub_0200BD04(u32 *param0) {
|
||||
|
||||
BOOL sub_0200BD20(
|
||||
struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1, const char **param2) {
|
||||
s32 st14 = 6;
|
||||
s32 st14 = 6;
|
||||
const char **st10 = param2;
|
||||
|
||||
if (param0 == NULL || param1 == NULL) {
|
||||
@@ -221,12 +221,12 @@ BOOL sub_0200BD20(
|
||||
}
|
||||
|
||||
param1->unk54 = st14;
|
||||
u32 r2 = sub_0200965C();
|
||||
u32 r2 = sub_0200965C();
|
||||
param1->unk08 = AllocFromHeap(param0->heapId, r2 * st14);
|
||||
|
||||
for (s32 i = 0; i < st14; i++) {
|
||||
struct UnkStruct_02008DEC_2 *st18 = sub_02009660(param1->unk08, i);
|
||||
void *st1c = AllocAndReadFile(param0->heapId, st10[i]);
|
||||
void *st1c = AllocAndReadFile(param0->heapId, st10[i]);
|
||||
|
||||
sub_02009668(st1c, st18, param0->heapId);
|
||||
FreeToHeap(st1c);
|
||||
@@ -238,14 +238,14 @@ BOOL sub_0200BD20(
|
||||
|
||||
for (s32 i = 0; i < st14; i++) {
|
||||
struct UnkStruct_02008DEC_2 *st20 = sub_02009660(param1->unk08, i);
|
||||
param1->unk24[i] = sub_02009424(sub_020096CC(st20), param0->heapId);
|
||||
param1->unk3c[i] = sub_020093A8(param1->unk0c[i], st20, param1->unk24[i], param0->heapId);
|
||||
param1->unk24[i] = sub_02009424(sub_020096CC(st20), param0->heapId);
|
||||
param1->unk3c[i] = sub_020093A8(param1->unk0c[i], st20, param1->unk24[i], param0->heapId);
|
||||
}
|
||||
|
||||
sub_02009A90(param1->unk24[0]);
|
||||
sub_02009D34(param1->unk24[1]);
|
||||
struct UnkStruct_02008AA4_2 *r6 = AllocAndReadFile(param0->heapId, st10[6]);
|
||||
param1->unk04 = sub_02008BE0(r6,
|
||||
param1->unk04 = sub_02008BE0(r6,
|
||||
param0->heapId,
|
||||
param1->unk0c[0],
|
||||
param1->unk0c[1],
|
||||
@@ -473,7 +473,7 @@ struct UnkStruct_0200BB14_5 *sub_0200C154(
|
||||
}
|
||||
|
||||
ptr->unk08->unk0 = AllocFromHeap(param0->heapId, sizeof(struct UnkStruct_0200BB14_sub));
|
||||
ptr->unk04 = ptr->unk08->unk0;
|
||||
ptr->unk04 = ptr->unk08->unk0;
|
||||
if (ptr->unk08->unk0 == NULL) {
|
||||
if (ptr->unk08 != NULL) {
|
||||
FreeToHeap(ptr->unk08);
|
||||
|
||||
@@ -50,18 +50,18 @@ void FontData_Init(struct FontData *ptr, NarcId narcId, s32 fileId, BOOL unk, He
|
||||
NARC_ReadFromMember(ptr->narc, (u32)fileId, 0, 16, &ptr->gfxHeader);
|
||||
ptr->isFixedWidthFont = unk;
|
||||
if (unk) {
|
||||
ptr->glyphWidths = NULL;
|
||||
ptr->glyphWidths = NULL;
|
||||
ptr->glyphWidthFunc = GetGlyphWidth_FixedWidth;
|
||||
} else {
|
||||
GF_ASSERT(ptr->gfxHeader.widthDataStart != 0);
|
||||
ptr->glyphWidths = AllocFromHeap(heapId, ptr->gfxHeader.numGlyphs);
|
||||
ptr->glyphWidths = AllocFromHeap(heapId, ptr->gfxHeader.numGlyphs);
|
||||
ptr->glyphWidthFunc = GetGlyphWidth_VariableWidth;
|
||||
NARC_ReadFromMember(ptr->narc, (u32)fileId, ptr->gfxHeader.widthDataStart, ptr->gfxHeader.numGlyphs, ptr->glyphWidths);
|
||||
}
|
||||
GF_ASSERT(ptr->gfxHeader.glyphWidth <= 2 && ptr->gfxHeader.glyphHeight <= 2);
|
||||
ptr->glyphShape = sGlyphShapes[ptr->gfxHeader.glyphWidth - 1][ptr->gfxHeader.glyphHeight - 1];
|
||||
ptr->glyphSize = (u32)(16 * ptr->gfxHeader.glyphWidth * ptr->gfxHeader.glyphHeight);
|
||||
ptr->fileId = (u32)fileId;
|
||||
ptr->glyphSize = (u32)(16 * ptr->gfxHeader.glyphWidth * ptr->gfxHeader.glyphHeight);
|
||||
ptr->fileId = (u32)fileId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ void InitFontResources(struct FontData *ptr, u32 a1, HeapID heapId) {
|
||||
}
|
||||
|
||||
void InitFontResources_FromPreloaded(struct FontData *ptr, HeapID heapId) {
|
||||
u32 r4 = ptr->glyphSize * ptr->gfxHeader.numGlyphs;
|
||||
ptr->narcReadBuf = AllocFromHeap(heapId, r4);
|
||||
u32 r4 = ptr->glyphSize * ptr->gfxHeader.numGlyphs;
|
||||
ptr->narcReadBuf = AllocFromHeap(heapId, r4);
|
||||
ptr->uncompGlyphFunc = DecompressGlyphTiles_FromPreloaded;
|
||||
NARC_ReadFromMember(ptr->narc, ptr->fileId, ptr->gfxHeader.headerSize, r4, ptr->narcReadBuf);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ void TryLoadGlyph(struct FontData *ptr, u32 param1, struct UnkStruct_02002C14_su
|
||||
if (param1 <= ptr->gfxHeader.numGlyphs) {
|
||||
ptr->uncompGlyphFunc(ptr, (u16)(param1 - 1), ptr2);
|
||||
} else {
|
||||
ptr2->width = 0;
|
||||
ptr2->width = 0;
|
||||
ptr2->height = 0;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void DecompressGlyphTiles_FromPreloaded(struct FontData *ptr, u16 param1, struct
|
||||
DecompressGlyphTile((void *)(r4 + 0x30), (void *)(param2->buf + 0x60));
|
||||
break;
|
||||
}
|
||||
param2->width = (u8)ptr->glyphWidthFunc(ptr, param1);
|
||||
param2->width = (u8)ptr->glyphWidthFunc(ptr, param1);
|
||||
param2->height = ptr->gfxHeader.fixedHeight;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ void DecompressGlyphTiles_LazyFromNarc(struct FontData *ptr, u16 param1, struct
|
||||
DecompressGlyphTile((void *)(ptr->glyphReadBuf + 0x30), (void *)(param2->buf + 0x60));
|
||||
break;
|
||||
}
|
||||
param2->width = (u8)ptr->glyphWidthFunc(ptr, param1);
|
||||
param2->width = (u8)ptr->glyphWidthFunc(ptr, param1);
|
||||
param2->height = ptr->gfxHeader.fixedHeight;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ int GetGlyphWidth_FixedWidth(struct FontData *ptr, int a1) {
|
||||
|
||||
s32 GetStringWidthMultiline(struct FontData *r7, const u16 *arr, u32 r6) {
|
||||
s32 ret = 0;
|
||||
u32 r4 = 0;
|
||||
u32 r4 = 0;
|
||||
while (*arr != EOS) {
|
||||
if (*arr == EXT_CTRL_CODE_BEGIN) {
|
||||
arr = MsgArray_SkipControlCode(arr);
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
struct String *String_New(u32 length, HeapID heapId) {
|
||||
struct String *ret = AllocFromHeap(heapId, length * 2 + 10);
|
||||
if (ret != NULL) {
|
||||
ret->magic = STR16_MAGIC;
|
||||
ret->magic = STR16_MAGIC;
|
||||
ret->maxsize = (u16)length;
|
||||
ret->size = 0;
|
||||
ret->size = 0;
|
||||
ret->data[0] = EOS;
|
||||
}
|
||||
return ret;
|
||||
@@ -25,7 +25,7 @@ void String_Delete(struct String *str) {
|
||||
|
||||
void String_SetEmpty(struct String *str) {
|
||||
ASSERT_STR16(str);
|
||||
str->size = 0;
|
||||
str->size = 0;
|
||||
str->data[0] = EOS;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print
|
||||
String_SetEmpty(str);
|
||||
if (isNegative) {
|
||||
num *= -1;
|
||||
u16 hyphen = (u16)((whichCharset == 0) ? 0x00F1 : 0x01BE);
|
||||
u16 hyphen = (u16)((whichCharset == 0) ? 0x00F1 : 0x01BE);
|
||||
str->data[str->size++] = hyphen;
|
||||
}
|
||||
u32 dividend = sPowersOfTen[ndigits - 1];
|
||||
@@ -89,14 +89,14 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print
|
||||
u16 digit = (u16)(num / dividend);
|
||||
num -= dividend * digit;
|
||||
if (printingMode == PRINTING_MODE_LEADING_ZEROS) {
|
||||
u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2);
|
||||
u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2);
|
||||
str->data[str->size++] = value;
|
||||
} else if (digit != 0 || dividend == 1) {
|
||||
printingMode = PRINTING_MODE_LEADING_ZEROS;
|
||||
u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2);
|
||||
printingMode = PRINTING_MODE_LEADING_ZEROS;
|
||||
u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2);
|
||||
str->data[str->size++] = value;
|
||||
} else if (printingMode == PRINTING_MODE_RIGHT_ALIGN) {
|
||||
u16 value = (u16)((whichCharset == 0) ? 0x0001 : 0x01E2);
|
||||
u16 value = (u16)((whichCharset == 0) ? 0x0001 : 0x01E2);
|
||||
str->data[str->size++] = value;
|
||||
}
|
||||
dividend /= 10;
|
||||
@@ -108,7 +108,7 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print
|
||||
}
|
||||
|
||||
s64 String_atoi(struct String *str, BOOL *flag) {
|
||||
s64 ret = 0;
|
||||
s64 ret = 0;
|
||||
s64 pow10 = 1;
|
||||
if (str->size > 18) {
|
||||
return 0;
|
||||
@@ -252,7 +252,7 @@ void StrAddChar(struct String *str, u16 val) {
|
||||
|
||||
if (str->size + 1 < str->maxsize) {
|
||||
str->data[str->size++] = val;
|
||||
str->data[str->size] = EOS;
|
||||
str->data[str->size] = EOS;
|
||||
return;
|
||||
}
|
||||
GF_ASSERT(0);
|
||||
@@ -276,10 +276,10 @@ BOOL String_IsTrainerName(struct String *string) {
|
||||
|
||||
void StringCat_HandleTrainerName(struct String *dest, struct String *src) {
|
||||
if (String_IsTrainerName(src)) {
|
||||
u16 *dest_p = &dest->data[dest->size];
|
||||
u16 *src_p = &src->data[1];
|
||||
s32 bit = 0;
|
||||
u32 outsize = 0;
|
||||
u16 *dest_p = &dest->data[dest->size];
|
||||
u16 *src_p = &src->data[1];
|
||||
s32 bit = 0;
|
||||
u32 outsize = 0;
|
||||
u16 cur_char = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
@@ -11,10 +11,10 @@ struct UnkStruct_020220C4 *sub_020220C4(u8 *a0, u32 a1, void (*a2)(s32, s32, u32
|
||||
GF_ASSERT(a1 != 0);
|
||||
ret = AllocFromHeap(heapId, sizeof(struct UnkStruct_020220C4));
|
||||
if (ret != NULL) {
|
||||
ret->field_0 = a0;
|
||||
ret->field_4 = a1;
|
||||
ret->field_8 = a2;
|
||||
ret->field_C = a3;
|
||||
ret->field_0 = a0;
|
||||
ret->field_4 = a1;
|
||||
ret->field_8 = a2;
|
||||
ret->field_C = a3;
|
||||
ret->field_10 = AllocFromHeap(heapId, a1 * sizeof(struct UnkStruct_020220C4_sub));
|
||||
if (ret->field_10 != NULL) {
|
||||
for (i = 0; i < a1; i++) {
|
||||
|
||||
@@ -40,10 +40,10 @@ void sub_02022450() {
|
||||
SetBakRomCode(ROM_CODE_ADAJ_BE);
|
||||
}
|
||||
FSArchive *const r0 = FS_FindArchive(arc_name, 3);
|
||||
r0->fat = card_header_buffer->fat.offset;
|
||||
r0->fat_size = card_header_buffer->fat.length;
|
||||
r0->fnt = card_header_buffer->fnt.offset;
|
||||
r0->fnt_size = card_header_buffer->fnt.length;
|
||||
r0->fat = card_header_buffer->fat.offset;
|
||||
r0->fat_size = card_header_buffer->fat.length;
|
||||
r0->fnt = card_header_buffer->fnt.offset;
|
||||
r0->fnt_size = card_header_buffer->fnt.length;
|
||||
if (GetBakRomCode() != ROM_CODE_ADAJ_BE || GetBakRomMaker() != MAKER_CODE_01_BE) {
|
||||
OS_Terminate();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user