diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 0c00b9227..14f81031d 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8350,8 +8350,7 @@ function object_step_without_floor_orient() end --- @param obj Object ---- Don't use this function outside of of a context where the current object and `obj` are the same.
---- Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields +--- Updates the object `obj` horizontal velocity using its forward vel and move angle yaw, then moves it function obj_move_xyz_using_fvel_and_yaw(obj) -- ... end @@ -9666,17 +9665,17 @@ function cur_obj_set_billboard_if_vanilla_cam() -- ... end ---- @param o Object +--- @param obj Object --- @param radius number --- @param height number -function obj_set_hitbox_radius_and_height(o, radius, height) +function obj_set_hitbox_radius_and_height(obj, radius, height) -- ... end ---- @param o Object +--- @param obj Object --- @param radius number --- @param height number -function obj_set_hurtbox_radius_and_height(o, radius, height) +function obj_set_hurtbox_radius_and_height(obj, radius, height) -- ... end diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index fbf12edf3..d8fc42d21 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -3175,8 +3175,7 @@ Used for boulders, falling pillars, and the rolling snowman body ## [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw) ### Description -Don't use this function outside of of a context where the current object and `obj` are the same. -Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields +Updates the object `obj` horizontal velocity using its forward vel and move angle yaw, then moves it ### Lua Example `obj_move_xyz_using_fvel_and_yaw(obj)` diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index a9abe5b7f..3a03b8a38 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -2566,12 +2566,12 @@ Marks an object to be unloaded at the end of the frame ## [obj_set_hitbox_radius_and_height](#obj_set_hitbox_radius_and_height) ### Lua Example -`obj_set_hitbox_radius_and_height(o, radius, height)` +`obj_set_hitbox_radius_and_height(obj, radius, height)` ### Parameters | Field | Type | | ----- | ---- | -| o | [Object](structs.md#Object) | +| obj | [Object](structs.md#Object) | | radius | `number` | | height | `number` | @@ -2579,7 +2579,7 @@ Marks an object to be unloaded at the end of the frame - None ### C Prototype -`void obj_set_hitbox_radius_and_height(struct Object *o, f32 radius, f32 height);` +`void obj_set_hitbox_radius_and_height(struct Object *obj, f32 radius, f32 height);` [:arrow_up_small:](#) @@ -2588,12 +2588,12 @@ Marks an object to be unloaded at the end of the frame ## [obj_set_hurtbox_radius_and_height](#obj_set_hurtbox_radius_and_height) ### Lua Example -`obj_set_hurtbox_radius_and_height(o, radius, height)` +`obj_set_hurtbox_radius_and_height(obj, radius, height)` ### Parameters | Field | Type | | ----- | ---- | -| o | [Object](structs.md#Object) | +| obj | [Object](structs.md#Object) | | radius | `number` | | height | `number` | @@ -2601,7 +2601,7 @@ Marks an object to be unloaded at the end of the frame - None ### C Prototype -`void obj_set_hurtbox_radius_and_height(struct Object *o, f32 radius, f32 height);` +`void obj_set_hurtbox_radius_and_height(struct Object *obj, f32 radius, f32 height);` [:arrow_up_small:](#) diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 6ef7df224..c79daa6bc 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -487,17 +487,16 @@ s16 object_step_without_floor_orient(void) { } /* |description| -Don't use this function outside of of a context where the current object and `obj` are the same. -Moves `obj` based on a seemingly random mix of using either the current obj or `obj`'s fields +Updates the object `obj` horizontal velocity using its forward vel and move angle yaw, then moves it |descriptionEnd| */ void obj_move_xyz_using_fvel_and_yaw(struct Object *obj) { - if (!o || !obj) { return; } - o->oVelX = obj->oForwardVel * sins(obj->oMoveAngleYaw); - o->oVelZ = obj->oForwardVel * coss(obj->oMoveAngleYaw); + if (!obj) { return; } + obj->oVelX = obj->oForwardVel * sins(obj->oMoveAngleYaw); + obj->oVelZ = obj->oForwardVel * coss(obj->oMoveAngleYaw); - obj->oPosX += o->oVelX; + obj->oPosX += obj->oVelX; obj->oPosY += obj->oVelY; - obj->oPosZ += o->oVelZ; + obj->oPosZ += obj->oVelZ; } /* |description|Checks if a point is within distance from any active Mario visible to objects' graphical position|descriptionEnd| */ @@ -786,12 +785,11 @@ s8 obj_find_wall_displacement(VEC_OUT Vec3f dist, f32 x, f32 y, f32 z, f32 radiu Spawns a number of coins at the location of an object with a random forward velocity, y velocity, and direction |descriptionEnd| */ void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins) { - if (!o) { return; } if (!obj) { return; } struct Object *coin; s8 count; - rng_position_init(o->oPosX, o->oPosY, o->oPosZ); + rng_position_init(obj->oPosX, obj->oPosY, obj->oPosZ); for (count = 0; count < nCoins; count++) { coin = spawn_object(obj, MODEL_YELLOW_COIN, bhvMovingYellowCoin); if (coin != NULL) { diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 171035660..75b1a4158 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -501,7 +501,7 @@ s16 obj_angle_to_point(struct Object *obj, f32 pointX, f32 pointZ) { } s16 obj_turn_toward_object(struct Object *obj, struct Object *target, s16 angleIndex, s16 turnAmount) { - if (obj == NULL || target == NULL || !o) { return 0; } + if (obj == NULL || target == NULL) { return 0; } f32 a, b, c, d; UNUSED s32 unused; s16 targetAngle = 0; @@ -531,8 +531,8 @@ s16 obj_turn_toward_object(struct Object *obj, struct Object *target, s16 angleI break; } - startAngle = o->OBJECT_FIELD_U32(angleIndex); - o->OBJECT_FIELD_U32(angleIndex) = approach_s16_symmetric(startAngle, targetAngle, turnAmount); + startAngle = obj->OBJECT_FIELD_U32(angleIndex); + obj->OBJECT_FIELD_U32(angleIndex) = approach_s16_symmetric(startAngle, targetAngle, turnAmount); return targetAngle; } @@ -914,9 +914,8 @@ void cur_obj_init_animation_with_sound(s32 animIndex) { } void obj_init_animation_with_accel_and_sound(struct Object *obj, s32 animIndex, f32 accel) { - if (!o) { return; } if (obj != NULL) { - struct AnimationTable *animations = o->oAnimations; + struct AnimationTable *animations = obj->oAnimations; if (animations && (u32)animIndex < animations->count) { s32 animAccel = (s32)(accel * 65536.0f); geo_obj_init_animation_accel(&obj->header.gfx, animations->anims[animIndex], animAccel); @@ -1954,18 +1953,18 @@ void cur_obj_set_billboard_if_vanilla_cam(void) { } } -void obj_set_hitbox_radius_and_height(struct Object *o, f32 radius, f32 height) { - if (o == NULL) { return; } +void obj_set_hitbox_radius_and_height(struct Object *obj, f32 radius, f32 height) { + if (obj == NULL) { return; } - o->hitboxRadius = radius; - o->hitboxHeight = height; + obj->hitboxRadius = radius; + obj->hitboxHeight = height; } -void obj_set_hurtbox_radius_and_height(struct Object *o, f32 radius, f32 height) { - if (o == NULL) { return; } +void obj_set_hurtbox_radius_and_height(struct Object *obj, f32 radius, f32 height) { + if (obj == NULL) { return; } - o->hurtboxRadius = radius; - o->hurtboxHeight = height; + obj->hurtboxRadius = radius; + obj->hurtboxHeight = height; } void cur_obj_set_hitbox_radius_and_height(f32 radius, f32 height) { diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 90f8276f9..9d9e3e7b9 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -27867,15 +27867,15 @@ int smlua_func_obj_set_hitbox_radius_and_height(lua_State* L) { return 0; } - struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); + struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_hitbox_radius_and_height"); return 0; } f32 radius = smlua_to_number(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_hitbox_radius_and_height"); return 0; } f32 height = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_hitbox_radius_and_height"); return 0; } - extern void obj_set_hitbox_radius_and_height(struct Object *o, f32 radius, f32 height); - obj_set_hitbox_radius_and_height(o, radius, height); + extern void obj_set_hitbox_radius_and_height(struct Object *obj, f32 radius, f32 height); + obj_set_hitbox_radius_and_height(obj, radius, height); return 1; } @@ -27889,15 +27889,15 @@ int smlua_func_obj_set_hurtbox_radius_and_height(lua_State* L) { return 0; } - struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); + struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_set_hurtbox_radius_and_height"); return 0; } f32 radius = smlua_to_number(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_hurtbox_radius_and_height"); return 0; } f32 height = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_hurtbox_radius_and_height"); return 0; } - extern void obj_set_hurtbox_radius_and_height(struct Object *o, f32 radius, f32 height); - obj_set_hurtbox_radius_and_height(o, radius, height); + extern void obj_set_hurtbox_radius_and_height(struct Object *obj, f32 radius, f32 height); + obj_set_hurtbox_radius_and_height(obj, radius, height); return 1; }