pokeemerald/src/field_map_obj.c

78 lines
1.6 KiB
C
Raw Normal View History

2017-09-06 14:35:16 +02:00
// Includes
#include "global.h"
2017-09-06 15:29:59 +02:00
#include "sprite.h"
#include "rom4.h"
#include "field_player_avatar.h"
2017-09-06 14:35:16 +02:00
#include "field_map_obj.h"
// Static struct declarations
// Static RAM declarations
// Static ROM declarations
2017-09-06 15:38:38 +02:00
/*static*/ void sub_808D450(void);
2017-09-06 15:29:59 +02:00
2017-09-06 14:35:16 +02:00
// ROM data
// Code
2017-09-06 15:29:59 +02:00
/*static*/ void npc_clear_ids_and_state(struct MapObject *mapObject)
2017-09-06 14:46:47 +02:00
{
memset(mapObject, 0, sizeof(struct MapObject));
mapObject->localId = 0xFF;
mapObject->mapNum = -1;
mapObject->mapGroup = -1;
mapObject->mapobj_unk_1C = -1;
}
2017-09-06 15:25:16 +02:00
2017-09-06 15:29:59 +02:00
static void npcs_clear_ids_and_state(void)
2017-09-06 15:25:16 +02:00
{
u8 i;
2017-09-06 15:42:10 +02:00
2017-09-06 15:25:16 +02:00
for (i = 0; i < ARRAY_COUNT(gUnknown_02037350); i ++)
{
npc_clear_ids_and_state(&gUnknown_02037350[i]);
}
}
2017-09-06 15:29:59 +02:00
void sub_808D438(void)
{
strange_npc_table_clear();
npcs_clear_ids_and_state();
ClearPlayerAvatarInfo();
sub_808D450();
}
2017-09-06 15:38:38 +02:00
/*static*/ void sub_808D450(void)
{
u8 spriteIdx;
spriteIdx = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31);
gSprites[spriteIdx].oam.affineMode = 1;
InitSpriteAffineAnim(&gSprites[spriteIdx]);
StartSpriteAffineAnim(&gSprites[spriteIdx], 0);
gSprites[spriteIdx].invisible = TRUE;
spriteIdx = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[21], 0, 0, 31);
gSprites[spriteIdx].oam.affineMode = 1;
InitSpriteAffineAnim(&gSprites[spriteIdx]);
StartSpriteAffineAnim(&gSprites[spriteIdx], 1);
gSprites[spriteIdx].invisible = TRUE;
}
2017-09-06 15:42:10 +02:00
u8 sub_808D4F4(void)
{
u8 i;
for (i = 0; i < ARRAY_COUNT(gUnknown_02037350); i ++)
{
if (!gUnknown_02037350[i].active)
{
break;
}
}
return i;
}