Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pret merge (17 of January) #6045

Merged
merged 18 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
459 changes: 231 additions & 228 deletions asm/macros/event.inc

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions data/event_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

.section script_data, "aw", %progbits

.set ALLOCATE_SCRIPT_CMD_TABLE, 1
.include "data/script_cmd_table.inc"

gSpecialVars::
Expand Down
475 changes: 246 additions & 229 deletions data/script_cmd_table.inc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions data/scripts/mauville_man.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_Bard::
end

MauvilleCity_PokemonCenter_1F_EventScript_PlaySong::
setvar VAR_0x8004, 0
setvar VAR_0x8004, FALSE @ Play his current song
special PlayBardSong
delay 60
special HasBardSongBeenChanged
Expand All @@ -45,7 +45,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_WriteLyrics::
faceplayer
goto_if_eq VAR_RESULT, 0, MauvilleCity_PokemonCenter_1F_EventScript_DeclineWritingLyrics
msgbox MauvilleCity_PokemonCenter_1F_Text_LetMeSingItForYou, MSGBOX_DEFAULT
setvar VAR_0x8004, 1
setvar VAR_0x8004, TRUE @ Play the new song
special PlayBardSong
delay 60
msgbox MauvilleCity_PokemonCenter_1F_Text_ThatHowYouWantedSongToGo, MSGBOX_YESNO
Expand Down
10 changes: 9 additions & 1 deletion graphics/cave_transition/enter.pal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JASC-PAL
0100
8
16
148 197 172
16 16 16
32 32 32
Expand All @@ -9,3 +9,11 @@ JASC-PAL
82 82 82
98 98 98
115 115 115
131 131 131
148 148 148
164 164 164
180 180 180
197 197 197
213 213 213
230 230 230
255 255 255
11 changes: 0 additions & 11 deletions graphics/cave_transition/exit.pal

This file was deleted.

54 changes: 31 additions & 23 deletions include/bard_music.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
#ifndef GUARD_BARD_MUSIC_H
#define GUARD_BARD_MUSIC_H

#define BARD_SOUND_MAX_LENGTH 6
// The maximum number of BardSoundTemplates/BardSounds there can be for each easy chat word.
#define MAX_BARD_SOUNDS_PER_WORD 6

struct BardSound
// The number of pitch tables there are for each pitch table size (see sPitchTables).
#define NUM_BARD_PITCH_TABLES_PER_SIZE 5

// This struct describes which phoneme song to play for the sound, and whether to
// make any adjustments to its length or volume. Very few sounds make any adjustments.
struct BardSoundTemplate
{
/*0x00*/ u8 songLengthId;
/*0x01*/ s8 songLengthOffset;
/*0x02*/ u16 unused;
/*0x04*/ s16 volume;
/*0x06*/ u16 unused2;
u8 songId;
s8 lengthAdjustment;
u16 unused; // Only set on EC_WORD_WAAAH, and never read.
s16 volume;
};

struct BardPhoneme
// This is the length and pitch to play the phoneme song at.
// These will be calculated in 'CalcWordSounds'.
struct BardSound
{
/*0x00*/ u16 length;
/*0x02*/ u16 pitch;
u16 length;
u16 pitch;
};

struct BardSong
{
/*0x00*/ u8 currWord;
/*0x01*/ u8 currPhoneme;
/*0x02*/ u8 phonemeTimer;
/*0x03*/ u8 state;
/*0x04*/ s16 length;
/*0x06*/ u16 volume;
/*0x08*/ s16 pitch;
/*0x0A*/ s16 voiceInflection;
/*0x0C*/ u16 lyrics[BARD_SOUND_MAX_LENGTH];
/*0x18*/ struct BardPhoneme phonemes[BARD_SOUND_MAX_LENGTH];
/*0x30*/ const struct BardSound *sound;
u8 lyricsIndex;
u8 soundIndex;
u8 timer;
u8 state;
s16 length; // Length of the sound for the word currently being sung (i.e. the sum of 'length' in all the current word's phonemes).
u16 volume;
s16 pitch;
s16 voiceInflection;
u16 lyrics[NUM_BARD_SONG_WORDS];
struct BardSound sounds[MAX_BARD_SOUNDS_PER_WORD];
const struct BardSoundTemplate *soundTemplates;
};

extern const u16 gNumBardWords_Species;
extern const u16 gNumBardWords_Moves;
const struct BardSound *GetWordSounds(u16 word);
void GetWordPhonemes(struct BardSong *song, u16 word);

const struct BardSoundTemplate *GetWordSoundTemplates(u16 easyChatWord);
void CalcWordSounds(struct BardSong *song, u16 pitchTableIndex);

#endif //GUARD_BARD_MUSIC_H
1 change: 1 addition & 0 deletions include/constants/contest.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
#define CONTEST_EFFECT_TYPE_WORSEN 4
#define CONTEST_EFFECT_TYPE_SPECIAL_APPEAL 5
#define CONTEST_EFFECT_TYPE_TURN_ORDER 6
#define CONTEST_EFFECT_TYPE_UNKNOWN 8

#define COMBO_STARTER_POUND 1
#define COMBO_STARTER_FIRE_PUNCH 2
Expand Down
2 changes: 1 addition & 1 deletion include/constants/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
#define FEMALE 1
#define GENDER_COUNT 2

#define BARD_SONG_LENGTH 6
#define NUM_BARD_SONG_WORDS 6
#define NUM_STORYTELLER_TALES 4
#define NUM_TRADER_ITEMS 4
#define GIDDY_MAX_TALES 10
Expand Down
8 changes: 8 additions & 0 deletions include/constants/songs.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@
#define MUS_RG_TEACHY_TV_MENU 558 // MUS_RG_TVNOIZE
#define END_MUS MUS_RG_TEACHY_TV_MENU

// These PH_* constants are phoneme sounds used by the "bard" NPC (see src/bard_music.c and src/mauville_old_man.c).
// Each comes in a triplet of PH_*_BLEND, PH_*_HELD, and PH_*_SOLO, and the name of each triplet incorporates the English phonetic sound it represents.
#define PH_TRAP_BLEND 559
#define PH_TRAP_HELD 560
#define PH_TRAP_SOLO 561
Expand Down Expand Up @@ -548,4 +550,10 @@

#define MUS_NONE 0xFFFF

#define FIRST_PHONEME_SONG PH_TRAP_BLEND
#define LAST_PHONEME_SONG PH_NURSE_SOLO
#define NUM_PHONEME_SONGS (LAST_PHONEME_SONG - FIRST_PHONEME_SONG + 1)
#define PHONEME_ID(song) ((song) - FIRST_PHONEME_SONG)
#define PHONEME_ID_NONE 0xFF

#endif // GUARD_CONSTANTS_SONGS_H
2 changes: 1 addition & 1 deletion include/constants/vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define VARS_START 0x4000

// temporary vars
// The first 0x10 vars are are temporary--they are cleared every time a map is loaded.
// The first 0x10 vars are temporary--they are cleared every time a map is loaded.
#define TEMP_VARS_START 0x4000
#define VAR_TEMP_0 (TEMP_VARS_START + 0x0)
#define VAR_TEMP_1 (TEMP_VARS_START + 0x1)
Expand Down
4 changes: 2 additions & 2 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,8 @@ struct MauvilleManBard
{
/*0x00*/ u8 id;
/*0x01*/ //u8 padding1;
/*0x02*/ u16 songLyrics[BARD_SONG_LENGTH];
/*0x0E*/ u16 temporaryLyrics[BARD_SONG_LENGTH];
/*0x02*/ u16 songLyrics[NUM_BARD_SONG_WORDS];
/*0x0E*/ u16 newSongLyrics[NUM_BARD_SONG_WORDS];
/*0x1A*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x22*/ u8 filler_2DB6[0x3];
/*0x25*/ u8 playerTrainerId[TRAINER_ID_LENGTH];
Expand Down
6 changes: 3 additions & 3 deletions include/rotating_gate.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef GUARD_ROTATING_GATE_H
#define GUARD_ROTATING_GATE_H

void RotatingGatePuzzleCameraUpdate(s16, s16);
void RotatingGatePuzzleCameraUpdate(s16 deltaX, s16 deltaY);
void RotatingGate_InitPuzzleAndGraphics(void);
u32 CheckForRotatingGatePuzzleCollision(u8, s16, s16);
bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8, s16, s16);
bool32 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y);
bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s16 y);

#endif // GUARD_ROTATING_GATE_H
5 changes: 3 additions & 2 deletions include/sprite.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef GUARD_SPRITE_H
#define GUARD_SPRITE_H

#define OAM_MATRIX_COUNT 32
#define MAX_SPRITES 64
#define SPRITE_NONE 0xFF
#define TAG_NONE 0xFFFF
Expand Down Expand Up @@ -260,12 +261,12 @@ extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[];
extern const struct SpriteTemplate gDummySpriteTemplate;

extern u8 gReservedSpritePaletteCount;
extern struct Sprite gSprites[];
extern struct Sprite gSprites[MAX_SPRITES + 1];
extern u8 gOamLimit;
extern u16 gReservedSpriteTileCount;
extern s16 gSpriteCoordOffsetX;
extern s16 gSpriteCoordOffsetY;
extern struct OamMatrix gOamMatrices[];
extern struct OamMatrix gOamMatrices[OAM_MATRIX_COUNT];
extern bool8 gAffineAnimsDisabled;

void ResetSpriteData(void);
Expand Down
4 changes: 3 additions & 1 deletion include/test/overworld_script.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#define RUN_OVERWORLD_SCRIPT(...) RunScriptImmediately(OVERWORLD_SCRIPT(__VA_ARGS__))

// Make overworld script macros available.
asm(".include \"asm/macros/event.inc\"\n");
asm(".include \"constants/gba_constants.inc\"\n"
".include \"asm/macros/asm.inc\"\n"
".include \"asm/macros/event.inc\"\n");

#endif
Loading
Loading