From 9f748cbe76f2c4ea9e873751e4f244e013b602f9 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:54:04 -0500 Subject: [PATCH] sep-coin --- autogen/lua_definitions/constants.lua | 9 --------- autogen/lua_definitions/functions.lua | 18 +++++++++--------- autogen/lua_definitions/structs.lua | 2 +- data/dynos_bin_behavior.cpp | 2 +- docs/lua/constants.md | 8 -------- docs/lua/functions-6.md | 26 +++++++++++++------------- docs/lua/structs.md | 2 +- include/object_constants.h | 7 ------- include/object_fields.h | 8 ++++---- src/game/behaviors/coin.inc.c | 2 +- src/game/object_helpers.c | 20 ++++++++++---------- src/pc/lua/smlua_cobject_autogen.c | 2 +- src/pc/lua/smlua_constants_autogen.c | 3 --- src/pc/lua/smlua_functions_autogen.c | 26 +++++++++++++------------- 14 files changed, 54 insertions(+), 81 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 09db5b128..8386309ee 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -5204,15 +5204,6 @@ BOBOMB_ACT_LAVA_DEATH = 100 --- @type integer BOBOMB_ACT_DEATH_PLANE_DEATH = 101 -COIN_TYPE_NONE = 0 --- @type CoinTypes -COIN_TYPE_YELLOW = 1 --- @type CoinTypes -COIN_TYPE_BLUE = 2 --- @type CoinTypes - ---- @alias CoinTypes ---- | `COIN_TYPE_NONE` ---- | `COIN_TYPE_YELLOW` ---- | `COIN_TYPE_BLUE` - --- @type integer HIDDEN_BLUE_COIN_ACT_INACTIVE = 0 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index d3324747c..d4dda9bc8 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -9841,29 +9841,29 @@ end --- @param obj Object --- @param numCoins integer ---- @param baseYVel number +--- @param sp30 number --- @param coinBehavior Pointer_BehaviorScript --- @param posJitter integer --- @param model integer --- Spawns loot coins from an object using the specified behavior, jitter, and model -function obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model) +function obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model) -- ... end --- @param obj Object --- @param numCoins integer ---- @param baseYVel number +--- @param sp28 number --- @param posJitter integer --- Spawns blue loot coins from an object -function obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter) +function obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter) -- ... end --- @param obj Object --- @param numCoins integer ---- @param baseYVel number +--- @param sp28 number --- Spawns yellow loot coins from an object -function obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel) +function obj_spawn_loot_yellow_coins(obj, numCoins, sp28) -- ... end @@ -10251,10 +10251,10 @@ function cur_obj_set_hitbox_and_die_if_attacked(hitbox, deathSound, noLootCoins) -- ... end ---- @param mistSize number ---- @param coinType integer +--- @param sp18 number +--- @param sp1C integer --- Explodes the current object, spawns particles, and optionally spawns coins -function obj_explode_and_spawn_coins(mistSize, coinType) +function obj_explode_and_spawn_coins(sp18, sp1C) -- ... end diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 48319b0e8..187590de6 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1580,7 +1580,7 @@ --- @field public oCloudFwooshMovementRadius integer --- @field public oCoinUnkF4 integer --- @field public oCoinUnkF8 integer ---- @field public oCoinBaseYVel number +--- @field public oCoinUnk110 number --- @field public oCoinUnk1B0 integer --- @field public oCollisionParticleUnkF4 number --- @field public oControllablePlatformUnkF8 integer diff --git a/data/dynos_bin_behavior.cpp b/data/dynos_bin_behavior.cpp index d5452ad85..f6673b413 100644 --- a/data/dynos_bin_behavior.cpp +++ b/data/dynos_bin_behavior.cpp @@ -1132,7 +1132,7 @@ s64 DynOS_Bhv_ParseBehaviorScriptConstants(const String &_Arg, bool *found) { /* Coin */ bhv_constant(oCoinUnkF4); bhv_constant(oCoinUnkF8); - bhv_constant(oCoinBaseYVel); + bhv_constant(oCoinUnk110); #ifndef VERSION_JP bhv_constant(oCoinUnk1B0); #endif diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 9b6cf38f2..7fd2706fa 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -79,7 +79,6 @@ - [obj_behaviors.c](#obj_behaviorsc) - [obj_behaviors_2.h](#obj_behaviors_2h) - [object_constants.h](#object_constantsh) - - [enum CoinTypes](#enum-CoinTypes) - [object_list_processor.h](#object_list_processorh) - [enum ObjectList](#enum-ObjectList) - [os_cont.h](#os_conth) @@ -2491,13 +2490,6 @@ - BOBOMB_ACT_EXPLODE - BOBOMB_ACT_LAVA_DEATH - BOBOMB_ACT_DEATH_PLANE_DEATH - -### [enum CoinTypes](#CoinTypes) -| Identifier | Value | -| :--------- | :---- | -| COIN_TYPE_NONE | 0 | -| COIN_TYPE_YELLOW | 1 | -| COIN_TYPE_BLUE | 2 | - HIDDEN_BLUE_COIN_ACT_INACTIVE - HIDDEN_BLUE_COIN_ACT_WAITING - HIDDEN_BLUE_COIN_ACT_ACTIVE diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index 57ba31a92..af00fbdfc 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -3024,14 +3024,14 @@ Sets the current object's hurtbox radius and height Spawns loot coins from an object using the specified behavior, jitter, and model ### Lua Example -`obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model)` +`obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| baseYVel | `number` | +| sp30 | `number` | | coinBehavior | `Pointer` <`BehaviorScript`> | | posJitter | `integer` | | model | `integer` | @@ -3040,7 +3040,7 @@ Spawns loot coins from an object using the specified behavior, jitter, and model - None ### C Prototype -`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);` +`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);` [:arrow_up_small:](#) @@ -3052,21 +3052,21 @@ Spawns loot coins from an object using the specified behavior, jitter, and model Spawns blue loot coins from an object ### Lua Example -`obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter)` +`obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| baseYVel | `number` | +| sp28 | `number` | | posJitter | `integer` | ### Returns - None ### C Prototype -`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter);` +`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter);` [:arrow_up_small:](#) @@ -3078,20 +3078,20 @@ Spawns blue loot coins from an object Spawns yellow loot coins from an object ### Lua Example -`obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel)` +`obj_spawn_loot_yellow_coins(obj, numCoins, sp28)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| baseYVel | `number` | +| sp28 | `number` | ### Returns - None ### C Prototype -`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel);` +`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28);` [:arrow_up_small:](#) @@ -4459,19 +4459,19 @@ Gives the current object a hitbox and kills it if attacked, with optional loot s Explodes the current object, spawns particles, and optionally spawns coins ### Lua Example -`obj_explode_and_spawn_coins(mistSize, coinType)` +`obj_explode_and_spawn_coins(sp18, sp1C)` ### Parameters | Field | Type | | ----- | ---- | -| mistSize | `number` | -| coinType | `integer` | +| sp18 | `number` | +| sp1C | `integer` | ### Returns - None ### C Prototype -`void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType);` +`void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C);` [:arrow_up_small:](#) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 4f137f25e..b0b13daee 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -2189,7 +2189,7 @@ | oCloudFwooshMovementRadius | `integer` | | | oCoinUnkF4 | `integer` | | | oCoinUnkF8 | `integer` | | -| oCoinBaseYVel | `number` | | +| oCoinUnk110 | `number` | | | oCoinUnk1B0 | `integer` | | | oCollisionParticleUnkF4 | `number` | | | oControllablePlatformUnkF8 | `integer` | | diff --git a/include/object_constants.h b/include/object_constants.h index 5be96cc59..720955e83 100644 --- a/include/object_constants.h +++ b/include/object_constants.h @@ -146,13 +146,6 @@ #define BOBOMB_ACT_LAVA_DEATH 100 #define BOBOMB_ACT_DEATH_PLANE_DEATH 101 -/* Coin Type */ -enum CoinTypes { // coinType - COIN_TYPE_NONE, - COIN_TYPE_YELLOW, - COIN_TYPE_BLUE -}; - /* Hidden Blue Coin */ /* oAction */ #define HIDDEN_BLUE_COIN_ACT_INACTIVE 0 diff --git a/include/object_fields.h b/include/object_fields.h index 57332fcc3..fedbe1e91 100644 --- a/include/object_fields.h +++ b/include/object_fields.h @@ -398,11 +398,11 @@ #define /*0x1AC*/ oCloudFwooshMovementRadius OBJECT_FIELD_S16(0x49, 0) /* Coin */ -#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C) -#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22) +#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C) +#define /*0x110*/ oCoinUnk110 OBJECT_FIELD_F32(0x22) #ifndef VERSION_JP -#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A) +#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A) #endif /* Collision Particle */ diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.inc.c index 616111abf..cd78b7d19 100644 --- a/src/game/behaviors/coin.inc.c +++ b/src/game/behaviors/coin.inc.c @@ -50,7 +50,7 @@ void bhv_temp_coin_loop(void) { void bhv_coin_init(void) { rng_position_init(o->oPosX, o->oPosY, o->oPosZ); - o->oVelY = random_float() * 10.0f + 30 + o->oCoinBaseYVel; + o->oVelY = random_float() * 10.0f + 30 + o->oCoinUnk110; o->oForwardVel = random_float() * 10.0f; o->oMoveAngleYaw = random_u16(); rng_position_finish(); diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index e2d663122..43a556ef7 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -2104,7 +2104,7 @@ void cur_obj_set_hurtbox_radius_and_height(f32 radius, f32 height) { } /* |description|Spawns loot coins from an object using the specified behavior, jitter, and model|descriptionEnd| */ -void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model) { +void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model) { if (obj == NULL) { return; } s32 i; f32 spawnHeight; @@ -2127,18 +2127,18 @@ void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const if (coin == NULL) { return; } obj_translate_xz_random(coin, posJitter); coin->oPosY = spawnHeight; - coin->oCoinBaseYVel = baseYVel; + coin->oCoinUnk110 = sp30; } } /* |description|Spawns blue loot coins from an object|descriptionEnd| */ -void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter) { - obj_spawn_loot_coins(obj, numCoins, baseYVel, bhvBlueCoinJumping, posJitter, MODEL_BLUE_COIN); +void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter) { + obj_spawn_loot_coins(obj, numCoins, sp28, bhvBlueCoinJumping, posJitter, MODEL_BLUE_COIN); } /* |description|Spawns yellow loot coins from an object|descriptionEnd| */ -void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel) { - obj_spawn_loot_coins(obj, numCoins, baseYVel, bhvSingleCoinGetsSpawned, 0, MODEL_YELLOW_COIN); +void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28) { + obj_spawn_loot_coins(obj, numCoins, sp28, bhvSingleCoinGetsSpawned, 0, MODEL_YELLOW_COIN); } /* |description|Spawns a yellow coin at Mario's position and decrements the current object's loot count|descriptionEnd| */ @@ -3169,15 +3169,15 @@ s32 cur_obj_set_hitbox_and_die_if_attacked(struct ObjectHitbox *hitbox, s32 deat } /* |description|Explodes the current object, spawns particles, and optionally spawns coins|descriptionEnd| */ -void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType) { +void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C) { if (!o) { return; } - spawn_mist_particles_variable(0, 0, mistSize); + spawn_mist_particles_variable(0, 0, sp18); spawn_triangle_break_particles(30, 138, 3.0f, 4); obj_mark_for_deletion(o); - if (coinType == COIN_TYPE_YELLOW) { + if (sp1C == 1) { obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); - } else if (coinType == COIN_TYPE_BLUE) { + } else if (sp1C == 2) { obj_spawn_loot_blue_coins(o, o->oNumLootCoins, 20.0f, 150); } } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 306a591aa..bd86da1cc 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1802,7 +1802,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oCloudCenterY", LVT_F32, offsetof(struct Object, oCloudCenterY), false, LOT_NONE }, { "oCloudFwooshMovementRadius", LVT_S16, offsetof(struct Object, oCloudFwooshMovementRadius), false, LOT_NONE }, { "oCloudGrowSpeed", LVT_F32, offsetof(struct Object, oCloudGrowSpeed), false, LOT_NONE }, - { "oCoinBaseYVel", LVT_F32, offsetof(struct Object, oCoinBaseYVel), false, LOT_NONE }, + { "oCoinUnk110", LVT_F32, offsetof(struct Object, oCoinUnk110), false, LOT_NONE }, #ifndef VERSION_JP { "oCoinUnk1B0", LVT_S32, offsetof(struct Object, oCoinUnk1B0), false, LOT_NONE }, #endif diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index e1ebcf038..98fa34964 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -2505,9 +2505,6 @@ const char gSmluaConstants[] = "" "BOBOMB_ACT_EXPLODE=3\n" "BOBOMB_ACT_LAVA_DEATH=100\n" "BOBOMB_ACT_DEATH_PLANE_DEATH=101\n" -"COIN_TYPE_NONE=0\n" -"COIN_TYPE_YELLOW=1\n" -"COIN_TYPE_BLUE=2\n" "HIDDEN_BLUE_COIN_ACT_INACTIVE=0\n" "HIDDEN_BLUE_COIN_ACT_WAITING=1\n" "HIDDEN_BLUE_COIN_ACT_ACTIVE=2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 4e6c39f62..1b3bb0e3c 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -28010,7 +28010,7 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_coins"); return 0; } - f32 baseYVel = smlua_to_number(L, 3); + f32 sp30 = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_coins"); return 0; } BehaviorScript * coinBehavior = (BehaviorScript *)smlua_to_cpointer(L, 4, LVT_BEHAVIORSCRIPT_P); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_coins"); return 0; } @@ -28019,8 +28019,8 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { s16 model = smlua_to_integer(L, 6); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_spawn_loot_coins"); return 0; } - extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); - obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model); + extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); + obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model); return 1; } @@ -28038,13 +28038,13 @@ int smlua_func_obj_spawn_loot_blue_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_blue_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_blue_coins"); return 0; } - f32 baseYVel = smlua_to_number(L, 3); + f32 sp28 = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_blue_coins"); return 0; } s16 posJitter = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_blue_coins"); return 0; } - extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter); - obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter); + extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter); + obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter); return 1; } @@ -28062,11 +28062,11 @@ int smlua_func_obj_spawn_loot_yellow_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_yellow_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_yellow_coins"); return 0; } - f32 baseYVel = smlua_to_number(L, 3); + f32 sp28 = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_yellow_coins"); return 0; } - extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel); - obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel); + extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28); + obj_spawn_loot_yellow_coins(obj, numCoins, sp28); return 1; } @@ -29162,13 +29162,13 @@ int smlua_func_obj_explode_and_spawn_coins(lua_State* L) { return 0; } - f32 mistSize = smlua_to_number(L, 1); + f32 sp18 = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_explode_and_spawn_coins"); return 0; } - s32 coinType = smlua_to_integer(L, 2); + s32 sp1C = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_explode_and_spawn_coins"); return 0; } - extern void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType); - obj_explode_and_spawn_coins(mistSize, coinType); + extern void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C); + obj_explode_and_spawn_coins(sp18, sp1C); return 1; }