Initial work on pokemon_summary_screen.c

This commit is contained in:
luckytyphlosion
2020-06-14 16:08:21 -04:00
parent e2eb17dcbd
commit bc143a695d
10 changed files with 570 additions and 690 deletions
+2
View File
@@ -56,3 +56,5 @@ types_*.taghl
_Deparsed_XSubs.pm
porymap.project.cfg
.vscode/*.*
baserom.txt
pokefirered.txt
+4 -4
View File
@@ -36,7 +36,7 @@ include config.mk
GCC_VER = $(shell $(CC) -dumpversion)
ifeq ($(MODERN),0)
CC1 := tools/agbcc/bin/agbcc
CC1 := tools/agbcc/bin/agbcc$(EXE)
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
LIBPATH := -L ../../tools/agbcc/lib
else
@@ -209,15 +209,15 @@ $(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc
$(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE)
$(C_BUILDDIR)/isagbprn.o: CC1 := tools/agbcc/bin/old_agbcc
$(C_BUILDDIR)/isagbprn.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE)
$(C_BUILDDIR)/isagbprn.o: CFLAGS := -mthumb-interwork
$(C_BUILDDIR)/trainer_tower.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/flying.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm
$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm$(EXE)
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet
else
$(C_BUILDDIR)/berry_crush_2.o: CFLAGS += -Wno-address-of-packed-member
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# $1: phrase to find
if [ "$2" == "" ]; then
grep_flags="-wr"
else
grep_flags="$2"
fi
grep "$1" "$grep_flags" --include="*.c" --include="*.h" --include="*.s" --include="*.inc" --include="*.txt" --exclude-dir=".git" --exclude-dir=".travis" --exclude-dir="build" --exclude-dir="common_syms" --exclude-dir="data" --exclude-dir="graphics" --exclude-dir="sound" --exclude-dir="tools"
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# Compares baserom.gba and pokefirered.gba
# create baserom.txt if necessary
if [ ! -f baserom.txt ]; then
hexdump -C baserom.gba > baserom.txt # can create an empty baserom.txt if no baserom.gba
fi
hexdump -C pokefirered.gba > pokefirered.txt
diff -u baserom.txt pokefirered.txt | less
+2 -2
View File
@@ -1,12 +1,12 @@
#ifndef GUARD_MAIN_H
#define GUARD_MAIN_H
#include "global.h"
typedef void (*MainCallback)(void);
typedef void (*IntrCallback)(void);
typedef void (*IntrFunc)(void);
#include "global.h"
extern IntrFunc gIntrTable[];
struct Main
+5 -3
View File
@@ -20,16 +20,18 @@ enum PokemonSummaryScreenMode
{
PSS_MODE_NORMAL,
PSS_MODE_UNK1,
PSS_MODE_BOX,
PSS_MODE_SELECT_MOVE,
PSS_MODE_UNK3,
PSS_MODE_UNK4,
PSS_MODE_BOX,
};
enum PokemonSummaryScreenPage
{
PSS_PAGE_INFO,
PSS_PAGE_SKILLS,
PSS_PAGE_BATTLE_MOVES,
PSS_PAGE_CONTEST_MOVES,
PSS_PAGE_MOVES,
PSS_PAGE_MOVES_INFO,
};
s32 GetLastViewedMonIndex(void);
+1
View File
@@ -268,6 +268,7 @@ SECTIONS {
src/tm_case.o(.text);
src/menu_indicators.o(.text);
src/pokedex_area_markers.o(.text);
src/pokemon_summary_screen.o(.text);
asm/pokemon_summary_screen.o(.text);
src/help_system.o(.text);
src/wild_pokemon_area.o(.text);
+147
View File
@@ -0,0 +1,147 @@
#include "global.h"
#include "gflib.h"
#include "pokemon.h"
#include "pokemon_summary_screen.h"
#include "help_system.h"
extern void sub_8138B8C(struct Pokemon * mon);
extern void sub_8135C34(void);
struct PokemonSummaryScreenData {
u8 temp0[0x3024];
bool32 isEnemyParty; /* 0x3024 */
u8 temp3028[0x1d8];
u8 ALIGNED(4) isEgg; /* 0x3200 */
u8 ALIGNED(4) isBadEgg; /* 0x3204 */
u8 ALIGNED(4) mode; /* 0x3208 */
u8 ALIGNED(4) unk320C; /* 0x320C */
u8 ALIGNED(4) lastIndex; /* 0x3210 */
u8 ALIGNED(4) curPageIndex; /* 0x3214 */
u8 ALIGNED(4) unk3218; /* 0x3218 */
u8 ALIGNED(4) isBoxMon; /* 0x321C */
u8 ALIGNED(4) unk3220; /* 0x3220 */
u8 ALIGNED(4) unk3224; /* 0x3224 */
u8 ALIGNED(4) unk3228; /* 0x3228 */
u8 ALIGNED(4) unk322C; /* 0x322C */
u8 ALIGNED(4) unk3230; /* 0x3230 */
u8 ALIGNED(4) lockMovesFlag; /* 0x3234 */
u8 ALIGNED(4) unk3238; /* 0x3238 */
u8 ALIGNED(4) unk323C; /* 0x323C */
u8 ALIGNED(4) unk3240; /* 0x3240 */
u8 ALIGNED(4) unk3244; /* 0x3244 */
u8 temp3248[0x18];
u16 ALIGNED(4) unk3260; /* 0x3260 */
u8 temp3264[0xc];
u8 ALIGNED(4) unk3270; /* 0x3270 */
u8 ALIGNED(4) unk3274; /* 0x3274 */
u8 ALIGNED(4) unk3278; /* 0x3278 */
u8 ALIGNED(4) unk327C; /* 0x327C */
u8 temp3280[0x10];
struct Pokemon currentMon;
union {
struct Pokemon * mons;
struct BoxPokemon * boxMons;
} monList;
MainCallback savedCallback;
struct Sprite * markingSprite;
u8 ALIGNED(4) unk3300; /* 0x3300 */
u8 ALIGNED(4) unk3304; /* 0x3304 */
};
struct Struct203B144 {
u8 unk0[0x28];
};
extern struct PokemonSummaryScreenData * gMonSummaryScreen;
extern struct Struct203B144 * gUnknown_203B144;
extern u8 gUnknown_203B16D;
extern u8 gUnknown_203B16E;
void ShowPokemonSummaryScreen(struct Pokemon * party, u8 cursorPos, u8 lastIdx, MainCallback savedCallback, u8 mode)
{
gMonSummaryScreen = AllocZeroed(sizeof(struct PokemonSummaryScreenData));
gUnknown_203B144 = AllocZeroed(sizeof(struct Struct203B144));
if (gMonSummaryScreen == NULL)
{
SetMainCallback2(savedCallback);
return;
}
gLastViewedMonIndex = cursorPos;
gUnknown_203B16D = 0;
gUnknown_203B16E = 0;
gMonSummaryScreen->savedCallback = savedCallback;
gMonSummaryScreen->monList.mons = party;
if (party == gEnemyParty)
gMonSummaryScreen->isEnemyParty = TRUE;
else
gMonSummaryScreen->isEnemyParty = FALSE;
gMonSummaryScreen->lastIndex = lastIdx;
gMonSummaryScreen->mode = mode;
switch (gMonSummaryScreen->mode) {
case PSS_MODE_NORMAL:
default:
SetHelpContext(HELPCONTEXT_POKEMON_INFO);
gMonSummaryScreen->curPageIndex = PSS_PAGE_INFO;
gMonSummaryScreen->isBoxMon = FALSE;
gMonSummaryScreen->lockMovesFlag = FALSE;
break;
case PSS_MODE_BOX:
SetHelpContext(HELPCONTEXT_POKEMON_INFO);
gMonSummaryScreen->curPageIndex = PSS_PAGE_INFO;
gMonSummaryScreen->isBoxMon = TRUE;
gMonSummaryScreen->lockMovesFlag = FALSE;
break;
case PSS_MODE_SELECT_MOVE:
case PSS_MODE_UNK3:
SetHelpContext(HELPCONTEXT_POKEMON_MOVES);
gMonSummaryScreen->curPageIndex = PSS_PAGE_MOVES_INFO;
gMonSummaryScreen->isBoxMon = FALSE;
gMonSummaryScreen->lockMovesFlag = TRUE;
break;
}
gMonSummaryScreen->unk3270 = 0;
gMonSummaryScreen->unk3274 = 0;
gMonSummaryScreen->unk3278 = 0;
gMonSummaryScreen->unk327C = 0;
gMonSummaryScreen->unk3238 = 0;
gMonSummaryScreen->unk323C = 2;
gMonSummaryScreen->unk3240 = 1;
gMonSummaryScreen->unk3244 = 0;
gMonSummaryScreen->unk3228 = 0;
gMonSummaryScreen->unk322C = 1;
sub_8138B8C(&gMonSummaryScreen->currentMon);
gMonSummaryScreen->isEgg = GetMonData(&gMonSummaryScreen->currentMon, MON_DATA_IS_EGG);
gMonSummaryScreen->isBadEgg = GetMonData(&gMonSummaryScreen->currentMon, MON_DATA_SANITY_IS_BAD_EGG);
if (gMonSummaryScreen->isBadEgg == TRUE) {
gMonSummaryScreen->isEgg = TRUE;
}
gMonSummaryScreen->unk3300 = 0xff;
SetMainCallback2(sub_8135C34);
}
void ShowSelectMovePokemonSummaryScreen(struct Pokemon * party, u8 cursorPos, u8 lastIdx, MainCallback savedCallback, u16 a4) {
ShowPokemonSummaryScreen(party, cursorPos, lastIdx, savedCallback, PSS_MODE_SELECT_MOVE);
gMonSummaryScreen->unk3260 = a4;
}
+1 -1
View File
@@ -235,7 +235,7 @@
.align 2
@ .include "src/pokemon_summary_screen.o"
gUnknown_203B140: @ 203B140
gMonSummaryScreen: @ 203B140
.space 0x4
gUnknown_203B144: @ 203B144