mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
obj_init_animation_with_accel_and_sound + fix collision_find_surface_on_ray parameter names (#352)
This commit is contained in:
parent
413c27402c
commit
8311116cdf
8 changed files with 83 additions and 17 deletions
|
@ -7366,6 +7366,14 @@ function obj_init_animation(obj, animIndex)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param obj Object
|
||||
--- @param animIndex integer
|
||||
--- @param accel number
|
||||
--- @return nil
|
||||
function obj_init_animation_with_accel_and_sound(obj, animIndex, accel)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param obj Object
|
||||
--- @return integer
|
||||
function obj_is_hidden(obj)
|
||||
|
@ -7990,11 +7998,11 @@ end
|
|||
--- @param startX number
|
||||
--- @param startY number
|
||||
--- @param startZ number
|
||||
--- @param endX number
|
||||
--- @param endY number
|
||||
--- @param endZ number
|
||||
--- @param dirX number
|
||||
--- @param dirY number
|
||||
--- @param dirZ number
|
||||
--- @return RayIntersectionInfo
|
||||
function collision_find_surface_on_ray(startX, startY, startZ, endX, endY, endZ)
|
||||
function collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ)
|
||||
-- ...
|
||||
end
|
||||
|
||||
|
|
|
@ -5299,6 +5299,28 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [obj_init_animation_with_accel_and_sound](#obj_init_animation_with_accel_and_sound)
|
||||
|
||||
### Lua Example
|
||||
`obj_init_animation_with_accel_and_sound(obj, animIndex, accel)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| obj | [Object](structs.md#Object) |
|
||||
| animIndex | `integer` |
|
||||
| accel | `number` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void obj_init_animation_with_accel_and_sound(struct Object *obj, s32 animIndex, f32 accel);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [obj_is_hidden](#obj_is_hidden)
|
||||
|
||||
### Lua Example
|
||||
|
@ -7191,7 +7213,7 @@
|
|||
## [collision_find_surface_on_ray](#collision_find_surface_on_ray)
|
||||
|
||||
### Lua Example
|
||||
`local RayIntersectionInfoValue = collision_find_surface_on_ray(startX, startY, startZ, endX, endY, endZ)`
|
||||
`local RayIntersectionInfoValue = collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
|
@ -7199,15 +7221,15 @@
|
|||
| startX | `number` |
|
||||
| startY | `number` |
|
||||
| startZ | `number` |
|
||||
| endX | `number` |
|
||||
| endY | `number` |
|
||||
| endZ | `number` |
|
||||
| dirX | `number` |
|
||||
| dirY | `number` |
|
||||
| dirZ | `number` |
|
||||
|
||||
### Returns
|
||||
[RayIntersectionInfo](structs.md#RayIntersectionInfo)
|
||||
|
||||
### C Prototype
|
||||
`struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 endX, f32 endY, f32 endZ);`
|
||||
`struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
@ -1374,6 +1374,7 @@
|
|||
- [obj_explode_and_spawn_coins](functions-4.md#obj_explode_and_spawn_coins)
|
||||
- [obj_has_behavior](functions-4.md#obj_has_behavior)
|
||||
- [obj_init_animation](functions-4.md#obj_init_animation)
|
||||
- [obj_init_animation_with_accel_and_sound](functions-4.md#obj_init_animation_with_accel_and_sound)
|
||||
- [obj_is_hidden](functions-4.md#obj_is_hidden)
|
||||
- [obj_mark_for_deletion](functions-4.md#obj_mark_for_deletion)
|
||||
- [obj_pitch_to_object](functions-4.md#obj_pitch_to_object)
|
||||
|
|
|
@ -880,6 +880,17 @@ void cur_obj_init_animation_with_sound(s32 animIndex) {
|
|||
o->oSoundStateID = animIndex;
|
||||
}
|
||||
|
||||
void obj_init_animation_with_accel_and_sound(struct Object *obj, s32 animIndex, f32 accel) {
|
||||
if (obj != NULL) {
|
||||
struct Animation **anims = obj->oAnimations;
|
||||
if (anims != NULL) {
|
||||
s32 animAccel = (s32)(accel * 65536.0f);
|
||||
geo_obj_init_animation_accel(&obj->header.gfx, &anims[animIndex], animAccel);
|
||||
}
|
||||
obj->oSoundStateID = animIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void cur_obj_init_animation_with_accel_and_sound(s32 animIndex, f32 accel) {
|
||||
struct Animation **anims = o->oAnimations;
|
||||
if (anims != NULL) {
|
||||
|
|
|
@ -135,6 +135,7 @@ void obj_scale_xyz(struct Object* obj, f32 xScale, f32 yScale, f32 zScale);
|
|||
void obj_scale(struct Object *obj, f32 scale);
|
||||
void cur_obj_scale(f32 scale);
|
||||
void cur_obj_init_animation_with_sound(s32 animIndex);
|
||||
void obj_init_animation_with_accel_and_sound(struct Object *obj, s32 animIndex, f32 accel);
|
||||
void cur_obj_init_animation_with_accel_and_sound(s32 animIndex, f32 accel);
|
||||
void cur_obj_init_animation(s32 animIndex);
|
||||
void obj_init_animation_with_sound(struct Object *obj, const struct Animation * const* animations, s32 animIndex);
|
||||
|
|
|
@ -24343,6 +24343,28 @@ int smlua_func_obj_init_animation(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_obj_init_animation_with_accel_and_sound(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "obj_init_animation_with_accel_and_sound", 3, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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_init_animation_with_accel_and_sound"); return 0; }
|
||||
s32 animIndex = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_init_animation_with_accel_and_sound"); return 0; }
|
||||
f32 accel = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_init_animation_with_accel_and_sound"); return 0; }
|
||||
|
||||
extern void obj_init_animation_with_accel_and_sound(struct Object *obj, s32 animIndex, f32 accel);
|
||||
obj_init_animation_with_accel_and_sound(obj, animIndex, accel);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int smlua_func_obj_init_animation_with_sound(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
@ -26213,14 +26235,14 @@ int smlua_func_collision_find_surface_on_ray(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 startZ = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 endX = smlua_to_number(L, 4);
|
||||
f32 dirX = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 endY = smlua_to_number(L, 5);
|
||||
f32 dirY = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 endZ = smlua_to_number(L, 6);
|
||||
f32 dirZ = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "collision_find_surface_on_ray"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray(startX, startY, startZ, endX, endY, endZ));
|
||||
smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -30470,6 +30492,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "obj_explode_and_spawn_coins", smlua_func_obj_explode_and_spawn_coins);
|
||||
smlua_bind_function(L, "obj_has_behavior", smlua_func_obj_has_behavior);
|
||||
smlua_bind_function(L, "obj_init_animation", smlua_func_obj_init_animation);
|
||||
smlua_bind_function(L, "obj_init_animation_with_accel_and_sound", smlua_func_obj_init_animation_with_accel_and_sound);
|
||||
//smlua_bind_function(L, "obj_init_animation_with_sound", smlua_func_obj_init_animation_with_sound); <--- UNIMPLEMENTED
|
||||
smlua_bind_function(L, "obj_is_hidden", smlua_func_obj_is_hidden);
|
||||
smlua_bind_function(L, "obj_mark_for_deletion", smlua_func_obj_mark_for_deletion);
|
||||
|
|
|
@ -156,11 +156,11 @@ struct GlobalObjectCollisionData gGlobalObjectCollisionData = {
|
|||
.wooden_signpost_seg3_collision_0302DD80 = (Collision*) wooden_signpost_seg3_collision_0302DD80,
|
||||
};
|
||||
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 endX, f32 endY, f32 endZ) {
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ) {
|
||||
static struct RayIntersectionInfo info = { 0 };
|
||||
Vec3f orig = { startX, startY, startZ };
|
||||
Vec3f end = { endX, endY, endZ };
|
||||
find_surface_on_ray(orig, end, &info.surface, info.hitPos);
|
||||
Vec3f dir = { dirX, dirY, dirZ };
|
||||
find_surface_on_ray(orig, dir, &info.surface, info.hitPos);
|
||||
return &info;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ struct GlobalObjectCollisionData {
|
|||
|
||||
extern struct GlobalObjectCollisionData gGlobalObjectCollisionData;
|
||||
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 endX, f32 endY, f32 endZ);
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ);
|
||||
|
||||
struct Surface* get_water_surface_pseudo_floor(void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue