Alchemy
Loading...
Searching...
No Matches

speakers.c

Go to the documentation of this file.
1/// @file
2/// Speaker definitions: portraits and idle lines by sprite.
3/// Part of object.c, the field object, compiled only through it.
4
6
7/// Returns the speaker definition of sprite id from gBattleFx_DefinitionTable,
8/// or its last entry when there is none. The search stops after 0x82 entries,
9/// all but the table's last of its 131.
12 u32 definitionIndex = 0;
13
14 if (entry->id != id) {
15 do {
16 definitionIndex += 1;
17 entry++;
18 if (definitionIndex > 0x81)
19 break;
20 } while (entry->id != id);
21 }
22 return entry;
23}
24
25/// Returns the sprite id stored by a live actor's animated sprite, or 0 when
26/// that actor has no animated sprite or its sprite-id pointer is absent.
28 struct BattleRenderObject *object = ObjectTable_Get(id);
29
30 if (object->kind != 1 || object->animation == NULL ||
31 object->animation->value28 == NULL) {
32 return 0;
33 }
34 return *object->animation->value28;
35}
36
37/// Returns the portrait shown beside the messages of sprite id (0x100 plus
38/// its definition's value), or 0 with no portrait or with gGameState.speech
39/// off.
41 u8 portraitId;
42
43 if (gGameState.speech == 0 ||
44 (portraitId = BattleFx_FindDefinition(id)->value) == 0xFF) {
45 return 0;
46 }
47 return portraitId + 0x100;
48}
49
50/// Returns the definition flags of actor id's sprite, which choose its line
51/// when it has nothing to say.
54}
void * ObjectTable_Get(u32 actorIndex)
Returns the actor in slot index (0 to 65), or NULL.
Definition actors.c:462
const struct BattleEffectEntry gBattleFx_DefinitionTable[131]
Speaker definitions: {sprite, portrait (0xff for none), idle line flags}.
Definition fxdata.c:163
struct GameState gGameState
What every part of object.c shares: its includes and the macros and types more than one part uses.
s32 BattleFx_GetAnimationValue(s32 id)
Returns the sprite id stored by a live actor's animated sprite, or 0 when that actor has no animated ...
Definition speakers.c:27
s32 BattleFx_GetResourceId(u32 id)
Returns the portrait shown beside the messages of sprite id (0x100 plus its definition's value),...
Definition speakers.c:40
struct BattleEffectEntry * BattleFx_FindDefinition(u32 id)
Returns the speaker definition of sprite id from gBattleFx_DefinitionTable, or its last entry when th...
Definition speakers.c:10
s32 BattleFx_GetFlags(s32 id)
Returns the definition flags of actor id's sprite, which choose its line when it has nothing to say.
Definition speakers.c:52
#define NULL
Definition bilibin.h:6
A speaker definition, a row of gBattleFx_DefinitionTable: a sprite, its portrait (0xff for none) and ...
A field actor as the speaker lookup reads it: its kind (1 for an animated sprite) and that sprite.
struct BattleAnimationState * animation
u8 speech
1 shows speakers' portraits beside their messages
Definition game_state.h:64
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned char u8
Definition types.h:11