Merge remote-tracking branch 'pret/master'

This commit is contained in:
Diegoisawesome
2017-09-19 19:42:32 -05:00
79 changed files with 14787 additions and 32744 deletions

6431
src/battle_3.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -87,7 +87,7 @@ static u8 BattleAI_ChooseMoveOrAction_Singles(void);
static u8 BattleAI_ChooseMoveOrAction_Doubles(void);
static void RecordLastUsedMoveByTarget(void);
static void BattleAI_DoAIProcessing(void);
static void AIStackPushVar(u8 *);
static void AIStackPushVar(const u8 *);
static bool8 AIStackPop(void);
static void BattleAICmd_if_random_less_than(void);
@@ -192,7 +192,7 @@ static void BattleAICmd_if_holds_item(void);
// ewram
EWRAM_DATA u8 *gAIScriptPtr = NULL;
EWRAM_DATA const u8 *gAIScriptPtr = NULL;
EWRAM_DATA static u8 sBank_AI = 0;
// const rom data
@@ -2902,7 +2902,7 @@ static void BattleAICmd_if_flash_fired(void)
gAIScriptPtr += 6;
}
static void AIStackPushVar(u8 *var)
static void AIStackPushVar(const u8 *var)
{
gBattleResources->AI_ScriptsStack->ptr[gBattleResources->AI_ScriptsStack->size++] = var;
}

View File

@@ -807,7 +807,7 @@ const struct Berry gBerries[] =
// unused
void ClearEnigmaBerries(void)
{
CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, sizeof(gSaveBlock1Ptr->enigmaBerry));
CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, 52);
}
void SetEnigmaBerry(u8 *src)
@@ -815,7 +815,7 @@ void SetEnigmaBerry(u8 *src)
u32 i;
u8 *dest = (u8*)&gSaveBlock1Ptr->enigmaBerry;
for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++)
for (i = 0; i < 52; i++)
dest[i] = src[i];
}
@@ -827,7 +827,7 @@ u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry)
dest = (u8*)enigmaBerry;
checksum = 0;
for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry) - sizeof(gSaveBlock1Ptr->enigmaBerry.checksum); i++)
for (i = 0; i < 52 - sizeof(gSaveBlock1Ptr->enigmaBerry.checksum); i++)
{
checksum += dest[i];
}

5118
src/field_map_obj.c Executable file

File diff suppressed because it is too large Load Diff

4
src/hall_of_fame.c Normal file
View File

@@ -0,0 +1,4 @@
#include "global.h"
#include "hall_of_fame.h"

View File

@@ -38,7 +38,7 @@ void PutMemBlockHeader(void *block, struct MemBlock *prev, struct MemBlock *next
void PutFirstMemBlockHeader(void *block, u32 size)
{
PutMemBlockHeader(block, (struct MemBlock *)block, (struct MemBlock *)block, size - 16);
PutMemBlockHeader(block, (struct MemBlock *)block, (struct MemBlock *)block, size - sizeof(struct MemBlock));
}
void *AllocInternal(void *heapStart, u32 size)
@@ -48,6 +48,7 @@ void *AllocInternal(void *heapStart, u32 size)
struct MemBlock *splitBlock;
u32 foundBlockSize;
// Alignment
if (size & 3)
size = 4 * ((size / 4) + 1);
@@ -58,7 +59,7 @@ void *AllocInternal(void *heapStart, u32 size)
foundBlockSize = pos->size;
if (foundBlockSize >= size) {
if (foundBlockSize - size <= 31) {
if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) {
// The block isn't much bigger than the requested size,
// so just use it.
pos->flag = TRUE;