diff --git a/include/math.h b/include/math.h index b682372bb..6762b4a85 100644 --- a/include/math.h +++ b/include/math.h @@ -51,38 +51,17 @@ bool8 FP48_16_SLessThan(const s48_16 *a, const s48_16 *b); void FP48_16_Add(s48_16 *dst, s48_16 *a, s48_16 *b); void FP48_16_Subtract(s48_16 *dst, s48_16 *a, s48_16 *b); -//static inline bool8 F248Equal(s24_8 x, s24_8 y) { -// return x.raw == y.raw; -//} - -#define F248LessThanInt(x, y) (x.raw < 0x100 * y) -#define F248LessThanFloat(x, y) (x.raw < (int)(y * 0x100)) -#define FloatLessThanF248(x, y) ((int)(x * 0x100) < y.raw) -//static inline bool8 F248LessThanOne(s24_8 x) { -// return x.raw < 0x100; -//} -#define F248LessThan(x, y) (x.raw < y.raw) -#define F248GreaterThan(x, y) (x.raw > y.raw) -#define F248Equal(x, y) (x.raw == y.raw) -#define F248EqualsInt(x, y) (x.raw == 0x100 * y) - -//static inline bool8 F248LessThan(s24_8 x, s24_8 y) { -// return x.raw < y.raw; -//} - -#define F248_AddInt(x, y) ((s24_8){x.raw + 0x100 * y}) -#define F248_SubInt(x, y) ((s24_8){x.raw - 0x100 * y}) - -static inline s24_8 F248_Add(s24_8 x, s24_8 y) { - return (s24_8){x.raw + y.raw}; -} - -static inline s24_8 F248_Sub(s24_8 x, s24_8 y) { - return (s24_8){x.raw - y.raw}; -} - -static inline s24_8 F248_MulInt(s24_8 x, s32 y) { - return (s24_8){x.raw * y}; -} +#define F248LessThanInt(x, y) (x < 0x100 * y) +#define F248LessThanFloat(x, y) (x < (int)(y * 0x100)) +#define FloatLessThanF248(x, y) ((int)(x * 0x100) < y) +#define F248LessThan(x, y) (x < y) +#define F248GreaterThan(x, y) (x > y) +#define F248Equal(x, y) (x == y) +#define F248EqualsInt(x, y) (x == 0x100 * y) +#define F248_AddInt(x, y) ((s24_8){x + 0x100 * y}) +#define F248_SubInt(x, y) ((s24_8){x - 0x100 * y}) +#define F248_Add(x, y)(x + y) +#define F248_Sub(x, y)(x - y) +#define F248_MulInt(x, y)(x * y) #endif // GUARD_MATH_H diff --git a/include/number_util.h b/include/number_util.h index cbab8120d..7d585caa9 100644 --- a/include/number_util.h +++ b/include/number_util.h @@ -17,14 +17,11 @@ typedef struct FixedPoint * significant bits are the integer part and the 8 least significant bits are * the fractional part. */ -typedef struct s24_8 { - // It's almost certainly not an actual struct, but keep it as one until we decomp all structures that include it - s32 raw; -} s24_8; +typedef s32 s24_8; // Does not match as a struct in Blue/Sky. -#define F248_ZERO ((s24_8){}) -#define F248_ONE ((s24_8){0x100}) -#define F248_MAX ((s24_8){0x7FFFFFFF}) +#define F248_ZERO ((s24_8)0) +#define F248_ONE ((s24_8)0x100) +#define F248_MAX ((s24_8)0x7FFFFFFF) /** * This type represents a signed 48.16 fixed-point number, where the 48 most @@ -59,19 +56,8 @@ void WriteBellyBits(DataSerializer *r0, FixedPoint *src); // Sometimes it's used directly as opposed to calling IntToFixedPoint #define IntToFixedPointMacro(x) ((FixedPoint){x, 0}) -#define IntToF248_2(x) ((s24_8){x * 0x100}) -#define FloatToF248_2(x) ((s24_8){(int)(x * 0x100)}) -static inline s24_8 IntToF248(s32 x) { - return (s24_8){x * 256}; -} - -static inline s24_8 FloatToF248(float x) { - return (s24_8){(int)(x * 256)}; -} - -static inline s32 F248ToInt(s24_8 x) { - return x.raw / 256; -} - +#define IntToF248(x) (((x) << 8)) +#define FloatToF248(x) ((int)(x * 0x100)) +#define F248ToInt(x) ((s24_8)(x / 256)) #endif diff --git a/src/blow_away.c b/src/blow_away.c index a25a7e078..086462acb 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -173,7 +173,7 @@ void sub_807D068(Entity *pokemon, DungeonPos *pos) pixelY += incrementY; local_34.x = pixelX; local_34.y = pixelY; - pokemon->unk1C.raw = sin_4096(iVar8) * 0xc; + pokemon->unk1C = sin_4096(iVar8) * 0xc; UpdateEntityPixelPos(pokemon, &local_34); if (ShouldDisplayEntity(pokemon)) { DungeonRunFrameActions(0x1a); diff --git a/src/dungeon_8041AD0.c b/src/dungeon_8041AD0.c index f63bcf7e7..b8895e32c 100644 --- a/src/dungeon_8041AD0.c +++ b/src/dungeon_8041AD0.c @@ -212,11 +212,11 @@ static s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5) sub_800569C(&pos, &entity->axObj.axdata, a3); if (pos.x != 99 && pos.y != 99) { pixelPos.x = entity->pixelPos.x + (pos.x << 8); - pixelPos.y = (entity->pixelPos.y + (pos.y << 8)) - entInfo->unk174.raw; + pixelPos.y = (entity->pixelPos.y + (pos.y << 8)) - entInfo->unk174; } else { pixelPos.x = entity->pixelPos.x; - pixelPos.y = entity->pixelPos.y - entInfo->unk174.raw; + pixelPos.y = entity->pixelPos.y - entInfo->unk174; } var = entity->pixelPos.y / 256; @@ -1510,16 +1510,16 @@ static void sub_8042A84(s16 param_1, Entity *entity, u32 param_3) param_1_s16 = param_1; - r6 = IntToF248_2(2).raw; + r6 = IntToF248(2); if (sub_8042768(entity)) { sub_804151C(entity,param_1_s16,0); sub_803E708(param_3,0x42); do { - if (entity->unk1C.raw > IntToF248_2(199.999).raw) break; + if (entity->unk1C > FloatToF248(199.999)) break; DungeonRunFrameActions(0x42); - entity->unk1C.raw += + r6; - r6 += IntToF248_2(1).raw; - iVar3 = (entity->pixelPos.y - entity->unk1C.raw) / 256; + entity->unk1C += + r6; + r6 += IntToF248(1); + iVar3 = (entity->pixelPos.y - entity->unk1C) / 256; } while (-8 <= iVar3 - gDungeon->unk181e8.cameraPixelPos.y); entity->isVisible = 0; sub_804178C(0); diff --git a/src/dungeon_config.c b/src/dungeon_config.c index e8ba20d69..b399b6442 100644 --- a/src/dungeon_config.c +++ b/src/dungeon_config.c @@ -173,16 +173,16 @@ UNUSED static const s16 sUnusedConfig1 = 95; const s16 gGinsengPlus3BoostChance = 12; // Move modifiers -const s24_8 gSolarBeamModifier = IntToF248_2(2.0); -const s24_8 gSkyAttackModifier = IntToF248_2(2.0); -const s24_8 gRazorWindModifier = IntToF248_2(2.0); -const s24_8 gFocusPunchModifier = IntToF248_2(2.0); -const s24_8 gSkullBashModifier = IntToF248_2(2.0); -const s24_8 gFlyModifier = IntToF248_2(2.0); -const s24_8 gBounceModifier = IntToF248_2(2.0); -const s24_8 gDiveModifier = IntToF248_2(2.0); -const s24_8 gDigModifier = IntToF248_2(2.0); -const s24_8 gFacadeModifier = IntToF248_2(2.0); +const s24_8 gSolarBeamModifier = FloatToF248(2.0); +const s24_8 gSkyAttackModifier = FloatToF248(2.0); +const s24_8 gRazorWindModifier = FloatToF248(2.0); +const s24_8 gFocusPunchModifier = FloatToF248(2.0); +const s24_8 gSkullBashModifier = FloatToF248(2.0); +const s24_8 gFlyModifier = FloatToF248(2.0); +const s24_8 gBounceModifier = FloatToF248(2.0); +const s24_8 gDiveModifier = FloatToF248(2.0); +const s24_8 gDigModifier = FloatToF248(2.0); +const s24_8 gFacadeModifier = FloatToF248(2.0); // Fixed damage/heal values const s16 gBurnDmgValue = 5; @@ -275,42 +275,42 @@ UNUSED static const s16 sUnusedConfig3 = 0; // Stat stage multipliers const s24_8 gAtkStatStageMultipliers[21] = { - IntToF248_2(0.2500), IntToF248_2(0.2696), IntToF248_2(0.2892), IntToF248_2(0.3087), IntToF248_2(0.3282), IntToF248_2(0.3478), - IntToF248_2(0.3985), IntToF248_2(0.4493), IntToF248_2(0.5000), IntToF248_2(0.6993), IntToF248_2(1.0000), IntToF248_2(1.2969), - IntToF248_2(1.5000), IntToF248_2(1.5978), IntToF248_2(1.6485), IntToF248_2(1.6993), IntToF248_2(1.7500), IntToF248_2(1.7969), - IntToF248_2(1.8478), IntToF248_2(1.8985), IntToF248_2(2.0000) + FloatToF248(0.2500), FloatToF248(0.2696), FloatToF248(0.2892), FloatToF248(0.3087), FloatToF248(0.3282), FloatToF248(0.3478), + FloatToF248(0.3985), FloatToF248(0.4493), FloatToF248(0.5000), FloatToF248(0.6993), FloatToF248(1.0000), FloatToF248(1.2969), + FloatToF248(1.5000), FloatToF248(1.5978), FloatToF248(1.6485), FloatToF248(1.6993), FloatToF248(1.7500), FloatToF248(1.7969), + FloatToF248(1.8478), FloatToF248(1.8985), FloatToF248(2.0000) }; const s24_8 gDefStatStageMultipliers[21] = { - IntToF248_2(0.2500), IntToF248_2(0.2696), IntToF248_2(0.2892), IntToF248_2(0.3087), IntToF248_2(0.3282), IntToF248_2(0.3478), - IntToF248_2(0.3985), IntToF248_2(0.5469), IntToF248_2(0.6993), IntToF248_2(0.8672), IntToF248_2(1.0000), IntToF248_2(1.2969), - IntToF248_2(1.5000), IntToF248_2(1.5978), IntToF248_2(1.6485), IntToF248_2(1.6993), IntToF248_2(1.7500), IntToF248_2(1.7969), - IntToF248_2(1.8478), IntToF248_2(1.8985), IntToF248_2(2.0000) + FloatToF248(0.2500), FloatToF248(0.2696), FloatToF248(0.2892), FloatToF248(0.3087), FloatToF248(0.3282), FloatToF248(0.3478), + FloatToF248(0.3985), FloatToF248(0.5469), FloatToF248(0.6993), FloatToF248(0.8672), FloatToF248(1.0000), FloatToF248(1.2969), + FloatToF248(1.5000), FloatToF248(1.5978), FloatToF248(1.6485), FloatToF248(1.6993), FloatToF248(1.7500), FloatToF248(1.7969), + FloatToF248(1.8478), FloatToF248(1.8985), FloatToF248(2.0000) }; const s24_8 gAccEvsStatStageMultipliers[2][21] = { // Accuracy { - IntToF248_2(0.3282), IntToF248_2(0.3478), IntToF248_2(0.3672), IntToF248_2(0.3985), IntToF248_2(0.4297), IntToF248_2(0.4493), - IntToF248_2(0.5469), IntToF248_2(0.5977), IntToF248_2(0.6993), IntToF248_2(0.7969), IntToF248_2(1.0000), IntToF248_2(1.2500), - IntToF248_2(1.5000), IntToF248_2(1.5978), IntToF248_2(1.6485), IntToF248_2(1.6993), IntToF248_2(1.7500), IntToF248_2(1.7969), - IntToF248_2(1.8478), IntToF248_2(1.8985), IntToF248_2(2.0000) + FloatToF248(0.3282), FloatToF248(0.3478), FloatToF248(0.3672), FloatToF248(0.3985), FloatToF248(0.4297), FloatToF248(0.4493), + FloatToF248(0.5469), FloatToF248(0.5977), FloatToF248(0.6993), FloatToF248(0.7969), FloatToF248(1.0000), FloatToF248(1.2500), + FloatToF248(1.5000), FloatToF248(1.5978), FloatToF248(1.6485), FloatToF248(1.6993), FloatToF248(1.7500), FloatToF248(1.7969), + FloatToF248(1.8478), FloatToF248(1.8985), FloatToF248(2.0000) }, // Evasion { - IntToF248_2(2.0000), IntToF248_2(1.8985), IntToF248_2(1.8478), IntToF248_2(1.7969), IntToF248_2(1.7500), IntToF248_2(1.6993), - IntToF248_2(1.6485), IntToF248_2(1.5978), IntToF248_2(1.5000), IntToF248_2(1.3515), IntToF248_2(1.0000), IntToF248_2(0.7969), - IntToF248_2(0.6993), IntToF248_2(0.5977), IntToF248_2(0.5000), IntToF248_2(0.3985), IntToF248_2(0.3477), IntToF248_2(0.2969), - IntToF248_2(0.2500), IntToF248_2(0.1993), IntToF248_2(0.1485) + FloatToF248(2.0000), FloatToF248(1.8985), FloatToF248(1.8478), FloatToF248(1.7969), FloatToF248(1.7500), FloatToF248(1.6993), + FloatToF248(1.6485), FloatToF248(1.5978), FloatToF248(1.5000), FloatToF248(1.3515), FloatToF248(1.0000), FloatToF248(0.7969), + FloatToF248(0.6993), FloatToF248(0.5977), FloatToF248(0.5000), FloatToF248(0.3985), FloatToF248(0.3477), FloatToF248(0.2969), + FloatToF248(0.2500), FloatToF248(0.1993), FloatToF248(0.1485) }, }; const s32 gDetectBandAccuracyDebuffValue = 30; // For attacking mon, which effectively raises target's evasion const s32 gIqQuickDodgerAccuracyDebuffValue = 30; // For attacking mon, which effectively raises target's evasion // Move modifiers again -const s24_8 gReversalModifiers[4] = {IntToF248_2(8), IntToF248_2(4), IntToF248_2(2), IntToF248_2(1)}; // Based on hp/max HP ratio -const s24_8 gWaterSpoutModifiers[4] = {IntToF248_2(0.1), IntToF248_2(0.2), IntToF248_2(0.5), IntToF248_2(1)}; // Based on hp/max HP ratio -const s24_8 gEruptionModifiers[4] = {IntToF248_2(0.1), IntToF248_2(0.2), IntToF248_2(0.5), IntToF248_2(1)}; // Based on hp/max HP ratio +const s24_8 gReversalModifiers[4] = {FloatToF248(8), FloatToF248(4), FloatToF248(2), FloatToF248(1)}; // Based on hp/max HP ratio +const s24_8 gWaterSpoutModifiers[4] = {FloatToF248(0.1), FloatToF248(0.2), FloatToF248(0.5), FloatToF248(1)}; // Based on hp/max HP ratio +const s24_8 gEruptionModifiers[4] = {FloatToF248(0.1), FloatToF248(0.2), FloatToF248(0.5), FloatToF248(1)}; // Based on hp/max HP ratio const s32 gStockpileHealHpValues[4] = {0, 20, 40, 80}; // Castform related @@ -327,14 +327,14 @@ const u8 gWeatherBallTypes[WEATHER_COUNT] = }; const s24_8 gWeatherBallModifiers[WEATHER_COUNT] = { - [WEATHER_CLEAR] = IntToF248_2(1.0), - [WEATHER_SUNNY] = IntToF248_2(2.0), - [WEATHER_SANDSTORM] = IntToF248_2(2.0), - [WEATHER_CLOUDY] = IntToF248_2(1.0), - [WEATHER_RAIN] = IntToF248_2(2.0), - [WEATHER_HAIL] = IntToF248_2(2.0), - [WEATHER_FOG] = IntToF248_2(2.0), - [WEATHER_SNOW] = IntToF248_2(2.0), + [WEATHER_CLEAR] = FloatToF248(1.0), + [WEATHER_SUNNY] = FloatToF248(2.0), + [WEATHER_SANDSTORM] = FloatToF248(2.0), + [WEATHER_CLOUDY] = FloatToF248(1.0), + [WEATHER_RAIN] = FloatToF248(2.0), + [WEATHER_HAIL] = FloatToF248(2.0), + [WEATHER_FOG] = FloatToF248(2.0), + [WEATHER_SNOW] = FloatToF248(2.0), }; const struct CastformWeatherData gCastformByWeather[WEATHER_COUNT] = diff --git a/src/dungeon_cutscene.c b/src/dungeon_cutscene.c index 4842acd37..80053dd93 100644 --- a/src/dungeon_cutscene.c +++ b/src/dungeon_cutscene.c @@ -949,7 +949,7 @@ void sub_80856E0(Entity * pokemon, s32 direction) entityInfo->unk174 = F248_Sub(entityInfo->unk174, IntToF248(2)); DungeonRunFrameActions(0x46); } - entityInfo->unk174.raw = 0; // weird one that doesn't match with struct assignment + entityInfo->unk174 = 0; // weird one that doesn't match with struct assignment DungeonRunFrameActions(0x46); } diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index 2777bf5bb..d3c32d778 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -246,7 +246,7 @@ static void sub_8088484(Entity *param_1) PlaySoundEffect(0x1ea); for(iVar1 = 250; iVar1 >= 0; iVar1 -= 5) { - GetEntInfo(param_1)->unk174 = IntToF248_2(iVar1); + GetEntInfo(param_1)->unk174 = IntToF248(iVar1); SetDungeonBGColorRGB(iVar1,iVar1,iVar1 / 2,1,0); DungeonRunFrameActions(0x46); } diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index ae939d673..19dd0211b 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -194,11 +194,11 @@ static void sub_808C8E0(Entity *entity) PlaySoundEffect(0x1a5); sub_806CDD4(entity, 0, DIRECTION_SOUTH); for(iVar1 = 0; iVar1 < 16; iVar1++){ - GetEntInfo(entity)->unk174 = IntToF248_2(iVar1); + GetEntInfo(entity)->unk174 = IntToF248(iVar1); DungeonRunFrameActions(0x46); } for(iVar1 = 16; iVar1 < 200; iVar1 += 4){ - GetEntInfo(entity)->unk174 = IntToF248_2(iVar1); + GetEntInfo(entity)->unk174 = IntToF248(iVar1); DungeonRunFrameActions(0x46); } sub_8086A3C(entity); diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index 48319bdde..8632fb51e 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -174,16 +174,16 @@ static void HoOhDropInEffect(Entity * param_1) iVar1 = IntToF248(12); PlaySoundEffect(0x1f8); while( 1 ) { - iVar2.raw -= iVar1.raw; + iVar2 -= iVar1; iVar1 = F248_Sub(iVar1, FloatToF248(0.375)); if (F248LessThanFloat(iVar1, 0.08)) { - iVar1 = FloatToF248_2(0.08); + iVar1 = FloatToF248(0.08); } if (F248LessThanInt(iVar2, 0)) break; GetEntInfo(param_1)->unk174 = iVar2; DungeonRunFrameActions(70); } - GetEntInfo(param_1)->unk174 = IntToF248_2(0); + GetEntInfo(param_1)->unk174 = IntToF248(0); } static void HoOhScreenFlash(void) diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index 98193a369..92c3c2ff5 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -425,15 +425,15 @@ static void JirachiDropInEffect(Entity *jirachiEntity) iVar2 = IntToF248(2); PlaySoundEffect(0x1f8); while (1) { - iVar1.raw = iVar1.raw - iVar2.raw; // FRAGILE! Subtraction and assignment below must use .raw + iVar1 = iVar1 - iVar2; // FRAGILE! Subtraction and assignment below must use if (F248LessThanInt(iVar1, 24)) { - iVar2.raw = IntToF248_2(1).raw; + iVar2 = IntToF248(1); } if (F248LessThanInt(iVar1, 0)) break; GetEntInfo(jirachiEntity)->unk174 = iVar1; DungeonRunFrameActions(0x46); } - GetEntInfo(jirachiEntity)->unk174 = IntToF248_2(0); + GetEntInfo(jirachiEntity)->unk174 = IntToF248(0); } static void JirachiSpinEffect(Entity * jirachiEntity) diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index df90972ac..fff89cdd8 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -144,20 +144,20 @@ static void MewtwoDropInEffect(Entity *mewtwoEntity) s24_8 iVar2; GetEntInfo(mewtwoEntity)->unk15E = 0; - iVar2 = IntToF248_2(200); - iVar1 = IntToF248_2(4); + iVar2 = IntToF248(200); + iVar1 = IntToF248(4); PlaySoundEffect(0x1f8); while( 1 ) { - iVar2.raw -= iVar1.raw; - iVar1 = F248_Sub(iVar1, FloatToF248_2(0.045)); + iVar2 -= iVar1; + iVar1 = F248_Sub(iVar1, FloatToF248(0.045)); if (F248LessThanFloat(iVar1, 0.12)) { - iVar1 = FloatToF248_2(0.12); + iVar1 = FloatToF248(0.12); } if (F248LessThanInt(iVar2, 0)) break; GetEntInfo(mewtwoEntity)->unk174 = iVar2; DungeonRunFrameActions(0x46); } - GetEntInfo(mewtwoEntity)->unk174 = IntToF248_2(0); + GetEntInfo(mewtwoEntity)->unk174 = IntToF248(0); } static void MewtwoScreenFlash(void) diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index d1064d6e6..c1f82da5a 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -250,11 +250,11 @@ static void MoltresDropInEffect(Entity * moltresEntity) GetEntInfo(moltresEntity)->unk15C = 1; GetEntInfo(moltresEntity)->unk15E = 0; - GetEntInfo(moltresEntity)->unk174 = IntToF248_2(200); + GetEntInfo(moltresEntity)->unk174 = IntToF248(200); PlaySoundEffect(0x1f8); for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5) { - GetEntInfo(moltresEntity)->unk174 = IntToF248_2(iVar1); + GetEntInfo(moltresEntity)->unk174 = IntToF248(iVar1); DungeonRunFrameActions(0x46); } } diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index 17717c4a6..71f47ef39 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -181,12 +181,12 @@ static void RayquazaDropInEffect(Entity *rayquazaEntity) s24_8 iVar2; GetEntInfo(rayquazaEntity)->unk15E = 0; - iVar2 = IntToF248_2(200); - iVar1 = IntToF248_2(6); + iVar2 = IntToF248(200); + iVar1 = IntToF248(6); PlaySoundEffect(0x1f8); while( 1 ) { - iVar2.raw = iVar2.raw - iVar1.raw; // must be .raw - iVar1 = F248_Sub(iVar1, FloatToF248_2(3./32.)); + iVar2 = iVar2 - iVar1; // must be + iVar1 = F248_Sub(iVar1, FloatToF248(3./32.)); if (F248LessThanFloat(iVar1, 0.08)) { iVar1 = FloatToF248(0.08); } @@ -194,7 +194,7 @@ static void RayquazaDropInEffect(Entity *rayquazaEntity) GetEntInfo(rayquazaEntity)->unk174 = iVar2; DungeonRunFrameActions(0x46); } - GetEntInfo(rayquazaEntity)->unk174 = IntToF248_2(0); + GetEntInfo(rayquazaEntity)->unk174 = IntToF248(0); } static void RayquazaScreenFlash(void) diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index 412128ace..0363853e6 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -171,16 +171,16 @@ static void sub_808A528(Entity * param_1) iVar1 = IntToF248(12); PlaySoundEffect(0x1f8); while( 1 ) { - iVar2.raw -= iVar1.raw; + iVar2 -= iVar1; iVar1 = F248_Sub(iVar1, FloatToF248(0.375)); if (F248LessThanFloat(iVar1, 0.08)) { - iVar1 = FloatToF248_2(0.08); + iVar1 = FloatToF248(0.08); } if (F248LessThanInt(iVar2, 0)) break; GetEntInfo(param_1)->unk174 = iVar2; DungeonRunFrameActions(70); } - GetEntInfo(param_1)->unk174 = IntToF248_2(0); + GetEntInfo(param_1)->unk174 = IntToF248(0); } static void SuicuneScreenFlash(void) diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index d37942aa8..bd587214b 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -238,11 +238,11 @@ static void ZapdosDropInEffect(Entity *zapdosEntity) GetEntInfo(zapdosEntity)->unk15C = 1; GetEntInfo(zapdosEntity)->unk15E = 0; - GetEntInfo(zapdosEntity)->unk174.raw = 200; // incorrect value? Overwritten immediately anyway + GetEntInfo(zapdosEntity)->unk174 = 200; // incorrect value? Overwritten immediately anyway PlaySoundEffect(0x1ea); for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5) { - GetEntInfo(zapdosEntity)->unk174 = IntToF248_2(iVar1); + GetEntInfo(zapdosEntity)->unk174 = IntToF248(iVar1); DungeonRunFrameActions(0x46); } sub_803E708(0x1e,0x46); diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index fce5a4c0a..69b59f756 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -375,7 +375,7 @@ static void sub_80482FC(Entity *pokemon, Entity *target, u32 pp, u8 param_4) InitPokemonMove(&move, MOVE_PROJECTILE); move.PP = pp; - HandleDamagingMove(pokemon, target, &move, IntToF248_2(1.0), param_4); + HandleDamagingMove(pokemon, target, &move, IntToF248(1), param_4); } static void sub_8048340(Entity *pokemon, Entity *target, u32 r2) diff --git a/src/dungeon_items.c b/src/dungeon_items.c index ce4094bba..9725e1929 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -388,7 +388,7 @@ bool8 sub_80462AC(Entity * entity, u8 hallucinating, u8 a2, u8 a3, u8 a4) } x = (entity->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x; - y = ((entity->pixelPos.y - entity->unk1C.raw) / 256) - gDungeon->unk181e8.cameraPixelPos.y; + y = ((entity->pixelPos.y - entity->unk1C) / 256) - gDungeon->unk181e8.cameraPixelPos.y; y2 = ((entity->pixelPos.y / 256) - gDungeon->unk181e8.cameraPixelPos.y) + 8; y2 /= 2; @@ -549,7 +549,7 @@ static void sub_8046734(Entity *entity, DungeonPos *pos) for (i = 0; i < 24; i++) { calcPixelPos.x += add.x; calcPixelPos.y += add.y; - entity->unk1C.raw = sin_4096(sinVal) * 12; + entity->unk1C = sin_4096(sinVal) * 12; UpdateEntityPixelPos(entity, &calcPixelPos); sub_80462AC(entity, hallucinating, 0, unk, 0); DungeonRunFrameActions(0x13); @@ -562,7 +562,7 @@ static void sub_8046734(Entity *entity, DungeonPos *pos) } SetEntityPixelPos(entity, posPixel.x, posPixel.y); - entity->unk1C.raw = 0; + entity->unk1C = 0; sub_80462AC(entity, hallucinating, 1, 0xFF, 0); DungeonRunFrameActions(0x13); } @@ -669,7 +669,7 @@ void sub_804687C(Entity *entity, DungeonPos *pos1, DungeonPos *pos2, Item *item, for (i = 0; i < count; i++) { if (EntityIsValid(&itemEntities[i])) { IncreaseEntityPixelPos(&itemEntities[i], itemVelocity[i].x, itemVelocity[i].y); - itemEntities[i].unk1C.raw = sin_4096(sinVal) * 12; + itemEntities[i].unk1C = sin_4096(sinVal) * 12; sub_80462AC(&itemEntities[i], hallucinating, 1, dirMaybe, 0); } } diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 0645fdc78..7eeaef094 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -881,9 +881,9 @@ void SetMonSummaryInfoFromEntity(struct MonSummaryInfo *param_1, Entity *target) param_1->unk58[uVar15] = 40; uVar15++; } - if ((((((info->offensiveMultipliers[0].raw < 0x100) || (info->offensiveMultipliers[1].raw < 0x100) - ) || (info->defensiveMultipliers[0].raw < 0x100)) || - ((info->defensiveMultipliers[1].raw < 0x100 || (info->offensiveStages[0] < 10)))) || + if ((((((info->offensiveMultipliers[0] < 0x100) || (info->offensiveMultipliers[1] < 0x100) + ) || (info->defensiveMultipliers[0] < 0x100)) || + ((info->defensiveMultipliers[1] < 0x100 || (info->offensiveStages[0] < 10)))) || ((info->offensiveStages[1] < 10 || ((info->defensiveStages[0] < 10 || (info->defensiveStages[1] < 10)))))) || ((info->hitChanceStages[0] < 10 || (info->hitChanceStages[1] < 10)))) { diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index 113bc0baf..8ff960de4 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -674,7 +674,7 @@ void UpdateEntitySpecies(Entity *entity, s32 _species) entity->axObj.unk43_animId2 = 0xFF; entity->axObj.unk45_orientation = 1; entity->axObj.unk47 = 1; - entity->unk1C = IntToF248_2(0); + entity->unk1C = IntToF248(0); if (entInfo->frozenClassStatus.status == STATUS_WRAP || entInfo->frozenClassStatus.status == STATUS_WRAPPED) { sub_8076CB4(entInfo->unk9C); @@ -765,7 +765,7 @@ static void InitEntityFromSpawnInfo(bool8 a0, Entity *entity, struct MonSpawnInf entInfo->aiTarget.unkC = 0; entInfo->aiTarget.aiTargetSpawnGenID = 0; entInfo->unkFF = 0; - entInfo->unk174.raw = 0; + entInfo->unk174 = 0; entInfo->decoyAITracker = 0; ResetMonEntityData(entInfo, TRUE); ZeroOutItem(&entInfo->heldItem); @@ -877,8 +877,8 @@ void ResetMonEntityData(EntityInfo *entInfo, bool8 setStatsToOne) entInfo->offensiveStages[i] = 10; entInfo->defensiveStages[i] = 10; entInfo->hitChanceStages[i] = 10; - entInfo->offensiveMultipliers[i].raw = IntToF248_2(1).raw; - entInfo->defensiveMultipliers[i].raw = IntToF248_2(1).raw; + entInfo->offensiveMultipliers[i] = IntToF248(1); + entInfo->defensiveMultipliers[i] = IntToF248(1); } if (hasForecast) { diff --git a/src/dungeon_mon_sprite_render.c b/src/dungeon_mon_sprite_render.c index 9a182e0e3..d3433a745 100644 --- a/src/dungeon_mon_sprite_render.c +++ b/src/dungeon_mon_sprite_render.c @@ -185,7 +185,7 @@ void UpdateMonsterSprite(Entity *entity) entity->prevPixelPos.y = entity->pixelPos.y; x = (entity->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x; - y = (((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256) - gDungeon->unk181e8.cameraPixelPos.y; + y = (((entity->pixelPos.y - entity->unk1C) - entInfo->unk174) / 256) - gDungeon->unk181e8.cameraPixelPos.y; y2 = (entity->pixelPos.y / 256) - gDungeon->unk181e8.cameraPixelPos.y; y2 /= 2; if (entInfo->unk156 == 0) { @@ -208,7 +208,7 @@ void UpdateMonsterSprite(Entity *entity) } pos1.x = entity->pixelPos.x / 256; - pos1.y = ((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256; + pos1.y = ((entity->pixelPos.y - entity->unk1C) - entInfo->unk174) / 256; sub_8005700(posArray, &entity->axObj.axdata); UpdateDungeonPokemonSprite2(entInfo->dungeonSpriteId, &pos1, posArray, gDungeon->unk181e8.priority); @@ -219,17 +219,17 @@ void UpdateMonsterSprite(Entity *entity) sub_8042EC8(entity, y2); if (entInfo->unk15C == 0) { if (entInfo->unkFF == 1) { - if (entInfo->unk174.raw <= IntToF248_2(199.999).raw) { - entInfo->unk174.raw += IntToF248_2(8).raw; - if (entInfo->unk174.raw > IntToF248_2(200).raw) { - entInfo->unk174.raw = IntToF248_2(200).raw; + if (entInfo->unk174 <= FloatToF248(199.999)) { + entInfo->unk174 += IntToF248(8); + if (entInfo->unk174 > IntToF248(200)) { + entInfo->unk174 = IntToF248(200); } } } else { - entInfo->unk174.raw -= IntToF248_2(12).raw; - if (entInfo->unk174.raw < IntToF248_2(0).raw) { - entInfo->unk174.raw = IntToF248_2(0).raw; + entInfo->unk174 -= IntToF248(12); + if (entInfo->unk174 < IntToF248(0)) { + entInfo->unk174 = IntToF248(0); } } } diff --git a/src/dungeon_monster_house.c b/src/dungeon_monster_house.c index c9958bc75..17ed9be3d 100644 --- a/src/dungeon_monster_house.c +++ b/src/dungeon_monster_house.c @@ -164,15 +164,15 @@ void TriggerMonsterHouse(Entity *entity, bool8 forcedMonsterHouse) if (sub_806AA0C(spawnStruct.species, 1)) { Entity *newMonster = SpawnWildMon(&spawnStruct, FALSE); if (EntityIsValid(newMonster)) { - newMonster->unk1C = IntToF248_2(200); + newMonster->unk1C = IntToF248(200); for (j = 0; j < 100; j++) { - newMonster->unk1C = s24_8_mul(newMonster->unk1C, IntToF248_2(0.665)); - if (newMonster->unk1C.raw < IntToF248_2(1).raw) { + newMonster->unk1C = s24_8_mul(newMonster->unk1C, FloatToF248(0.665)); + if (newMonster->unk1C < IntToF248(1)) { break; } DungeonRunFrameActions(0x57); } - newMonster->unk1C = IntToF248_2(0); + newMonster->unk1C = IntToF248(0); } } } diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 9b7e5f0d0..2f259a95b 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -389,13 +389,13 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, case MOVE_WIDE_SLASH: case MOVE_SPIN_SLASH: case MOVE_BLOOP_SLASH: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(1), itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248(1), itemId) != 0); break; case MOVE_REGULAR_ATTACK: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(0.5), itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, FloatToF248(0.5), itemId) != 0); break; case MOVE_NOTHING: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(0), itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248(0), itemId) != 0); break; case MOVE_EARTHQUAKE: moveHadEffect = EarthquakeMoveAction(attacker, currTarget, move, itemId); @@ -437,7 +437,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, case MOVE_CROSS_CHOP: case MOVE_RAZOR_LEAF: case MOVE_LEAF_BLADE: - moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248_2(1), itemId) != 0); + moveHadEffect = (HandleDamagingMove(attacker, currTarget, move, IntToF248(1), itemId) != 0); break; case MOVE_FISSURE: moveHadEffect = FissureMoveAction(attacker, currTarget, move, itemId); @@ -1328,7 +1328,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, bool8 HandleRegularDamagingMove(Entity *attacker, Entity *target, Move *move, s32 itemId) { - return (HandleDamagingMove(attacker, target, move, IntToF248_2(1), itemId) != 0); + return (HandleDamagingMove(attacker, target, move, IntToF248(1), itemId) != 0); } s32 HandleDamagingMove(Entity *attacker, Entity *target, Move *move, s24_8 modifier, s32 itemId) diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 9f342f2de..ddca6fd44 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -784,10 +784,10 @@ bool8 AccuracyCalc(Entity *attacker, Entity *target, Move *move, s32 accuracyTyp if (statStageAccuracy > 20) statStageAccuracy = 20; statStageMul = gAccEvsStatStageMultipliers[0][statStageAccuracy]; - if (statStageMul.raw < 0) statStageMul.raw = 0; - if (statStageMul.raw > IntToF248_2(100).raw) statStageMul = IntToF248_2(100); + if (statStageMul < 0) statStageMul = 0; + if (statStageMul > IntToF248(100)) statStageMul = IntToF248(100); - accuracy *= statStageMul.raw; + accuracy *= statStageMul; accuracy /= 256; statStageEvasion = targetInfo->hitChanceStages[1]; @@ -808,10 +808,10 @@ bool8 AccuracyCalc(Entity *attacker, Entity *target, Move *move, s32 accuracyTyp if (statStageEvasion > 20) statStageEvasion = 20; statStageMul = gAccEvsStatStageMultipliers[1][statStageEvasion]; - if (statStageMul.raw < 0) statStageMul.raw = 0; - if (statStageMul.raw > IntToF248_2(100).raw) statStageMul = IntToF248_2(100); + if (statStageMul < 0) statStageMul = 0; + if (statStageMul > IntToF248(100)) statStageMul = IntToF248(100); - accuracy *= statStageMul.raw; + accuracy *= statStageMul; accuracy /= 256; if (rand < accuracy) return TRUE; diff --git a/src/dungeon_projectile_throw.c b/src/dungeon_projectile_throw.c index c39a2acb4..bcee44498 100644 --- a/src/dungeon_projectile_throw.c +++ b/src/dungeon_projectile_throw.c @@ -50,7 +50,7 @@ void HandleStraightProjectileThrow(Entity *thrower, Item *item, DungeonPos *pos, projectile->isVisible = TRUE; projectile->unk22 = 0; projectile->axObj.info.item = item; - projectile->unk1C.raw = 0; + projectile->unk1C = 0; projectile->pos = *pos; SetEntityPixelPos(projectile, (pos->x * 24 + 4) << 8, (pos->y * 24 + 0) << 8); @@ -241,7 +241,7 @@ void HandleCurvedProjectileThrow(Entity *thrower, Item *item, DungeonPos *startP projectile->isVisible = TRUE; projectile->unk22 = 0; projectile->axObj.info.item = item; - projectile->unk1C.raw = 0; + projectile->unk1C = 0; projectile->pos = *startPos; SetEntityPixelPos(projectile, (startPos->x * 24 + 4) << 8, (startPos->y * 24 + 4) << 8); @@ -305,7 +305,7 @@ void HandleCurvedProjectileThrow(Entity *thrower, Item *item, DungeonPos *startP displayX = posXFixed + 0x400; displayY = posYFixed + 0x400; - projectile->unk1C.raw = sinVal; + projectile->unk1C = sinVal; unkX = (posXFixed / 256) + 8; unkY = (posYFixed / 256) + 16; sinePhase += sinePhaseStep; diff --git a/src/ground_link.c b/src/ground_link.c index 6c9667914..6419cd6dc 100644 --- a/src/ground_link.c +++ b/src/ground_link.c @@ -49,7 +49,7 @@ s32 GroundLink_GetArea(s32 _arg0, PixelPos *arg1, PixelPos *arg2, PixelPos *arg3 SetUnkInGroundEvent(&ptr->pos, arg1); - arg2->x = arg1->x + IntToF248(ptr->width * 8).raw; - arg2->y = arg1->y + IntToF248(ptr->height * 8).raw; + arg2->x = arg1->x + IntToF248(ptr->width * 8); + arg2->y = arg1->y + IntToF248(ptr->height * 8); return ptr->ret; } diff --git a/src/ground_script.c b/src/ground_script.c index 2ef43f74f..52bfb25b9 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -2172,7 +2172,7 @@ static s32 ExecuteScriptCommand(Action *action) break; } case 0x71: case 0x77: case 0x7d: case 0x83: { -#define HYPOT FP24_8_Hypot((s24_8){scriptData->pos2.x - scriptData->pos1.x}, (s24_8){scriptData->pos2.y - scriptData->pos1.y}).raw / curCmd.argShort +#define HYPOT FP24_8_Hypot((s24_8){scriptData->pos2.x - scriptData->pos1.x}, (s24_8){scriptData->pos2.y - scriptData->pos1.y}) / curCmd.argShort action->callbacks->getHitboxCenter(action->parentObject, &scriptData->pos1); scriptData->pos2.x = curCmd.arg1 << 8; scriptData->pos2.y = curCmd.arg2 << 8; diff --git a/src/hurl_orb.c b/src/hurl_orb.c index 7447ce24f..2519d2c89 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -168,7 +168,7 @@ void HandleHurlOrb(Entity *target, Entity *attacker) var_54.y += r10; UpdateEntityPixelPos(attacker, &var_54); if (ShouldDisplayEntity(attacker)) { - attacker->unk1C.raw = sin_4096(var_2C) << 5; + attacker->unk1C = sin_4096(var_2C) << 5; DungeonRunFrameActions(0x3B); if (!(i & 3)) { attackerDirection &= DIRECTION_MASK; @@ -181,7 +181,7 @@ void HandleHurlOrb(Entity *target, Entity *attacker) var_54.x = pixelPosX; var_54.y = pixelPosY; - attacker->unk1C.raw = 0; + attacker->unk1C = 0; UpdateEntityPixelPos(attacker, &var_54); DungeonRunFrameActions(0x3B); GetEntInfo(attacker)->action.direction = attackerDirection & DIRECTION_MASK; diff --git a/src/math.c b/src/math.c index ac9579759..3157b3dce 100644 --- a/src/math.c +++ b/src/math.c @@ -92,25 +92,25 @@ s24_8 s24_8_mul(s24_8 x, s24_8 y) bool8 sgn0; bool8 sgn1; - sgn0 = x.raw < 0; - sgn1 = y.raw < 0; + sgn0 = x < 0; + sgn1 = y < 0; - if (x.raw == 0) + if (x == 0) return (s24_8){0}; - if (y.raw == 0) + if (y == 0) return (s24_8){0}; if (sgn0) - x.raw = -x.raw; + x = -x; if (sgn1) - y.raw = -y.raw; + y = -y; ret = u24_8_mul(x, y); if (sgn0 != sgn1) - ret.raw = -ret.raw; + ret = -ret; return ret; } @@ -129,25 +129,25 @@ static s24_8 s24_8_div(s24_8 x, s24_8 y) bool8 sgn0; bool8 sgn1; - sgn0 = x.raw < 0; - sgn1 = y.raw < 0; + sgn0 = x < 0; + sgn1 = y < 0; - if (y.raw == 0) + if (y == 0) return (s24_8){INT32_MAX}; - if (x.raw == 0) + if (x == 0) return (s24_8){0}; if (sgn0) - x.raw = -x.raw; + x = -x; if (sgn1) - y.raw = -y.raw; + y = -y; ret = u24_8_div(x, y); if (sgn0 != sgn1) - ret.raw = -ret.raw; + ret = -ret; return ret; } @@ -171,13 +171,13 @@ static s24_8 u24_8_mul(s24_8 x, s24_8 y) u32 high_bit_mask; u32 round_up; - if (x.raw == 0 || y.raw == 0) + if (x == 0 || y == 0) return F248_ZERO; x_h = 0; - x_l = x.raw; + x_l = x; y_h = 0; - y_l = y.raw; + y_l = y; out_h = 0; out_l = 0; high_bit_mask = 0x80 << 24; // high bit of u32 @@ -240,15 +240,15 @@ static s24_8 u24_8_div(s24_8 x, s24_8 y) s32 sl; s32 temp; - if (y.raw == 0) + if (y == 0) return F248_MAX; - if (x.raw == 0) + if (x == 0) return F248_ZERO; - r7 = (u32)x.raw >> 24; - r6 = x.raw << 8; - sl = y.raw; + r7 = (u32)x >> 24; + r6 = x << 8; + sl = y; r9 = 0; r5 = 0; r4 = 0; @@ -323,19 +323,19 @@ s24_8 FP24_8_Hypot(s24_8 x, s24_8 y) r5 = x; r6 = y; - if (r5.raw < 0) - r5.raw = -r5.raw; + if (r5 < 0) + r5 = -r5; - if (r6.raw < 0) - r6.raw = -r6.raw; + if (r6 < 0) + r6 = -r6; - if (r5.raw < r6.raw) { + if (r5 < r6) { r4 = r5; r5 = r6; r6 = r4; } - if (r6.raw != 0) { + if (r6 != 0) { for (i = 2; i >= 0; i--) { r4 = s24_8_div(r6, r5); r4 = s24_8_mul(r4, r4); @@ -386,8 +386,8 @@ UNUSED s24_8 FP48_16_ToF248(s48_16 *a) void FP48_16_FromF248(s48_16 *a, s24_8 b) { - a->lo = b.raw << 8; - a->hi = b.raw >> 24; + a->lo = b << 8; + a->hi = b >> 24; if (a->hi & 0x80) a->hi |= ~0x7F; diff --git a/src/move_checks.c b/src/move_checks.c index ec9d1659c..35f78c48e 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -662,8 +662,8 @@ bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move) if (userData->offensiveStages[i] < targetData->offensiveStages[i]) break; if (userData->defensiveStages[i] < targetData->defensiveStages[i] || userData->hitChanceStages[i] < targetData->hitChanceStages[i] || - userData->offensiveMultipliers[i].raw < targetData->offensiveMultipliers[i].raw || - userData->defensiveMultipliers[i].raw < targetData->defensiveMultipliers[i].raw) + userData->offensiveMultipliers[i] < targetData->offensiveMultipliers[i] || + userData->defensiveMultipliers[i] < targetData->defensiveMultipliers[i]) { break; } diff --git a/src/move_orb_actions_1.c b/src/move_orb_actions_1.c index 20e0e530e..361276bec 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -46,7 +46,7 @@ bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon, target, gIronTailSecondaryChance)) { LowerDefensiveStat(pokemon, target, gStatIndexAtkDef, 1, 1, FALSE); @@ -56,7 +56,7 @@ bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId } static const s24_8 sRolloutModifiers[] = { - IntToF248_2(1.0), IntToF248_2(1.0), IntToF248_2(1.5), IntToF248_2(2.0), IntToF248_2(2.5), IntToF248_2(3.0), IntToF248_2(3.5), IntToF248_2(4.0), IntToF248_2(4.5), IntToF248_2(5.0) + FloatToF248(1.0), FloatToF248(1.0), FloatToF248(1.5), FloatToF248(2.0), FloatToF248(2.5), FloatToF248(3.0), FloatToF248(3.5), FloatToF248(4.0), FloatToF248(4.5), FloatToF248(5.0) }; bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 itemId) @@ -170,7 +170,7 @@ bool8 BubbleMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target, gBubbleSecondaryChance)) { LowerMovementSpeedTarget(pokemon, target, 1, FALSE); @@ -310,7 +310,7 @@ bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 itemId) flag = FALSE; if (IsSleeping(pokemon)) { - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gSnoreSecondaryChance)) { CringeStatusTarget(pokemon,target,FALSE); @@ -334,7 +334,7 @@ bool8 RockSlideMoveAction(Entity *pokemon, Entity *target, Move * move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gRockSlideSecondaryChance)) { CringeStatusTarget(pokemon,target,FALSE); @@ -357,9 +357,9 @@ bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 it flag = FALSE; chargeStatus = GetEntInfo(target)->bideClassStatus.status; - modifier = IntToF248_2(1); + modifier = IntToF248(1); if (chargeStatus == STATUS_DIVING) { - modifier = IntToF248_2(2); + modifier = IntToF248(2); } if (HandleDamagingMove(pokemon,target,move,modifier,itemId) != 0) { flag = TRUE; @@ -428,7 +428,7 @@ bool8 OverheatMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId flag = FALSE; entityInfo = GetEntInfo(pokemon); SendThawedMessage(pokemon,target); - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0)) { entityInfo->unk155 = 1; @@ -442,7 +442,7 @@ bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gAuroraBeamAtkLowerChance)) { @@ -469,7 +469,7 @@ bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemI bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gOctazookaAccLowerChance)) { @@ -559,7 +559,7 @@ bool8 FlameWheelMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item flag = FALSE; SendThawedMessage(pokemon, target); - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gFlameWheelSecondaryChance)) { @@ -576,7 +576,7 @@ bool8 BasicFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemI flag = FALSE; SendThawedMessage(pokemon, target); - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gFireMoveBurnSecondaryChance)) { @@ -610,7 +610,7 @@ bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) targetInfo = GetEntInfo(target); if(targetInfo->bideClassStatus.status == STATUS_FLYING || targetInfo->bideClassStatus.status == STATUS_BOUNCING) modifierInt = 2; - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),itemId) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248(modifierInt),itemId) ? TRUE : FALSE; return flag; } @@ -676,7 +676,7 @@ bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gShadowBallSecondaryChance)) { @@ -691,7 +691,7 @@ bool8 BiteMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gBiteSecondaryChance)) { @@ -706,7 +706,7 @@ bool8 ThunderMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gThunderSecondaryChance)) { @@ -742,7 +742,7 @@ bool8 FacadeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; s24_8 modifier; - modifier = IntToF248_2(1); + modifier = IntToF248(1); if((GetEntInfo(pokemon)->burnClassStatus.status) != STATUS_NONE) modifier = gFacadeModifier; flag = HandleDamagingMove(pokemon,target,move,modifier,itemId) ? TRUE : FALSE; @@ -754,7 +754,7 @@ bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gConstrictBubblebeamSecondaryChance)) { @@ -775,7 +775,7 @@ bool8 BrickBreakMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item flag = TRUE; } - flag |= (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0); + flag |= (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0); return flag; } @@ -784,7 +784,7 @@ bool8 RockTombMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -818,7 +818,7 @@ bool8 GigaDrainMoveAction(Entity * pokemon, Entity * target, Move * move, s32 it EntityInfo *entityInfo; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); - uVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); + uVar3 = HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId); flag = uVar3 != 0 ? TRUE : FALSE; if (flag && RollSecondaryEffect(pokemon, 0)) { newHP = uVar3 / 2; @@ -866,11 +866,11 @@ bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, s32 bool8 flag; if (GetEntInfo(target)->burnClassStatus.status == STATUS_PARALYSIS) { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),itemId) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248(2),itemId) ? TRUE : FALSE; EndBurnClassStatus(pokemon, target); } else { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) ? TRUE : FALSE; } return flag; } @@ -903,7 +903,7 @@ bool8 HazeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 OutrageMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -920,7 +920,7 @@ bool8 LowKickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; EntityInfo *entityInfo = GetEntInfo(target); - weight.raw = GetWeight(entityInfo->apparentID); + weight = GetWeight(entityInfo->apparentID); flag = HandleDamagingMove(pokemon, target, move, weight, itemId) != 0 ? TRUE: FALSE; return flag; } @@ -929,7 +929,7 @@ bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 it { bool8 flag = FALSE; EntityInfo *entityInfo; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, gAncientPowerSecondaryChance)) @@ -961,7 +961,7 @@ bool8 AgilityMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index e4412e8a2..c12671f94 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -68,7 +68,7 @@ bool8 BasicIceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gIceMoveFreezeSecondaryChance)) { @@ -84,7 +84,7 @@ bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item EntityInfo *entityInfo; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, pokemon, gMeteorMashSecondaryChance)) { @@ -113,7 +113,7 @@ bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gMovesConfusionSecondaryChance)) { @@ -145,7 +145,7 @@ bool8 DamageLowerDefMoveAction(Entity *pokemon, Entity *target, Move *move, stru bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_5) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),param_5) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gPsychicSecondaryChance)) { @@ -158,7 +158,7 @@ bool8 DamageLowerDefMoveAction(Entity *pokemon, Entity *target, Move *move, stru bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) { bool8 flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) + if(HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) @@ -229,7 +229,7 @@ bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if ((HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) && (EntityIsValid(pokemon))) { + if ((HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) && (EntityIsValid(pokemon))) { iVar2 = GetEntInfo(pokemon)->maxHPStat; if (iVar2 < 0) { iVar2 = iVar2 + 7; @@ -265,7 +265,7 @@ bool8 EarthquakeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item modifierInt = 2; } - return (HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),itemId) != 0); + return (HandleDamagingMove(pokemon,target,move,IntToF248(modifierInt),itemId) != 0); } bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) @@ -291,7 +291,7 @@ bool8 LickMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gLickSecondaryChance)) { @@ -324,7 +324,7 @@ bool8 ThunderboltMoveAction(Entity *pokemon, Entity *target, Move *move, s32 ite bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gThunderboltSecondaryChance)) { @@ -369,7 +369,7 @@ bool8 ExtrasensoryMoveAction(Entity *pokemon, Entity *target, Move *move, s32 it bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gExtrasensorySecondaryChance)) { @@ -394,7 +394,7 @@ bool8 AbsorbMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) flag = FALSE; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); - iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); + iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId); if (iVar3 != 0) { iVar4 = iVar3 / 2; if (iVar4 < 1) { @@ -492,7 +492,7 @@ bool8 HeadbuttMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gHeadbuttSecondaryChance)) { @@ -508,7 +508,7 @@ bool8 DoubleEdgeMoveAction(Entity * pokemon,Entity * target,Move * move,s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if ((!AbilityIsActive(pokemon, ABILITY_ROCK_HEAD)) && (RollSecondaryEffect(pokemon,0) != 0)) { HP = GetEntInfo(pokemon)->maxHPStat; @@ -546,7 +546,7 @@ bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gSmogSecondaryChance)) { @@ -567,7 +567,7 @@ bool8 SacredFireMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gSacredFireSecondaryChance)) { @@ -605,7 +605,7 @@ bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemI modifier = gSolarBeamModifier; if (((weather == WEATHER_SANDSTORM) || (weather == WEATHER_RAIN)) || weather == WEATHER_HAIL) { - modifier.raw /= 2; + modifier /= 2; } weather = HandleDamagingMove(pokemon,target,move,modifier,itemId) != 0 ? TRUE : FALSE; sub_8079764(pokemon); @@ -673,7 +673,7 @@ bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gMuddyWaterAccLowerChance)) { @@ -698,7 +698,7 @@ bool8 TwisterMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId) if (entInfo->bideClassStatus.status == STATUS_FLYING || entInfo->bideClassStatus.status == STATUS_BOUNCING) { modifierInt = 2; } - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(modifierInt),itemId) != 0) + if (HandleDamagingMove(pokemon,target,move,IntToF248(modifierInt),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon,target,gTwisterSecondaryChance) != 0) { @@ -713,7 +713,7 @@ bool8 TwineedleMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemI bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; gUnknown_202F218 = 1; } @@ -876,7 +876,7 @@ bool8 ThundershockMoveAction(Entity *pokemon, Entity *target, Move *move, s32 it bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gThundershockSecondaryChance)) { @@ -897,7 +897,7 @@ bool8 ZapCannonMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemI bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -930,7 +930,7 @@ bool8 PoisonFangMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gPoisonFangSecondaryChance)) { diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index 4335ef9e0..63039abcf 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -56,7 +56,7 @@ bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 ite bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gPoisonStingSecondaryChance)) { @@ -77,13 +77,13 @@ bool8 JumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 itemId flag = FALSE; if (param_5 == 0) { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0 ? TRUE : FALSE; } if (!flag) { moveType = GetMoveTypeForMonster(pokemon,move); movePower = GetMovePower(pokemon,move); moveCritChance = GetMoveCritChance(move); - CalcDamage(pokemon,target,moveType,movePower,moveCritChance,&dmgStruct, IntToF248_2(1),move->id,0); + CalcDamage(pokemon,target,moveType,movePower,moveCritChance,&dmgStruct, IntToF248(1),move->id,0); SetMessageArgument_2(gFormatBuffer_Monsters[0],GetEntInfo(pokemon),0); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC7C8); dmgStruct.dmg /= 2; @@ -127,13 +127,13 @@ bool8 HiJumpKickMoveAction(Entity * pokemon,Entity * target,Move * move,s32 item flag = FALSE; if (param_5 == 0) { - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),itemId) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248(2),itemId) != 0 ? TRUE : FALSE; } if (!flag) { moveType = GetMoveTypeForMonster(pokemon,move); movePower = GetMovePower(pokemon,move); moveCritChance = GetMoveCritChance(move); - CalcDamage(pokemon,target,moveType,movePower,moveCritChance,&dmgStruct,IntToF248_2(2),move->id,0); + CalcDamage(pokemon,target,moveType,movePower,moveCritChance,&dmgStruct,IntToF248(2),move->id,0); SetMessageArgument_2(gFormatBuffer_Monsters[0],GetEntInfo(pokemon),0); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC7C8); dmgStruct.dmg /= 2; @@ -150,7 +150,7 @@ bool8 TriAttackMoveAction(Entity * pokemon, Entity * target, Move *move, s32 ite bool8 flag; flag = FALSE; - if(HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId)) + if(HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId)) { flag = TRUE; if(sub_805727C(pokemon, target, gTriAttackSecondaryChance)) @@ -234,7 +234,7 @@ bool8 TripleKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 it bool8 flag; gUnknown_202F210++; - flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(gUnknown_202F210), itemId) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon, target, move, IntToF248(gUnknown_202F210), itemId) ? TRUE : FALSE; return flag; } @@ -256,7 +256,7 @@ bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -291,12 +291,12 @@ bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) flag = FALSE; if (GetEntInfo(target)->bideClassStatus.status == STATUS_DIVING) { - modifierInt = IntToF248_2(2).raw; + modifierInt = IntToF248(2); } else { - modifierInt = IntToF248_2(1).raw; + modifierInt = IntToF248(1); } - modifier.raw = modifierInt; + modifier = modifierInt; if(HandleDamagingMove(pokemon,target,move,modifier,itemId) != 0) flag = TRUE; return flag; @@ -351,7 +351,7 @@ bool8 FakeOutMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gFakeOutSecondaryChance)) { @@ -374,7 +374,7 @@ bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) DungeonPos pos; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0) != 0) { if (!EntityIsValid(target)) { @@ -431,7 +431,7 @@ bool8 sub_805A568(Entity * pokemon, Entity * target, Move *move, s32 itemId) { bool8 flag; - flag = HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) ? TRUE : FALSE; return flag; } @@ -440,7 +440,7 @@ bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 item bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,0) != 0) { LowerOffensiveStat(pokemon,pokemon,gStatIndexAtkDef,1,0,FALSE); @@ -456,7 +456,7 @@ bool8 SteelWingMoveAction(Entity *pokemon, Entity *target, Move *move, struct St bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_5) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),param_5) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,gSteelWingSecondaryChance) != 0) { entityInfo = GetEntInfo(pokemon); @@ -473,7 +473,7 @@ bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) stockpileStage = &GetEntInfo(pokemon)->stockpileStage; if (*stockpileStage != 0) { - HandleDamagingMove(pokemon,target,move,IntToF248_2(*stockpileStage),itemId); + HandleDamagingMove(pokemon,target,move,IntToF248(*stockpileStage),itemId); *stockpileStage = 0; } else { @@ -487,7 +487,7 @@ bool8 DynamicPunchMoveAction(Entity *pokemon, Entity *target, Move *move, s32 it bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, 0)) { @@ -695,7 +695,7 @@ bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, s32 i bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gSecretPowerSecondaryEffectChance) != 0) { switch(gSecretPowerTable[gDungeon->tileset]) { @@ -738,7 +738,7 @@ bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, s32 itemId) bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gDizzyPunchSecondaryChance) != 0) { ConfuseStatusTarget(pokemon, target, FALSE); @@ -809,7 +809,7 @@ bool8 BlastBurnMoveAction(Entity *pokemon, Entity *target, Move *move, s32 itemI bool8 flag; SendThawedMessage(pokemon, target); - flag = HandleDamagingMove(pokemon,target,move,IntToF248_2(2),itemId) != 0 ? TRUE : FALSE; + flag = HandleDamagingMove(pokemon,target,move,IntToF248(2),itemId) != 0 ? TRUE : FALSE; return flag; } @@ -818,7 +818,7 @@ bool8 CrushClawMoveAction(Entity * pokemon, Entity * target, Move *move, s32 ite bool8 flag; flag = FALSE; - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gCrushClawSecondaryChance) != 0) { LowerDefensiveStat(pokemon, target, gStatIndexAtkDef, 1, 1, FALSE); @@ -833,7 +833,7 @@ bool8 BlazeKickMoveAction(Entity * pokemon, Entity * target, Move *move, s32 ite flag = FALSE; SendThawedMessage(pokemon, target); - if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if ( HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gBlazeKickSecondaryChance) != 0) { BurnedStatusTarget(pokemon, target, 0, FALSE); @@ -920,7 +920,7 @@ bool8 PoisonTailMoveAction(Entity * pokemon, Entity * target, Move *move, s32 it bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gPoisonTailSecondaryChance) != 0) { PoisonedStatusTarget(pokemon,target,FALSE); @@ -981,7 +981,7 @@ bool8 sub_805B17C(Entity * pokemon, Entity * target, Move *move, s32 itemId) uVar4 = 0x7e; } } - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gMovesConstrictionChance) != 0) { SqueezedStatusTarget(pokemon,target,uVar4,0); diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index e4be8dcf9..0182f8a2a 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -74,7 +74,7 @@ bool8 MistBallMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gMistBallSecondaryChance) != 0) { LowerOffensiveStat(pokemon,target,gStatIndexSpecial,1,1,0); @@ -91,7 +91,7 @@ bool8 DestinyBondMoveAction(Entity * pokemon,Entity * target,Move *move, s32 ite bool8 FalseSwipeMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { - return (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId)) ? TRUE : FALSE; + return (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId)) ? TRUE : FALSE; } bool8 MirrorCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) @@ -109,7 +109,7 @@ bool8 CalmMindMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId bool8 HiddenPowerMoveAction(Entity * pokemon,Entity * target,Move *move, s32 itemId) { - HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); + HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId); return TRUE; } @@ -119,7 +119,7 @@ bool8 MetalClawMoveAction(Entity * pokemon,Entity * target,Move *move, struct St bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_5) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),param_5) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,gMetalClawSecondaryChance) != 0) { entityInfo = GetEntInfo(pokemon); @@ -222,7 +222,7 @@ bool8 DreamEaterMoveAction(Entity * pokemon, Entity * target, Move *move, s32 it flag = FALSE; hasLiquidOoze = AbilityIsActive(target, ABILITY_LIQUID_OOZE); if (IsSleeping(target)) { - iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId); + iVar3 = HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId); if (iVar3 != 0) { flag = TRUE; newHP = iVar3 / 2; @@ -330,7 +330,7 @@ bool8 LusterPurgeMoveAction(Entity * pokemon, Entity * target, Move * move, s32 bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if(sub_805727C(pokemon, target, gLusterPurgeSecondaryChance)) { @@ -347,7 +347,7 @@ bool8 StruggleMoveAction(Entity * pokemon, Entity * target, Move * move, s32 ite bool8 flag; flag = FALSE; - if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), itemId) != 0) { + if (HandleDamagingMove(pokemon, target, move, IntToF248(1), itemId) != 0) { flag = TRUE; if (RollSecondaryEffect(pokemon, 0) != 0) { entityHP = GetEntInfo(pokemon)->maxHPStat; @@ -401,7 +401,7 @@ bool8 ThiefAction(Entity *pokemon, Entity *target, Move *move, s32 itemId) Item *targetItem; flag = FALSE; - if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),itemId) != 0) { + if (HandleDamagingMove(pokemon,target,move,IntToF248(1),itemId) != 0) { flag = TRUE; if (sub_805727C(pokemon,target, 0) != 0) { pokemonInfo1 = GetEntInfo(pokemon); diff --git a/src/move_orb_effects_3.c b/src/move_orb_effects_3.c index b6cc71822..ff197f926 100644 --- a/src/move_orb_effects_3.c +++ b/src/move_orb_effects_3.c @@ -81,7 +81,7 @@ void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move * for (index = 0, iVar8 = 0xc7ff; index < 400; index++) { bVar2 = TRUE; if (entityInfo->unkFF == 1) - if(iVar7 = entityInfo->unk174.raw, bVar2 = FALSE, iVar7 > iVar8) // unk174 -> u32 to s32 + if(iVar7 = entityInfo->unk174, bVar2 = FALSE, iVar7 > iVar8) // unk174 -> u32 to s32 { bVar2 = TRUE; } diff --git a/src/trawl_orb.c b/src/trawl_orb.c index a17ca95fe..045372727 100644 --- a/src/trawl_orb.c +++ b/src/trawl_orb.c @@ -60,7 +60,7 @@ void HandleTrawlOrb(Entity *user, Entity *target) currItemEntity->spawnGenID = 0; currItemEntity->isVisible = TRUE; currItemEntity->unk22 = 0; - currItemEntity->unk1C = IntToF248_2(0); + currItemEntity->unk1C = IntToF248(0); itemInfo[itemsCount] = gDungeon->unk3804[i]; currItemEntity++; itemsCount++; @@ -132,7 +132,7 @@ void HandleTrawlOrb(Entity *user, Entity *target) for (i = 0; i < itemsCount; i++) { if (EntityIsValid(&itemEntities[i])) { IncreaseEntityPixelPos(&itemEntities[i], itemVelocity[i].x, itemVelocity[i].y); - itemEntities[i].unk1C.raw = sin_4096(unkAngle) * 0xC; + itemEntities[i].unk1C = sin_4096(unkAngle) * 0xC; sub_80462AC(&itemEntities[i], hallucinating, 0, var, 0); } } diff --git a/src/warp_target.c b/src/warp_target.c index f7eefb725..e25addd36 100644 --- a/src/warp_target.c +++ b/src/warp_target.c @@ -64,15 +64,15 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) sub_80421AC(pokemon,target); if (ShouldDisplayEntity(target)) { direction = (info->action).direction; - target->unk1C.raw += + 0x800; - while ( target->unk1C.raw < 0xa000) { + target->unk1C += + 0x800; + while ( target->unk1C < 0xa000) { if ((gDungeonFramesCounter & 3) == 0) { direction = (direction + 1) & DIRECTION_MASK; info->action.direction = direction & DIRECTION_MASK; sub_806CE68(target,direction); } DungeonRunFrameActions(0x22); - target->unk1C.raw += 0x800; + target->unk1C += 0x800; } } @@ -110,7 +110,7 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) UpdateCamera(1); if (ShouldDisplayEntity(target)) { direction = (info->action).direction; - target->unk1C.raw = 0x9c00; + target->unk1C = 0x9c00; do { if ((gDungeonFramesCounter & 3) == 0) { direction = (direction + 1) & DIRECTION_MASK; @@ -118,10 +118,10 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) sub_806CE68(target,direction); } DungeonRunFrameActions(0x22); - target->unk1C.raw -= 0x400; - } while (0 < target->unk1C.raw); + target->unk1C -= 0x400; + } while (0 < target->unk1C); } - target->unk1C = IntToF248_2(0); + target->unk1C = IntToF248(0); DungeonRunFrameActions(0x22); if (flag) { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCB14); // But it dropped back at the same spot!