mirror of https://github.com/n64decomp/mk64.git
Separate effect bit-flags into components
This commit is contained in:
parent
3190ad2a7a
commit
52e32c4d86
|
|
@ -361,7 +361,7 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
|
|||
#define UNKNOWN_EFFECT_0x20000000 0x20000000 //
|
||||
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
|
||||
#define BOO_EFFECT 0x80000000 // being a boo
|
||||
|
||||
#define ALL_EFFECTS 0xFFFFFFFF
|
||||
|
||||
/**
|
||||
* @brief durations of effects
|
||||
|
|
|
|||
|
|
@ -1442,7 +1442,7 @@ void func_8005A14C(s32 playerId) {
|
|||
objectIndex = D_8018CE10[playerId].objectIndex;
|
||||
lapCount = gLapCountByPlayerId[playerId];
|
||||
if (player->type & PLAYER_EXISTS) {
|
||||
if (player->effects & 0x204C0) {
|
||||
if (player->effects & (UNKNOWN_EFFECT_0x20000 | UNKNOWN_EFFECT_0x400 | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) {
|
||||
gObjectList[objectIndex].direction_angle[2] += 0x1000;
|
||||
} else {
|
||||
if (gObjectList[objectIndex].direction_angle[2] != 0) {
|
||||
|
|
@ -1459,7 +1459,7 @@ void func_8005A14C(s32 playerId) {
|
|||
} else {
|
||||
u16_step_down_towards(&gObjectList[objectIndex].direction_angle[0], 0, 0x00000100);
|
||||
}
|
||||
if (player->effects & 0x03000000) {
|
||||
if (player->effects & (HIT_BY_ITEM_EFFECT | UNKNOWN_EFFECT_0x1000000)) {
|
||||
func_80087D24(objectIndex, 6.0f, 1.5f, 0.0f);
|
||||
} else {
|
||||
f32_step_towards(&gObjectList[objectIndex].offset[1], 0.0f, 1.0f);
|
||||
|
|
@ -6428,7 +6428,7 @@ void func_8006CEC0(Player* arg0, s16 arg1, s8 arg2, s8 arg3) {
|
|||
}
|
||||
switch (gActiveScreenMode) {
|
||||
case SCREEN_MODE_1P:
|
||||
if (((arg0->effects & 0x04000000) != 0x04000000) && ((arg0->effects & UNKNOWN_EFFECT_0x400) != UNKNOWN_EFFECT_0x400) &&
|
||||
if (((arg0->effects & HIT_EFFECT) != HIT_EFFECT) && ((arg0->effects & UNKNOWN_EFFECT_0x400) != UNKNOWN_EFFECT_0x400) &&
|
||||
((arg0->effects & UNKNOWN_EFFECT_0x1000000) != UNKNOWN_EFFECT_0x1000000)) {
|
||||
if (((arg0->unk_0CA & 2) != 2) && ((arg0->unk_0CA & 0x10) != 0x10) && !(arg0->unk_0CA & 0x100)) {
|
||||
func_80060504(arg0, arg1, sp20, arg2, arg3);
|
||||
|
|
@ -6440,7 +6440,7 @@ void func_8006CEC0(Player* arg0, s16 arg1, s8 arg2, s8 arg3) {
|
|||
case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL:
|
||||
case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL:
|
||||
case SCREEN_MODE_3P_4P_SPLITSCREEN:
|
||||
if (((arg0->type & 0x4000) != 0) && ((arg0->effects & 0x04000000) != 0x04000000) &&
|
||||
if (((arg0->type & 0x4000) != 0) && ((arg0->effects & HIT_EFFECT) != HIT_EFFECT) &&
|
||||
((arg0->effects & UNKNOWN_EFFECT_0x400) != UNKNOWN_EFFECT_0x400) &&
|
||||
((arg0->effects & UNKNOWN_EFFECT_0x1000000) != UNKNOWN_EFFECT_0x1000000)) {
|
||||
if (((arg0->unk_0CA & 2) != 2) && ((arg0->unk_0CA & 0x10) != 0x10) && !(arg0->unk_0CA & 0x100)) {
|
||||
|
|
|
|||
|
|
@ -976,7 +976,7 @@ void func_80089020(s32 playerId, f32* arg1) {
|
|||
} else {
|
||||
var_f2 = -*arg1;
|
||||
}
|
||||
if (player->effects & 0xC0) {
|
||||
if (player->effects & (BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) {
|
||||
if (gCurrentCourseId == COURSE_SHERBET_LAND) {
|
||||
if (var_f2 <= 0.5) {
|
||||
var_f0 = 0.025f;
|
||||
|
|
@ -1234,7 +1234,7 @@ s32 func_80089E18(s32 objectIndex) {
|
|||
player = gPlayerOne;
|
||||
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
|
||||
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++) {
|
||||
if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x800000C0) &&
|
||||
if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) &&
|
||||
(has_collided_horizontally_with_player(objectIndex, player) != 0)) {
|
||||
if (player->effects & STAR_EFFECT) {
|
||||
var_s6 = 1;
|
||||
|
|
@ -1256,7 +1256,7 @@ s32 func_80089F24(s32 objectIndex) {
|
|||
player = gPlayerOne;
|
||||
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
|
||||
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++) {
|
||||
if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x800002C0)) {
|
||||
if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | STAR_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT))) {
|
||||
if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) &&
|
||||
(has_collided_horizontally_with_player(objectIndex, player) != 0)) {
|
||||
var_s7 = 1;
|
||||
|
|
|
|||
|
|
@ -4440,7 +4440,7 @@ void cpu_use_item_strategy(s32 playerId) {
|
|||
if (cpuStrategy->timer < 10000) {
|
||||
cpuStrategy->timer += 1;
|
||||
}
|
||||
if (player->effects & (BOO_EFFECT | BOOST_EFFECT | STAR_EFFECT)) { // 0x80002200
|
||||
if (player->effects & (BOO_EFFECT | BOOST_EFFECT | STAR_EFFECT)) {
|
||||
cpuStrategy->timer = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ void func_8008D760(Player* player) {
|
|||
player->unk_07C = 0;
|
||||
player->unk_0C0 = 0;
|
||||
player->rotation[1] = player->unk_0AE;
|
||||
player->effects &= 0xFFF7FFFF;
|
||||
player->effects &= ~UNKNOWN_EFFECT_0x80000;
|
||||
player->kartGravity = gKartGravityTable[player->characterId];
|
||||
player->type &= 0xFF7F;
|
||||
}
|
||||
|
|
@ -661,7 +661,7 @@ void func_8008D97C(Player* player) {
|
|||
player->unk_07C = 0;
|
||||
player->unk_0C0 = 0;
|
||||
player->rotation[1] = player->unk_0AE;
|
||||
player->effects &= 0xFF7FFFFF;
|
||||
player->effects &= ~UNKNOWN_EFFECT_0x800000;
|
||||
player->kartGravity = gKartGravityTable[player->characterId];
|
||||
}
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ void apply_hit_sound_effect(Player* player, s8 playerIndex) {
|
|||
player->unk_238 = 0;
|
||||
player->unk_DB4.unk10 = 4.5f;
|
||||
D_8018D990[playerIndex] = 0;
|
||||
player->effects &= ~0x08000010;
|
||||
player->effects &= ~(UNKNOWN_EFFECT_0x8000000 | DRIFTING_EFFECT);
|
||||
D_80165190[0][playerIndex] = 1;
|
||||
D_80165190[1][playerIndex] = 1;
|
||||
D_80165190[2][playerIndex] = 1;
|
||||
|
|
@ -831,7 +831,7 @@ void apply_hit_rotating_sound_effect(Player* player, s8 playerIndex) {
|
|||
clean_effect(player, playerIndex);
|
||||
|
||||
player->soundEffects &= ~HIT_ROTATING_SOUND_EFFECT;
|
||||
player->effects |= 0x40020000;
|
||||
player->effects |= (LIGHTNING_EFFECT | UNKNOWN_EFFECT_0x20000);
|
||||
player->effects &= ~DRIFTING_EFFECT;
|
||||
player->unk_08C *= 0.6;
|
||||
player->unk_0B0 = 0;
|
||||
|
|
@ -942,7 +942,7 @@ void func_8008E4A4(Player* player, s8 playerIndex) {
|
|||
player->currentSpeed = 0.0f;
|
||||
player->velocity[0] = 0.0f;
|
||||
player->velocity[2] = 0.0f;
|
||||
player->effects &= ~0xC0;
|
||||
player->effects &= ~(BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT);
|
||||
|
||||
if ((player->effects & UNKNOWN_EFFECT_0x8) != UNKNOWN_EFFECT_0x8) {
|
||||
++player->unk_0E0;
|
||||
|
|
@ -1053,7 +1053,7 @@ void apply_hit_by_item_effect(Player* player, s8 playerIndex) {
|
|||
player->unk_042 += 0xAAA;
|
||||
player->unk_08C /= 2;
|
||||
player->currentSpeed = 0.0f;
|
||||
player->effects &= ~0xC0;
|
||||
player->effects &= ~(BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT);
|
||||
|
||||
if ((player->effects & UNKNOWN_EFFECT_0x8) != UNKNOWN_EFFECT_0x8) {
|
||||
++player->unk_0E0;
|
||||
|
|
|
|||
|
|
@ -1659,13 +1659,13 @@ void func_8002BF4C(Player* player, s8 playerIndex) {
|
|||
|
||||
if (((player->speed / 18.0f) * 216.0f) < 50.0f) {
|
||||
player->unk_0E2 = 0;
|
||||
player->effects &= 0xFFDFFFFF;
|
||||
player->effects &= ~CPU_FAST_EFFECT;
|
||||
return;
|
||||
}
|
||||
if ((player->effects & CPU_FAST_EFFECT) == CPU_FAST_EFFECT) {
|
||||
player->unk_0E2 -= 1;
|
||||
if (player->unk_0E2 <= 0) {
|
||||
player->effects &= 0xFFDFFFFF;
|
||||
player->effects &= ~CPU_FAST_EFFECT;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < NUM_PLAYERS; i++) {
|
||||
|
|
@ -2868,7 +2868,7 @@ void func_8002FE84(Player* player, f32 arg1) {
|
|||
}
|
||||
|
||||
// Huh?
|
||||
if (((player->effects & 0xFFFFFFFF) & UNKNOWN_EFFECT_0x8) == UNKNOWN_EFFECT_0x8) {
|
||||
if (((player->effects & ALL_EFFECTS) & UNKNOWN_EFFECT_0x8) == UNKNOWN_EFFECT_0x8) {
|
||||
player->unk_098 = ((player->currentSpeed * player->currentSpeed) / 25.0f) * 1.1;
|
||||
return;
|
||||
}
|
||||
|
|
@ -3032,8 +3032,7 @@ f32 func_80030150(Player* player, s8 playerIndex) {
|
|||
((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT)) {
|
||||
return (1.0f - player->unk_104) * var_f2;
|
||||
}
|
||||
// Have to `and` the 0x2000 here to force the compiler to reload the immediate
|
||||
if (((player->effects & BOOST_EFFECT) == (BOOST_EFFECT & 0xFFFFFFFF)) ||
|
||||
if (((player->effects & BOOST_EFFECT) == BOOST_EFFECT) ||
|
||||
((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT) ||
|
||||
((player->effects & BOOST_RAMP_WOOD_EFFECT) == BOOST_RAMP_WOOD_EFFECT)) {
|
||||
func_8002FE84(player, player->boostPower + player->unk_08C);
|
||||
|
|
@ -4033,7 +4032,7 @@ void func_80033AE0(Player* player, struct Controller* controller, s8 arg2) {
|
|||
if (player->unk_10C != 0) {
|
||||
func_8002BD58(player);
|
||||
}
|
||||
player->effects &= 0xDFFFFFFF;
|
||||
player->effects &= ~UNKNOWN_EFFECT_0x20000000;
|
||||
if (((s32) player->tyres[BACK_RIGHT].surfaceType) > 0xE) {
|
||||
var_f12 = var_f12;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2077,7 +2077,7 @@ void evaluate_collision_between_player_actor(Player* player, struct Actor* actor
|
|||
}
|
||||
break;
|
||||
case ACTOR_BANANA:
|
||||
if (player->effects & (BOO_EFFECT | 0x8C0)) {
|
||||
if (player->effects & (BOO_EFFECT | UNKNOWN_EFFECT_0x800 | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) {
|
||||
break;
|
||||
}
|
||||
if (player->soundEffects & 1) {
|
||||
|
|
@ -2106,7 +2106,7 @@ void evaluate_collision_between_player_actor(Player* player, struct Actor* actor
|
|||
destroy_destructable_actor(actor);
|
||||
break;
|
||||
case ACTOR_GREEN_SHELL:
|
||||
if (player->effects & 0x80000400) {
|
||||
if (player->effects & (BOO_EFFECT | UNKNOWN_EFFECT_0x400)) {
|
||||
break;
|
||||
}
|
||||
if (player->soundEffects & 4) {
|
||||
|
|
|
|||
|
|
@ -998,7 +998,7 @@ void func_80022BC4(Player* player, UNUSED s8 playerIndex) {
|
|||
temp_f0 *= 0.8;
|
||||
temp_v0 = 0;
|
||||
if (temp_f0 <= 0.1) {
|
||||
player->effects &= 0xF7FFFFFF;
|
||||
player->effects &= ~UNKNOWN_EFFECT_0x8000000;
|
||||
temp_f0 = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5983,7 +5983,7 @@ void func_80080B28(s32 objectIndex, s32 playerId) {
|
|||
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
|
||||
if (!(temp_s0->soundEffects & 0x100)) {
|
||||
temp_f0 = func_80088F54(objectIndex, temp_s0);
|
||||
if ((temp_f0 <= 9.0) && !(temp_s0->effects & 0x04000000) &&
|
||||
if ((temp_f0 <= 9.0) && !(temp_s0->effects & HIT_EFFECT) &&
|
||||
(has_collided_horizontally_with_player(objectIndex, temp_s0) != 0)) {
|
||||
if ((temp_s0->type & PLAYER_EXISTS) && !(temp_s0->type & 0x100)) {
|
||||
if (!(temp_s0->effects & STAR_EFFECT)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue