mirror of
https://github.com/pmret/papermario.git
synced 2024-09-09 11:02:38 +02:00
Misc decomp 70 (#716)
* aura_appendGfx * 3 more action commands * fire_shell * hammer, hurricane * spiny_surge * data stuff, cleanup, whirlwind * warnings * water_block data and func * water_block * effect stuff cleanup * big_snowflakes effect * data cleanup, fpr abi regs * 2 battle item funcs + data * 2 mo * shooting_star func * 3 16F740 funcs * btl_state_update_end_battle * map funcs * more dedupe * cleanin * draw_entity_model_C/D * effect butterflies, btl state funcs * it is done * it is done * PR comments, some cleanup
This commit is contained in:
parent
dcd315865c
commit
021592d219
@ -7,3 +7,4 @@ def apply(config, args):
|
||||
config['mapfile'] = f'{ver_dir}build/papermario.map'
|
||||
config['source_directories'] = ['src', f'{ver_dir}asm', 'include', f'{ver_dir}assets']
|
||||
config['make_command'] = ['ninja']
|
||||
config['objdump_flags'] = ['-M','reg-names=32']
|
||||
|
@ -245,7 +245,7 @@ typedef struct PlayerData {
|
||||
/* 0x1C8 */ s16 storedItems[32];
|
||||
/* 0x208 */ s16 equippedBadges[64];
|
||||
/* 0x288 */ char unk_288;
|
||||
/* 0x289 */ u8 merleeSpellType;
|
||||
/* 0x289 */ s8 merleeSpellType;
|
||||
/* 0x28A */ s8 merleeCastsLeft;
|
||||
/* 0x28B */ char unk_28B;
|
||||
/* 0x28C */ s16 merleeTurnCount;
|
||||
@ -1616,7 +1616,7 @@ typedef struct ActorPartBlueprint {
|
||||
/* 0x14 */ s32 eventFlags;
|
||||
/* 0x18 */ s32 elementImmunityFlags;
|
||||
/* 0x1C */ s8 unk_1C;
|
||||
/* 0x1C */ s8 unk_1D;
|
||||
/* 0x1D */ s8 unk_1D;
|
||||
/* 0x1E */ char unk_1E[2];
|
||||
/* 0x20 */ s32 unk_20;
|
||||
} ActorPartBlueprint; // size = 0x24
|
||||
@ -2048,7 +2048,7 @@ typedef struct PlayerStatus {
|
||||
/* 0x0CC */ s32 shadowID;
|
||||
/* 0x0D0 */ f32* unk_D0;
|
||||
/* 0x0D4 */ f32 spinRate;
|
||||
/* 0x0D8 */ UNK_PTR** unk_D8;
|
||||
/* 0x0D8 */ struct EffectInstance* unk_D8; // effect 46
|
||||
/* 0x0DC */ s32 currentButtons;
|
||||
/* 0x0E0 */ s32 pressedButtons;
|
||||
/* 0x0E4 */ s32 heldButtons;
|
||||
@ -2283,7 +2283,7 @@ typedef struct PartnerActionStatus {
|
||||
|
||||
typedef struct EntityModel {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ u8 renderMode;
|
||||
/* 0x04 */ s8 renderMode;
|
||||
/* 0x05 */ u8 unk_05;
|
||||
/* 0x06 */ u8 unk_06;
|
||||
/* 0x07 */ u8 unk_07;
|
||||
@ -2291,7 +2291,7 @@ typedef struct EntityModel {
|
||||
/* 0x0C */ f32 timeScale; ///< Default is 1.0
|
||||
/* 0x10 */ s32* cmdListReadPos;
|
||||
/* 0x14 */ Gfx* displayList;
|
||||
/* 0x18 */ Matrix4s transform;
|
||||
/* 0x18 */ Mtx transform;
|
||||
/* 0x58 */ s32* cmdListSavedPos;
|
||||
/* 0x5C */ Vtx* vertexArray;
|
||||
/* 0x60 */ UNK_FUN_PTR(fpSetupGfxCallback);
|
||||
|
@ -142,66 +142,29 @@ enum EffectID {
|
||||
EFFECT_86,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char unk_00[0x38];
|
||||
f32 unk_38[4];
|
||||
} EffectUnkStruct1;
|
||||
|
||||
typedef struct EffectStruct {
|
||||
char unk_00[0x4];
|
||||
f32 unk_04;
|
||||
f32 unk_08;
|
||||
f32 unk_0C;
|
||||
f32 unk_10;
|
||||
char unk_14[0x4];
|
||||
s32 unk_18;
|
||||
s32 unk_1C;
|
||||
s32 unk_20;
|
||||
X32 unk_24;
|
||||
s32 unk_28;
|
||||
s32 unk_2C;
|
||||
s32 unk_30;
|
||||
u8 unk_34;
|
||||
s32 unk_38;
|
||||
char unk_3C[0xC];
|
||||
EffectUnkStruct1* unk_48;
|
||||
char unk_4C[0x24];
|
||||
s32 unk_70;
|
||||
s32 unk_74;
|
||||
} EffectStruct;
|
||||
|
||||
typedef struct StarSpiritEffectUnkStruct {
|
||||
char unk_00[0xC];
|
||||
EffectStruct* unk_0C;
|
||||
} StarSpiritEffectUnkStruct;
|
||||
|
||||
typedef struct StarSpiritEffect {
|
||||
/* 0x00 */ f32 unk_00;
|
||||
/* 0x04 */ f32 unk_04;
|
||||
typedef struct StarSpiritsEnergyFXData {
|
||||
/* 0x00 */ char unk_00[0x8];
|
||||
/* 0x08 */ f32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ f32 unk_14;
|
||||
/* 0x18 */ f32 unk_18;
|
||||
/* 0x1C */ f32 unk_1C;
|
||||
/* 0x20 */ f32 unk_20;
|
||||
/* 0x14 */ char unk_14[0x20];
|
||||
/* 0x34 */ s32 unk_34;
|
||||
/* 0x38 */ char unk_38[0x38];
|
||||
/* 0x70 */ s32 unk_70;
|
||||
/* 0x74 */ s32 unk_74;
|
||||
} StarSpiritsEnergyFXData; // size = ?
|
||||
|
||||
typedef struct SpiritCardFXData {
|
||||
/* 0x00 */ char unk_00[0x4];
|
||||
/* 0x04 */ f32 unk_04;
|
||||
/* 0x08 */ f32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
/* 0x10 */ char unk_10[0x10];
|
||||
/* 0x20 */ s32 unk_20;
|
||||
/* 0x24 */ f32 unk_24;
|
||||
/* 0x28 */ f32 unk_28;
|
||||
/* 0x2C */ f32 unk_2C;
|
||||
/* 0x30 */ f32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
/* 0x38 */ s32 unk_38;
|
||||
/* 0x3C */ s32 unk_3C;
|
||||
/* 0x40 */ s32 unk_40; // a shadowID
|
||||
/* 0x44 */ s16 unk_44;
|
||||
/* 0x46 */ s16 unk_46;
|
||||
/* 0x48 */ s16 unk_48;
|
||||
/* 0x4A */ s16 unk_4A;
|
||||
/* 0x4C */ s16 unk_4C;
|
||||
/* 0x4E */ s16 unk_4E;
|
||||
/* 0x50 */ struct StarSpiritEffectUnkStruct* unk_50;
|
||||
/* 0x54 */ struct StarSpiritEffectUnkStruct* unk_54;
|
||||
} StarSpiritEffect; // size = 0x58
|
||||
/* 0x28 */ char unk_28[0xC];
|
||||
/* 0x34 */ s8 unk_34;
|
||||
} SpiritCardFXData; // ?
|
||||
|
||||
typedef struct BigSmokePuffFXData {
|
||||
/* 0x00 */ s16 unk_00;
|
||||
@ -219,6 +182,21 @@ typedef struct BigSmokePuffFXData {
|
||||
/* 0x28 */ char unk_28[0x4];
|
||||
} BigSmokePuffFXData; // size = 0x2C
|
||||
|
||||
typedef struct BigSnowflakeFXData {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ f32 unk_04;
|
||||
/* 0x08 */ f32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ f32 unk_14;
|
||||
/* 0x18 */ f32 unk_18;
|
||||
/* 0x1C */ f32 unk_1C;
|
||||
/* 0x20 */ f32 unk_20;
|
||||
/* 0x24 */ s32 unk_24;
|
||||
/* 0x28 */ s32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
} BigSnowflakeFXData; // size = 0x30
|
||||
|
||||
typedef struct LandingDustFXData {
|
||||
/* 0x00 */ u16 type;
|
||||
/* 0x02 */ char unk_02[0x2];
|
||||
@ -535,6 +513,19 @@ typedef struct SleepBubbleFXData {
|
||||
/* 0xC8 */ f32 unk_C8;
|
||||
} SleepBubbleFXData; // size = 0xCC
|
||||
|
||||
typedef struct WaterFountainFXData {
|
||||
/* 0x00 */ char unk_00[0x18];
|
||||
/* 0x18 */ s32 unk_18;
|
||||
/* 0x1C */ s32 unk_1C;
|
||||
/* 0x20 */ s32 unk_20;
|
||||
/* 0x24 */ char unk_24[0x4];
|
||||
/* 0x28 */ s32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ s32 unk_30;
|
||||
/* 0x34 */ char unk_34[0x4];
|
||||
/* 0x38 */ f32 unk_38;
|
||||
} WaterFountainFXData; // size = ?
|
||||
|
||||
typedef struct AuraFXData {
|
||||
/* 0x00 */ s32 type;
|
||||
/* 0x04 */ Vec3f pos;
|
||||
@ -544,7 +535,7 @@ typedef struct AuraFXData {
|
||||
/* 0x1C */ f32 unk_1C;
|
||||
/* 0x20 */ f32 unk_20;
|
||||
/* 0x24 */ f32 unk_24;
|
||||
/* 0x28 */ s32 unk_28;
|
||||
/* 0x28 */ s32 primA;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ s32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
@ -563,13 +554,13 @@ typedef struct AuraFXData {
|
||||
s32 s;
|
||||
f32 f;
|
||||
} unk_64;
|
||||
/* 0x68 */ u8 unk_68;
|
||||
/* 0x69 */ u8 unk_69;
|
||||
/* 0x6A */ u8 unk_6A;
|
||||
/* 0x6B */ u8 unk_6B;
|
||||
/* 0x6C */ u8 unk_6C;
|
||||
/* 0x6D */ u8 unk_6D;
|
||||
/* 0x6E */ u8 unk_6E;
|
||||
/* 0x68 */ u8 primR;
|
||||
/* 0x69 */ u8 primG;
|
||||
/* 0x6A */ u8 primB;
|
||||
/* 0x6B */ u8 envR;
|
||||
/* 0x6C */ u8 envG;
|
||||
/* 0x6D */ u8 engB;
|
||||
/* 0x6E */ u8 engA;
|
||||
} AuraFXData; // size = 0x70
|
||||
|
||||
typedef struct BlastFXData {
|
||||
@ -660,98 +651,15 @@ typedef struct DamageIndicatorFXData {
|
||||
/* 0x3C */ s32 numParts;
|
||||
} DamageIndicatorFXData; // size = 0x40
|
||||
|
||||
// TODO figure out what this actually is
|
||||
// fx_quizmo_stage invokes gEffectTable[78]'s entryPoint function
|
||||
// fx_cold_breath invokes gEffectTable[111]'s entryPoint function
|
||||
// fx_star_spirits_energy invokes gEffectTable[131]'s entryPoint function
|
||||
// These functions are currently typed to return void
|
||||
// Assume they return an Effect*, and this struct is accessed at unk_0C,
|
||||
// but this struct differs from EffectInstanceData
|
||||
// Search for "struct N(temp)" for examples
|
||||
typedef struct EffectInstanceDataThing {
|
||||
char unk_00[0x4];
|
||||
f32 unk_04;
|
||||
f32 unk_08;
|
||||
f32 unk_0C;
|
||||
f32 unk_10;
|
||||
char unk_14[0x4];
|
||||
s32 unk_18;
|
||||
s32 unk_1C;
|
||||
s32 unk_20;
|
||||
X32 unk_24;
|
||||
s32 unk_28;
|
||||
s32 unk_2C;
|
||||
s32 unk_30;
|
||||
s32 unk_34;
|
||||
s32 unk_38;
|
||||
char unk_3C[0xC];
|
||||
EffectUnkStruct1* unk_48;
|
||||
char unk_4C[0x24];
|
||||
s32 unk_70;
|
||||
s32 unk_74;
|
||||
} EffectInstanceDataThing; // TODO remove / convert to appropriate effect data struct
|
||||
|
||||
typedef struct EffectInstanceData {
|
||||
/* 0x00 */ EffectInstanceDataThing* unk_00;
|
||||
/* 0x04 */ Vec3f pos;
|
||||
/* 0x10 */ Vec3f rotation;
|
||||
/* 0x1C */ Vec3f scale;
|
||||
/* 0x28 */ f32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ f32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
/* 0x38 */ f32 unk_38;
|
||||
/* 0x3C */ s32 unk_3C;
|
||||
/* 0x40 */ char unk_40[0x24];
|
||||
/* 0x64 */ f32 unk_64;
|
||||
/* 0x68 */ char unk_68[0x18];
|
||||
} EffectInstanceData; // size = 0x80
|
||||
|
||||
typedef struct EffectInstance {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ s32 effectIndex;
|
||||
/* 0x08 */ s32 numParts;
|
||||
/* 0x0C */ void* data;
|
||||
/* 0x10 */ struct EffectGraphics* graphics;
|
||||
} EffectInstance; // size = 0x14
|
||||
|
||||
typedef struct EffectBlueprint {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ s32 effectID;
|
||||
/* 0x08 */ void (*init)(EffectInstance* effectInst);
|
||||
/* 0x0C */ void (*update)(EffectInstance* effectInst);
|
||||
/* 0x10 */ void (*renderWorld)(EffectInstance* effectInst);
|
||||
/* 0x14 */ void (*unk_14)(EffectInstance* effectInst);
|
||||
} EffectBlueprint; // size = 0x18
|
||||
|
||||
typedef struct EffectGraphics {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ s32 effectIndex;
|
||||
/* 0x08 */ s32 instanceCounter;
|
||||
/* 0x0C */ s32 freeDelay;
|
||||
/* 0x10 */ void (*update)(EffectInstance* effectInst);
|
||||
/* 0x14 */ void (*renderWorld)(EffectInstance* effectInst);
|
||||
/* 0x18 */ void (*renderUI)(EffectInstance* effectInst);
|
||||
/* 0x1C */ s32* data;
|
||||
} EffectGraphics; // size = 0x20
|
||||
|
||||
typedef struct EffectTableEntry {
|
||||
/* 0x00 */ void (*entryPoint);
|
||||
/* 0x04 */ void* dmaStart;
|
||||
/* 0x08 */ void* dmaEnd;
|
||||
/* 0x0C */ void* dmaDest;
|
||||
/* 0x10 */ void* graphicsDmaStart;
|
||||
/* 0x14 */ void* graphicsDmaEnd;
|
||||
} EffectTableEntry; // size = 0x18
|
||||
|
||||
typedef struct EffectWhirlwind {
|
||||
/* 0x00 */ char unk_00[40];
|
||||
// seems to actually be PlayerStatus, but it's too large seemingly given the bss padding in UnkWhirlwindEffectFunc.inc.c
|
||||
typedef struct EffectWhirlwindUnk {
|
||||
/* 0x00 */ char unk_00[0x28];
|
||||
/* 0x28 */ f32 unk_28;
|
||||
/* 0x2C */ f32 unk_2C;
|
||||
/* 0x30 */ f32 unk_30;
|
||||
} EffectWhirlwind;
|
||||
} EffectWhirlwindUnk;
|
||||
|
||||
typedef struct Effect6BData {
|
||||
typedef struct Effect6BFXData {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ Vec3f pos;
|
||||
/* 0x10 */ char unk_10[12];
|
||||
@ -764,16 +672,32 @@ typedef struct Effect6BData {
|
||||
/* 0x38 */ f32 unk_38;
|
||||
/* 0x3C */ s32 unk_3C;
|
||||
/* 0x40 */ char unk_40[0x4];
|
||||
} Effect6BData; // size = 0x44
|
||||
} Effect6BFXData; // size = 0x44
|
||||
|
||||
typedef struct Effect6BInstance {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ char unk_04[8];
|
||||
/* 0x0C */ Effect6BData* data;
|
||||
} Effect6BInstance;
|
||||
typedef struct ColdBreathFXData {
|
||||
/* 0x00 */ char unk_00[0x18];
|
||||
/* 0x18 */ s32 unk_18;
|
||||
/* 0x1C */ s32 unk_1C;
|
||||
/* 0x20 */ s32 unk_20;
|
||||
/* 0x24 */ char unk_24[0x4];
|
||||
/* 0x28 */ s32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ s32 unk_30;
|
||||
} ColdBreathFXData; // size = ?
|
||||
|
||||
typedef struct Effect6FData {
|
||||
/* 0x00 */ EffectInstanceDataThing* unk_00;
|
||||
typedef struct LightningFXData {
|
||||
/* 0x00 */ char unk_00[0x30];
|
||||
/* 0x30 */ s32 unk_30;
|
||||
/* 0x34 */ s32 unk_34;
|
||||
/* 0x38 */ s32 unk_38;
|
||||
/* 0x3C */ char unk_3C[0x4];
|
||||
/* 0x40 */ s32 unk_40;
|
||||
/* 0x44 */ s32 unk_44;
|
||||
/* 0x48 */ s32 unk_48;
|
||||
} LightningFXData; // size = ?
|
||||
|
||||
typedef struct Effect6FFXData {
|
||||
/* 0x00 */ char unk_00[0x4];
|
||||
/* 0x04 */ Vec3f pos;
|
||||
/* 0x10 */ Vec3i rotation;
|
||||
/* 0x1C */ Vec3i scale;
|
||||
@ -782,15 +706,49 @@ typedef struct Effect6FData {
|
||||
/* 0x38 */ f32 unk_38;
|
||||
/* 0x3C */ s32 unk_3C;
|
||||
/* 0x40 */ char unk_40[0x4];
|
||||
} Effect6FData; // size = 0x44
|
||||
} Effect6FFXData; // size = 0x44
|
||||
|
||||
typedef struct Effect6FInstance {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ s32 effectIndex;
|
||||
/* 0x08 */ s32 numParts;
|
||||
/* 0x0C */ Effect6FData* data;
|
||||
/* 0x10 */ struct EffectGraphics* effect;
|
||||
} Effect6FInstance;
|
||||
typedef struct MiscParticlesFXData {
|
||||
char unk_00[0x38];
|
||||
s32 unk_38;
|
||||
s32 unk_3C;
|
||||
s32 unk_40;
|
||||
char unk_44[0x4];
|
||||
s32 unk_48;
|
||||
s32 unk_4C;
|
||||
s32 unk_50;
|
||||
} MiscParticlesFXData; // size = ?
|
||||
|
||||
typedef struct ButterflyFXData {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ s32 unk_04;
|
||||
/* 0x08 */ s32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ f32 unk_14;
|
||||
/* 0x18 */ f32 unk_18;
|
||||
/* 0x1C */ f32 unk_1C;
|
||||
/* 0x20 */ f32 unk_20;
|
||||
/* 0x24 */ s32 unk_24;
|
||||
/* 0x28 */ f32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ s32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
/* 0x38 */ f32 unk_38;
|
||||
/* 0x3C */ f32 unk_3C;
|
||||
/* 0x40 */ f32 unk_40;
|
||||
/* 0x44 */ f32 unk_44;
|
||||
} ButterflyFXData; // size = 0x48
|
||||
|
||||
typedef struct Effect46FXData {
|
||||
/* 0x00 */ char unk_00[0x24];
|
||||
/* 0x04 */ s32 unk_24;
|
||||
} Effect46FXData; // size = 0x44
|
||||
|
||||
typedef struct ThunderboltRingFXData {
|
||||
/* 0x00 */ char unk_00[0x30];
|
||||
/* 0x30 */ s32 unk_30;
|
||||
} ThunderboltRingFXData; // size = ?
|
||||
|
||||
// fx_quizmo_stage
|
||||
typedef struct EffectDataQuizStage {
|
||||
@ -821,6 +779,87 @@ typedef struct EffectDataQuizVannaT {
|
||||
/* 0x1C */ s32 anim;
|
||||
} EffectDataQuizVannaT; // size = 0x20
|
||||
|
||||
typedef struct EffectInstanceData {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ Vec3f pos;
|
||||
/* 0x10 */ Vec3f rotation;
|
||||
/* 0x1C */ Vec3f scale;
|
||||
/* 0x28 */ f32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ f32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
/* 0x38 */ f32 unk_38;
|
||||
/* 0x3C */ s32 unk_3C;
|
||||
/* 0x40 */ char unk_40[0x24];
|
||||
/* 0x64 */ f32 unk_64;
|
||||
/* 0x68 */ char unk_68[0x18];
|
||||
} EffectInstanceData; // size = 0x80
|
||||
|
||||
typedef struct EffectInstance {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ s32 effectIndex;
|
||||
/* 0x08 */ s32 numParts;
|
||||
/* 0x0C */ void* data;
|
||||
/* 0x10 */ struct EffectGraphics* graphics;
|
||||
} EffectInstance; // size = 0x14
|
||||
|
||||
typedef struct StarSpiritData {
|
||||
/* 0x00 */ f32 unk_00;
|
||||
/* 0x04 */ f32 unk_04;
|
||||
/* 0x08 */ f32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ f32 unk_14;
|
||||
/* 0x18 */ f32 unk_18;
|
||||
/* 0x1C */ f32 unk_1C;
|
||||
/* 0x20 */ f32 unk_20;
|
||||
/* 0x24 */ f32 unk_24;
|
||||
/* 0x28 */ f32 unk_28;
|
||||
/* 0x2C */ f32 unk_2C;
|
||||
/* 0x30 */ f32 unk_30;
|
||||
/* 0x34 */ f32 unk_34;
|
||||
/* 0x38 */ s32 unk_38;
|
||||
/* 0x3C */ s32 unk_3C;
|
||||
/* 0x40 */ s32 unk_40; // a shadowID
|
||||
/* 0x44 */ s16 unk_44;
|
||||
/* 0x46 */ s16 unk_46;
|
||||
/* 0x48 */ s16 unk_48;
|
||||
/* 0x4A */ s16 unk_4A;
|
||||
/* 0x4C */ s16 unk_4C;
|
||||
/* 0x4E */ s16 unk_4E;
|
||||
/* 0x50 */ EffectInstance* unk_50;
|
||||
/* 0x54 */ EffectInstance* unk_54;
|
||||
} StarSpiritData; // size = 0x58
|
||||
|
||||
typedef struct EffectBlueprint {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ s32 effectID;
|
||||
/* 0x08 */ void (*init)(EffectInstance* effectInst);
|
||||
/* 0x0C */ void (*update)(EffectInstance* effectInst);
|
||||
/* 0x10 */ void (*renderWorld)(EffectInstance* effectInst);
|
||||
/* 0x14 */ void (*unk_14)(EffectInstance* effectInst);
|
||||
} EffectBlueprint; // size = 0x18
|
||||
|
||||
typedef struct EffectGraphics {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ s32 effectIndex;
|
||||
/* 0x08 */ s32 instanceCounter;
|
||||
/* 0x0C */ s32 freeDelay;
|
||||
/* 0x10 */ void (*update)(EffectInstance* effectInst);
|
||||
/* 0x14 */ void (*renderWorld)(EffectInstance* effectInst);
|
||||
/* 0x18 */ void (*renderUI)(EffectInstance* effectInst);
|
||||
/* 0x1C */ s32* data;
|
||||
} EffectGraphics; // size = 0x20
|
||||
|
||||
typedef struct EffectTableEntry {
|
||||
/* 0x00 */ void (*entryPoint);
|
||||
/* 0x04 */ void* dmaStart;
|
||||
/* 0x08 */ void* dmaEnd;
|
||||
/* 0x0C */ void* dmaDest;
|
||||
/* 0x10 */ void* graphicsDmaStart;
|
||||
/* 0x14 */ void* graphicsDmaEnd;
|
||||
} EffectTableEntry; // size = 0x18
|
||||
|
||||
enum FireBreathType {
|
||||
FIRE_BREATH_LARGE = 0,
|
||||
FIRE_BREATH_SMALL = 1,
|
||||
@ -897,7 +936,7 @@ EffectInstance* fx_bombette_breaking(s32, s32, s32, f32, s32, s32);
|
||||
EffectInstance* fx_firework(s32, f32, f32, f32, f32, s32);
|
||||
EffectInstance* fx_confetti(s32, f32, f32, f32, f32, s32);
|
||||
EffectInstance* fx_snowfall(s32, s32);
|
||||
EffectInstance* fx_46(s32, EffectWhirlwind*, f32, s32);
|
||||
EffectInstance* fx_46(s32, EffectWhirlwindUnk*, f32, s32);
|
||||
EffectInstance* fx_gather_magic(s32, f32, f32, f32, f32, s32);
|
||||
EffectInstance* fx_attack_result_text(s32, f32, f32, f32, f32, s32);
|
||||
EffectInstance* fx_small_gold_sparkle(s32, f32, f32, f32, f32, s32);
|
||||
|
@ -76,7 +76,7 @@ FX_MAIN(falling_leaves_main);
|
||||
FX_MAIN(stars_spread_main);
|
||||
FX_MAIN(steam_burst_main);
|
||||
FX_MAIN(stars_orbiting_main);
|
||||
FX_MAIN(big_snowflakes_main);
|
||||
void big_snowflakes_main(s32, f32, f32, f32);
|
||||
EffectInstance* debuff_main(s32, f32, f32, f32);
|
||||
FX_MAIN(green_impact_main);
|
||||
FX_MAIN(radial_shimmer_main);
|
||||
@ -101,7 +101,7 @@ FX_MAIN(snowfall_main);
|
||||
FX_MAIN(fx_46_main);
|
||||
FX_MAIN(gather_magic_main);
|
||||
EffectInstance* attack_result_text_main(s32, f32, f32, f32, f32, s32);
|
||||
EffectInstance* small_gold_sparkle_main(EffectInstanceDataThing*, f32, f32, f32, f32);
|
||||
EffectInstance* small_gold_sparkle_main(s32, f32, f32, f32, f32);
|
||||
FX_MAIN(flashing_box_shockwave_main);
|
||||
EffectInstance* balloon_main(s32, f32, f32, f32, f32, s32);
|
||||
FX_MAIN(floating_rock_main);
|
||||
@ -113,7 +113,7 @@ FX_MAIN(motion_blur_flame_main);
|
||||
FX_MAIN(energy_orb_wave_main);
|
||||
FX_MAIN(merlin_house_stars_main);
|
||||
FX_MAIN(quizmo_audience_main);
|
||||
FX_MAIN(butterflies_main);
|
||||
EffectInstance* butterflies_main(s32, f32, f32, f32);
|
||||
EffectInstance* stat_change_main(s32, f32, f32, f32, f32, s32);
|
||||
FX_MAIN(snaking_static_main);
|
||||
FX_MAIN(thunderbolt_ring_main);
|
||||
|
@ -574,6 +574,8 @@ enum SoundIDs {
|
||||
SOUND_21C = 0x0000021C,
|
||||
SOUND_MENU_ERROR = 0x0000021D,
|
||||
SOUND_231 = 0x00000231,
|
||||
SOUND_233 = 0x00000233,
|
||||
SOUND_234 = 0x00000234,
|
||||
SOUND_246 = 0x00000246,
|
||||
SOUND_259 = 0x00000259,
|
||||
SOUND_25A = 0x0000025A,
|
||||
@ -2585,7 +2587,7 @@ enum BattleStatusFlags1 {
|
||||
BS_FLAGS1_400 = 0x00000400,
|
||||
BS_FLAGS1_800 = 0x00000800,
|
||||
BS_FLAGS1_1000 = 0x00001000,
|
||||
BS_FLAGS1_2000 = 0x08002000,
|
||||
BS_FLAGS1_2000 = 0x00002000,
|
||||
BS_FLAGS1_4000 = 0x00004000,
|
||||
BS_FLAGS1_8000 = 0x00008000,
|
||||
BS_FLAGS1_10000 = 0x00010000,
|
||||
@ -2620,10 +2622,12 @@ enum BattleStatusFlags2 {
|
||||
BS_FLAGS2_800 = 0x00000800,
|
||||
BS_FLAGS2_NO_TARGET_AVAILABLE = 0x00001000,
|
||||
BS_FLAGS2_10000 = 0x00010000,
|
||||
BS_FLAGS2_100000 = 0x00100000,
|
||||
BS_FLAGS2_1000000 = 0x01000000,
|
||||
BS_FLAGS2_2000000 = 0x02000000,
|
||||
BS_FLAGS2_4000000 = 0x04000000,
|
||||
BS_FLAGS2_8000000 = 0x08000000,
|
||||
BS_FLAGS2_10000000 = 0x10000000,
|
||||
};
|
||||
|
||||
enum BattleStates {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "map.h"
|
||||
#include "enums.h"
|
||||
#include "stdlib/stdarg.h"
|
||||
#include "xstdio.h"
|
||||
|
||||
f32 fabsf(f32 f);
|
||||
f64 fabs(f64 f);
|
||||
@ -33,8 +34,6 @@ s32 dma_copy(Addr romStart, Addr romEnd, void* vramDest);
|
||||
f32 rand_float(void);
|
||||
void copy_matrix(Matrix4f src, Matrix4f dest);
|
||||
|
||||
s32 _Printf(PrintCallback pfn, char* arg, const char* fmt, va_list ap);
|
||||
|
||||
s32 get_global_byte(s32 index);
|
||||
s32 get_global_flag(s32 index);
|
||||
s32 get_area_byte(s32 index);
|
||||
@ -256,6 +255,7 @@ f32 clamp_angle(f32 theta);
|
||||
s32 sign(s32 value);
|
||||
s32 func_80055448(s32);
|
||||
s32 func_80055464(s32, s32);
|
||||
s32 func_80055618(s32, s32);
|
||||
s32 func_800E0208(void);
|
||||
|
||||
s32 battle_heap_create(void);
|
||||
@ -432,7 +432,7 @@ ModelAnimator* get_animator_by_index(s32 arg0);
|
||||
void set_screen_overlay_params_front(u8, f32);
|
||||
void set_screen_overlay_params_back(u8, f32);
|
||||
void set_screen_overlay_alpha(s32, f32);
|
||||
void get_screen_overlay_params(s32, u8*, f32*);
|
||||
void get_screen_overlay_params(s32, u8* type, f32* zoom);
|
||||
void set_screen_overlay_color(s32, u8, u8, u8);
|
||||
void set_screen_overlay_center(s32, s32, s32, s32);
|
||||
s32 rand_int(s32);
|
||||
@ -722,6 +722,8 @@ void load_font(s32 font);
|
||||
|
||||
void* load_asset_by_name(const char* assetName, u32* decompressedSize);
|
||||
|
||||
Gfx* mdl_get_copied_gfx(s32 copyIndex);
|
||||
void mdl_get_copied_vertices(s32 copyIndex, Vtx** firstVertex, Vtx** copiedVertices, s32* numCopied);
|
||||
void mdl_draw_hidden_panel_surface(Gfx** arg0, u16 treeIndex);
|
||||
s32 func_8011CFBC(void);
|
||||
void set_screen_overlay_center_worldpos(s32 idx, s32 posIdx, s32 x, s32 y, s32 z);
|
||||
@ -769,8 +771,11 @@ void hide_foreground_models_unchecked(void);
|
||||
void show_foreground_models(void);
|
||||
void hide_foreground_models(void);
|
||||
void btl_set_state(s32 battleState);
|
||||
void draw_entity_model_E(s32, Mtx*);
|
||||
void draw_entity_model_A(s32, Mtx*);
|
||||
void draw_entity_model_B(s32, Mtx*, s32, s32);
|
||||
void draw_entity_model_C(s32, Mtx*);
|
||||
void draw_entity_model_D(s32, Mtx*, s32, Vtx*);
|
||||
void draw_entity_model_E(s32, Mtx*);
|
||||
void free_entity_model_by_index(s32 idx);
|
||||
void btl_cam_use_preset(s32);
|
||||
void btl_cam_set_params(s16, s16, s16, s16, s32, s32, s32, s32);
|
||||
@ -879,6 +884,9 @@ void func_80254950(void);
|
||||
void func_802549A0(void);
|
||||
void func_802549C0(void);
|
||||
|
||||
void func_8023E104(void);
|
||||
void func_8023E11C(void);
|
||||
|
||||
void set_goal_pos_to_part(ActorState* state, s32 actorID, s32 partIndex);
|
||||
|
||||
void init_encounters_ui(void);
|
||||
@ -891,6 +899,8 @@ s32 get_asset_offset(char*, s32*);
|
||||
void initialize_status_menu(void);
|
||||
void status_menu_start_blinking_fp(void);
|
||||
s32 is_status_menu_visible(void);
|
||||
void status_menu_start_blinking_starpoints(void);
|
||||
void status_menu_stop_blinking_starpoints(void);
|
||||
void status_menu_start_blinking_hp(void);
|
||||
void status_menu_start_blinking_sp(void);
|
||||
void status_menu_stop_blinking_fp(void);
|
||||
|
23
include/gcc/memory.h
Normal file
23
include/gcc/memory.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef _MEMORY_H
|
||||
#define _MEMORY_H
|
||||
/*
|
||||
memory.h
|
||||
*/
|
||||
|
||||
#ifndef _SIZE_T_DEF
|
||||
#define _SIZE_T_DEF
|
||||
typedef unsigned size_t;
|
||||
#endif
|
||||
|
||||
void *memccpy(void *,void *,int,size_t);
|
||||
void *memchr(void *,int,size_t);
|
||||
int memcmp(const void *,const void *,size_t);
|
||||
void *memcpy(void *,const void *,size_t);
|
||||
int memicmp(void *,void *,size_t);
|
||||
void *memmove(void *,void *,size_t);
|
||||
void *memset(void *,int,size_t);
|
||||
|
||||
void movmem(void *,void *,unsigned);
|
||||
void setmem(void *,unsigned,int);
|
||||
|
||||
#endif
|
42
include/gcc/string.h
Executable file
42
include/gcc/string.h
Executable file
@ -0,0 +1,42 @@
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
/*
|
||||
string.h
|
||||
*/
|
||||
|
||||
#ifndef _SIZE_T_DEF
|
||||
#define _SIZE_T_DEF
|
||||
typedef unsigned size_t;
|
||||
#endif
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
char *stpcpy(char *,const char *);
|
||||
char *strcat(char *,const char *);
|
||||
char *strchr(const char *,int);
|
||||
int strcmp(const char *,const char *);
|
||||
char *strcpy(char *,const char *);
|
||||
size_t strcspn(const char *,const char *);
|
||||
char *strdup(const char *);
|
||||
char *strerror(int);
|
||||
int stricmp(const char *,const char *);
|
||||
size_t strlen(const char *);
|
||||
char *strlwr(char *);
|
||||
char *strncat(char *,const char *,size_t);
|
||||
int strncmp(const char *,const char *,size_t);
|
||||
char *strncpy(char *,const char *,size_t);
|
||||
int strnicmp(const char *,const char *,size_t);
|
||||
char *strnset(char *,int,size_t);
|
||||
char *strpbrk(const char *,const char *);
|
||||
char *strrchr(const char *,int);
|
||||
char *strrev(char *);
|
||||
char *strset(char *,int);
|
||||
size_t strspn(const char *,const char *);
|
||||
char *strstr(const char *,const char *);
|
||||
char *strtok(char *,const char *);
|
||||
char *strupr(char *);
|
||||
|
||||
#define strcmpi(s1,s2) stricmp(s1,s2)
|
||||
#define strncmpi(s1,s2,n) strnicmp(s1,s2,n)
|
||||
|
||||
#endif
|
@ -152,6 +152,7 @@ typedef enum ShapeTypes {
|
||||
|
||||
typedef ModelTreeInfo ModelTreeInfoList[0x200];
|
||||
extern ModelTreeInfoList* mdl_currentModelTreeNodeInfo;
|
||||
extern ModelList* gCurrentModels;
|
||||
|
||||
void update_model_animator(s32);
|
||||
void update_model_animator_with_transform(s32 animatorID, Mtx* mtx);
|
||||
|
37
include/xstdio.h
Executable file
37
include/xstdio.h
Executable file
@ -0,0 +1,37 @@
|
||||
#ifndef _XSTDIO_H
|
||||
#define _XSTDIO_H
|
||||
#include "PR/ultratypes.h"
|
||||
//#include "stdlib.h"
|
||||
//#include "stdarg.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ union {
|
||||
/* 0x0 */ long long ll;
|
||||
/* 0x0 */ double ld;
|
||||
} v;
|
||||
/* 0x8 */ unsigned char* s;
|
||||
/* 0xC */ int n0;
|
||||
/* 0x10 */ int nz0;
|
||||
/* 0x14 */ int n1;
|
||||
/* 0x18 */ int nz1;
|
||||
/* 0x1C */ int n2;
|
||||
/* 0x20 */ int nz2;
|
||||
/* 0x24 */ int prec;
|
||||
/* 0x28 */ int width;
|
||||
/* 0x2C */ size_t nchar;
|
||||
/* 0x30 */ unsigned int flags;
|
||||
/* 0x34 */ char qual;
|
||||
} _Pft;
|
||||
|
||||
#define FLAGS_SPACE 1
|
||||
#define FLAGS_PLUS 2
|
||||
#define FLAGS_MINUS 4
|
||||
#define FLAGS_HASH 8
|
||||
#define FLAGS_ZERO 16
|
||||
typedef char *outfun(char*,const char*,size_t);
|
||||
|
||||
int _Printf(outfun prout, char *arg, const char *fmt, va_list args);
|
||||
void _Litob(_Pft *args, char type);
|
||||
void _Ldtob(_Pft* args, char type);
|
||||
|
||||
#endif
|
873
src/16F740.c
873
src/16F740.c
@ -10,66 +10,141 @@ extern s32* D_800DC064;
|
||||
extern s16 D_802809F6;
|
||||
extern s16 D_802809F8;
|
||||
extern s32 D_80280A30;
|
||||
extern s32 D_8029F254;
|
||||
extern u8 D_8029F244;
|
||||
extern s32 D_8029F248;
|
||||
extern s32 D_8029F24C;
|
||||
extern s32 D_8029F250;
|
||||
extern s32 D_8029F254;
|
||||
extern s32 D_8029F258;
|
||||
extern s32 D_8029F25C;
|
||||
extern s32 D_8029F260;
|
||||
extern s32 D_8029F264;
|
||||
|
||||
// Almost good but some reorderings at the beginning
|
||||
#ifdef NON_EQUIVALENT
|
||||
void btl_merlee_on_start_turn(void) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
EncounterStatus* currentEncounter = &gCurrentEncounter;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
|
||||
if (!(gBattleStatus.flags2 & 0x40) && battleStatus->unk_8A != 3 && battleStatus->unk_8A != 4 && playerData->merleeCastsLeft > 0) {
|
||||
if (playerData->merleeTurnCount <= 0) {
|
||||
s32 d100 = rand_int(100);
|
||||
do {
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_40) &&
|
||||
battleStatus->nextMerleeSpellType != 3 &&
|
||||
battleStatus->nextMerleeSpellType != 4 &&
|
||||
playerData->merleeCastsLeft > 0)
|
||||
{
|
||||
if (playerData->merleeTurnCount <= 0) {
|
||||
s32 temp = rand_int(100);
|
||||
|
||||
if (currentEncounter->currentEnemy != NULL) {
|
||||
if (currentEncounter->currentEnemy->flags & 0x40000) {
|
||||
if (d100 <= 45) {
|
||||
if (currentEncounter->currentEnemy != NULL) {
|
||||
if (currentEncounter->currentEnemy->flags & ENEMY_FLAGS_40000) {
|
||||
if (temp <= 45) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (temp <= 90) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else {
|
||||
playerData->merleeSpellType = 3;
|
||||
}
|
||||
} else if (temp <= 30) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (d100 <= 90) {
|
||||
} else if (temp <= 60) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else {
|
||||
} else if (temp <= 80) {
|
||||
playerData->merleeSpellType = 3;
|
||||
} else {
|
||||
playerData->merleeSpellType = 4;
|
||||
}
|
||||
} else if (d100 <= 30) {
|
||||
} else if (temp <= 30) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (d100 <= 60) {
|
||||
} else if (temp <= 60) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else if (d100 <= 80) {
|
||||
} else if (temp <= 80) {
|
||||
playerData->merleeSpellType = 3;
|
||||
} else {
|
||||
playerData->merleeSpellType = 4;
|
||||
}
|
||||
} else if (d100 <= 30) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (d100 <= 60) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else if (d100 <= 80) {
|
||||
playerData->merleeSpellType = 3;
|
||||
} else {
|
||||
playerData->merleeSpellType = 4;
|
||||
|
||||
temp = rand_int(10) + 6;
|
||||
playerData->merleeTurnCount = temp;
|
||||
}
|
||||
playerData->merleeTurnCount = rand_int(10) + 6;
|
||||
}
|
||||
|
||||
if (playerData->merleeTurnCount >= 2) {
|
||||
playerData->merleeTurnCount--;
|
||||
} else {
|
||||
playerData->merleeTurnCount = 0;
|
||||
battleStatus->unk_8A = playerData->merleeSpellType;
|
||||
playerData->merleeCastsLeft--;
|
||||
if (playerData->merleeTurnCount >= 2) {
|
||||
playerData->merleeTurnCount--;
|
||||
} else {
|
||||
playerData->merleeTurnCount = 0;
|
||||
battleStatus->nextMerleeSpellType = playerData->merleeSpellType;
|
||||
playerData->merleeCastsLeft--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (0); // TODO: required to match
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "16F740", btl_merlee_on_start_turn);
|
||||
#endif
|
||||
|
||||
INCLUDE_ASM(s32, "16F740", btl_merlee_on_first_strike);
|
||||
void btl_merlee_on_first_strike(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
EncounterStatus* currentEncounter = &gCurrentEncounter;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
|
||||
do {
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_40) &&
|
||||
battleStatus->nextMerleeSpellType != 3 &&
|
||||
battleStatus->nextMerleeSpellType != 4 &&
|
||||
playerData->merleeCastsLeft > 0)
|
||||
{
|
||||
if (playerData->merleeTurnCount <= 0) {
|
||||
s32 temp = rand_int(100);
|
||||
|
||||
if (currentEncounter->currentEnemy != NULL) {
|
||||
if (currentEncounter->currentEnemy->flags & ENEMY_FLAGS_40000) {
|
||||
if (temp <= 45) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (temp <= 90) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else {
|
||||
playerData->merleeSpellType = 3;
|
||||
}
|
||||
} else if (temp <= 30) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (temp <= 60) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else if (temp <= 80) {
|
||||
playerData->merleeSpellType = 3;
|
||||
} else {
|
||||
playerData->merleeSpellType = 4;
|
||||
}
|
||||
} else if (temp <= 30) {
|
||||
playerData->merleeSpellType = 1;
|
||||
} else if (temp <= 60) {
|
||||
playerData->merleeSpellType = 2;
|
||||
} else if (temp <= 80) {
|
||||
playerData->merleeSpellType = 3;
|
||||
} else {
|
||||
playerData->merleeSpellType = 4;
|
||||
}
|
||||
|
||||
if (playerData->merleeSpellType != 4) {
|
||||
// same outcome either way. has to be written like this, and the check does exist in the code. bug?
|
||||
if (playerData->merleeTurnCount == -1) {
|
||||
temp = rand_int(5) + 5;
|
||||
} else {
|
||||
temp = rand_int(5) + 5;
|
||||
|
||||
}
|
||||
} else {
|
||||
temp = rand_int(8) + 5;
|
||||
}
|
||||
playerData->merleeTurnCount = temp;
|
||||
}
|
||||
|
||||
if (playerData->merleeSpellType == 3 || playerData->merleeSpellType == 4) {
|
||||
if (playerData->merleeTurnCount >= 2) {
|
||||
playerData->merleeTurnCount--;
|
||||
} else {
|
||||
battleStatus->nextMerleeSpellType = playerData->merleeSpellType;
|
||||
playerData->merleeTurnCount = 0;
|
||||
playerData->merleeCastsLeft--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (0); // TODO: required to match
|
||||
}
|
||||
|
||||
void btl_set_state(s32 battleState) {
|
||||
s32 flags = gBattleStatus.flags2;
|
||||
@ -441,9 +516,9 @@ void btl_state_update_begin_player_turn(void) {
|
||||
}
|
||||
|
||||
if (D_8029F254 == 0) {
|
||||
btl_set_state(BATTLE_STATE2_PLAYER_DEFEATED);
|
||||
btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER);
|
||||
} else{
|
||||
btl_set_state(BATTLE_STATE2_UNK_8);
|
||||
btl_set_state(BATTLE_STATE_BEGIN_PARTNER_TURN);
|
||||
gBattleStatus.flags2 |= 2;
|
||||
}
|
||||
}
|
||||
@ -489,7 +564,121 @@ void btl_state_update_switch_to_player(void) {
|
||||
void btl_state_draw_switch_to_player(void) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "16F740", btl_state_update_begin_partner_turn);
|
||||
void btl_state_update_begin_partner_turn(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
Actor* partner = battleStatus->partnerActor;
|
||||
Actor* enemy;
|
||||
s32 i;
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_UNK_0) {
|
||||
if (partner == NULL) {
|
||||
D_8029F254 = 1;
|
||||
gBattleState2 = BATTLE_STATE2_PLAYER_DEFEATED;
|
||||
} else if ((battleStatus->flags2 & (BS_FLAGS2_4 | BS_FLAGS2_2)) != (BS_FLAGS2_4 | BS_FLAGS2_2)) {
|
||||
if (!(partner->flags & ACTOR_FLAG_NO_ATTACK)) {
|
||||
btl_cam_use_preset(2);
|
||||
btl_cam_move(5);
|
||||
gBattleState2 = BATTLE_STATE2_UNK_64;
|
||||
} else {
|
||||
btl_set_state(BATTLE_STATE_9);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
btl_set_state(BATTLE_STATE_9);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_UNK_64) {
|
||||
if (btl_cam_is_moving_done()) {
|
||||
D_8029F258 = 0;
|
||||
reset_actor_turn_info();
|
||||
partner = battleStatus->partnerActor;
|
||||
battleStatus->unk_86 = 0x7F;
|
||||
battleStatus->blockResult = 0x7F;
|
||||
D_8029F254 = 0;
|
||||
gBattleStatus.flags1 |= BS_FLAGS1_80000;
|
||||
gBattleStatus.flags2 |= BS_FLAGS1_100000;
|
||||
partner->flags |= ACTOR_FLAG_8000000;
|
||||
|
||||
if (partner->koStatus != 0) {
|
||||
partner->koDuration--;
|
||||
D_8029F254 = 1;
|
||||
D_8029F258 = 20;
|
||||
if (partner->koDuration > 0) {
|
||||
// TODO: We believe these are DebuffFXData*,
|
||||
// but unk_3C is a u8 for these and we need it to be an s32...
|
||||
((s32*)(partner->debuffEffect->data))[15] = partner->koDuration;
|
||||
} else {
|
||||
partner->koStatus = 0;
|
||||
dispatch_event_partner(EVENT_34);
|
||||
// TODO: We believe these are DebuffFXData*,
|
||||
// but unk_3C is a u8 for these and we need it to be an s32...
|
||||
((s32*)(partner->debuffEffect->data))[15] = 0;
|
||||
gBattleStatus.flags2 |= BS_FLAGS2_8;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
|
||||
enemy = battleStatus->enemyActors[i];
|
||||
if (enemy != NULL) {
|
||||
enemy->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
|
||||
}
|
||||
}
|
||||
gBattleState2 = BATTLE_STATE2_UNK_1;
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_UNK_1) {
|
||||
if (partner != NULL) {
|
||||
if (partner->onHitScript == NULL || !does_script_exist(partner->onHitID)) {
|
||||
partner->onHitScript = NULL;
|
||||
} else {
|
||||
goto block_27; // TODO find a way to remove
|
||||
}
|
||||
}
|
||||
|
||||
gBattleStatus.flags2 &= ~BS_FLAGS2_8;
|
||||
if (btl_check_player_defeated() || btl_check_enemies_defeated()) {
|
||||
return;
|
||||
}
|
||||
gBattleState2 = BATTLE_STATE2_UNK_8;
|
||||
}
|
||||
|
||||
block_27:
|
||||
if (gBattleState2 == BATTLE_STATE2_UNK_8) {
|
||||
if (partner->onTurnChanceScriptSource != NULL) {
|
||||
Evt* script;
|
||||
|
||||
battleStatus->battlePhase = 0xC;
|
||||
script = start_script(partner->onTurnChanceScriptSource, 0xA, 0);
|
||||
partner->onTurnChangeScript = script;
|
||||
partner->onTurnChangeID = script->id;
|
||||
script->owner1.actorID = ACTOR_PARTNER;
|
||||
}
|
||||
gBattleState2 = BATTLE_STATE2_UNK_9;
|
||||
}
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_UNK_9 &&
|
||||
(partner->onTurnChanceScriptSource == NULL || !does_script_exist(partner->onTurnChangeID)))
|
||||
{
|
||||
gBattleState2 = BATTLE_STATE2_PLAYER_DEFEATED;
|
||||
}
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_PLAYER_DEFEATED) {
|
||||
if (D_8029F258 != 0) {
|
||||
D_8029F258--;
|
||||
return;
|
||||
}
|
||||
gBattleStatus.flags2 &= ~BS_FLAGS2_100000;
|
||||
if (D_8029F254 == 0) {
|
||||
btl_set_state(BATTLE_STATE_SWITCH_TO_PARTNER);
|
||||
} else {
|
||||
gBattleStatus.flags2 |= BS_FLAGS2_4;
|
||||
btl_set_state(BATTLE_STATE_9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void btl_state_draw_begin_partner_turn(void) {
|
||||
}
|
||||
@ -889,7 +1078,115 @@ void btl_state_update_end_training_battle(void) {
|
||||
void btl_state_draw_end_training_battle(void) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "16F740", btl_state_update_end_battle);
|
||||
void btl_state_update_end_battle(void) {
|
||||
Battle* blah = (*D_800DC4FC);
|
||||
EncounterStatus* encounterStatus = &gCurrentEncounter;
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
Stage* stage;
|
||||
Evt* script;
|
||||
s32 i;
|
||||
|
||||
switch (gBattleState2) {
|
||||
case BATTLE_STATE2_UNK_0:
|
||||
D_80280A30 = 0;
|
||||
if (gGameStatusPtr->debugEnemyContact == 2) {
|
||||
D_80280A30 = 255;
|
||||
}
|
||||
if (encounterStatus->battleOutcome == 1 && !(gBattleStatus.flags1 & BS_FLAGS1_800000)) {
|
||||
btl_cam_unfreeze();
|
||||
btl_cam_use_preset(BTL_CAM_PRESET_B);
|
||||
set_screen_overlay_color(0, 0, 0, 0);
|
||||
set_screen_overlay_center(0, 0, 160, 120);
|
||||
}
|
||||
gBattleState2 = BATTLE_STATE2_UNK_1;
|
||||
break;
|
||||
case BATTLE_STATE2_UNK_1:
|
||||
if (D_80280A30 == 255) {
|
||||
gBattleState2 = BATTLE_STATE2_UNK_2;
|
||||
break;
|
||||
}
|
||||
D_80280A30 += battleStatus->unk_8D;
|
||||
if (D_80280A30 > 255) {
|
||||
D_80280A30 = 255;
|
||||
}
|
||||
break;
|
||||
case BATTLE_STATE2_UNK_2:
|
||||
D_80280A30 = 255;
|
||||
gBattleStatus.flags1 &= ~BS_FLAGS1_1;
|
||||
if (D_800DC064 == NULL) {
|
||||
stage = blah->stage;
|
||||
} else {
|
||||
stage = D_800DC064[1];
|
||||
}
|
||||
if (stage->postBattle == NULL) {
|
||||
gBattleState2 = BATTLE_STATE2_UNK_4;
|
||||
return;
|
||||
}
|
||||
script = start_script(stage->postBattle, 0xA, 0);
|
||||
battleStatus->controlScript = script;
|
||||
gBattleState2 = BATTLE_STATE2_UNK_3;
|
||||
battleStatus->controlScriptID = script->id;
|
||||
break;
|
||||
case BATTLE_STATE2_UNK_3:
|
||||
if (!does_script_exist(battleStatus->controlScriptID)) {
|
||||
gBattleState2 = BATTLE_STATE2_UNK_4;
|
||||
// fallthrough
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
case BATTLE_STATE2_UNK_4:
|
||||
kill_all_scripts();
|
||||
for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
|
||||
if (battleStatus->enemyActors[i] != NULL) {
|
||||
btl_delete_actor(battleStatus->enemyActors[i]);
|
||||
}
|
||||
}
|
||||
if (battleStatus->partnerActor != NULL) {
|
||||
btl_delete_actor(battleStatus->partnerActor);
|
||||
}
|
||||
|
||||
btl_delete_player_actor(battleStatus->playerActor);
|
||||
|
||||
if (battleStatus->nextMerleeSpellType == 4) {
|
||||
encounterStatus->merleeCoinBonus = 1;
|
||||
battleStatus->nextMerleeSpellType = 0;
|
||||
}
|
||||
|
||||
encounterStatus->damageTaken = battleStatus->damageTaken;
|
||||
|
||||
if (gBattleStatus.flags2 & BS_FLAGS2_10000000) {
|
||||
encounterStatus->dropWhackaBump = 1;
|
||||
}
|
||||
|
||||
remove_all_effects();
|
||||
set_windows_visible(0);
|
||||
|
||||
if (gBattleStatus.flags2 & BS_FLAGS2_40) {
|
||||
decrement_status_menu_disabled();
|
||||
}
|
||||
|
||||
if (encounterStatus->battleOutcome == OUTCOME_PLAYER_LOST &&
|
||||
!(gBattleStatus.flags1 & BS_FLAGS1_800000))
|
||||
{
|
||||
s16 areaID;
|
||||
s16 mapID;
|
||||
|
||||
btl_set_state(BATTLE_STATE_0);
|
||||
D_800DC4D0 = gBattleState;
|
||||
get_map_IDs_by_name("gv_01", &areaID, &mapID);
|
||||
gGameStatusPtr->areaID = areaID;
|
||||
gGameStatusPtr->mapID = mapID;
|
||||
gGameStatusPtr->entryID = 0;
|
||||
set_game_mode(GAME_MODE_ENTER_WORLD);
|
||||
} else {
|
||||
btl_set_state(BATTLE_STATE_0);
|
||||
D_800DC4D0 = gBattleState;
|
||||
func_8003E514(1);
|
||||
set_game_mode(GAME_MODE_END_BATTLE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void btl_state_draw_end_battle(void) {
|
||||
Camera* camera = &gCameras[gCurrentCameraID];
|
||||
@ -926,7 +1223,162 @@ void btl_state_update_defend(void) {
|
||||
void btl_state_draw_defend(void) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "16F740", btl_state_update_run_away);
|
||||
void btl_state_update_run_away(void) {
|
||||
BattleStatus* battleStatus = &gBattleStatus;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
EncounterStatus* currentEncounter = &gCurrentEncounter;
|
||||
Actor* player = battleStatus->playerActor;
|
||||
Actor* partner = battleStatus->partnerActor;
|
||||
Actor* enemy;
|
||||
s32 var_s0;
|
||||
f32 var_f2;
|
||||
Evt* script;
|
||||
s32 i;
|
||||
|
||||
switch (gBattleState2) {
|
||||
case BATTLE_STATE2_UNK_0:
|
||||
battleStatus->unk_8C = 0;
|
||||
gBattleStatus.flags1 &= ~BS_FLAGS1_40000;
|
||||
gBattleStatus.flags2 |= BS_FLAGS2_10 | BS_FLAGS2_8 | BS_FLAGS2_4 | BS_FLAGS2_2;
|
||||
playerData->unk_2A6++;
|
||||
btl_cam_use_preset(BTL_CAM_PRESET_25);
|
||||
var_s0 = 0;
|
||||
btl_cam_target_actor(ACTOR_PLAYER);
|
||||
var_f2 = 0.0f;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
|
||||
enemy = battleStatus->enemyActors[i];
|
||||
if (enemy != NULL) {
|
||||
if (!(enemy->flags & ACTOR_FLAG_TARGET_ONLY)) {
|
||||
if (!(enemy->flags & ACTOR_FLAG_NO_DMG_APPLY)) {
|
||||
f32 escapeChance = enemy->actorBlueprint->escapeChance;
|
||||
|
||||
var_s0 += 1;
|
||||
if (enemy->debuff == 3 ||
|
||||
enemy->debuff == 4 ||
|
||||
enemy->debuff == 5 ||
|
||||
enemy->debuff == 6 ||
|
||||
enemy->debuff == 7 ||
|
||||
enemy->debuff == 8)
|
||||
{
|
||||
escapeChance = 100.0f;
|
||||
}
|
||||
var_f2 += escapeChance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player->state.varTable[0] = var_f2 / var_s0;
|
||||
if (gGameStatusPtr->debugEnemyContact == 4) {
|
||||
player->state.varTable[0] = 100;
|
||||
}
|
||||
battleStatus->battlePhase = 3;
|
||||
script = start_script(PlayerScriptDispatcher, 0xA, 0);
|
||||
player->takeTurnScript = script;
|
||||
player->takeTurnID = script->id;
|
||||
script->owner1.actorID = ACTOR_PLAYER;
|
||||
if (partner != NULL && partner->koStatus == 0) {
|
||||
script = start_script(partner->takeTurnScriptSource, 0xA, 0);
|
||||
partner->takeTurnScript = script;
|
||||
partner->takeTurnID = script->id;
|
||||
script->owner1.actorID = ACTOR_PARTNER;
|
||||
}
|
||||
gBattleState2 = BATTLE_STATE2_UNK_2;
|
||||
break;
|
||||
case 2:
|
||||
if (!does_script_exist(player->takeTurnID) && battleStatus->unk_8C == 0) {
|
||||
if (!(gBattleStatus.flags1 & BS_FLAGS1_40000)) {
|
||||
gBattleState2 = BATTLE_STATE2_UNK_3;
|
||||
} else {
|
||||
currentEncounter->battleOutcome = 2;
|
||||
if (is_ability_active(ABILITY_RUNAWAY_PAY) == 0) {
|
||||
gBattleState2 = BATTLE_STATE2_UNK_B;
|
||||
} else {
|
||||
status_menu_start_blinking_starpoints();
|
||||
func_8023E104();
|
||||
D_8029F264 = 0;
|
||||
D_8029F24C = 0;
|
||||
D_80280A30 = 0;
|
||||
D_8029F25C = battleStatus->totalStarPoints * 100;
|
||||
D_8029F250 = 20;
|
||||
D_8029F260 = D_8029F25C / D_8029F250;
|
||||
gBattleState2 = BATTLE_STATE2_PLAYER_DEFEATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_PLAYER_DEFEATED) {
|
||||
if (battleStatus->totalStarPoints != 0) {
|
||||
s8 temp_v1_4;
|
||||
|
||||
D_8029F25C -= D_8029F260;
|
||||
temp_v1_4 = D_8029F25C / 100;
|
||||
var_s0 = battleStatus->totalStarPoints - temp_v1_4;
|
||||
battleStatus->totalStarPoints = temp_v1_4;
|
||||
|
||||
if (var_s0 > 0) {
|
||||
sfx_play_sound(SOUND_211);
|
||||
}
|
||||
playerData->starPoints += var_s0;
|
||||
D_80280A30 += 1;
|
||||
if (D_8029F250 == 0 && battleStatus->totalStarPoints != 0) {
|
||||
playerData->starPoints++;
|
||||
}
|
||||
}
|
||||
if (playerData->starPoints >= 99) {
|
||||
playerData->starPoints = 99;
|
||||
}
|
||||
if (battleStatus->totalStarPoints == 0) {
|
||||
if (D_8029F250 != 0) {
|
||||
D_8029F250--;
|
||||
} else {
|
||||
status_menu_stop_blinking_starpoints();
|
||||
func_8023E11C();
|
||||
gBattleState2 = BATTLE_STATE2_UNK_B;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleState2 == BATTLE_STATE2_UNK_B) {
|
||||
playerData->battlesFled++;
|
||||
if (!(gBattleStatus.flags2 & 0x02000000)) {
|
||||
bgm_set_song(0, -1, 0, 1500, 8);
|
||||
}
|
||||
btl_set_state(BATTLE_STATE_END_BATTLE);
|
||||
}
|
||||
|
||||
switch (gBattleState2) {
|
||||
case BATTLE_STATE2_UNK_3:
|
||||
battleStatus->battlePhase = 7;
|
||||
script = start_script(PlayerScriptDispatcher, 0xA, 0);
|
||||
player->takeTurnScript = script;
|
||||
player->takeTurnID = script->id;
|
||||
script->owner1.actorID = ACTOR_PLAYER;
|
||||
if (partner != NULL && partner->koStatus == 0) {
|
||||
script = start_script(partner->takeTurnScriptSource, 0xA, 0);
|
||||
partner->takeTurnScript = script;
|
||||
partner->takeTurnID = script->id;
|
||||
script->owner1.actorID = ACTOR_PARTNER;
|
||||
}
|
||||
gBattleState2 = BATTLE_STATE2_UNK_4;
|
||||
break;
|
||||
case BATTLE_STATE2_UNK_4:
|
||||
if (D_8029F248 != 0) {
|
||||
D_8029F248--;
|
||||
return;
|
||||
}
|
||||
if (!does_script_exist(player->takeTurnID) &&
|
||||
(partner == NULL || !does_script_exist(partner->takeTurnID)) &&
|
||||
battleStatus->unk_8C == 0)
|
||||
{
|
||||
btl_set_state(BATTLE_STATE_9);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||