Compare commits
10 Commits
release-ne
...
debug
Author | SHA1 | Date | |
---|---|---|---|
2b76b1d086 | |||
0aebf688a3 | |||
8980f61306 | |||
d754515c78 | |||
7e1b759681 | |||
d29b0f18df | |||
d152a71e58 | |||
5408877964 | |||
a5cb4fd35f | |||
7a1befb261 |
8
.gitpod.yml
Normal file
8
.gitpod.yml
Normal file
@ -0,0 +1,8 @@
|
||||
# This configuration file was automatically generated by Gitpod.
|
||||
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
|
||||
# and commit this file to your remote git repository to share the goodness with others.
|
||||
|
||||
tasks:
|
||||
- init: echo "See INSTALL.md for compilation instructions."
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
# DO's and DON'T's for contributors to `tumbledemerald`:
|
||||
|
||||
If you are looking for code style guidelines, see the [style guide](STYLE.md)
|
||||
|
||||
DO:
|
||||
|
||||
- Keep `tumbledemerald` up-to-date with `@pret`'s decomp. (pret/pokeemerald)
|
||||
- Keep `tumbledemerald` up-to-date with `@pret`'s decomp. (pret/pokeemerald on GitHub.com)
|
||||
- Send pull requests
|
||||
- Send feature requests
|
||||
- Hang out with us on **[matrix]**
|
||||
|
14
CREDITS.md
14
CREDITS.md
@ -20,6 +20,20 @@
|
||||
- @itsdarsh: keep being a legend.
|
||||
|
||||
|
||||
# more people
|
||||
|
||||
TheXaman
|
||||
ExpoSeed
|
||||
DizzyEggg
|
||||
Ketsuban
|
||||
Zeuturic
|
||||
ipatix
|
||||
paccy
|
||||
surskitty
|
||||
Lunos
|
||||
ShinyDragonHunter
|
||||
|
||||
|
||||
# Other awesome people:
|
||||
|
||||
Anyone and everyone I possibly forgot!
|
||||
|
181
INSTALL.md
181
INSTALL.md
@ -2,27 +2,14 @@
|
||||
|
||||
These instructions explain how to set up the tools required to build **tumbledemerald**, which assembles the source files into a ROM.
|
||||
|
||||
If you're just ready to compile a ROM, and you have a machine running a Debian/Ubuntu-based distro or Arch Linux:
|
||||
|
||||
```fish
|
||||
git clone https://github.com/tumbledemerald-org/te-utils.git
|
||||
cd te-utils
|
||||
cd scripts
|
||||
cd linux
|
||||
cd game
|
||||
sh pacman # if you use Debian or Ubuntu, enter "sh apt" here instead.
|
||||
```
|
||||
|
||||
For other systems, follow the manual install instructions below:
|
||||
|
||||
These instructions come with notes which can be expanded by clicking the "<i>Note...</i>" text.
|
||||
In general, you should not need to open these unless if you get an error or if you need additional clarification.
|
||||
|
||||
If you run into trouble, ask for help on Matrix (see [README.md](README.md)).
|
||||
If you run into trouble, ask for help on Matrix.
|
||||
|
||||
## Windows
|
||||
Windows has instructions for building with three possible terminals, providing 3 different options in case the user stumbles upon unexpected errors.
|
||||
- [Windows 10 (WSL1)](#windows-10-wsl1) (**Fastest, highly recommended**, Windows 10 only)
|
||||
- [Windows 10 (WSL1)](#windows-10-wsl1) (**Fastest, highly recommended**, Windows 10 and later only)
|
||||
- [Windows (msys2)](#windows-msys2) (Second fastest)
|
||||
- [Windows (Cygwin)](#windows-cygwin) (Slowest)
|
||||
|
||||
@ -35,7 +22,7 @@ Unscientific benchmarks suggest **msys2 is 2x slower** than WSL1, and **Cygwin i
|
||||
> may <a href="https://bugreports.qt.io/browse/QTBUG-86277">have problems with parsing the <code>\\wsl$</code> network drive path</a>.
|
||||
</details>
|
||||
|
||||
All of the Windows instructions assume that the default drive is C:\\. If this differs to your actual drive letter, then replace C with the correct drive letter when reading the instructions.
|
||||
All of the Windows instructions assume that the default drive is "C". If this differs to your actual drive letter, then replace C with the correct drive letter when reading the instructions.
|
||||
|
||||
**A note of caution**: As Windows 7 is officially unsupported by Microsoft and Windows 8 has very little usage, some maintainers are unwilling to maintain the Windows 7/8 instructions. Thus, these instructions may break in the future with fixes taking longer than fixes to the Windows 10 instructions.
|
||||
|
||||
@ -58,7 +45,7 @@ WSL1 is the preferred terminal to build **tumbledemerald**. The following instru
|
||||
<details>
|
||||
<summary><i>Note for advanced users...</i></summary>
|
||||
|
||||
> You can pick a preferred Linux distribution, but setup instructions may differ. Debian should work with the given instructions, but has not been tested.
|
||||
> You can pick a preferred Linux distribution, but setup instructions may differ. Debian should work with the given instructions.
|
||||
</details>
|
||||
|
||||
4. Open the [Microsoft Store Linux Selection](https://aka.ms/wslstore), click Ubuntu, then click Get, which will install the Ubuntu distribution.
|
||||
@ -90,7 +77,7 @@ Some tips before proceeding:
|
||||
sudo apt update && sudo apt upgrade
|
||||
```
|
||||
|
||||
> Note: If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/pokeemerald/blob/571c598/INSTALL.md)**,which **tumbledemerald does ***not***, then follow the [legacy WSL1 instructions](docs/legacy_WSL1_INSTALL.md) from here.
|
||||
> Note: If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/tumbledemerald/blob/571c598/INSTALL.md)**, which tumbledemerald does _not_, then follow the [legacy WSL1 instructions](docs/legacy_WSL1_INSTALL.md) from here.
|
||||
|
||||
4. Certain packages are required to build tumbledemerald. Install these packages by running the following command:
|
||||
|
||||
@ -122,7 +109,7 @@ cd /mnt/c/Users/<user>/Desktop/decomps
|
||||
|
||||
If this works, then proceed to [Installation](#installation).
|
||||
|
||||
Otherwise, ask for help on Matrix (see [README.md](README.md)), or continue reading below for [Windows instructions using msys2](#windows-msys2).
|
||||
Otherwise, ask for help on Matrix, or continue reading below for [Windows instructions using msys2](#windows-msys2).
|
||||
|
||||
## Windows (msys2)
|
||||
|
||||
@ -138,12 +125,12 @@ Otherwise, ask for help on Matrix (see [README.md](README.md)), or continue read
|
||||
|
||||
Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert.
|
||||
|
||||
1. Open msys2 at C:\devkitPro\msys2\msys2_shell.bat.
|
||||
1. Open msys2 at C:\devkitPro\msys2\mingw64.exe or run `C:\devkitPro\msys2\msys2_shell.bat -mingw64`.
|
||||
|
||||
2. Certain packages are required to build tumbledemerald. Install these by running the following command:
|
||||
|
||||
```bash
|
||||
pacman -S make gcc zlib-devel git
|
||||
pacman -S make zlib-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-libpng
|
||||
```
|
||||
<details>
|
||||
<summary><i>Note...</i></summary>
|
||||
@ -151,39 +138,6 @@ Note that in msys2, Copy is Ctrl+Insert and Paste is Shift+Insert.
|
||||
> This command will ask for confirmation, just enter the yes action when prompted.
|
||||
</details>
|
||||
|
||||
3. Download [libpng](https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz/download).
|
||||
|
||||
4. Change directory to where libpng was downloaded. By default, msys2 will start in the current user's profile folder, located at **C:\Users\\⁠_\<user>_**, where *\<user>* is your Windows username. In most cases, libpng should be saved within a subfolder of the profile folder. For example, if libpng was saved to **C:\Users\\_\<user>_\Downloads** (the Downloads location for most users), enter this command:
|
||||
|
||||
```bash
|
||||
cd Downloads
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><i>Notes...</i></summary>
|
||||
|
||||
> Note 1: While not shown, msys uses forward slashes `/` instead of backwards slashes `\` as the directory separator.
|
||||
> Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "Downloads/My Downloads"`.
|
||||
> Note 3: Windows path names are case-insensitive so adhering to capitalization isn’t needed.
|
||||
> Note 4: If libpng was saved elsewhere, you will need to specify the full path to where libpng was downloaded, e.g. `cd c:/devkitpro/msys2` if it was saved there.
|
||||
</details>
|
||||
|
||||
5. Run the following commands to uncompress and install libpng.
|
||||
|
||||
```bash
|
||||
tar xf libpng-1.6.37.tar.xz
|
||||
cd libpng-1.6.37
|
||||
./configure --prefix=/usr
|
||||
make check
|
||||
make install
|
||||
```
|
||||
|
||||
6. Then finally, run the following command to change back to the user profile folder.
|
||||
|
||||
```bash
|
||||
cd
|
||||
```
|
||||
|
||||
### Choosing where to store tumbledemerald (msys2)
|
||||
At this point, you can choose a folder to store tumbledemerald into. If you're okay with storing tumbledemerald in the user profile folder, then proceed to [Installation](#installation). Otherwise, you'll need to account for where tumbledemerald is stored when changing directory to the tumbledemerald folder.
|
||||
|
||||
@ -195,7 +149,7 @@ cd Desktop/decomps
|
||||
|
||||
If this works, then proceed to [Installation](#installation).
|
||||
|
||||
Otherwise, ask for help on Matrix (see [README.md](README.md)), or continue reading below for [Windows instructions using Cygwin](#windows-cygwin).
|
||||
Otherwise, ask for help on Matrix, or continue reading below for [Windows instructions using Cygwin](#windows-cygwin).
|
||||
|
||||
## Windows (Cygwin)
|
||||
1. If devkitARM is **not installed**, then follow the instructions used to [install devkitARM](#installing-devkitarm) for the msys2 setup before continuing. *Remember to not continue following the msys2 instructions by mistake!*
|
||||
@ -263,7 +217,7 @@ Note that the directory **must exist** in Windows. If you want to store tumblede
|
||||
> Note 2: Windows path names are case-insensitive so adhering to capitalization isn't needed
|
||||
</details>
|
||||
|
||||
If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Matrix (see [README.md](README.md)).
|
||||
If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Matrix.
|
||||
|
||||
## macOS
|
||||
1. If the Xcode Command Line Tools are not installed, download the tools [here](https://developer.apple.com/xcode/resources/), open your Terminal, and run the following command:
|
||||
@ -333,41 +287,42 @@ Note that the directory **must exist** in the folder system. If you want to stor
|
||||
> Note: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "Desktop/decomp folder"`
|
||||
</details>
|
||||
|
||||
If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Matrix (see [README.md](README.md)).
|
||||
If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Matrix.
|
||||
|
||||
## Linux
|
||||
Open Terminal and enter the following commands, depending on which distro you're using.
|
||||
|
||||
### Debian/Ubuntu-based distributions
|
||||
Run the following commands to install the necessary packages:
|
||||
Run the following command to install the necessary packages:
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
sudo apt install build-essential binutils-arm-none-eabi git libpng-dev
|
||||
```
|
||||
Then proceed to [Choosing where to store tumbledemerald (Linux)](#choosing-where-to-store-tumbledemerald-linux).
|
||||
<details>
|
||||
<summary><i>Note for legacy repos...</i></summary>
|
||||
|
||||
> If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/pokeemerald/blob/571c598/INSTALL.md)**, which **tumbledemerald** does ***not***,
|
||||
> If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/tumbledemerald/blob/571c598/INSTALL.md)**, which tumbledemerald does _not_,
|
||||
> then you will have to install devkitARM. Install all the above packages except binutils-arm-none-eabi, and follow the instructions to
|
||||
> [install devkitARM on Debian/Ubuntu-based distributions](#installing-devkitarm-on-debianubuntu-based-distributions).
|
||||
</details>
|
||||
|
||||
### Arch Linux based systems (Arch, Manjaro, Garuda, etc.)
|
||||
Run the following commands to install the necessary packages:
|
||||
```fish
|
||||
sudo pacman -Syu
|
||||
sudo pacman -S gcc g++ make arm-none-eabi-binutils git libpng
|
||||
### Arch Linux, Manjaro, and other Arch-based distributions
|
||||
Run this command as root to install the necessary packages:
|
||||
```bash
|
||||
pacman -S base-devel arm-none-eabi-binutils git libpng
|
||||
```
|
||||
|
||||
A `pacman -Syu` is also recommended but not strictly required.
|
||||
|
||||
Then proceed to [Choosing where to store tumbledemerald (Linux)](#choosing-where-to-store-tumbledemerald-linux).
|
||||
<details>
|
||||
<summary><i>Note for legacy repos...</i></summary>
|
||||
|
||||
> If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/pokeemerald/blob/571c598/INSTALL.md)**, which **tumbledemerald** does ***not***,
|
||||
> then you will have to install devkitARM. Install all the above packages except binutils-arm-none-eabi, and follow the instructions to
|
||||
> [install devkitARM on Debian/Ubuntu-based distributions](#installing-devkitarm-on-debianubuntu-based-distributions).
|
||||
> If the repository you plan to build has an **[older revision of the INSTALL.md](https://github.com/pret/tumbledemerald/blob/571c598/INSTALL.md)**, which tumbledemerald does _not_,
|
||||
> then you will have to install devkitARM. Install all the above packages except arm-none-eabi-binutils, and follow the instructions to
|
||||
> [install devkitARM on Arch Linux](#installing-devkitarm-on-arch-linux).
|
||||
</details>
|
||||
|
||||
|
||||
### Other distributions
|
||||
_(Specific instructions for other distributions would be greatly appreciated!)_
|
||||
|
||||
@ -376,14 +331,12 @@ _(Specific instructions for other distributions would be greatly appreciated!)_
|
||||
- `g++`
|
||||
- `make`
|
||||
- `git`
|
||||
- `libpng-dev`
|
||||
- `arm-none-eabi binutils`
|
||||
- `libpng-dev` (sometimes called `libpng-devel` or just `libpng`)
|
||||
|
||||
2. Follow the instructions [here](https://devkitpro.org/wiki/devkitPro_pacman) to install devkitPro pacman. (unless you decided to use arm binutils) As a reminder, the goal is to configure an existing pacman installation to recognize devkitPro's repositories.
|
||||
2. Follow the instructions [here](https://devkitpro.org/wiki/devkitPro_pacman) to install devkitPro pacman. As a reminder, the goal is to configure an existing pacman installation to recognize devkitPro's repositories.
|
||||
3. Once devkitPro pacman is configured, run the following commands:
|
||||
|
||||
```bash
|
||||
sudo pacman -Syu
|
||||
sudo pacman -Sy
|
||||
sudo pacman -S gba-dev
|
||||
```
|
||||
@ -393,7 +346,7 @@ _(Specific instructions for other distributions would be greatly appreciated!)_
|
||||
### Choosing where to store tumbledemerald (Linux)
|
||||
At this point, you can choose a folder to store tumbledemerald (and agbcc) into. If so, you'll have to account for the modified folder path when changing directory to the tumbledemerald folder.
|
||||
|
||||
If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Matrix (see [README.md](README.md)).
|
||||
If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Matrix.
|
||||
|
||||
## Installation
|
||||
|
||||
@ -408,7 +361,7 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for
|
||||
1. If tumbledemerald is not already downloaded (some users may prefer to download tumbledemerald via a git client like GitHub Desktop), run:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Rebirth-Devs/tumbledemerald
|
||||
git clone https://gitlab.com/tbld/game.git
|
||||
```
|
||||
|
||||
<details>
|
||||
@ -424,15 +377,37 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for
|
||||
> Where *\<folder where tumbledemerald is to be stored>* is the path of the folder [where you chose to store tumbledemerald](#Choosing-where-to-store-tumbledemerald-WSL1). Then run the `git clone` command again.
|
||||
</details>
|
||||
|
||||
2. Since agbcc is a submodule, here:
|
||||
|
||||
In the game repo:
|
||||
2. Install agbcc into tumbledemerald. The commands to run depend on certain conditions. **You should only follow one of the listed instructions**:
|
||||
- If agbcc has **not been built before** in the folder where you chose to store tumbledemerald, run the following commands to build and install it into tumbledemerald:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/pret/agbcc
|
||||
cd agbcc
|
||||
./build.sh
|
||||
./install.sh ../
|
||||
./install.sh ../tumbledemerald
|
||||
```
|
||||
|
||||
- **Otherwise**, if agbcc has been built before (e.g. if the git clone above fails), but was **last built on a different terminal** than the one currently used (only relevant to Windows, e.g. switching from msys2 to WSL1), then run the following commands to build and install it into tumbledemerald:
|
||||
|
||||
```bash
|
||||
cd agbcc
|
||||
git clean -fX
|
||||
./build.sh
|
||||
./install.sh ../tumbledemerald
|
||||
```
|
||||
|
||||
- **Otherwise**, if agbcc has been built before on the same terminal, run the following commands to install agbcc into tumbledemerald:
|
||||
|
||||
```bash
|
||||
cd agbcc
|
||||
./install.sh ../tumbledemerald
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><i>Note...</i></summary>
|
||||
|
||||
> If building agbcc or tumbledemerald results in an error, try deleting the agbcc folder and re-installing agbcc as if it has not been built before.
|
||||
</details>
|
||||
|
||||
3. Once agbcc is installed, change directory back to the base directory where tumbledemerald and agbcc are stored:
|
||||
|
||||
@ -446,11 +421,15 @@ If you aren't in the tumbledemerald directory already, then **change directory**
|
||||
```bash
|
||||
cd tumbledemerald
|
||||
```
|
||||
To build **tumbledemerald.gba** for the first time and confirm it matches the official ROM image (Note: to speed up builds, see [Parallel builds](#parallel-builds)):
|
||||
To build **tumbledemerald.gba** (Note: to speed up builds, see [Parallel builds](#parallel-builds)):
|
||||
```bash
|
||||
make compare
|
||||
```
|
||||
If an OK is returned, then the installation went smoothly.
|
||||
If you see something like:
|
||||
```bash
|
||||
-m01 POKEMON EMER -cBPEE --silent
|
||||
```
|
||||
then the build was successful.
|
||||
<details>
|
||||
<summary>Note for Windows...</summary>
|
||||
> If you switched terminals since the last build (e.g. from msys2 to WSL1), you must run `make clean-tools` once before any subsequent `make` commands.
|
||||
@ -471,6 +450,8 @@ To speed up building, first get the value of `nproc` by running the following co
|
||||
```bash
|
||||
nproc
|
||||
```
|
||||
For example, I use Gitpod to compile the builds in releases, and the output of `nproc` there is `16`. So I would run `make -j16`.
|
||||
|
||||
Builds can then be sped up by running the following command:
|
||||
```bash
|
||||
make -j<output of nproc>
|
||||
@ -479,13 +460,6 @@ Replace `<output of nproc>` with the number that the `nproc` command returned.
|
||||
|
||||
`nproc` is not available on macOS. The alternative is `sysctl -n hw.ncpu` ([relevant Stack Overflow thread](https://stackoverflow.com/questions/1715580)).
|
||||
|
||||
## Debug info
|
||||
|
||||
To build **tumbledemerald.elf** with enhanced debug info:
|
||||
```bash
|
||||
make DINFO=1
|
||||
```
|
||||
|
||||
## devkitARM's C compiler
|
||||
|
||||
This project supports the `arm-none-eabi-gcc` compiler included with devkitARM. If devkitARM (a.k.a. gba-dev) has already been installed as part of the platform-specific instructions, simply run:
|
||||
@ -562,7 +536,25 @@ devkitARM is now installed.
|
||||
|
||||
devkitARM is now installed.
|
||||
|
||||
## Other toolchains
|
||||
### Installing devkitARM on Arch Linux
|
||||
|
||||
1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages.
|
||||
2. Install `gba-dev`: run the following command as root.
|
||||
|
||||
```console
|
||||
pacman -S gba-dev
|
||||
```
|
||||
This will ask for the selection of packages to install. Just press Enter to install all of them, followed by entering Y to proceed with the installation.
|
||||
|
||||
3. Run the following command to set devkitPro related environment variables (alternatively, close and re-open the Terminal):
|
||||
|
||||
```bash
|
||||
source /etc/profile.d/devkit-env.sh
|
||||
```
|
||||
|
||||
devkitARM is now installed.
|
||||
|
||||
### Other toolchains
|
||||
|
||||
To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`.
|
||||
```bash
|
||||
@ -574,8 +566,17 @@ make TOOLCHAIN="/usr/local/arm-none-eabi"
|
||||
```
|
||||
To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present.
|
||||
|
||||
### Building with debug info under a modern toolchain
|
||||
|
||||
To build **tumbledemerald.elf** with debug symbols under a modern toolchain:
|
||||
```bash
|
||||
make modern DINFO=1
|
||||
```
|
||||
Note that this is not necessary for a non-modern build since those are built with debug symbols by default.
|
||||
|
||||
# Useful additional tools
|
||||
|
||||
* [porymap](https://github.com/huderlem/porymap) for viewing and editing maps
|
||||
* [poryscript](https://github.com/huderlem/poryscript) for scripting ([VS Code extension](https://marketplace.visualstudio.com/items?itemName=karathan.poryscript))
|
||||
* [poryscript](https://github.com/huderlem/poryscript) for scripting ([VS Code/VSCodium extension](https://marketplace.visualstudio.com/items?itemName=karathan.poryscript))
|
||||
* [Tilemap Studio](https://github.com/Rangi42/tilemap-studio) for viewing and editing tilemaps
|
||||
* [VSCodium](https://vscodium.com)
|
||||
|
5
Makefile
5
Makefile
@ -301,6 +301,11 @@ else
|
||||
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
|
||||
endif
|
||||
|
||||
ifeq ($(DDEBUG), 1)
|
||||
override ASFLAGS += --defsym DEBUG=1
|
||||
override CPPFLAGS += -D DEBUG=1
|
||||
endif
|
||||
|
||||
ifeq ($(DINFO),1)
|
||||
override CFLAGS += -g
|
||||
endif
|
||||
|
8
include/debug.h
Normal file
8
include/debug.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GUARD_DEBUG_H
|
||||
#define GUARD_DEBUG_H
|
||||
#if DEBUG
|
||||
|
||||
void Debug_ShowMainMenu(void);
|
||||
|
||||
#endif
|
||||
#endif // GUARD_DEBUG_H
|
@ -133,12 +133,9 @@ struct Pokemon
|
||||
|
||||
struct MonSpritesGfxManager
|
||||
{
|
||||
u32 numSprites:4;
|
||||
u32 numSprites2:4; // Never read
|
||||
u32 numFrames:8;
|
||||
u32 active:8;
|
||||
u32 dataSize:4;
|
||||
u32 mode:4; // MON_SPR_GFX_MODE_*
|
||||
u8 numSprites;
|
||||
u8 numFrames;
|
||||
bool16 active;
|
||||
void *spriteBuffer;
|
||||
u8 **spritePointers;
|
||||
struct SpriteTemplate *templates;
|
||||
@ -436,8 +433,8 @@ void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
|
||||
const u8 *GetTrainerClassNameFromId(u16 trainerId);
|
||||
const u8 *GetTrainerNameFromId(u16 trainerId);
|
||||
bool8 HasTwoFramesAnimation(u16 species);
|
||||
struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode);
|
||||
void DestroyMonSpritesGfxManager(u8 managerId);
|
||||
u8 *MonSpritesGfxManager_GetSpritePtr(u8 managerId, u8 spriteNum);
|
||||
struct MonSpritesGfxManager *CreateMonSpritesGfxManager(void);
|
||||
void DestroyMonSpritesGfxManager(void);
|
||||
u8 *MonSpritesGfxManager_GetSpritePtr(u8 spriteNum);
|
||||
|
||||
#endif // GUARD_POKEMON_H
|
||||
|
@ -101,6 +101,7 @@ SECTIONS {
|
||||
src/random.o(.text);
|
||||
src/util.o(.text);
|
||||
src/daycare.o(.text);
|
||||
src/debug.o(.text);
|
||||
src/egg_hatch.o(.text);
|
||||
src/battle_interface.o(.text);
|
||||
src/battle_anim_smokescreen.o(.text);
|
||||
@ -486,6 +487,7 @@ SECTIONS {
|
||||
src/trig.o(.rodata);
|
||||
src/util.o(.rodata);
|
||||
src/daycare.o(.rodata);
|
||||
src/debug.o(.rodata);
|
||||
src/egg_hatch.o(.rodata);
|
||||
src/battle_gfx_sfx_util.o(.rodata);
|
||||
src/battle_interface.o(.rodata);
|
||||
|
206
src/debug.c
Normal file
206
src/debug.c
Normal file
@ -0,0 +1,206 @@
|
||||
#if DEBUG
|
||||
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "coins.h"
|
||||
#include "credits.h"
|
||||
#include "data.h"
|
||||
#include "daycare.h"
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
#include "event_scripts.h"
|
||||
#include "field_message_box.h"
|
||||
#include "field_screen_effect.h"
|
||||
#include "international_string_util.h"
|
||||
#include "item.h"
|
||||
#include "item_icon.h"
|
||||
#include "list_menu.h"
|
||||
#include "m4a.h"
|
||||
#include "main.h"
|
||||
#include "main_menu.h"
|
||||
#include "malloc.h"
|
||||
#include "map_name_popup.h"
|
||||
#include "menu.h"
|
||||
#include "money.h"
|
||||
#include "naming_screen.h"
|
||||
#include "new_game.h"
|
||||
#include "overworld.h"
|
||||
#include "palette.h"
|
||||
#include "pokedex.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_icon.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "random.h"
|
||||
#include "region_map.h"
|
||||
#include "script.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "sound.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "task.h"
|
||||
#include "pokemon_summary_screen.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/map_groups.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
#define DEBUG_MAIN_MENU_HEIGHT 7
|
||||
#define DEBUG_MAIN_MENU_WIDTH 11
|
||||
|
||||
void Debug_ShowMainMenu(void);
|
||||
static void Debug_DestroyMainMenu(u8);
|
||||
static void DebugAction_HealParty(u8 taskId);
|
||||
static void DebugAction_Fly(u8 taskId);
|
||||
static void DebugAction_Cancel(u8);
|
||||
static void DebugTask_HandleMainMenuInput(u8);
|
||||
|
||||
enum {
|
||||
DEBUG_MENU_ITEM_HEAL_PARTY,
|
||||
DEBUG_MENU_ITEM_FLY,
|
||||
DEBUG_MENU_ITEM_CANCEL,
|
||||
};
|
||||
|
||||
static const u8 gDebugText_HealParty[] = _("Heal party");
|
||||
static const u8 gDebugText_Fly[] = _("Fly");
|
||||
static const u8 gDebugText_Cancel[] = _("Cancel");
|
||||
|
||||
static const struct ListMenuItem sDebugMenuItems[] =
|
||||
{
|
||||
[DEBUG_MENU_ITEM_HEAL_PARTY] = {gDebugText_HealParty, DEBUG_MENU_ITEM_HEAL_PARTY}
|
||||
[DEBUG_MENU_ITEM_FLY] = {gDebugText_Fly, DEBUG_MENU_ITEM_FLY}
|
||||
[DEBUG_MENU_ITEM_CANCEL] = {gDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL}
|
||||
};
|
||||
|
||||
static void (*const sDebugMenuActions[])(u8) =
|
||||
{
|
||||
[DEBUG_MENU_ITEM_HEAL_PARTY] = DebugAction_HealParty
|
||||
[DEBUG_MENU_ITEM_FLY] = DebugAction_Fly
|
||||
[DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sDebugMenuWindowTemplate =
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 1,
|
||||
.width = DEBUG_MAIN_MENU_WIDTH,
|
||||
.height = 2 * DEBUG_MAIN_MENU_HEIGHT,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 1,
|
||||
};
|
||||
|
||||
static const struct ListMenuTemplate sDebugMenuListTemplate =
|
||||
{
|
||||
.items = sDebugMenuItems,
|
||||
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
|
||||
.totalItems = ARRAY_COUNT(sDebugMenuItems),
|
||||
.maxShowed = DEBUG_MAIN_MENU_HEIGHT,
|
||||
.windowId = 0,
|
||||
.header_X = 0,
|
||||
.item_X = 8,
|
||||
.cursor_X = 0,
|
||||
.upText_Y = 1,
|
||||
.cursorPal = 2,
|
||||
.fillValue = 1,
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 1,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = 1,
|
||||
.cursorKind = 0
|
||||
};
|
||||
|
||||
void Debug_ShowMainMenu(void) {
|
||||
struct ListMenuTemplate menuTemplate;
|
||||
u8 windowId;
|
||||
u8 menuTaskId;
|
||||
u8 inputTaskId;
|
||||
|
||||
// create window
|
||||
HideMapNamePopUpWindow();
|
||||
LoadMessageBoxAndBorderGfx();
|
||||
windowId = AddWindow(&sDebugMenuWindowTemplate);
|
||||
DrawStdWindowFrame(windowId, FALSE);
|
||||
|
||||
// create list menu
|
||||
menuTemplate = sDebugMenuListTemplate;
|
||||
menuTemplate.windowId = windowId;
|
||||
menuTaskId = ListMenuInit(&menuTemplate, 0, 0);
|
||||
|
||||
// draw everything
|
||||
CopyWindowToVram(windowId, 3);
|
||||
|
||||
// create input handler task
|
||||
inputTaskId = CreateTask(DebugTask_HandleMainMenuInput, 3);
|
||||
gTasks[inputTaskId].data[0] = menuTaskId;
|
||||
gTasks[inputTaskId].data[1] = windowId;
|
||||
}
|
||||
|
||||
static void Debug_DestroyMainMenu(u8 taskId)
|
||||
{
|
||||
DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL);
|
||||
ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE);
|
||||
RemoveWindow(gTasks[taskId].data[1]);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
|
||||
static void DebugTask_HandleMainMenuInput(u8 taskId)
|
||||
{
|
||||
void (*func)(u8);
|
||||
u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
if ((func = sDebugMenuActions[input]) != NULL)
|
||||
func(taskId);
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
Debug_DestroyMainMenu(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
static void DebugAction_Cancel(u8 taskId)
|
||||
{
|
||||
Debug_DestroyMainMenu(taskId);
|
||||
}
|
||||
|
||||
static void DebugAction_Fly(u8 taskId)
|
||||
{
|
||||
FlagSet(FLAG_VISITED_LITTLEROOT_TOWN);
|
||||
FlagSet(FLAG_VISITED_OLDALE_TOWN);
|
||||
FlagSet(FLAG_VISITED_DEWFORD_TOWN);
|
||||
FlagSet(FLAG_VISITED_LAVARIDGE_TOWN);
|
||||
FlagSet(FLAG_VISITED_FALLARBOR_TOWN);
|
||||
FlagSet(FLAG_VISITED_VERDANTURF_TOWN);
|
||||
FlagSet(FLAG_VISITED_PACIFIDLOG_TOWN);
|
||||
FlagSet(FLAG_VISITED_PETALBURG_CITY);
|
||||
FlagSet(FLAG_VISITED_SLATEPORT_CITY);
|
||||
FlagSet(FLAG_VISITED_MAUVILLE_CITY);
|
||||
FlagSet(FLAG_VISITED_RUSTBORO_CITY);
|
||||
FlagSet(FLAG_VISITED_FORTREE_CITY);
|
||||
FlagSet(FLAG_VISITED_LILYCOVE_CITY);
|
||||
FlagSet(FLAG_VISITED_MOSSDEEP_CITY);
|
||||
FlagSet(FLAG_VISITED_SOOTOPOLIS_CITY);
|
||||
FlagSet(FLAG_VISITED_EVER_GRANDE_CITY);
|
||||
FlagSet(FLAG_LANDMARK_POKEMON_LEAGUE);
|
||||
FlagSet(FLAG_LANDMARK_BATTLE_FRONTIER);
|
||||
Debug_DestroyMenu(taskId);
|
||||
SetMainCallback2(CB2_OpenFlyMap);
|
||||
}
|
||||
|
||||
static void DebugAction_Util_HealParty(u8 taskId)
|
||||
{
|
||||
PlaySE(SE_USE_ITEM);
|
||||
HealPlayerParty();
|
||||
EnableBothScriptContexts();
|
||||
Debug_DestroyMenu(taskId);
|
||||
}
|
||||
|
||||
#endif
|
@ -3,6 +3,7 @@
|
||||
#include "bike.h"
|
||||
#include "coord_event_weather.h"
|
||||
#include "daycare.h"
|
||||
#include "debug.h"
|
||||
#include "faraway_island.h"
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
@ -132,6 +133,14 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
|
||||
input->dpadDirection = DIR_WEST;
|
||||
else if (heldKeys & DPAD_RIGHT)
|
||||
input->dpadDirection = DIR_EAST;
|
||||
|
||||
#if DEBUG
|
||||
if ((heldKeys & R_BUTTON) && input->pressedStartButton)
|
||||
{
|
||||
input->input_field_1_2 = TRUE;
|
||||
input->pressedStartButton = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
@ -194,6 +203,15 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
if (input->pressedRButton && EnableAutoRun())
|
||||
return TRUE;
|
||||
|
||||
#if DEBUG
|
||||
if (input->input_field_1_2)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
Debug_ShowMainMenu();
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -318,6 +318,21 @@ static u8 ObjectEventCB2_NoMovement2(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void TryHidePlayerReflection(void)
|
||||
{
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].hasReflection) {
|
||||
s16 x, y;
|
||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
x = playerObjEvent->currentCoords.x;
|
||||
y = playerObjEvent->currentCoords.y;
|
||||
MoveCoords(DIR_SOUTH, &x, &y);
|
||||
if (!MetatileBehavior_IsReflective(MapGridGetMetatileBehaviorAt(x, y)))
|
||||
playerObjEvent->hideReflection = TRUE;
|
||||
else
|
||||
playerObjEvent->hideReflection = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
@ -325,6 +340,7 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys)
|
||||
HideShowWarpArrow(playerObjEvent);
|
||||
if (gPlayerAvatar.preventStep == FALSE)
|
||||
{
|
||||
TryHidePlayerReflection();
|
||||
Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
|
||||
if (TryInterruptObjectEventSpecialAnim(playerObjEvent, direction) == 0)
|
||||
{
|
||||
@ -335,6 +351,8 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys)
|
||||
MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys);
|
||||
PlayerAllowForcedMovementIfMovingSameDirection();
|
||||
}
|
||||
|
||||
TryHidePlayerReflection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
111
src/pokemon.c
111
src/pokemon.c
@ -69,7 +69,7 @@ EWRAM_DATA u8 gEnemyPartyCount = 0;
|
||||
EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
||||
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManagers[MON_SPR_GFX_MANAGERS_COUNT] = {NULL};
|
||||
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManager = NULL;
|
||||
|
||||
#include "data/battle_moves.h"
|
||||
|
||||
@ -3468,12 +3468,8 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition)
|
||||
{
|
||||
if (gMonSpritesGfxPtr != NULL)
|
||||
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
|
||||
else if (sMonSpritesGfxManagers[MON_SPR_GFX_MANAGER_A])
|
||||
gMultiuseSpriteTemplate = sMonSpritesGfxManagers[MON_SPR_GFX_MANAGER_A]->templates[battlerPosition];
|
||||
else if (sMonSpritesGfxManagers[MON_SPR_GFX_MANAGER_B])
|
||||
gMultiuseSpriteTemplate = sMonSpritesGfxManagers[MON_SPR_GFX_MANAGER_B]->templates[battlerPosition];
|
||||
else
|
||||
gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition];
|
||||
else if (sMonSpritesGfxManager)
|
||||
gMultiuseSpriteTemplate = sMonSpritesGfxManager->templates[battlerPosition];
|
||||
|
||||
gMultiuseSpriteTemplate.paletteTag = speciesTag;
|
||||
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
|
||||
@ -6882,11 +6878,11 @@ static bool8 ShouldSkipFriendshipChange(void)
|
||||
#define ALLOC_FAIL_STRUCT (1 << 1)
|
||||
#define GFX_MANAGER_ACTIVE 0xA3 // Arbitrary value
|
||||
#define GFX_MANAGER_SPR_SIZE (MON_PIC_SIZE * 4) // Only Castform uses more than MON_PIC_SIZE, despite not displaying its forms.
|
||||
#define GFX_MANAGER_NUM_FRAMES 4 // Only 2 frames are needed
|
||||
#define GFX_MANAGER_NUM_FRAMES 2 // Only 2 frames are needed, so only 2 frames are used in tumbledemerald
|
||||
|
||||
static void InitMonSpritesGfx_Battle(struct MonSpritesGfxManager* gfx)
|
||||
{
|
||||
u16 i, j;
|
||||
u32 i, j;
|
||||
for (i = 0; i < gfx->numSprites; i++)
|
||||
{
|
||||
gfx->templates[i] = gBattlerSpriteTemplates[i];
|
||||
@ -6912,41 +6908,21 @@ static void InitMonSpritesGfx_FullParty(struct MonSpritesGfxManager* gfx)
|
||||
}
|
||||
}
|
||||
|
||||
struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode)
|
||||
struct MonSpritesGfxManager *CreateMonSpritesGfxManager(void)
|
||||
{
|
||||
u8 i;
|
||||
u32 i;
|
||||
u8 failureFlags;
|
||||
struct MonSpritesGfxManager *gfx;
|
||||
|
||||
|
||||
failureFlags = 0;
|
||||
managerId %= MON_SPR_GFX_MANAGERS_COUNT;
|
||||
gfx = AllocZeroed(sizeof(*gfx));
|
||||
if (gfx == NULL)
|
||||
return NULL;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case MON_SPR_GFX_MODE_FULL_PARTY:
|
||||
gfx->numSprites = PARTY_SIZE + 1;
|
||||
gfx->numSprites2 = PARTY_SIZE + 1;
|
||||
gfx->numFrames = GFX_MANAGER_NUM_FRAMES;
|
||||
gfx->dataSize = 1;
|
||||
gfx->mode = MON_SPR_GFX_MODE_FULL_PARTY;
|
||||
break;
|
||||
// case MON_SPR_GFX_MODE_BATTLE:
|
||||
case MON_SPR_GFX_MODE_NORMAL:
|
||||
default:
|
||||
gfx->numSprites = MAX_BATTLERS_COUNT;
|
||||
gfx->numSprites2 = MAX_BATTLERS_COUNT;
|
||||
gfx->numFrames = GFX_MANAGER_NUM_FRAMES;
|
||||
gfx->dataSize = 1;
|
||||
gfx->mode = MON_SPR_GFX_MODE_NORMAL;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set up sprite / sprite pointer buffers
|
||||
gfx->spriteBuffer = AllocZeroed(gfx->dataSize * GFX_MANAGER_SPR_SIZE * gfx->numSprites);
|
||||
gfx->spritePointers = AllocZeroed(gfx->numSprites * 32); // ? Only * 4 is necessary, perhaps they were thinking bits.
|
||||
|
||||
gfx->numSprites = MAX_BATTLERS_COUNT;
|
||||
gfx->numFrames = GFX_MANAGER_NUM_FRAMES;
|
||||
gfx->spriteBuffer = AllocZeroed(GFX_MANAGER_SPR_SIZE * gfx->numSprites);
|
||||
gfx->spritePointers = AllocZeroed(gfx->numSprites * 4);
|
||||
if (gfx->spriteBuffer == NULL || gfx->spritePointers == NULL)
|
||||
{
|
||||
failureFlags |= ALLOC_FAIL_BUFFER;
|
||||
@ -6954,9 +6930,9 @@ struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode)
|
||||
else
|
||||
{
|
||||
for (i = 0; i < gfx->numSprites; i++)
|
||||
gfx->spritePointers[i] = gfx->spriteBuffer + (gfx->dataSize * GFX_MANAGER_SPR_SIZE * i);
|
||||
gfx->spritePointers[i] = gfx->spriteBuffer + (GFX_MANAGER_SPR_SIZE * i);
|
||||
}
|
||||
|
||||
|
||||
// Set up sprite structs
|
||||
gfx->templates = AllocZeroed(sizeof(struct SpriteTemplate) * gfx->numSprites);
|
||||
gfx->frameImages = AllocZeroed(sizeof(struct SpriteFrameImage) * gfx->numSprites * gfx->numFrames);
|
||||
@ -6968,20 +6944,9 @@ struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode)
|
||||
{
|
||||
for (i = 0; i < gfx->numFrames * gfx->numSprites; i++)
|
||||
gfx->frameImages[i].size = MON_PIC_SIZE;
|
||||
|
||||
switch (gfx->mode)
|
||||
{
|
||||
case MON_SPR_GFX_MODE_FULL_PARTY:
|
||||
InitMonSpritesGfx_FullParty(gfx);
|
||||
break;
|
||||
case MON_SPR_GFX_MODE_NORMAL:
|
||||
case MON_SPR_GFX_MODE_BATTLE:
|
||||
default:
|
||||
InitMonSpritesGfx_Battle(gfx);
|
||||
break;
|
||||
}
|
||||
InitMonSpritesGfx_Battle(gfx);
|
||||
}
|
||||
|
||||
|
||||
// If either of the allocations failed free their respective members
|
||||
if (failureFlags & ALLOC_FAIL_STRUCT)
|
||||
{
|
||||
@ -6993,7 +6958,7 @@ struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode)
|
||||
TRY_FREE_AND_SET_NULL(gfx->spritePointers);
|
||||
TRY_FREE_AND_SET_NULL(gfx->spriteBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (failureFlags)
|
||||
{
|
||||
// Clear, something failed to allocate
|
||||
@ -7002,27 +6967,21 @@ struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx->active = GFX_MANAGER_ACTIVE;
|
||||
sMonSpritesGfxManagers[managerId] = gfx;
|
||||
gfx->active = TRUE;
|
||||
sMonSpritesGfxManager = gfx;
|
||||
}
|
||||
|
||||
return sMonSpritesGfxManagers[managerId];
|
||||
|
||||
return sMonSpritesGfxManager;
|
||||
}
|
||||
|
||||
void DestroyMonSpritesGfxManager(u8 managerId)
|
||||
void DestroyMonSpritesGfxManager(void)
|
||||
{
|
||||
struct MonSpritesGfxManager *gfx;
|
||||
|
||||
managerId %= MON_SPR_GFX_MANAGERS_COUNT;
|
||||
gfx = sMonSpritesGfxManagers[managerId];
|
||||
struct MonSpritesGfxManager *gfx = sMonSpritesGfxManager;
|
||||
|
||||
if (gfx == NULL)
|
||||
return;
|
||||
|
||||
if (gfx->active != GFX_MANAGER_ACTIVE)
|
||||
{
|
||||
memset(gfx, 0, sizeof(*gfx));
|
||||
}
|
||||
else
|
||||
|
||||
if (gfx->active)
|
||||
{
|
||||
TRY_FREE_AND_SET_NULL(gfx->frameImages);
|
||||
TRY_FREE_AND_SET_NULL(gfx->templates);
|
||||
@ -7031,20 +6990,20 @@ void DestroyMonSpritesGfxManager(u8 managerId)
|
||||
memset(gfx, 0, sizeof(*gfx));
|
||||
Free(gfx);
|
||||
}
|
||||
else
|
||||
memset(gfx, 0, sizeof(*gfx));
|
||||
}
|
||||
|
||||
u8 *MonSpritesGfxManager_GetSpritePtr(u8 managerId, u8 spriteNum)
|
||||
u8 *MonSpritesGfxManager_GetSpritePtr(u8 spriteNum)
|
||||
{
|
||||
struct MonSpritesGfxManager *gfx = sMonSpritesGfxManagers[managerId % MON_SPR_GFX_MANAGERS_COUNT];
|
||||
if (gfx->active != GFX_MANAGER_ACTIVE)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
struct MonSpritesGfxManager *gfx = sMonSpritesGfxManager;
|
||||
|
||||
if (gfx->active)
|
||||
{
|
||||
if (spriteNum >= gfx->numSprites)
|
||||
spriteNum = 0;
|
||||
|
||||
|
||||
return gfx->spritePointers[spriteNum];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1111,7 +1111,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex,
|
||||
SummaryScreen_SetAnimDelayTaskId(TASK_NONE);
|
||||
|
||||
if (gMonSpritesGfxPtr == NULL)
|
||||
CreateMonSpritesGfxManager(MON_SPR_GFX_MANAGER_A, MON_SPR_GFX_MODE_NORMAL);
|
||||
CreateMonSpritesGfxManager();
|
||||
|
||||
SetMainCallback2(CB2_InitSummaryScreen);
|
||||
}
|
||||
@ -1500,7 +1500,7 @@ static void CloseSummaryScreen(u8 taskId)
|
||||
StopCryAndClearCrySongs();
|
||||
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 0x100);
|
||||
if (gMonSpritesGfxPtr == NULL)
|
||||
DestroyMonSpritesGfxManager(MON_SPR_GFX_MANAGER_A);
|
||||
DestroyMonSpritesGfxManager();
|
||||
FreeSummaryScreen();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@ -3902,12 +3902,12 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state)
|
||||
{
|
||||
if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->unk40EF == TRUE)
|
||||
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2],
|
||||
MonSpritesGfxManager_GetSpritePtr(MON_SPR_GFX_MANAGER_A, B_POSITION_OPPONENT_LEFT),
|
||||
MonSpritesGfxManager_GetSpritePtr(B_POSITION_OPPONENT_LEFT),
|
||||
summary->species2,
|
||||
summary->pid);
|
||||
else
|
||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2],
|
||||
MonSpritesGfxManager_GetSpritePtr(MON_SPR_GFX_MANAGER_A, B_POSITION_OPPONENT_LEFT),
|
||||
MonSpritesGfxManager_GetSpritePtr(B_POSITION_OPPONENT_LEFT),
|
||||
summary->species2,
|
||||
summary->pid);
|
||||
}
|
||||
|
Reference in New Issue
Block a user