Improvements to Bowser 2 (still not fully supported)
This commit is contained in:
parent
999ccccc77
commit
e1933e5f78
|
@ -2186,6 +2186,7 @@ const BehaviorScript bhvTiltingBowserLavaPlatform[] = {
|
|||
SET_FLOAT(oCollisionDistance, 20000),
|
||||
SET_INT(oFaceAngleYaw, 0),
|
||||
SET_HOME(),
|
||||
CALL_NATIVE(bhv_tilting_bowser_lava_platform_init),
|
||||
BEGIN_LOOP(),
|
||||
CALL_NATIVE(cur_obj_rotate_face_angle_using_vel),
|
||||
CALL_NATIVE(load_object_collision_model),
|
||||
|
|
|
@ -156,6 +156,7 @@ void bhv_bowser_loop(void);
|
|||
void bhv_bowser_body_anchor_init(void);
|
||||
void bhv_bowser_body_anchor_loop(void);
|
||||
void bhv_bowser_flame_spawn_loop(void);
|
||||
void bhv_tilting_bowser_lava_platform_init(void);
|
||||
void bhv_falling_bowser_platform_loop(void);
|
||||
void bhv_blue_bowser_flame_init(void);
|
||||
void bhv_blue_bowser_flame_loop(void);
|
||||
|
|
|
@ -1018,7 +1018,17 @@ void bowser_act_dead(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void bowser_tilt_platform(struct Object *platform, s16 a1) {
|
||||
void bhv_tilting_bowser_lava_platform_init(void) {
|
||||
struct SyncObject* so = network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||
network_init_object_field(o, &o->oAngleVelPitch);
|
||||
network_init_object_field(o, &o->oAngleVelRoll);
|
||||
network_init_object_field(o, &o->oFaceAnglePitch);
|
||||
network_init_object_field(o, &o->oFaceAngleRoll);
|
||||
network_init_object_field(o, &o->oMoveAnglePitch);
|
||||
network_init_object_field(o, &o->oMoveAngleRoll);
|
||||
}
|
||||
|
||||
void bowser_tilt_platform(struct Object* platform, s16 a1) {
|
||||
s16 angle;
|
||||
angle = o->oBowserAngleToCentre + 0x8000;
|
||||
platform->oAngleVelPitch = coss(angle) * a1;
|
||||
|
@ -1026,7 +1036,7 @@ void bowser_tilt_platform(struct Object *platform, s16 a1) {
|
|||
}
|
||||
|
||||
void bowser_act_ride_tilting_platform(void) {
|
||||
struct Object *platform = cur_obj_nearest_object_with_behavior(bhvTiltingBowserLavaPlatform);
|
||||
struct Object* platform = cur_obj_nearest_object_with_behavior(bhvTiltingBowserLavaPlatform);
|
||||
UNUSED s16 sp2A = o->oBowserAngleToCentre + 0x8000;
|
||||
s16 sp28;
|
||||
UNUSED s32 unused;
|
||||
|
@ -1058,11 +1068,15 @@ void bowser_act_ride_tilting_platform(void) {
|
|||
platform->oAngleVelRoll = 0;
|
||||
platform->oFaceAnglePitch = 0;
|
||||
platform->oFaceAngleRoll = 0;
|
||||
if (network_owns_object(o)) {
|
||||
network_send_object(platform);
|
||||
}
|
||||
}
|
||||
}
|
||||
cur_obj_extend_animation_if_at_end();
|
||||
}
|
||||
|
||||
|
||||
s32 bowser_check_fallen_off_stage(void) // bowser off stage?
|
||||
{
|
||||
if (o->oAction != 2 && o->oAction != 19) {
|
||||
|
@ -1278,6 +1292,13 @@ void bhv_bowser_loop(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void bhv_bowser_override_ownership(u8* shouldOverride, u8* shouldOwn) {
|
||||
if (o->oAction == 19) { // tilting platform
|
||||
*shouldOverride = TRUE;
|
||||
*shouldOwn = (gNetworkType == NT_SERVER);
|
||||
}
|
||||
}
|
||||
|
||||
void bhv_bowser_init(void) {
|
||||
s32 level; // 0 is dw, 1 is fs, 2 is sky
|
||||
o->oBowserUnk110 = 1;
|
||||
|
@ -1298,6 +1319,7 @@ void bhv_bowser_init(void) {
|
|||
o->oBowserEyesShut = 0;
|
||||
|
||||
struct SyncObject* so = network_init_object(o, 8000.0f);
|
||||
so->override_ownership = bhv_bowser_override_ownership;
|
||||
so->fullObjectSync = TRUE;
|
||||
network_init_object_field(o, &o->header.gfx.node.flags);
|
||||
network_init_object_field(o, &networkBowserAnimationIndex);
|
||||
|
|
|
@ -54,6 +54,7 @@ struct SyncObject {
|
|||
u8 (*ignore_if_true)(void);
|
||||
void (*on_received_pre)(u8 fromLocalIndex);
|
||||
void (*on_received_post)(u8 fromLocalIndex);
|
||||
void (*override_ownership)(u8* shouldOverride, u8* shouldOwn);
|
||||
void* extraFields[MAX_SYNC_OBJECT_FIELDS];
|
||||
};
|
||||
|
||||
|
|
|
@ -24,11 +24,22 @@ static float player_distance(struct MarioState* marioState, struct Object* o) {
|
|||
}
|
||||
|
||||
static bool should_own_object(struct SyncObject* so) {
|
||||
// check for override
|
||||
u8 shouldOverride = FALSE;
|
||||
u8 shouldOwn = FALSE;
|
||||
if (so->override_ownership != NULL) {
|
||||
extern struct Object* gCurrentObject;
|
||||
struct Object* tmp = gCurrentObject;
|
||||
gCurrentObject = so->o;
|
||||
so->override_ownership(&shouldOverride, &shouldOwn);
|
||||
gCurrentObject = tmp;
|
||||
if (shouldOverride) { return shouldOwn; }
|
||||
}
|
||||
|
||||
if (gMarioStates[0].heldByObj == so->o) { return true; }
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
if (gMarioStates[i].heldByObj == so->o) { return false; }
|
||||
}
|
||||
|
||||
if (so->o->oHeldState == HELD_HELD && so->o->heldByPlayerIndex == 0) { return true; }
|
||||
if (player_distance(&gMarioStates[0], so->o) > player_distance(&gMarioStates[1], so->o)) { return false; }
|
||||
if (so->o->oHeldState == HELD_HELD && so->o->heldByPlayerIndex != 0) { return false; }
|
||||
|
|
Loading…
Reference in New Issue