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