diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/battle.h | 6 | ||||
-rw-r--r-- | include/config.h | 8 | ||||
-rw-r--r-- | include/constants/battle_frontier.h | 2 | ||||
-rw-r--r-- | include/constants/event_objects.h | 4 | ||||
-rw-r--r-- | include/constants/flags.h | 4 | ||||
-rw-r--r-- | include/constants/pokemon.h | 4 | ||||
-rw-r--r-- | include/constants/species.h | 156 | ||||
-rw-r--r-- | include/gba/m4a_internal.h | 177 | ||||
-rw-r--r-- | include/global.fieldmap.h | 17 | ||||
-rw-r--r-- | include/global.h | 3 | ||||
-rw-r--r-- | include/graphics.h | 6 |
11 files changed, 210 insertions, 177 deletions
diff --git a/include/battle.h b/include/battle.h index 820684a69..53a78024a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -585,7 +585,11 @@ struct BattleSpriteData struct MonSpritesGfx { void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon - void* sprites[4]; + union + { + void* ptr[4]; + u8* byte[4]; + } sprites; struct SpriteTemplate templates[4]; struct SpriteFrameImage field_74[4][4]; u8 field_F4[0x80]; diff --git a/include/config.h b/include/config.h index 4f97a12a3..4c231a84d 100644 --- a/include/config.h +++ b/include/config.h @@ -15,9 +15,6 @@ // printing system. Use NoCashGBAPrint() and NoCashGBAPrintf() like you // would normally use AGBPrint() and AGBPrintf(). -// NOTE: Don't try to enable assert right now as many pointers -// still exist in defines and WILL likely result in a broken ROM. - #define ENGLISH #ifdef ENGLISH @@ -26,9 +23,12 @@ #define UNITS_METRIC #endif +// Uncomment to fix some identified minor bugs +//#define BUGFIX + // Various undefined behavior bugs may or may not prevent compilation with // newer compilers. So always fix them when using a modern compiler. -#if MODERN +#if MODERN || defined(BUGFIX) #ifndef UBFIX #define UBFIX #endif diff --git a/include/constants/battle_frontier.h b/include/constants/battle_frontier.h index 1a60714e8..bbe6db81c 100644 --- a/include/constants/battle_frontier.h +++ b/include/constants/battle_frontier.h @@ -51,7 +51,7 @@ #define MAX_BATTLE_FRONTIER_POINTS 9999 #define MAX_STREAK 9999 -// These sets of facility ids would be redunant if the order was consistent +// These sets of facility ids would be redundant if the order was consistent // The order is important for this set so that all the non-link records can be continuous #define RANKING_HALL_BATTLE_TOWER_SINGLES 0 #define RANKING_HALL_BATTLE_TOWER_DOUBLES 1 diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index ca312e957..8e026ef2d 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -205,7 +205,7 @@ #define OBJ_EVENT_GFX_REGICE 201 #define OBJ_EVENT_GFX_REGISTEEL 202 #define OBJ_EVENT_GFX_SKITTY 203 -#define OBJ_EVENT_GFX_KECLEON_1 204 +#define OBJ_EVENT_GFX_KECLEON 204 #define OBJ_EVENT_GFX_KYOGRE_2 205 #define OBJ_EVENT_GFX_GROUDON_2 206 #define OBJ_EVENT_GFX_RAYQUAZA_2 207 @@ -213,7 +213,7 @@ #define OBJ_EVENT_GFX_PIKACHU 209 #define OBJ_EVENT_GFX_AZUMARILL 210 #define OBJ_EVENT_GFX_WINGULL 211 -#define OBJ_EVENT_GFX_KECLEON_2 212 +#define OBJ_EVENT_GFX_KECLEON_BRIDGE_SHADOW 212 #define OBJ_EVENT_GFX_TUBER_M_SWIMMING 213 #define OBJ_EVENT_GFX_AZURILL 214 #define OBJ_EVENT_GFX_MOM 215 diff --git a/include/constants/flags.h b/include/constants/flags.h index a562b0670..9be269105 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1012,7 +1012,7 @@ #define FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_STEVEN 0x3C7 #define FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_BELDUM_POKEBALL 0x3C8 #define FLAG_HIDE_FORTREE_CITY_KECLEON 0x3C9 -#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_INVISIBLE 0x3CA +#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE 0x3CA #define FLAG_HIDE_LILYCOVE_CITY_RIVAL 0x3CB #define FLAG_HIDE_ROUTE_120_STEVEN 0x3CC #define FLAG_HIDE_SOOTOPOLIS_CITY_STEVEN 0x3CD @@ -1023,7 +1023,7 @@ #define FLAG_HIDE_AQUA_HIDEOUT_B1F_ELECTRODE_2 0x3D2 #define FLAG_HIDE_OLDALE_TOWN_RIVAL 0x3D3 #define FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE 0x3D4 -#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_VISIBLE 0x3D5 +#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_SHADOW 0x3D5 #define FLAG_HIDE_ROUTE_120_KECLEON_1 0x3D6 #define FLAG_HIDE_RUSTURF_TUNNEL_WANDA 0x3D7 #define FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WANDA 0x3D8 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 4cf0bd4f0..bac914fec 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -241,10 +241,10 @@ // Battle move flags #define FLAG_MAKES_CONTACT (1 << 0) #define FLAG_PROTECT_AFFECTED (1 << 1) -#define FLAG_MAGICCOAT_AFFECTED (1 << 2) +#define FLAG_MAGIC_COAT_AFFECTED (1 << 2) #define FLAG_SNATCH_AFFECTED (1 << 3) #define FLAG_MIRROR_MOVE_AFFECTED (1 << 4) -#define FLAG_KINGSROCK_AFFECTED (1 << 5) +#define FLAG_KINGS_ROCK_AFFECTED (1 << 5) // Growth rates #define GROWTH_MEDIUM_FAST 0 diff --git a/include/constants/species.h b/include/constants/species.h index 8fa5cf77b..983e1a796 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -417,36 +417,36 @@ #define SPECIES_CHIMECHO 411 #define SPECIES_EGG 412 -#define SPECIES_UNOWN_B 413 -#define SPECIES_UNOWN_C 414 -#define SPECIES_UNOWN_D 415 -#define SPECIES_UNOWN_E 416 -#define SPECIES_UNOWN_F 417 -#define SPECIES_UNOWN_G 418 -#define SPECIES_UNOWN_H 419 -#define SPECIES_UNOWN_I 420 -#define SPECIES_UNOWN_J 421 -#define SPECIES_UNOWN_K 422 -#define SPECIES_UNOWN_L 423 -#define SPECIES_UNOWN_M 424 -#define SPECIES_UNOWN_N 425 -#define SPECIES_UNOWN_O 426 -#define SPECIES_UNOWN_P 427 -#define SPECIES_UNOWN_Q 428 -#define SPECIES_UNOWN_R 429 -#define SPECIES_UNOWN_S 430 -#define SPECIES_UNOWN_T 431 -#define SPECIES_UNOWN_U 432 -#define SPECIES_UNOWN_V 433 -#define SPECIES_UNOWN_W 434 -#define SPECIES_UNOWN_X 435 -#define SPECIES_UNOWN_Y 436 -#define SPECIES_UNOWN_Z 437 -#define SPECIES_UNOWN_EMARK 438 -#define SPECIES_UNOWN_QMARK 439 - #define NUM_SPECIES SPECIES_EGG +#define SPECIES_UNOWN_B (NUM_SPECIES + 1) +#define SPECIES_UNOWN_C (SPECIES_UNOWN_B + 1) +#define SPECIES_UNOWN_D (SPECIES_UNOWN_B + 2) +#define SPECIES_UNOWN_E (SPECIES_UNOWN_B + 3) +#define SPECIES_UNOWN_F (SPECIES_UNOWN_B + 4) +#define SPECIES_UNOWN_G (SPECIES_UNOWN_B + 5) +#define SPECIES_UNOWN_H (SPECIES_UNOWN_B + 6) +#define SPECIES_UNOWN_I (SPECIES_UNOWN_B + 7) +#define SPECIES_UNOWN_J (SPECIES_UNOWN_B + 8) +#define SPECIES_UNOWN_K (SPECIES_UNOWN_B + 9) +#define SPECIES_UNOWN_L (SPECIES_UNOWN_B + 10) +#define SPECIES_UNOWN_M (SPECIES_UNOWN_B + 11) +#define SPECIES_UNOWN_N (SPECIES_UNOWN_B + 12) +#define SPECIES_UNOWN_O (SPECIES_UNOWN_B + 13) +#define SPECIES_UNOWN_P (SPECIES_UNOWN_B + 14) +#define SPECIES_UNOWN_Q (SPECIES_UNOWN_B + 15) +#define SPECIES_UNOWN_R (SPECIES_UNOWN_B + 16) +#define SPECIES_UNOWN_S (SPECIES_UNOWN_B + 17) +#define SPECIES_UNOWN_T (SPECIES_UNOWN_B + 18) +#define SPECIES_UNOWN_U (SPECIES_UNOWN_B + 19) +#define SPECIES_UNOWN_V (SPECIES_UNOWN_B + 20) +#define SPECIES_UNOWN_W (SPECIES_UNOWN_B + 21) +#define SPECIES_UNOWN_X (SPECIES_UNOWN_B + 22) +#define SPECIES_UNOWN_Y (SPECIES_UNOWN_B + 23) +#define SPECIES_UNOWN_Z (SPECIES_UNOWN_B + 24) +#define SPECIES_UNOWN_EMARK (SPECIES_UNOWN_B + 25) +#define SPECIES_UNOWN_QMARK (SPECIES_UNOWN_B + 26) + // National Dex Index Defines #define NATIONAL_DEX_NONE 0 @@ -845,31 +845,31 @@ #define NATIONAL_DEX_COUNT NATIONAL_DEX_DEOXYS -#define NATIONAL_DEX_OLD_UNOWN_B 387 -#define NATIONAL_DEX_OLD_UNOWN_C 388 -#define NATIONAL_DEX_OLD_UNOWN_D 389 -#define NATIONAL_DEX_OLD_UNOWN_E 390 -#define NATIONAL_DEX_OLD_UNOWN_F 391 -#define NATIONAL_DEX_OLD_UNOWN_G 392 -#define NATIONAL_DEX_OLD_UNOWN_H 393 -#define NATIONAL_DEX_OLD_UNOWN_I 394 -#define NATIONAL_DEX_OLD_UNOWN_J 395 -#define NATIONAL_DEX_OLD_UNOWN_K 396 -#define NATIONAL_DEX_OLD_UNOWN_L 397 -#define NATIONAL_DEX_OLD_UNOWN_M 398 -#define NATIONAL_DEX_OLD_UNOWN_N 399 -#define NATIONAL_DEX_OLD_UNOWN_O 400 -#define NATIONAL_DEX_OLD_UNOWN_P 401 -#define NATIONAL_DEX_OLD_UNOWN_Q 402 -#define NATIONAL_DEX_OLD_UNOWN_R 403 -#define NATIONAL_DEX_OLD_UNOWN_S 404 -#define NATIONAL_DEX_OLD_UNOWN_T 405 -#define NATIONAL_DEX_OLD_UNOWN_U 406 -#define NATIONAL_DEX_OLD_UNOWN_V 407 -#define NATIONAL_DEX_OLD_UNOWN_W 408 -#define NATIONAL_DEX_OLD_UNOWN_X 409 -#define NATIONAL_DEX_OLD_UNOWN_Y 410 -#define NATIONAL_DEX_OLD_UNOWN_Z 411 +#define NATIONAL_DEX_OLD_UNOWN_B (NATIONAL_DEX_COUNT + 1) +#define NATIONAL_DEX_OLD_UNOWN_C (NATIONAL_DEX_OLD_UNOWN_B + 1) +#define NATIONAL_DEX_OLD_UNOWN_D (NATIONAL_DEX_OLD_UNOWN_B + 2) +#define NATIONAL_DEX_OLD_UNOWN_E (NATIONAL_DEX_OLD_UNOWN_B + 3) +#define NATIONAL_DEX_OLD_UNOWN_F (NATIONAL_DEX_OLD_UNOWN_B + 4) +#define NATIONAL_DEX_OLD_UNOWN_G (NATIONAL_DEX_OLD_UNOWN_B + 5) +#define NATIONAL_DEX_OLD_UNOWN_H (NATIONAL_DEX_OLD_UNOWN_B + 6) +#define NATIONAL_DEX_OLD_UNOWN_I (NATIONAL_DEX_OLD_UNOWN_B + 7) +#define NATIONAL_DEX_OLD_UNOWN_J (NATIONAL_DEX_OLD_UNOWN_B + 8) +#define NATIONAL_DEX_OLD_UNOWN_K (NATIONAL_DEX_OLD_UNOWN_B + 9) +#define NATIONAL_DEX_OLD_UNOWN_L (NATIONAL_DEX_OLD_UNOWN_B + 10) +#define NATIONAL_DEX_OLD_UNOWN_M (NATIONAL_DEX_OLD_UNOWN_B + 11) +#define NATIONAL_DEX_OLD_UNOWN_N (NATIONAL_DEX_OLD_UNOWN_B + 12) +#define NATIONAL_DEX_OLD_UNOWN_O (NATIONAL_DEX_OLD_UNOWN_B + 13) +#define NATIONAL_DEX_OLD_UNOWN_P (NATIONAL_DEX_OLD_UNOWN_B + 14) +#define NATIONAL_DEX_OLD_UNOWN_Q (NATIONAL_DEX_OLD_UNOWN_B + 15) +#define NATIONAL_DEX_OLD_UNOWN_R (NATIONAL_DEX_OLD_UNOWN_B + 16) +#define NATIONAL_DEX_OLD_UNOWN_S (NATIONAL_DEX_OLD_UNOWN_B + 17) +#define NATIONAL_DEX_OLD_UNOWN_T (NATIONAL_DEX_OLD_UNOWN_B + 18) +#define NATIONAL_DEX_OLD_UNOWN_U (NATIONAL_DEX_OLD_UNOWN_B + 19) +#define NATIONAL_DEX_OLD_UNOWN_V (NATIONAL_DEX_OLD_UNOWN_B + 20) +#define NATIONAL_DEX_OLD_UNOWN_W (NATIONAL_DEX_OLD_UNOWN_B + 21) +#define NATIONAL_DEX_OLD_UNOWN_X (NATIONAL_DEX_OLD_UNOWN_B + 22) +#define NATIONAL_DEX_OLD_UNOWN_Y (NATIONAL_DEX_OLD_UNOWN_B + 23) +#define NATIONAL_DEX_OLD_UNOWN_Z (NATIONAL_DEX_OLD_UNOWN_B + 24) // Hoenn Dex Index Defines @@ -1264,30 +1264,30 @@ #define HOENN_DEX_HO_OH 385 #define HOENN_DEX_CELEBI 386 -#define HOENN_DEX_OLD_UNOWN_B 387 -#define HOENN_DEX_OLD_UNOWN_C 388 -#define HOENN_DEX_OLD_UNOWN_D 389 -#define HOENN_DEX_OLD_UNOWN_E 390 -#define HOENN_DEX_OLD_UNOWN_F 391 -#define HOENN_DEX_OLD_UNOWN_G 392 -#define HOENN_DEX_OLD_UNOWN_H 393 -#define HOENN_DEX_OLD_UNOWN_I 394 -#define HOENN_DEX_OLD_UNOWN_J 395 -#define HOENN_DEX_OLD_UNOWN_K 396 -#define HOENN_DEX_OLD_UNOWN_L 397 -#define HOENN_DEX_OLD_UNOWN_M 398 -#define HOENN_DEX_OLD_UNOWN_N 399 -#define HOENN_DEX_OLD_UNOWN_O 400 -#define HOENN_DEX_OLD_UNOWN_P 401 -#define HOENN_DEX_OLD_UNOWN_Q 402 -#define HOENN_DEX_OLD_UNOWN_R 403 -#define HOENN_DEX_OLD_UNOWN_S 404 -#define HOENN_DEX_OLD_UNOWN_T 405 -#define HOENN_DEX_OLD_UNOWN_U 406 -#define HOENN_DEX_OLD_UNOWN_V 407 -#define HOENN_DEX_OLD_UNOWN_W 408 -#define HOENN_DEX_OLD_UNOWN_X 409 -#define HOENN_DEX_OLD_UNOWN_Y 410 -#define HOENN_DEX_OLD_UNOWN_Z 411 +#define HOENN_DEX_OLD_UNOWN_B (HOENN_DEX_CELEBI + 1) +#define HOENN_DEX_OLD_UNOWN_C (HOENN_DEX_OLD_UNOWN_B + 1) +#define HOENN_DEX_OLD_UNOWN_D (HOENN_DEX_OLD_UNOWN_B + 2) +#define HOENN_DEX_OLD_UNOWN_E (HOENN_DEX_OLD_UNOWN_B + 3) +#define HOENN_DEX_OLD_UNOWN_F (HOENN_DEX_OLD_UNOWN_B + 4) +#define HOENN_DEX_OLD_UNOWN_G (HOENN_DEX_OLD_UNOWN_B + 5) +#define HOENN_DEX_OLD_UNOWN_H (HOENN_DEX_OLD_UNOWN_B + 6) +#define HOENN_DEX_OLD_UNOWN_I (HOENN_DEX_OLD_UNOWN_B + 7) +#define HOENN_DEX_OLD_UNOWN_J (HOENN_DEX_OLD_UNOWN_B + 8) +#define HOENN_DEX_OLD_UNOWN_K (HOENN_DEX_OLD_UNOWN_B + 9) +#define HOENN_DEX_OLD_UNOWN_L (HOENN_DEX_OLD_UNOWN_B + 10) +#define HOENN_DEX_OLD_UNOWN_M (HOENN_DEX_OLD_UNOWN_B + 11) +#define HOENN_DEX_OLD_UNOWN_N (HOENN_DEX_OLD_UNOWN_B + 12) +#define HOENN_DEX_OLD_UNOWN_O (HOENN_DEX_OLD_UNOWN_B + 13) +#define HOENN_DEX_OLD_UNOWN_P (HOENN_DEX_OLD_UNOWN_B + 14) +#define HOENN_DEX_OLD_UNOWN_Q (HOENN_DEX_OLD_UNOWN_B + 15) +#define HOENN_DEX_OLD_UNOWN_R (HOENN_DEX_OLD_UNOWN_B + 16) +#define HOENN_DEX_OLD_UNOWN_S (HOENN_DEX_OLD_UNOWN_B + 17) +#define HOENN_DEX_OLD_UNOWN_T (HOENN_DEX_OLD_UNOWN_B + 18) +#define HOENN_DEX_OLD_UNOWN_U (HOENN_DEX_OLD_UNOWN_B + 19) +#define HOENN_DEX_OLD_UNOWN_V (HOENN_DEX_OLD_UNOWN_B + 20) +#define HOENN_DEX_OLD_UNOWN_W (HOENN_DEX_OLD_UNOWN_B + 21) +#define HOENN_DEX_OLD_UNOWN_X (HOENN_DEX_OLD_UNOWN_B + 22) +#define HOENN_DEX_OLD_UNOWN_Y (HOENN_DEX_OLD_UNOWN_B + 23) +#define HOENN_DEX_OLD_UNOWN_Z (HOENN_DEX_OLD_UNOWN_B + 24) #endif // GUARD_CONSTANTS_SPECIES_H diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h index e2836c6f6..2d0e1bb1c 100644 --- a/include/gba/m4a_internal.h +++ b/include/gba/m4a_internal.h @@ -67,52 +67,69 @@ struct ToneData u8 release; }; +#define SOUND_CHANNEL_SF_START 0x80 +#define SOUND_CHANNEL_SF_STOP 0x40 +#define SOUND_CHANNEL_SF_LOOP 0x10 +#define SOUND_CHANNEL_SF_IEC 0x04 +#define SOUND_CHANNEL_SF_ENV 0x03 +#define SOUND_CHANNEL_SF_ENV_ATTACK 0x03 +#define SOUND_CHANNEL_SF_ENV_DECAY 0x02 +#define SOUND_CHANNEL_SF_ENV_SUSTAIN 0x01 +#define SOUND_CHANNEL_SF_ENV_RELEASE 0x00 +#define SOUND_CHANNEL_SF_ON (SOUND_CHANNEL_SF_START | SOUND_CHANNEL_SF_STOP | SOUND_CHANNEL_SF_IEC | SOUND_CHANNEL_SF_ENV) + +#define CGB_CHANNEL_MO_PIT 0x02 +#define CGB_CHANNEL_MO_VOL 0x01 + +#define CGB_NRx2_ENV_DIR_DEC 0x00 +#define CGB_NRx2_ENV_DIR_INC 0x08 + struct CgbChannel { - u8 sf; // 0x0 - u8 ty; // 0x1 - u8 rightVolume; // 0x2 - u8 leftVolume; // 0x3 - u8 at; // 0x4 - u8 de; // 0x5 - u8 su; // 0x6 - u8 re; // 0x7 - u8 ky; // 0x8 - u8 ev; // 0x9 - u8 eg; // 0xA - u8 ec; // 0xB - u8 echoVolume; // 0xC - u8 echoLength; // 0xD - u8 d1; // 0xE - u8 d2; // 0xF - u8 gt; // 0x10 - u8 mk; // 0x11 - u8 ve; // 0x12 - u8 pr; // 0x13 - u8 rp; // 0x14 - u8 d3[3]; // 0x15, 0x16, 0x17 - u8 d5; // 0x18 - u8 sg; // 0x19 - u8 n4; // 0x1A - u8 pan; // 0x1B - u8 panMask; // 0x1C - u8 mo; // 0x1D - u8 le; // 0x1E - u8 sw; // 0x1F - u32 fr; // 0x20 - u32 *wp; - u32 cp; - u32 tp; - u32 pp; - u32 np; - u8 d4[8]; + u8 statusFlags; + u8 type; + u8 rightVolume; + u8 leftVolume; + u8 attack; + u8 decay; + u8 sustain; + u8 release; + u8 key; + u8 envelopeVolume; + u8 envelopeGoal; + u8 envelopeCounter; + u8 pseudoEchoVolume; + u8 pseudoEchoLength; + u8 dummy1; + u8 dummy2; + u8 gateTime; + u8 midiKey; + u8 velocity; + u8 priority; + u8 rhythmPan; + u8 dummy3[3]; + u8 dummy5; + u8 sustainGoal; + u8 n4; // NR[1-4]4 register (initial, length bit) + u8 pan; + u8 panMask; + u8 modify; + u8 length; + u8 sweep; + u32 frequency; + u32 *wavePointer; // instructs CgbMain to load targeted wave + u32 *currentPointer; // stores the currently loaded wave + struct MusicPlayerTrack *track; + void *prevChannelPointer; + void *nextChannelPointer; + u8 dummy4[8]; }; struct MusicPlayerTrack; struct SoundChannel { - u8 status; + u8 statusFlags; u8 type; u8 rightVolume; u8 leftVolume; @@ -120,29 +137,29 @@ struct SoundChannel u8 decay; u8 sustain; u8 release; - u8 ky; - u8 ev; - u8 er; - u8 el; - u8 echoVolume; - u8 echoLength; - u8 d1; - u8 d2; - u8 gt; - u8 mk; - u8 ve; - u8 pr; - u8 rp; - u8 d3[3]; - u32 ct; + u8 key; // midi key as it was translated into final pitch + u8 envelopeVolume; + u8 envelopeVolumeRight; + u8 envelopeVolumeLeft; + u8 pseudoEchoVolume; + u8 pseudoEchoLength; + u8 dummy1; + u8 dummy2; + u8 gateTime; + u8 midiKey; // midi key as it was used in the track data + u8 velocity; + u8 priority; + u8 rhythmPan; + u8 dummy3[3]; + u32 count; u32 fw; - u32 freq; + u32 frequency; struct WaveData *wav; - u32 cp; + s8 *currentPointer; struct MusicPlayerTrack *track; - u32 pp; - u32 np; - u32 d4; + void *prevChannelPointer; + void *nextChannelPointer; + u32 dummy4; u16 xpi; u16 xpc; }; @@ -151,6 +168,16 @@ struct SoundChannel #define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer +struct MusicPlayerInfo; + +typedef void (*MPlayFunc)(); +typedef void (*PlyNoteFunc)(u32, struct MusicPlayerInfo *, struct MusicPlayerTrack *); +typedef void (*CgbSoundFunc)(void); +typedef void (*CgbOscOffFunc)(u8); +typedef u32 (*MidiKeyToCgbFreqFunc)(u8, u8, u8); +typedef void (*ExtVolPitFunc)(void); +typedef void (*MPlayMainFunc)(struct MusicPlayerInfo *); + struct SoundInfo { // This field is normally equal to ID_NUMBER but it is set to other @@ -168,7 +195,7 @@ struct SoundInfo u8 freq; u8 mode; - u8 c15; + u8 c15; // periodically counts from 14 down to 0 (15 states) u8 pcmDmaPeriod; // number of V-blanks per PCM DMA u8 maxLines; u8 gap[3]; @@ -176,14 +203,14 @@ struct SoundInfo s32 pcmFreq; s32 divFreq; struct CgbChannel *cgbChans; - u32 func; - u32 intp; - void (*CgbSound)(void); - void (*CgbOscOff)(u8); - u32 (*MidiKeyToCgbFreq)(u8, u8, u8); - u32 MPlayJumpTable; - u32 plynote; - u32 ExtVolPit; + MPlayMainFunc MPlayMainHead; + struct MusicPlayerInfo *musicPlayerHead; + CgbSoundFunc CgbSound; + CgbOscOffFunc CgbOscOff; + MidiKeyToCgbFreqFunc MidiKeyToCgbFreq; + MPlayFunc *MPlayJumpTable; + PlyNoteFunc plynote; + ExtVolPitFunc ExtVolPit; u8 gap2[16]; struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS]; s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2]; @@ -270,8 +297,8 @@ struct MusicPlayerTrack u8 lfoDelay; u8 lfoDelayC; u8 priority; - u8 echoVolume; - u8 echoLength; + u8 pseudoEchoVolume; + u8 pseudoEchoLength; struct SoundChannel *chan; struct ToneData tone; u8 gap[10]; @@ -312,8 +339,8 @@ struct MusicPlayerInfo struct MusicPlayerTrack *tracks; struct ToneData *tone; u32 ident; - u32 func; - u32 intp; + MPlayMainFunc MPlayMainNext; + struct MusicPlayerInfo *musicPlayerNext; }; struct MusicPlayer @@ -351,7 +378,7 @@ extern struct MusicPlayerTrack gPokemonCryTracks[]; extern char SoundMainRAM[]; -extern void *gMPlayJumpTable[]; +extern MPlayFunc gMPlayJumpTable[]; typedef void (*XcmdFunc)(struct MusicPlayerInfo *, struct MusicPlayerTrack *); extern const XcmdFunc gXcmdTable[]; @@ -380,7 +407,7 @@ u32 umul3232H32(u32 multiplier, u32 multiplicand); void SoundMain(void); void SoundMainBTM(void); void TrackStop(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track); -void MPlayMain(void); +void MPlayMain(struct MusicPlayerInfo *); void RealClearChain(void *x); void MPlayContinue(struct MusicPlayerInfo *mplayInfo); @@ -400,7 +427,7 @@ void CgbOscOff(u8); void CgbModVol(struct CgbChannel *chan); u32 MidiKeyToCgbFreq(u8, u8, u8); void DummyFunc(void); -void MPlayJumpTableCopy(void **mplayJumpTable); +void MPlayJumpTableCopy(MPlayFunc *mplayJumpTable); void SampleFreqSet(u32 freq); void m4aSoundVSyncOn(void); void m4aSoundVSyncOff(void); @@ -448,7 +475,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *); void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *); void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *); void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *); -void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_note(u32 note_cmd, struct MusicPlayerInfo *, struct MusicPlayerTrack *); // extended sound command handler functions void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *); diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 4598e87fa..c4d7be35d 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -195,15 +195,10 @@ struct ObjectEvent /*0x0C*/ struct Coords16 initialCoords; /*0x10*/ struct Coords16 currentCoords; /*0x14*/ struct Coords16 previousCoords; - /*0x18*/ u8 facingDirection:4; // current direction? - /*0x18*/ u8 movementDirection:4; - /*0x19*/ union __attribute__((packed)) { - u8 as_byte; - struct __attribute__((packed)) { - u8 x:4; - u8 y:4; - } ALIGNED(1) as_nybbles; - } ALIGNED(1) range; + /*0x18*/ u16 facingDirection:4; // current direction? + u16 movementDirection:4; + u16 rangeX:4; + u16 rangeY:4; /*0x1A*/ u8 fieldEffectSpriteId; /*0x1B*/ u8 warpArrowSpriteId; /*0x1C*/ u8 movementActionId; @@ -219,8 +214,8 @@ struct ObjectEvent struct ObjectEventGraphicsInfo { /*0x00*/ u16 tileTag; - /*0x02*/ u16 paletteTag1; - /*0x04*/ u16 paletteTag2; + /*0x02*/ u16 paletteTag; + /*0x04*/ u16 reflectionPaletteTag; /*0x06*/ u16 size; /*0x08*/ s16 width; /*0x0A*/ s16 height; diff --git a/include/global.h b/include/global.h index 85166e0ec..4ccd2be50 100644 --- a/include/global.h +++ b/include/global.h @@ -328,11 +328,12 @@ struct BattleDomeTrainer }; #define DOME_TOURNAMENT_TRAINERS_COUNT 16 +#define BATTLE_TOWER_RECORD_COUNT 5 struct BattleFrontier { /*0x64C*/ struct EmeraldBattleTowerRecord towerPlayer; - /*0x738*/ struct EmeraldBattleTowerRecord towerRecords[5]; // From record mixing. + /*0x738*/ struct EmeraldBattleTowerRecord towerRecords[BATTLE_TOWER_RECORD_COUNT]; // From record mixing. /*0xBEB*/ struct BattleTowerInterview towerInterview; /*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer; /*0xCA8*/ u8 challengeStatus; diff --git a/include/graphics.h b/include/graphics.h index 32268d6db..936f95aa8 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -5014,4 +5014,10 @@ extern const u16 gPokenavMessageBox_Pal[]; extern const u32 gPokenavOptions_Gfx[]; extern const u16 gPokenavOptions_Pal[]; +// Object event pals +extern const u16 gObjectEventPal_Brendan[]; +extern const u16 gObjectEventPal_May[]; +extern const u16 gObjectEventPal_RubySapphireBrendan[]; +extern const u16 gObjectEventPal_RubySapphireMay[]; + #endif //GUARD_GRAPHICS_H |