More tuxie fixes

Tuxie will regain its hitbox if dropped through crouching or any other means
Fixed detection of if any mario is far away
Immediately sends an object packet whenever any object is dropped or thrown

Fixes #9
This commit is contained in:
MysterD 2020-09-03 08:58:21 -07:00
parent ab9e7c7bca
commit 920c0674d9
2 changed files with 17 additions and 5 deletions

View file

@ -283,6 +283,8 @@ void small_penguin_free_actions(void) {
o->oAction = 5;
o->oSmallPenguinUnk88 = 0;
}
cur_obj_become_tangible();
cur_obj_enable_rendering();
cur_obj_update_floor_and_walls();
cur_obj_call_action_function(sSmallPenguinActions);
cur_obj_move_standard(-78);
@ -301,10 +303,10 @@ void bhv_small_penguin_loop(void) {
cur_obj_unrender_and_reset_state(0, 0);
if (cur_obj_has_behavior(bhvPenguinBaby))
obj_set_behavior(o, bhvSmallPenguin);
obj_copy_pos(o, gMarioObject);
obj_copy_pos(o, gMarioStates[o->heldByPlayerIndex].marioObj);
if (gGlobalTimer % 30 == 0)
#ifndef VERSION_JP
play_sound(SOUND_OBJ2_BABY_PENGUIN_YELL, gMarioObject->header.gfx.cameraToObject);
play_sound(SOUND_OBJ2_BABY_PENGUIN_YELL, gMarioStates[o->heldByPlayerIndex].marioObj->header.gfx.cameraToObject);
#else
play_sound(SOUND_OBJ2_BABY_PENGUIN_YELL, o->header.gfx.cameraToObject);
#endif

View file

@ -26,6 +26,7 @@
#include "rendering_graph_node.h"
#include "spawn_object.h"
#include "spawn_sound.h"
#include "pc/network/network.h"
u8 (*continueDialogFunction)(void) = NULL;
struct Object* continueDialogFunctionObject = NULL;
@ -1164,6 +1165,10 @@ void cur_obj_get_thrown_or_placed(f32 forwardVel, f32 velY, s32 thrownAction) {
o->oAction = thrownAction;
cur_obj_move_after_thrown_or_dropped(forwardVel, velY);
}
if (o->oSyncID != NULL && syncObjects[o->oSyncID].owned) {
network_send_object(o);
}
}
void cur_obj_get_dropped(void) {
@ -1172,6 +1177,10 @@ void cur_obj_get_dropped(void) {
o->oHeldState = HELD_FREE;
cur_obj_move_after_thrown_or_dropped(0.0f, 0.0f);
if (o->oSyncID != NULL && syncObjects[o->oSyncID].owned) {
network_send_object(o);
}
}
void cur_obj_set_model(s32 modelID) {
@ -2448,9 +2457,10 @@ s32 bit_shift_left(s32 a0) {
s32 cur_obj_mario_far_away(void) {
for (int i = 0; i < MAX_PLAYERS; i++) {
f32 dx = o->oHomeX - gMarioObject->oPosX;
f32 dy = o->oHomeY - gMarioObject->oPosY;
f32 dz = o->oHomeZ - gMarioObject->oPosZ;
struct Object* player = gMarioStates[i].marioObj;
f32 dx = o->oHomeX - player->oPosX;
f32 dy = o->oHomeY - player->oPosY;
f32 dz = o->oHomeZ - player->oPosZ;
f32 marioDistToHome = sqrtf(dx * dx + dy * dy + dz * dz);
if (marioDistToHome <= 2000.0f) { return FALSE; }
}