Fixed braces style
This commit is contained in:
parent
6c96641035
commit
8cab1b7094
9 changed files with 71 additions and 35 deletions
|
@ -55,18 +55,24 @@ void *AllocInternal(void *heapStart, u32 size)
|
|||
if (size & 3)
|
||||
size = 4 * ((size / 4) + 1);
|
||||
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
// Loop through the blocks looking for unused block that's big enough.
|
||||
|
||||
if (!pos->flag) {
|
||||
if (!pos->flag)
|
||||
{
|
||||
foundBlockSize = pos->size;
|
||||
|
||||
if (foundBlockSize >= size) {
|
||||
if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) {
|
||||
if (foundBlockSize >= size)
|
||||
{
|
||||
if (foundBlockSize - size < 2 * sizeof(struct MemBlock))
|
||||
{
|
||||
// The block isn't much bigger than the requested size,
|
||||
// so just use it.
|
||||
pos->flag = TRUE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// The block is significantly bigger than the requested
|
||||
// size, so split the rest into a separate block.
|
||||
foundBlockSize -= sizeof(struct MemBlock);
|
||||
|
@ -98,15 +104,18 @@ void *AllocInternal(void *heapStart, u32 size)
|
|||
|
||||
void FreeInternal(void *heapStart, void *pointer)
|
||||
{
|
||||
if (pointer) {
|
||||
if (pointer)
|
||||
{
|
||||
struct MemBlock *head = (struct MemBlock *)heapStart;
|
||||
struct MemBlock *block = (struct MemBlock *)((u8 *)pointer - sizeof(struct MemBlock));
|
||||
block->flag = FALSE;
|
||||
|
||||
// If the freed block isn't the last one, merge with the next block
|
||||
// if it's not in use.
|
||||
if (block->next != head) {
|
||||
if (!block->next->flag) {
|
||||
if (block->next != head)
|
||||
{
|
||||
if (!block->next->flag)
|
||||
{
|
||||
block->size += sizeof(struct MemBlock) + block->next->size;
|
||||
block->next->magic = 0;
|
||||
block->next = block->next->next;
|
||||
|
@ -117,8 +126,10 @@ void FreeInternal(void *heapStart, void *pointer)
|
|||
|
||||
// If the freed block isn't the first one, merge with the previous block
|
||||
// if it's not in use.
|
||||
if (block != head) {
|
||||
if (!block->prev->flag) {
|
||||
if (block != head)
|
||||
{
|
||||
if (!block->prev->flag)
|
||||
{
|
||||
block->prev->next = block->next;
|
||||
|
||||
if (block->next != head)
|
||||
|
@ -135,7 +146,8 @@ void *AllocZeroedInternal(void *heapStart, u32 size)
|
|||
{
|
||||
void *mem = AllocInternal(heapStart, size);
|
||||
|
||||
if (mem != NULL) {
|
||||
if (mem != NULL)
|
||||
{
|
||||
if (size & 3)
|
||||
size = 4 * ((size / 4) + 1);
|
||||
|
||||
|
|
|
@ -628,11 +628,13 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId)
|
|||
task->data[3] = 16;
|
||||
task->data[13] = GetAnimBattlerSpriteId(ANIM_TARGET);
|
||||
task->data[4] = OBJ_PLTT_ID2(gSprites[task->data[13]].oam.paletteNum);
|
||||
if (position == 1) {
|
||||
if (position == 1)
|
||||
{
|
||||
u16 mask = DISPCNT_BG1_ON;
|
||||
mask2 = mask;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
u16 mask = DISPCNT_BG2_ON;
|
||||
mask2 = mask;
|
||||
}
|
||||
|
|
|
@ -2050,7 +2050,8 @@ static void UpdateSpeedFromHit(u16 cmd)
|
|||
switch (cmd)
|
||||
{
|
||||
case LINKCMD_BLENDER_SCORE_BEST:
|
||||
if (sBerryBlender->speed < 1500) {
|
||||
if (sBerryBlender->speed < 1500)
|
||||
{
|
||||
sBerryBlender->speed += (384 / sNumPlayersToSpeedDivisor[sBerryBlender->numPlayers]);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -138,7 +138,8 @@ static void ContestEffect_StartleFrontMon(void)
|
|||
u8 idx = 0;
|
||||
u8 a = eContestAppealResults.contestant;
|
||||
|
||||
if (eContestAppealResults.turnOrder[a] != 0) {
|
||||
if (eContestAppealResults.turnOrder[a] != 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
|
|
|
@ -214,7 +214,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u
|
|||
// While the remaining space will be filled with actual data
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 256; k++) {
|
||||
for (k = 0; k < 256; k++)
|
||||
{
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
|
@ -224,14 +225,16 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u
|
|||
{
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 32; k++) {
|
||||
for (k = 0; k < 32; k++)
|
||||
{
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy tile data
|
||||
for (k = 0; k < 32 * object_size; k++) {
|
||||
for (k = 0; k < 32 * object_size; k++)
|
||||
{
|
||||
*dest = *src;
|
||||
src++;
|
||||
dest++;
|
||||
|
@ -239,7 +242,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u
|
|||
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 32; k++) {
|
||||
for (k = 0; k < 32; k++)
|
||||
{
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
|
@ -248,7 +252,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u
|
|||
|
||||
if (object_size == 6)
|
||||
{
|
||||
for (k = 0; k < 256; k++) {
|
||||
for (k = 0; k < 256; k++)
|
||||
{
|
||||
*dest = 0;
|
||||
dest++;
|
||||
}
|
||||
|
|
|
@ -1340,7 +1340,8 @@ static void DecorationItemsMenuAction_AttemptPlace(u8 taskId)
|
|||
else
|
||||
{
|
||||
ConvertIntToDecimalStringN(gStringVar1, sDecorationContext.size, STR_CONV_MODE_RIGHT_ALIGN, 2);
|
||||
if (sDecorationContext.isPlayerRoom == FALSE) {
|
||||
if (sDecorationContext.isPlayerRoom == FALSE)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations);
|
||||
}
|
||||
else
|
||||
|
@ -2254,7 +2255,8 @@ static void Task_PutAwayDecoration(u8 taskId)
|
|||
gTasks[taskId].tState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gPaletteFade.active) {
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
DrawWholeMapView();
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_PutAwayDecoration);
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
|
|
|
@ -1091,32 +1091,39 @@ static void InitResults_Member(void)
|
|||
{
|
||||
u8 i;
|
||||
|
||||
switch (sGame->state) {
|
||||
switch (sGame->state)
|
||||
{
|
||||
case 0:
|
||||
if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults))) {
|
||||
if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults)))
|
||||
{
|
||||
sGame->playersReceived = 0;
|
||||
sGame->state++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (IsLinkTaskFinished()) {
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
sGame->state++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (AllLinkBlocksReceived()) {
|
||||
for (i = 0; i < sGame->numPlayers; i++) {
|
||||
if (AllLinkBlocksReceived())
|
||||
{
|
||||
for (i = 0; i < sGame->numPlayers; i++)
|
||||
{
|
||||
memcpy(sGame->berryResults, gBlockRecvBuffer, sizeof(sGame->berryResults));
|
||||
sGame->playersReceived = sGame->numPlayers;
|
||||
}
|
||||
}
|
||||
if (sGame->playersReceived >= sGame->numPlayers) {
|
||||
if (sGame->playersReceived >= sGame->numPlayers)
|
||||
{
|
||||
sGame->timer++;
|
||||
sGame->state++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (WaitFanfare(TRUE)) {
|
||||
if (WaitFanfare(TRUE))
|
||||
{
|
||||
sGame->maxBerriesPickedInRow = sGame->berryResults[sGame->multiplayerId][BERRY_IN_ROW];
|
||||
SetGameFunc(FUNC_RESULTS);
|
||||
FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4);
|
||||
|
|
|
@ -102,8 +102,10 @@ static s32 _putsAscii(char *s, s32 len, void *buf)
|
|||
p0 = b->buffer;
|
||||
|
||||
/* Copy to buffer */
|
||||
for (i = 0; i < len; i++) {
|
||||
if(b->pbuffer == b->buffer + b->buffer_len - 1) {
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if(b->pbuffer == b->buffer + b->buffer_len - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
*(b->pbuffer ++) = s[i];
|
||||
|
@ -125,8 +127,10 @@ static s32 _putsEncoded(char *s, s32 len, void *buf)
|
|||
p0 = b->buffer;
|
||||
|
||||
/* Copy to buffer */
|
||||
for (i = 0; i < len; i++) {
|
||||
if(b->pbuffer == b->buffer + b->buffer_len - 1) {
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if(b->pbuffer == b->buffer + b->buffer_len - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
*(b->pbuffer ++) = mini_pchar_decode(s[i]);
|
||||
|
@ -191,7 +195,8 @@ static s32 mini_pad(char* ptr, s32 len, char pad_char, s32 pad_to, char *buffer)
|
|||
char * pbuffer = buffer;
|
||||
if(pad_to == 0)
|
||||
pad_to = len;
|
||||
if (len > pad_to) {
|
||||
if (len > pad_to)
|
||||
{
|
||||
len = pad_to;
|
||||
overflow = TRUE;
|
||||
}
|
||||
|
|
|
@ -3324,7 +3324,8 @@ static void SpriteCB_FlashMatchingLines(struct Sprite *sprite)
|
|||
if (sprite->sNumFullFlashes)
|
||||
sprite->sNumFullFlashes--;
|
||||
}
|
||||
else if (sprite->sColor >= maxColorChange) {
|
||||
else if (sprite->sColor >= maxColorChange)
|
||||
{
|
||||
// Reached peak darkness, reverse
|
||||
sprite->sColorIncr = -sprite->sColorIncr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue