added footprints

This commit is contained in:
TheXaman 2021-12-13 19:24:19 +01:00
parent a334f7f5e0
commit f1f4082f62
3 changed files with 50 additions and 1 deletions

View File

@ -28,7 +28,8 @@
#define WIN_INSTRUCTIONS 1 #define WIN_INSTRUCTIONS 1
#define WIN_BOTTOM_LEFT 2 #define WIN_BOTTOM_LEFT 2
#define WIN_BOTTOM_RIGHT 3 #define WIN_BOTTOM_RIGHT 3
#define WIN_END 4 #define WIN_FOOTPRINT 4
#define WIN_END 5
//Battle backgrounds //Battle backgrounds
#define MAP_BATTLE_SCENE_NORMAL 0 #define MAP_BATTLE_SCENE_NORMAL 0

View File

@ -4,6 +4,10 @@
extern u8 gUnusedPokedexU8; extern u8 gUnusedPokedexU8;
extern void (*gPokedexVBlankCB)(void); extern void (*gPokedexVBlankCB)(void);
#if P_ENABLE_DEBUG == TRUE
extern const u8 *const gMonFootprintTable[];
#endif
enum enum
{ {
DEX_MODE_HOENN, DEX_MODE_HOENN,

View File

@ -21,6 +21,7 @@
#include "overworld.h" #include "overworld.h"
#include "palette.h" #include "palette.h"
#include "palette_util.h" #include "palette_util.h"
#include "pokedex.h"
#include "pokemon.h" #include "pokemon.h"
#include "pokemon_animation.h" #include "pokemon_animation.h"
#include "pokemon_debug.h" #include "pokemon_debug.h"
@ -136,6 +137,16 @@ static const struct WindowTemplate sPokemonDebugWindowTemplate[] =
.paletteNum = 0xF, .paletteNum = 0xF,
.baseBlock = 1 + 30 + 60 + 30 .baseBlock = 1 + 30 + 60 + 30
}, },
[WIN_FOOTPRINT] =
{
.bg = 0,
.tilemapLeft = 27,
.tilemapTop = 14,
.width = 2,
.height = 2,
.paletteNum = 0xF,
.baseBlock = 1 + 30 + 60 + 30 + 150,
},
DUMMY_WIN_TEMPLATE, DUMMY_WIN_TEMPLATE,
}; };
@ -750,6 +761,31 @@ static void LoadAndCreateEnemyShadowSpriteCustom(struct PokemonDebugMenu *data,
gSprites[data->frontShadowSpriteId].invisible = FALSE; gSprites[data->frontShadowSpriteId].invisible = FALSE;
} }
//Tile functions (footprints)
static void DrawFootprintCustom(u8 windowId, u16 species)
{
u8 footprint[32 * 4] = {0};
const u8 * footprintGfx = gMonFootprintTable[species];
u32 i, j, tileIdx = 0;
if (footprintGfx != NULL)
{
for (i = 0; i < 32; i++)
{
u8 tile = footprintGfx[i];
for (j = 0; j < 4; j++)
{
u8 value = ((tile >> (2 * j)) & 1 ? 2 : 0);
if (tile & (2 << (2 * j)))
value |= 0x20;
footprint[tileIdx] = value;
tileIdx++;
}
}
}
CopyToWindowPixelBuffer(windowId, footprint, sizeof(footprint), 0);
}
//Battle background functions //Battle background functions
static void LoadBattleBg(u8 battleBgType, u8 battleTerrain) static void LoadBattleBg(u8 battleBgType, u8 battleTerrain)
{ {
@ -1050,6 +1086,10 @@ void CB2_Debug_Pokemon(void)
//BattleNg Name //BattleNg Name
PrintBattleBgName(taskId); PrintBattleBgName(taskId);
//Footprint
DrawFootprintCustom(WIN_FOOTPRINT, species);
CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX);
gMain.state++; gMain.state++;
break; break;
case 4: case 4:
@ -1406,6 +1446,10 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
//Arrow invisibility //Arrow invisibility
SetArrowInvisibility(data); SetArrowInvisibility(data);
//Footprint
DrawFootprintCustom(WIN_FOOTPRINT, species);
CopyWindowToVram(WIN_FOOTPRINT, COPYWIN_GFX);
} }
static void Exit_Debug_Pokemon(u8 taskId) static void Exit_Debug_Pokemon(u8 taskId)