MakeObjectTemplateFromFieldObjectTemplate

This commit is contained in:
PikalaxALT 2017-09-07 14:16:30 -04:00
parent 112177b57f
commit 12562aa2d4
3 changed files with 8 additions and 18 deletions

View File

@ -5,22 +5,6 @@
.text
thumb_func_start MakeObjectTemplateFromFieldObjectTemplate
@ void MakeObjectTemplateFromFieldObjectTemplate(struct FieldObjectTemplate *fieldObjectTemplate, struct objtemplate *objectTemplate, SpriteOamTable **spriteOamTables)
MakeObjectTemplateFromFieldObjectTemplate: @ 808DD50
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
adds r3, r2, 0
ldrb r0, [r4, 0x1]
ldrb r1, [r4, 0x9]
adds r2, r5, 0
bl MakeObjectTemplateFromFieldObjectGraphicsInfoWithCallbackIndex
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end MakeObjectTemplateFromFieldObjectTemplate
thumb_func_start AddPseudoFieldObject
@ void AddPseudoFieldObject(u8 graphicsId, void ( *callback)(), u16 x, u16 y, u8 subpriority)
AddPseudoFieldObject: @ 808DD68

View File

@ -613,3 +613,8 @@ void MakeObjectTemplateFromFieldObjectGraphicsInfoWithCallbackIndex(u16 graphics
{
MakeObjectTemplateFromFieldObjectGraphicsInfo(graphicsId, gUnknown_08505438[callbackIndex], sprTemplate, subspriteTables);
}
void MakeObjectTemplateFromFieldObjectTemplate(struct MapObjectTemplate *mapObjectTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
{
MakeObjectTemplateFromFieldObjectGraphicsInfoWithCallbackIndex(mapObjectTemplate->graphicsId, mapObjectTemplate->movementType, spriteTemplate, subspriteTables);
}

View File

@ -40,7 +40,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)
@ -50,6 +50,7 @@ void *AllocInternal(void *heapStart, u32 size)
struct MemBlock *splitBlock;
u32 foundBlockSize;
// Alignment
if (size & 3)
size = 4 * ((size / 4) + 1);
@ -60,7 +61,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;