mu-review in process

This commit is contained in:
MokhaLeee 2024-07-11 13:22:20 +08:00
parent 789afb3653
commit 5916290a71
28 changed files with 467 additions and 529 deletions

View File

@ -46,4 +46,12 @@ void APProc_Delete(struct APProc * proc);
void APProc_DeleteAll(void);
bool APProc_Exists(void);
#define ResetSpriteAnimClock(anim) \
(anim)->frameTimer = 0; \
(anim)->frameInterval = 0x100
#define FreezeSpriteAnim(anim) \
(anim)->frameTimer = 0; \
(anim)->frameInterval = 0
#endif // GUARD_AP_H

View File

@ -90,4 +90,11 @@ void PushSpriteLayerObjects(int layer);
struct SpriteProc * StartSpriteRefresher(ProcPtr parent, int layer, int x, int y, const u16* object, int tileref);
void MoveSpriteRefresher(struct SpriteProc* proc, int x, int y);
#define SetObjAffineAuto(id, angle, x_scale, y_scale) \
SetObjAffine((id), \
Div(+COS((angle)) << 4, (x_scale)), \
Div(-SIN((angle)) << 4, (y_scale)), \
Div(+SIN((angle)) << 4, (x_scale)), \
Div(+COS((angle)) << 4, (y_scale)))
#endif // GUARD_CTC_H

View File

@ -16,16 +16,18 @@ enum {
MU_MAX_COUNT = 4,
// Maximum move command count
MU_COMMAND_MAX_COUNT = 0x40,
MOVE_CMD_MAX_COUNT = 0x40,
// Maximum size of uncompressed MU sprite sheet
MU_GFX_MAX_SIZE = 0x2200,
// Default base obj tile index for storing sprites in VRAM
MU_BASE_OBJ_TILE = 0x380,
OBCHR_MU_180 = 0x180,
OBCHR_MU_380 = 0x380,
// obj palette id used for MU fade effects
MU_FADE_OBJ_PAL = 5,
OBPAL_MU_1 = 1,
OBPAL_MU_FADE = 5,
// Number of bits used to keep track of subpixels
MU_SUBPIXEL_PRECISION = 4,
@ -49,31 +51,31 @@ enum
{
// MU command identifiers
MU_COMMAND_END = -1, // end
MOVE_CMD_END = -1, // end
MU_COMMAND_MOVE_BASE,
MOVE_CMD_MOVE_BASE,
MU_COMMAND_MOVE_LEFT = MU_COMMAND_MOVE_BASE + FACING_LEFT,
MU_COMMAND_MOVE_RIGHT = MU_COMMAND_MOVE_BASE + FACING_RIGHT,
MU_COMMAND_MOVE_DOWN = MU_COMMAND_MOVE_BASE + FACING_DOWN,
MU_COMMAND_MOVE_UP = MU_COMMAND_MOVE_BASE + FACING_UP,
MOVE_CMD_MOVE_LEFT = MOVE_CMD_MOVE_BASE + FACING_LEFT,
MOVE_CMD_MOVE_RIGHT = MOVE_CMD_MOVE_BASE + FACING_RIGHT,
MOVE_CMD_MOVE_DOWN = MOVE_CMD_MOVE_BASE + FACING_DOWN,
MOVE_CMD_MOVE_UP = MOVE_CMD_MOVE_BASE + FACING_UP,
MU_COMMAND_HALT,
MOVE_CMD_HALT,
MU_COMMAND_FACE_BASE,
MOVE_CMD_FACE_BASE,
MU_COMMAND_FACE_LEFT = MU_COMMAND_FACE_BASE + FACING_LEFT,
MU_COMMAND_FACE_RIGHT = MU_COMMAND_FACE_BASE + FACING_RIGHT,
MU_COMMAND_FACE_DOWN = MU_COMMAND_FACE_BASE + FACING_DOWN,
MU_COMMAND_FACE_UP = MU_COMMAND_FACE_BASE + FACING_UP,
MOVE_CMD_FACE_LEFT = MOVE_CMD_FACE_BASE + FACING_LEFT,
MOVE_CMD_FACE_RIGHT = MOVE_CMD_FACE_BASE + FACING_RIGHT,
MOVE_CMD_FACE_DOWN = MOVE_CMD_FACE_BASE + FACING_DOWN,
MOVE_CMD_FACE_UP = MOVE_CMD_FACE_BASE + FACING_UP,
MU_COMMAND_WAIT,
MU_COMMAND_BUMP,
MU_COMMAND_UNK11,
MU_COMMAND_SET_SPEED,
MOVE_CMD_SLEEP,
MOVE_CMD_BUMP,
MOVE_CMD_UNK11,
MOVE_CMD_SET_SPEED,
MU_COMMAND_CAMERA_ON,
MU_COMMAND_CAMERA_OFF,
MOVE_CMD_CAMERA_ON,
MOVE_CMD_CAMERA_OFF,
};
enum
@ -115,7 +117,7 @@ struct MuProc {
/* 34 */ struct MuConfig * config;
/* 38 */ void* pGfxVRAM;
/* 3C */ u8 muIndex;
/* 3C */ u8 slot;
/* 3D */ u8 _u3D;
/* 3E */ u8 cam_b;
/* 3F */ u8 state;
@ -140,16 +142,20 @@ struct MuProc {
struct MuConfig {
/* 00 */ u8 muIndex;
/* 00 */ u8 slot;
/* 01 */ u8 pal;
/* 02 */ u16 chr;
/* 04 */ u8 currentCommand;
/* 05 */ s8 commands[MU_COMMAND_MAX_COUNT];
/* 04 */ u8 pc;
/* 05 */ s8 movescr[MOVE_CMD_MAX_COUNT];
/* 45 */ // 3 byte padding
/* 48 */ struct MuProc * mu;
};
#define MU_AdvanceGetCommand(proc) (proc->config->commands[proc->config->currentCommand++])
enum mu_config_ctrl_bits {
MU_CONFIG_SPPED_SLOW = 0x40,
MU_CONFIG_SPPED_NORMAL = 0x80,
MU_CONFIG_SPPED_FAST = 0x100,
};
struct MuStepSoundProc
{
@ -158,7 +164,7 @@ struct MuStepSoundProc
/* 58 */ u32 song1;
/* 5C */ u32 song2;
/* 60 */ u32 u60_buggedmaybe; // Checked for in MU_StartStepSfx but never initialized
/* 60 */ u32 unk60;
/* 64 */ s16 x1;
/* 66 */ s16 x2;
};
@ -167,13 +173,14 @@ struct MuFogBumpProc
{
PROC_HEADER;
/* 2C */ int xDisplay;
/* 30 */ int yDisplay;
/* 2C */ int x, y;
STRUCT_PAD(0x34, 0x50);
/* 34 */ STRUCT_PAD(0x34, 0x50);
/* 50 */ struct APHandle * sprite_anim;
/* 54 */ STRUCT_PAD(0x54, 0x64);
STRUCT_PAD(0x54, 0x64);
/* 64 */ s16 timer;
};
@ -219,73 +226,73 @@ struct MuProc * StartMuInternal(u16 x, u16 y, u16 jid, int objTileId, unsigned p
void SetMuFacing(struct MuProc * proc, int facing);
void SetMuDefaultFacing(struct MuProc * proc);
void SetAutoMuDefaultFacing(void);
void SetAutoMuMoveScript(const u8 commands[MU_COMMAND_MAX_COUNT]);
void SetAutoMuMoveScript(const u8 commands[MOVE_CMD_MAX_COUNT]);
s8 MuExists(void);
s8 MuExistsActive(void);
s8 IsMuActive(struct MuProc * proc);
void SetMuMoveScript(struct MuProc * proc, const u8 commands[MU_COMMAND_MAX_COUNT]);
struct MuProc * StartMuScripted(u16 x, u16 y, u16 jid, int palId, const u8 commands[MU_COMMAND_MAX_COUNT]);
void SetMuMoveScript(struct MuProc * proc, const u8 commands[MOVE_CMD_MAX_COUNT]);
struct MuProc * StartMuScripted(u16 x, u16 y, u16 jid, int palId, const u8 commands[MOVE_CMD_MAX_COUNT]);
void MuStepSe_Init(struct MuStepSoundProc * proc);
void MuStepSe_PlaySeA(struct MuStepSoundProc * proc);
void MuStepSe_PlaySeB(struct MuStepSoundProc * proc);
void MU_StartStepSfx(int soundId, int b, int hPosition);
void StartPlayMuStepSe(int song, int alt_offset, int x);
void PlayMuStepSe(struct MuProc * proc);
void MU_8078894(struct MuProc * proc);
void MU_InterpretCommandScript(struct MuProc * proc);
void MU_StartFogBumpFx(int x, int y);
void EndMuMovement(struct MuProc * proc);
void RunMuMoveScript(struct MuProc * proc);
void StartMuFogBump(int x, int y);
void MuFogBump_Init(struct MuFogBumpProc * proc);
void MuFogBump_ScaleLoop(struct MuFogBumpProc * proc);
void MuFogBump_EndLoop(struct MuFogBumpProc * proc);
u8 MU_IsFogBumpFxActive(void);
void Mu_OnStateBump(struct MuProc * proc);
void Mu_OnStateMoving(struct MuProc * proc);
void Mu_OnStateUnk4(struct MuProc * proc);
void Mu_OnStateSleeping(struct MuProc * proc);
void Mu_OnStateNone(struct MuProc * proc);
void Mu_OnStateDoNothing(struct MuProc * proc);
void Mu_OnStateMovement(struct MuProc * proc);
void MU_AdvanceStepSfx(struct MuProc * proc);
void UpdateMuStepSounds(struct MuProc * proc);
void MU_OnLoop(struct MuProc * proc);
void MU_OnEnd(struct MuProc * proc);
void MU_EndAll(void);
void MU_End(struct MuProc * proc);
void MU_EndInternal(struct MuProc * proc);
void MU_80790CC(struct MuProc * proc);
void HaltMu(struct MuProc * proc);
void MU_AllDisable(void);
void MU_AllEnable(void);
void MU_GetComputedEndPosition(int * xOut, int * yOut, const u8 * commands);
s8 MU_CanStart(void);
void MU_AllRestartAnimations(void);
void ApplyMoveScriptToCoordinates(int * xOut, int * yOut, const u8 * commands);
s8 CanStartMu(void);
void ResetMuAnims(void);
static struct MuConfig * GetDefaultMuConfig(int objTileId, u8 * outIndex);
static struct MuConfig * GetNewMuConfig(int objTileId, u8 * outIndex);
u8 MU_ComputeDisplayPosition(struct MuProc * proc, struct Vec2 * out);
void MU_DisplayAsSMS(struct MuProc * proc);
void MU_DisplayAsMMS(struct MuProc * proc);
u16 MU_GetMovementSpeed(struct MuProc * proc);
void MU_SetMoveConfig(struct MuProc * proc, u16 config);
void* GetMuImgBufById(int muIndex);
u8 GetMuDisplayPosition(struct MuProc * proc, struct Vec2 * out);
void PutMuSMS(struct MuProc * proc);
void PutMu(struct MuProc * proc);
u16 GetMuQ4MovementSpeed(struct MuProc * proc);
void SetMuConfig(struct MuProc * proc, u16 config);
void* GetMuImgBufById(int slot);
const void * GetMuImg(struct MuProc * proc);
const void * GetMuAnimForJid(u16 classId);
void MU_StartDeathFade(struct MuProc * muProc);
void MuDeathFade_OnLoop(struct MuEffectProc * proc);
void MUBlinkEffect_OnLoop(struct MuEffectProc * proc);
void MU_StartBlinkEffect(struct MuProc * muProc);
void MuBlink_OnLoop(struct MuEffectProc * proc);
void StartBlinkMu(struct MuProc * muProc);
void MU_SetupPixelEffect(u32* data, int frame);
void MuPixelEffect_OnLoop(struct MuEffectProc * proc);
void MU_StartPixelEffect(struct MuProc * muProc);
void MU_Hide(struct MuProc * proc);
void MU_Show(struct MuProc * proc);
void MU_SetDisplayPosition(struct MuProc * proc, int x, int y);
void MU_SetDisplayOffset(struct MuProc * proc, int xOff, int yOff);
void MU_StartFlashFade(struct MuProc * proc, int flashType);
void MU_8079858(struct MuProc * muProc);
void HideMu(struct MuProc * proc);
void ShowMu(struct MuProc * proc);
void SetMuScreenPosition(struct MuProc * proc, int x, int y);
void SetMuScreenOffset(struct MuProc * proc, int xOff, int yOff);
void StartMuFadeIntoFlash(struct MuProc * proc, int flashType);
void StartMuFadeFromFlash(struct MuProc * muProc);
void MuRestorePalInfo_Apply(struct MuEffectProc * proc);
void MU_StartActionAnim(struct MuProc * proc);
void MU_EndSelectionApAnim(int argAp);
void MU_StartDelayedFaceTarget(struct MuProc * proc);
void MU_EndRefaceApAnim(int argAp);
void MU_EndFasterApAnim(int argAp);
void MU_StartFastMoveAnim(struct MuProc * proc);
void MU_StartCritFlash(struct MuProc * muProc, int flashType);
void StartMuActionAnim(struct MuProc * proc);
void MuActionAnimFinishFunc(int arg);
void StartMuDelayedFaceDefender(struct MuProc * proc);
void MuDelayedFaceDefenderFunc(int arg);
void MuSlowDownAnimFreezeFunc(int arg);
void StartMuSpeedUpAnim(struct MuProc * proc);
void StartMuCritFlash(struct MuProc * muProc, int flashType);
void MuCritFlash_Init(struct MuFlashEffectProc * proc);
void MuCritFlash_SetFadedPalette(struct MuFlashEffectProc * proc);
void MuCritFlash_SetRegularPalette(struct MuFlashEffectProc * proc);
@ -298,7 +305,7 @@ void MU_AllForceSetMaxMoveSpeed(void);
void MU_ForceSetMaxMoveSpeed(ProcPtr proc);
void MU_SetSpecialSprite(struct MuProc * proc, int jid, const u16 * palette);
void MU_SetPaletteId(struct MuProc * proc, unsigned paletteId);
struct MuProc * MU_GetByIndex(int muIndex);
struct MuProc * MU_GetByIndex(int slot);
struct MuProc * MU_GetByUnit(struct Unit * unit);
void MU_SortObjLayers(void);
@ -306,7 +313,7 @@ extern u8 gMUGfxBuffer[MU_GFX_MAX_SIZE * MU_MAX_COUNT];
extern struct ProcCmd CONST_DATA ProcScr_Mu[];
extern struct ProcCmd CONST_DATA ProcScr_MuDeathFade[];
extern struct ProcCmd CONST_DATA ProcScr_MuBlinkEffect[];
extern struct ProcCmd CONST_DATA ProcScr_MuBlink[];
extern struct ProcCmd CONST_DATA ProcScr_MuRestorePalInfo[];
extern u16 CONST_DATA MuSoundScr_Foot[];
extern u16 CONST_DATA MuSoundScr_FootHeavy[];
@ -326,9 +333,9 @@ extern u16 CONST_DATA MuSoundScr_Myrrh[];
// extern ??? gUnknown_089A2C28
// extern ??? ProcScr_Mu
extern CONST_DATA struct ProcCmd ProcScr_MuDeathFade[];
extern CONST_DATA struct ProcCmd ProcScr_MuBlinkEffect[];
extern CONST_DATA struct ProcCmd ProcScr_MuBlink[];
extern CONST_DATA struct ProcCmd ProcScr_MuRestorePalInfo[];
extern const u16 * CONST_DATA MUFlashColorLookup[];
extern const u16 * CONST_DATA gMuFlashPalLut[];
#endif // GUARD_MU_H

View File

@ -159,4 +159,6 @@ int CountProcs(const struct ProcCmd * script);
void Proc_FindBegin(struct ProcFindIterator* it, const struct ProcCmd* script);
ProcPtr Proc_FindNext(struct ProcFindIterator* it);
#define Proc_Exists(script) (Proc_Find((script)) ? true : false)
#endif // GUARD_PROC_H

View File

@ -826,8 +826,8 @@ ProcPtr StartGmMu(ProcPtr);
// ??? GmMu_SetUnit(???);
void GmMu_RemoveUnit(struct GMapMuProc *, int);
// ??? sub_80BDD94(???);
void GmMu_ShowUnit(struct GMapMuProc *, int);
void GmMu_HideUnit(struct GMapMuProc *, int);
void GmShowMuUnit(struct GMapMuProc *, int);
void GmHideMuUnit(struct GMapMuProc *, int);
void sub_80BDEB4(struct GMapMuProc *, struct UnknownSub80BDEB4 *);
void sub_80BDFA4(struct GMapMuProc *, struct UnknownSub80BDFA4 *);
void GmMu_PauseMovement(struct GMapMuProc *, int);

View File

@ -171,24 +171,24 @@ void GenerateBestMovementScript(int x, int y, u8 output[])
// Build neighbor cost list
if (x == (gBmMapSize.x - 1))
neighbourCosts[MU_COMMAND_MOVE_LEFT] |= 0xFF;
neighbourCosts[MOVE_CMD_MOVE_LEFT] |= 0xFF;
else
neighbourCosts[MU_COMMAND_MOVE_LEFT] = gWorkingBmMap[y][x+1];
neighbourCosts[MOVE_CMD_MOVE_LEFT] = gWorkingBmMap[y][x+1];
if (x == 0)
neighbourCosts[MU_COMMAND_MOVE_RIGHT] |= 0xFF;
neighbourCosts[MOVE_CMD_MOVE_RIGHT] |= 0xFF;
else
neighbourCosts[MU_COMMAND_MOVE_RIGHT] = gWorkingBmMap[y][x-1];
neighbourCosts[MOVE_CMD_MOVE_RIGHT] = gWorkingBmMap[y][x-1];
if (y == (gBmMapSize.y - 1))
neighbourCosts[MU_COMMAND_MOVE_UP] |= 0xFF;
neighbourCosts[MOVE_CMD_MOVE_UP] |= 0xFF;
else
neighbourCosts[MU_COMMAND_MOVE_UP] = gWorkingBmMap[y+1][x];
neighbourCosts[MOVE_CMD_MOVE_UP] = gWorkingBmMap[y+1][x];
if (y == 0)
neighbourCosts[MU_COMMAND_MOVE_DOWN] |= 0xFF;
neighbourCosts[MOVE_CMD_MOVE_DOWN] |= 0xFF;
else
neighbourCosts[MU_COMMAND_MOVE_DOWN] = gWorkingBmMap[y-1][x];
neighbourCosts[MOVE_CMD_MOVE_DOWN] = gWorkingBmMap[y-1][x];
// find best cost
@ -238,19 +238,19 @@ void GenerateBestMovementScript(int x, int y, u8 output[])
switch (nextDirection)
{
case MU_COMMAND_MOVE_LEFT:
case MOVE_CMD_MOVE_LEFT:
x++;
break;
case MU_COMMAND_MOVE_RIGHT:
case MOVE_CMD_MOVE_RIGHT:
x--;
break;
case MU_COMMAND_MOVE_UP:
case MOVE_CMD_MOVE_UP:
y++;
break;
case MU_COMMAND_MOVE_DOWN:
case MOVE_CMD_MOVE_DOWN:
y--;
break;
@ -263,19 +263,19 @@ void GenerateBestMovementScript(int x, int y, u8 output[])
void RevertMovementScript(u8* begin, u8* end)
{
u8 buffer[MU_COMMAND_MAX_COUNT];
u8 buffer[MOVE_CMD_MAX_COUNT];
u8* it = buffer;
while (end > begin)
*it++ = *--end;
*it = MU_COMMAND_HALT;
*it = MOVE_CMD_HALT;
for (it = buffer; *it != MU_COMMAND_HALT;)
for (it = buffer; *it != MOVE_CMD_HALT;)
*begin++ = *it++;
*begin = MU_COMMAND_HALT;
*begin = MOVE_CMD_HALT;
}
void UnitApplyWorkingMovementScript(struct Unit* unit, int x, int y)
@ -289,19 +289,19 @@ void UnitApplyWorkingMovementScript(struct Unit* unit, int x, int y)
switch (*it)
{
case MU_COMMAND_MOVE_UP: // up
case MOVE_CMD_MOVE_UP: // up
y--;
break;
case MU_COMMAND_MOVE_DOWN: // down
case MOVE_CMD_MOVE_DOWN: // down
y++;
break;
case MU_COMMAND_MOVE_LEFT: // left
case MOVE_CMD_MOVE_LEFT: // left
x--;
break;
case MU_COMMAND_MOVE_RIGHT: // right
case MOVE_CMD_MOVE_RIGHT: // right
x++;
break;
@ -311,7 +311,7 @@ void UnitApplyWorkingMovementScript(struct Unit* unit, int x, int y)
{
if (gBmMapHidden[y][x] & HIDDEN_BIT_TRAP)
{
*++it = MU_COMMAND_HALT;
*++it = MOVE_CMD_HALT;
gActionData.unitActionType = UNIT_ACTION_TRAPPED;
gActionData.xMove = x;
@ -323,15 +323,15 @@ void UnitApplyWorkingMovementScript(struct Unit* unit, int x, int y)
if (gBmMapHidden[y][x] & HIDDEN_BIT_UNIT)
{
*it++ = MU_COMMAND_BUMP;
*it++ = MU_COMMAND_HALT;
*it++ = MOVE_CMD_BUMP;
*it++ = MOVE_CMD_HALT;
gActionData.unitActionType = UNIT_ACTION_TRAPPED;
return;
}
if (*it == MU_COMMAND_HALT)
if (*it == MOVE_CMD_HALT)
break;
it++;

View File

@ -215,8 +215,8 @@ s8 ActionDrop(ProcPtr proc) {
struct Unit* target = GetUnit(gActionData.targetIndex);
if (gBmMapHidden[gActionData.yOther][gActionData.xOther] & HIDDEN_BIT_UNIT) {
gWorkingMovementScript[0] = MU_COMMAND_BUMP;
gWorkingMovementScript[1] = MU_COMMAND_HALT;
gWorkingMovementScript[0] = MOVE_CMD_BUMP;
gWorkingMovementScript[1] = MOVE_CMD_HALT;
SetAutoMuMoveScript(gWorkingMovementScript);
return 0;
}
@ -581,7 +581,7 @@ void BATTLE_PostCombatDeathFades(struct CombatActionProc* proc) {
muProc = StartMu(&gBattleTarget.unit);
gWorkingMovementScript[0] = GetFacingDirection(gBattleActor.unit.xPos, gBattleActor.unit.yPos, gBattleTarget.unit.xPos, gBattleTarget.unit.yPos);
gWorkingMovementScript[1] = MU_COMMAND_HALT;
gWorkingMovementScript[1] = MOVE_CMD_HALT;
SetMuMoveScript(muProc, gWorkingMovementScript);
MU_StartDeathFade(muProc);

View File

@ -79,31 +79,31 @@ void GetPathFromMovementScript(void) {
if (cmd <= 0xa) {
switch (cmd) {
case MU_COMMAND_END + 1:
case MU_COMMAND_HALT + 1:
case MOVE_CMD_END + 1:
case MOVE_CMD_HALT + 1:
return;
case MU_COMMAND_FACE_LEFT + 1:
case MU_COMMAND_FACE_RIGHT + 1:
case MU_COMMAND_FACE_DOWN + 1:
case MU_COMMAND_FACE_UP + 1:
case MU_COMMAND_WAIT + 1:
case MOVE_CMD_FACE_LEFT + 1:
case MOVE_CMD_FACE_RIGHT + 1:
case MOVE_CMD_FACE_DOWN + 1:
case MOVE_CMD_FACE_UP + 1:
case MOVE_CMD_SLEEP + 1:
continue;
case MU_COMMAND_MOVE_LEFT + 1:
case MOVE_CMD_MOVE_LEFT + 1:
AddPointToPathArrowProc(
gpPathArrowProc->pathX[gpPathArrowProc->pathLen] - 1,
gpPathArrowProc->pathY[gpPathArrowProc->pathLen]);
break;
case MU_COMMAND_MOVE_RIGHT + 1:
case MOVE_CMD_MOVE_RIGHT + 1:
AddPointToPathArrowProc(
gpPathArrowProc->pathX[gpPathArrowProc->pathLen] + 1,
gpPathArrowProc->pathY[gpPathArrowProc->pathLen]);
break;
case MU_COMMAND_MOVE_UP + 1:
case MOVE_CMD_MOVE_UP + 1:
AddPointToPathArrowProc(
gpPathArrowProc->pathX[gpPathArrowProc->pathLen],
gpPathArrowProc->pathY[gpPathArrowProc->pathLen] - 1);
break;
case MU_COMMAND_MOVE_DOWN + 1:
case MOVE_CMD_MOVE_DOWN + 1:
AddPointToPathArrowProc(
gpPathArrowProc->pathX[gpPathArrowProc->pathLen],
gpPathArrowProc->pathY[gpPathArrowProc->pathLen] + 1);
@ -125,20 +125,20 @@ void GetMovementScriptFromPath(void) {
newX = gpPathArrowProc->pathX[i];
x = gpPathArrowProc->pathX[i - 1];
if (newX < x) {
gWorkingMovementScript[i - 1] = MU_COMMAND_MOVE_LEFT;
gWorkingMovementScript[i - 1] = MOVE_CMD_MOVE_LEFT;
}
else if (newX > x) {
gWorkingMovementScript[i - 1] = MU_COMMAND_MOVE_RIGHT;
gWorkingMovementScript[i - 1] = MOVE_CMD_MOVE_RIGHT;
}
else if (gpPathArrowProc->pathY[i] < gpPathArrowProc->pathY[i - 1]) {
gWorkingMovementScript[i - 1] = MU_COMMAND_MOVE_UP;
gWorkingMovementScript[i - 1] = MOVE_CMD_MOVE_UP;
}
else {
gWorkingMovementScript[i - 1] = MU_COMMAND_MOVE_DOWN;
gWorkingMovementScript[i - 1] = MOVE_CMD_MOVE_DOWN;
}
}
gWorkingMovementScript[i - 1] = MU_COMMAND_HALT;
gWorkingMovementScript[i - 1] = MOVE_CMD_HALT;
}
void GenerateMovementMapForActiveUnit(void) {

View File

@ -801,7 +801,7 @@ void Shop_ExitShopDialogue(struct ProcShop * proc)
void Shop_OnExit(void)
{
Proc_EndEach(gProcScr_GoldBox);
Proc_ForEach(ProcScr_Mu, (ProcFunc) MU_Show);
Proc_ForEach(ProcScr_Mu, (ProcFunc) ShowMu);
}
void Shop_PrepEntryDialogue(struct ProcShop * proc)
@ -904,7 +904,7 @@ void Shop_Init(struct ProcShop * proc)
else
StartBgm(0x35, 0);
Proc_ForEach(ProcScr_Mu, (ProcFunc) MU_Hide);
Proc_ForEach(ProcScr_Mu, (ProcFunc) HideMu);
InitShopScreenConfig();

View File

@ -227,10 +227,10 @@ void AiStartCombatAction(struct CpPerformProc* proc) {
void AiStartEscapeAction(struct CpPerformProc* proc) {
u8 scripts[4][3] = {
{ MU_COMMAND_MOVE_LEFT, MU_COMMAND_MOVE_LEFT, MU_COMMAND_HALT },
{ MU_COMMAND_MOVE_RIGHT, MU_COMMAND_MOVE_RIGHT, MU_COMMAND_HALT },
{ MU_COMMAND_MOVE_DOWN, MU_COMMAND_MOVE_DOWN, MU_COMMAND_HALT },
{ MU_COMMAND_MOVE_UP, MU_COMMAND_MOVE_UP, MU_COMMAND_HALT },
{ MOVE_CMD_MOVE_LEFT, MOVE_CMD_MOVE_LEFT, MOVE_CMD_HALT },
{ MOVE_CMD_MOVE_RIGHT, MOVE_CMD_MOVE_RIGHT, MOVE_CMD_HALT },
{ MOVE_CMD_MOVE_DOWN, MOVE_CMD_MOVE_DOWN, MOVE_CMD_HALT },
{ MOVE_CMD_MOVE_UP, MOVE_CMD_MOVE_UP, MOVE_CMD_HALT },
};
if ((gAiDecision.xTarget != 5) && (proc->isUnitVisible)) {

View File

@ -2858,7 +2858,7 @@ u8 TryPrepareEventUnitMovement(struct EventEngineProc * proc, int x, int y)
return FALSE; // Failed to start camera movement
}
if (!MU_CanStart())
if (!CanStartMu())
return FALSE; // No room to make MU for the moving unit
return TRUE; // Yay!

View File

@ -102,9 +102,9 @@ void Make6CKOIDO(struct Unit* unit, int direction, int config, ProcPtr parent)
proc->unit = unit;
proc->direction = direction;
proc->mu_commands[0] = MU_COMMAND_CAMERA_OFF;
proc->mu_commands[0] = MOVE_CMD_CAMERA_OFF;
proc->mu_commands[1] = direction;
proc->mu_commands[2] = MU_COMMAND_HALT;
proc->mu_commands[2] = MOVE_CMD_HALT;
Make6CKOIDO_common(unit, config, proc);
}
@ -115,9 +115,9 @@ void Make6CKOIDOAMM(struct Unit* unit, int direction)
proc->unit = unit;
proc->direction = direction;
proc->mu_commands[0] = MU_COMMAND_CAMERA_OFF;
proc->mu_commands[0] = MOVE_CMD_CAMERA_OFF;
proc->mu_commands[1] = direction;
proc->mu_commands[2] = MU_COMMAND_HALT;
proc->mu_commands[2] = MOVE_CMD_HALT;
Make6CKOIDO_common(unit, 0, proc);
}

View File

@ -86,7 +86,7 @@ void _InitFontForUIDefault(void) {
}
void MapAnim_Cleanup(void) {
MU_AllRestartAnimations();
ResetMuAnims();
ResetTextFont();
DeleteBattleAnimInfoThing();
InitBmBgLayers();

View File

@ -27,7 +27,7 @@ void MakeBattleMOVEUNIT(int maActor, struct BattleUnit* bu, struct Unit* unit)
gManimSt.actor[maActor].mu->sprite_anim->frameInterval = 0;
if (BUNIT_IS_OBSTACLE(bu))
MU_Hide(gManimSt.actor[maActor].mu);
HideMu(gManimSt.actor[maActor].mu);
switch (unit->statusIndex) {

View File

@ -26,7 +26,7 @@ void MapEventBattle_SetUpHitData(ProcPtr proc)
void MapEventBattle_OnEnd(void)
{
MU_AllRestartAnimations();
ResetMuAnims();
ResetTextFont();
DeleteBattleAnimInfoThing();
InitBmBgLayers();

View File

@ -24,12 +24,12 @@ const struct ProcCmd * GetItemAnim6CCode(void)
void MapAnim_AnimateSubjectIdle(ProcPtr proc)
{
MU_StartActionAnim(gManimSt.actor[gManimSt.subjectActorId].mu);
StartMuActionAnim(gManimSt.actor[gManimSt.subjectActorId].mu);
}
void MapAnim_SubjectResetAnim(ProcPtr proc)
{
MU_StartDelayedFaceTarget(gManimSt.actor[gManimSt.subjectActorId].mu);
StartMuDelayedFaceDefender(gManimSt.actor[gManimSt.subjectActorId].mu);
}
void sub_80812C0(void)
@ -64,7 +64,7 @@ void sub_80813C0(void)
void MapAnim_BeginSubjectFastAnim(void)
{
MU_StartFastMoveAnim(gManimSt.actor[gManimSt.subjectActorId].mu);
StartMuSpeedUpAnim(gManimSt.actor[gManimSt.subjectActorId].mu);
}
void MapAnimMoveUnitTowardsTargetExt(struct MuProc * mu1, struct MuProc * mu2)
@ -291,7 +291,7 @@ void MapAnim_BeginRoundSpecificAnims(ProcPtr proc)
gManimSt.actor[map_target].unit->xPos * 0x10 - gBmSt.camera.x
);
MU_StartCritFlash(
StartMuCritFlash(
gManimSt.actor[map_target].mu,
GetSpellAssocFlashColor(gManimSt.actor[map_actor].bu->weaponBefore)
);
@ -302,7 +302,7 @@ void MapAnim_BeginRoundSpecificAnims(ProcPtr proc)
gManimSt.actor[map_target].unit->xPos * 0x10 - gBmSt.camera.x
);
MU_StartFastMoveAnim(gManimSt.actor[map_actor].mu);
StartMuSpeedUpAnim(gManimSt.actor[map_actor].mu);
}
else
{
@ -477,17 +477,17 @@ void MapAnimCallSpellAssocRepair(ProcPtr proc)
void SpellWarpStartFlashFade(ProcPtr proc)
{
MU_StartFlashFade(gManimSt.actor[gManimSt.targetActorId].mu, 0);
StartMuFadeIntoFlash(gManimSt.actor[gManimSt.targetActorId].mu, 0);
}
void sub_8081CF8(ProcPtr proc)
{
MU_8079858(gManimSt.actor[gManimSt.targetActorId].mu);
StartMuFadeFromFlash(gManimSt.actor[gManimSt.targetActorId].mu);
}
void SpellWarpMuHide(ProcPtr proc)
{
MU_Hide(gManimSt.actor[gManimSt.targetActorId].mu);
HideMu(gManimSt.actor[gManimSt.targetActorId].mu);
}
void SpellWarpStartExplosion(ProcPtr proc)
@ -514,7 +514,7 @@ void SpellWarpStartImplosion(ProcPtr proc)
void SpellWarpMuShow(ProcPtr proc)
{
MU_Show(gManimSt.actor[gManimSt.targetActorId].mu);
ShowMu(gManimSt.actor[gManimSt.targetActorId].mu);
}
void SpellWarpSetNewPosition(ProcPtr proc)
@ -522,7 +522,7 @@ void SpellWarpSetNewPosition(ProcPtr proc)
struct Unit * unit = gManimSt.actor[gManimSt.targetActorId].unit;
struct MuProc * mu = gManimSt.actor[gManimSt.targetActorId].mu;
MU_SetDisplayPosition(
SetMuScreenPosition(
mu,
gManimSt.xtarget * 0x10,
gManimSt.ytarget * 0x10);

614
src/mu.c

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ void MuCtr_InitDefinedMove(struct MuCtrlProc * proc, struct Unit * unit, const s
gBmMapOther[y][x] = 0;
gBmMapOther[pos.y][pos.x] = unit->pCharacterData->number;
MU_Hide(proc->muProc);
HideMu(proc->muProc);
}
//! FE8U = 0x08079F84
@ -280,7 +280,7 @@ s8 sub_807A0E4(struct MuCtrlProc * proc)
ShowUnitSprite(unit);
unit->state &= ~US_HIDDEN;
MU_Hide(proc->muProc);
HideMu(proc->muProc);
gBmMapUnit[unit->yPos][unit->xPos] = unit->index;
RefreshUnitSprites();
}
@ -454,7 +454,7 @@ void MuCtr_ExecREDA_807A358(struct MuCtrlProc * proc)
{
struct MuProc * muProc = proc->muProc;
MU_Show(muProc);
ShowMu(muProc);
SetMuMoveScript(muProc, commands);
config = reda->flags;
@ -464,7 +464,7 @@ void MuCtr_ExecREDA_807A358(struct MuCtrlProc * proc)
config |= 0x40;
}
MU_SetMoveConfig(muProc, config);
SetMuConfig(muProc, config);
if ((flagsB & 4) != 0)
{

View File

@ -196,17 +196,17 @@ void sub_80493D0(u8 a, int b, u8 * c, int * xOut, int * yOut)
u8 gUnknown_080D9FA0[8] =
{
MU_COMMAND_MOVE_UP,
MU_COMMAND_HALT,
MOVE_CMD_MOVE_UP,
MOVE_CMD_HALT,
MU_COMMAND_MOVE_LEFT,
MU_COMMAND_HALT,
MOVE_CMD_MOVE_LEFT,
MOVE_CMD_HALT,
MU_COMMAND_MOVE_DOWN,
MU_COMMAND_HALT,
MOVE_CMD_MOVE_DOWN,
MOVE_CMD_HALT,
MU_COMMAND_MOVE_RIGHT,
MU_COMMAND_HALT,
MOVE_CMD_MOVE_RIGHT,
MOVE_CMD_HALT,
};
s8 gUnknown_080D9FA8[8] =
@ -563,7 +563,7 @@ void sub_80498F4(void)
gUnknown_03001838[0] = StartMu(unit);
MU_SetDisplayPosition(gUnknown_03001838[0], unit->xPos * 16, (unit->yPos - 1) * 16);
SetMuScreenPosition(gUnknown_03001838[0], unit->xPos * 16, (unit->yPos - 1) * 16);
DisableMuCamera(gUnknown_03001838[0]);
SetMuFacing(gUnknown_03001838[0], 3);
@ -937,8 +937,8 @@ void sub_8049D24(struct SioBattleMapProc * proc)
u8 gUnknown_080D9FB5[2] =
{
MU_COMMAND_MOVE_UP,
MU_COMMAND_HALT,
MOVE_CMD_MOVE_UP,
MOVE_CMD_HALT,
};
// clang-format on
@ -1386,8 +1386,8 @@ void sub_804A5A4(void)
u8 gUnknown_080D9FB7[2] =
{
MU_COMMAND_MOVE_RIGHT,
MU_COMMAND_HALT,
MOVE_CMD_MOVE_RIGHT,
MOVE_CMD_HALT,
};
// clang-format on
@ -2575,8 +2575,8 @@ void sub_804B624(struct SioBattleMapProc * proc)
mu = StartMu(unit);
gWorkingMovementScript[0] = MU_COMMAND_MOVE_DOWN;
gWorkingMovementScript[1] = MU_COMMAND_HALT;
gWorkingMovementScript[0] = MOVE_CMD_MOVE_DOWN;
gWorkingMovementScript[1] = MOVE_CMD_HALT;
SetMuMoveScript(mu, gWorkingMovementScript);
@ -2768,7 +2768,7 @@ void sub_804B850(struct SioBattleMapProc * proc)
gWorkingMovementScript[0] = GetFacingDirection(
gBattleActor.unit.xPos, gBattleActor.unit.yPos, gBattleTarget.unit.xPos, gBattleTarget.unit.yPos);
gWorkingMovementScript[1] = MU_COMMAND_HALT;
gWorkingMovementScript[1] = MOVE_CMD_HALT;
SetMuMoveScript(mu, gWorkingMovementScript);
StartLinkArenaMUDeathFade(mu);

View File

@ -149,7 +149,7 @@ void SioWarp_Init(struct SioWarpProc * proc)
if (proc->playStepSe)
{
MU_StartStepSfx(0x7f, 2, proc->x * 8);
StartPlayMuStepSe(0x7f, 2, proc->x * 8);
}
return;
@ -250,14 +250,14 @@ void SioWarpFx_804C178(struct SioWarpProc * proc)
//! FE8U = 0x0804C188
void SioWarpFx_HideMoveUnit(struct SioWarpProc * proc)
{
MU_Hide(proc->muProc);
HideMu(proc->muProc);
return;
}
//! FE8U = 0x0804C194
void SioWarpFx_SetMUPosition(struct SioWarpProc * proc)
{
MU_SetDisplayPosition(proc->muProc, proc->x * 16, proc->y * 16);
SetMuScreenPosition(proc->muProc, proc->x * 16, proc->y * 16);
proc->unit->xPos = proc->x;
proc->unit->yPos = proc->y;
@ -273,7 +273,7 @@ void SioWarpFx_ShowMoveUnit(struct SioWarpProc * proc)
SetMuFacing(proc->muProc, proc->facing);
}
MU_Show(proc->muProc);
ShowMu(proc->muProc);
return;
}

View File

@ -1138,7 +1138,7 @@ void UnitSlide_FadeOutLoop(struct StatScreenEffectProc* proc)
{
SetBlendConfig(1, proc->timer, 0x10 - proc->timer, 0);
MU_SetDisplayPosition(gStatScreen.mu,
SetMuScreenPosition(gStatScreen.mu,
80, 138 + gStatScreen.yDispOff);
gStatScreen.yDispOff = Interpolate(2, proc->yDispInit, proc->yDispFinal, proc->timer, 0x10);
@ -1177,7 +1177,7 @@ void UnitSlide_FadeInLoop(struct StatScreenEffectProc* proc)
{
SetBlendConfig(1, 0x10 - proc->timer, proc->timer, 0);
MU_SetDisplayPosition(gStatScreen.mu,
SetMuScreenPosition(gStatScreen.mu,
80, 138 + gStatScreen.yDispOff);
gStatScreen.yDispOff = Interpolate(5, proc->yDispInit, proc->yDispFinal, proc->timer, 0x10);
@ -1199,7 +1199,7 @@ void UnitSlide_SetNewUnit(struct StatScreenEffectProc* proc)
void ClearSlide(struct Proc* proc)
{
if (gStatScreen.mu)
MU_SetDisplayPosition(gStatScreen.mu,
SetMuScreenPosition(gStatScreen.mu,
80, 138);
gLCDControlBuffer.bg0cnt.priority = 1;

View File

@ -52,7 +52,7 @@ void StartArenaResultsScreen(void) {
//! FE8U = 0x080B57A0
void ArenaUi_Init(ProcPtr proc) {
Proc_ForEach(ProcScr_Mu, (ProcFunc) MU_Hide);
Proc_ForEach(ProcScr_Mu, (ProcFunc) HideMu);
InitShopScreenConfig();
@ -296,7 +296,7 @@ void ArenaUi_ShowGoldBoxOnVictoryOrDraw(ProcPtr proc) {
//! FE8U = 0x080B5BE4
void ArenaUi_OnEnd(void) {
Proc_EndEach(gProcScr_GoldBox);
Proc_ForEach(ProcScr_Mu, (ProcFunc) MU_Show);
Proc_ForEach(ProcScr_Mu, (ProcFunc) ShowMu);
return;
}

View File

@ -5,8 +5,8 @@
void ChangeActiveUnitFacing(int xLook, int yLook) {
int direction = GetFacingDirection(gActiveUnit->xPos, gActiveUnit->yPos, xLook, yLook)
+ MU_COMMAND_FACE_BASE;
+ MOVE_CMD_FACE_BASE;
gWorkingMovementScript[0] = direction;
gWorkingMovementScript[1] = MU_COMMAND_HALT;
gWorkingMovementScript[1] = MOVE_CMD_HALT;
SetAutoMuMoveScript(gWorkingMovementScript);
}

View File

@ -23,13 +23,13 @@ void RemoveGmUnit(int index)
//! FE8U = 0x080BF554
void ShowGmUnit(int index)
{
GmMu_ShowUnit(GM_MU, index);
GmShowMuUnit(GM_MU, index);
}
//! FE8U = 0x080BF570
void HideGmUnit(int index)
{
GmMu_HideUnit(GM_MU, index);
GmHideMuUnit(GM_MU, index);
}
//! FE8U = 0x080BF58C

View File

@ -470,7 +470,7 @@ void sub_80B9028(struct WorldMapMainProc * proc)
GmMu_SetPosition(proc->unk_54, i, *a, *b);
GmMu_ShowUnit(proc->unk_54, i);
GmShowMuUnit(proc->unk_54, i);
}
return;

View File

@ -638,7 +638,7 @@ void sub_80BDD94(struct GMapMuProc * muProc, int index)
}
//! FE8U = 0x080BDDC4
void GmMu_ShowUnit(struct GMapMuProc * muProc, int index)
void GmShowMuUnit(struct GMapMuProc * muProc, int index)
{
struct GMapMuPrimProc * muPrimProc;
int i;
@ -667,7 +667,7 @@ void GmMu_ShowUnit(struct GMapMuProc * muProc, int index)
}
//! FE8U = 0x080BDE3C
void GmMu_HideUnit(struct GMapMuProc * muProc, int index)
void GmHideMuUnit(struct GMapMuProc * muProc, int index)
{
struct GMapMuPrimProc * muPrimProc;
int i;
@ -1073,7 +1073,7 @@ void sub_80BE45C(struct GMapMuPrimProc * proc)
if (sfxLut[divRem + 2] != 0)
{
MU_StartStepSfx(sfxLut[divRem + 2], sfxLut[1], (s16)hPos);
StartPlayMuStepSe(sfxLut[divRem + 2], sfxLut[1], (s16)hPos);
}
return;

View File

@ -252,13 +252,13 @@ void GmapRm_RemoveUnits(struct ProcGmapRm * proc)
else
proc->flag &= ~GMAPRM_FLAG_3;
GmMu_HideUnit(GM_MU, WM_MU_0);
GmHideMuUnit(GM_MU, WM_MU_0);
}
void GmapRm_DisplayLeaderUnit(struct ProcGmapRm * proc)
{
if (proc->flag & GMAPRM_FLAG_3)
GmMu_ShowUnit(GM_MU, WM_MU_0);
GmShowMuUnit(GM_MU, WM_MU_0);
}
void GmapRm_80C2320(struct ProcGmapRm * proc)

View File

@ -285,7 +285,7 @@ void GmapTimeMons_ExecMonsterMergeMu(struct ProcGmapTimeMons * proc)
wm_uid = i + 4;
SetGmClassUnit(wm_uid, proc->confs[i].jid, WM_FACTION_RED, proc->confs[i].node);
gGMData.units[wm_uid].state |= GM_UNIT_STATE_B0;
GmMu_ShowUnit(GM_MU, wm_uid);
GmShowMuUnit(GM_MU, wm_uid);
}
Proc_Break(proc);
}
@ -375,7 +375,7 @@ void WmShowMonsters(void)
*&y = gWMNodeData[gGMData.units[i].location].y;
GmMu_SetPosition(GM_MU, i, x, y);
GmMu_ShowUnit(GM_MU, i);
GmShowMuUnit(GM_MU, i);
}
}