Add DynOS global player models option

This commit is contained in:
Agent X 2024-03-02 16:36:28 -05:00
parent 396d5c730b
commit 5fc381d616
21 changed files with 91 additions and 3 deletions

View file

@ -7688,6 +7688,14 @@ function obj_set_billboard(obj)
-- ... -- ...
end end
--- @param obj Object
--- @param index integer
--- @param modelID integer
--- @return nil
function obj_set_character_model(obj, index, modelID)
-- ...
end
--- @param obj Object --- @param obj Object
--- @return nil --- @return nil
function obj_set_cylboard(obj) function obj_set_cylboard(obj)

View file

@ -5961,6 +5961,28 @@
<br /> <br />
## [obj_set_character_model](#obj_set_character_model)
### Lua Example
`obj_set_character_model(obj, index, modelID)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| index | `integer` |
| modelID | `integer` |
### Returns
- None
### C Prototype
`void obj_set_character_model(struct Object* obj, u16 index, s32 modelID);`
[:arrow_up_small:](#)
<br />
## [obj_set_cylboard](#obj_set_cylboard) ## [obj_set_cylboard](#obj_set_cylboard)
### Lua Example ### Lua Example

View file

@ -1443,6 +1443,7 @@
- [obj_set_angle](functions-4.md#obj_set_angle) - [obj_set_angle](functions-4.md#obj_set_angle)
- [obj_set_behavior](functions-4.md#obj_set_behavior) - [obj_set_behavior](functions-4.md#obj_set_behavior)
- [obj_set_billboard](functions-4.md#obj_set_billboard) - [obj_set_billboard](functions-4.md#obj_set_billboard)
- [obj_set_character_model](functions-4.md#obj_set_character_model)
- [obj_set_cylboard](functions-4.md#obj_set_cylboard) - [obj_set_cylboard](functions-4.md#obj_set_cylboard)
- [obj_set_face_angle](functions-4.md#obj_set_face_angle) - [obj_set_face_angle](functions-4.md#obj_set_face_angle)
- [obj_set_face_angle_to_move_angle](functions-4.md#obj_set_face_angle_to_move_angle) - [obj_set_face_angle_to_move_angle](functions-4.md#obj_set_face_angle_to_move_angle)

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Výběr souboru"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Globální modely hráčů"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Bestand selecteren"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Globale spelermodellen"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFORMATIE" INFO_TITLE = "INFORMATIE"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "File Select"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Global Player Models"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Sélection de fichier"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Modèles de joueurs mondiaux"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFORMATIONS" INFO_TITLE = "INFORMATIONS"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Dateiauswahl"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Globale Spielermodelle"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -152,6 +152,7 @@ FILE_SELECT_THEME = "Selezione file"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Modelli di giocatore globali"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Wybór Pliku"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Globalne modele graczy"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFORMACJE" INFO_TITLE = "INFORMACJE"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Escolha de arquivo"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Modelos de jogador global"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -153,6 +153,7 @@ FILE_SELECT_THEME = "Выбор файла"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Глобальные модели игроков"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -154,6 +154,7 @@ FILE_SELECT_THEME = "Selección de archivo"
[DYNOS] [DYNOS]
DYNOS = "DYNOS" DYNOS = "DYNOS"
GLOBAL_PLAYER_MODELS = "Modelos de jugador global"
[HOST_MESSAGE] [HOST_MESSAGE]
INFO_TITLE = "INFO" INFO_TITLE = "INFO"

View file

@ -2369,7 +2369,7 @@ void init_single_mario(struct MarioState* m) {
u8 modelIndex = gNetworkPlayers[playerIndex].overrideModelIndex; u8 modelIndex = gNetworkPlayers[playerIndex].overrideModelIndex;
if (modelIndex >= CT_MAX) { modelIndex = 0; } if (modelIndex >= CT_MAX) { modelIndex = 0; }
m->character = &gCharacters[modelIndex]; m->character = &gCharacters[modelIndex];
obj_set_model(m->marioObj, m->character->modelId); obj_set_character_model(m->marioObj, m->playerIndex, m->character->modelId);
} }
void init_mario(void) { void init_mario(void) {

View file

@ -1441,6 +1441,14 @@ void obj_set_model(struct Object* obj, s32 modelID) {
smlua_call_event_hooks_object_model_param(HOOK_OBJECT_SET_MODEL, obj, modelID); smlua_call_event_hooks_object_model_param(HOOK_OBJECT_SET_MODEL, obj, modelID);
} }
void obj_set_character_model(struct Object* obj, u16 index, s32 modelID) {
obj->header.gfx.sharedChild = dynos_model_get_geo(modelID);
if (configGlobalPlayerModels || index == 0) {
dynos_actor_override((void*)&obj->header.gfx.sharedChild);
}
smlua_call_event_hooks_object_model_param(HOOK_OBJECT_SET_MODEL, obj, modelID);
}
void mario_set_flag(s32 flag) { void mario_set_flag(s32 flag) {
gMarioStates[0].flags |= flag; gMarioStates[0].flags |= flag;
} }

View file

@ -175,6 +175,7 @@ void cur_obj_get_thrown_or_placed(f32 forwardVel, f32 velY, s32 thrownAction);
void cur_obj_get_dropped(void); void cur_obj_get_dropped(void);
void cur_obj_set_model(s32 modelID); void cur_obj_set_model(s32 modelID);
void obj_set_model(struct Object* obj, s32 modelID); void obj_set_model(struct Object* obj, s32 modelID);
void obj_set_character_model(struct Object* obj, u16 index, s32 modelID);
void mario_set_flag(s32 flag); void mario_set_flag(s32 flag);
s32 cur_obj_clear_interact_status_flag(s32 flag); s32 cur_obj_clear_interact_status_flag(s32 flag);
void obj_mark_for_deletion(struct Object *obj); void obj_mark_for_deletion(struct Object *obj);

View file

@ -165,6 +165,7 @@ unsigned int configDjuiTheme = DJUI_THEME_DARK;
bool configDjuiThemeCenter = true; bool configDjuiThemeCenter = true;
unsigned int configDjuiScale = 0; unsigned int configDjuiScale = 0;
bool configCoopCompatibility = false; bool configCoopCompatibility = false;
bool configGlobalPlayerModels = true;
char configLastVersion[MAX_CONFIG_STRING] = SM64COOPDX_VERSION; char configLastVersion[MAX_CONFIG_STRING] = SM64COOPDX_VERSION;
static const struct ConfigOption options[] = { static const struct ConfigOption options[] = {
@ -262,6 +263,7 @@ static const struct ConfigOption options[] = {
{.name = "coop_custom_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[CAP]}, {.name = "coop_custom_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[CAP]},
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar}, {.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar},
{.name = "coop_compatibility", .type = CONFIG_TYPE_BOOL , .boolValue = &configCoopCompatibility}, {.name = "coop_compatibility", .type = CONFIG_TYPE_BOOL , .boolValue = &configCoopCompatibility},
{.name = "coopdx_global_player_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configGlobalPlayerModels},
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups},
{.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler},
#ifdef DEVELOPMENT #ifdef DEVELOPMENT

View file

@ -122,6 +122,7 @@ extern unsigned int configDjuiTheme;
extern bool configDjuiThemeCenter; extern bool configDjuiThemeCenter;
extern unsigned int configDjuiScale; extern unsigned int configDjuiScale;
extern bool configCoopCompatibility; extern bool configCoopCompatibility;
extern bool configGlobalPlayerModels;
extern char configLastVersion[]; extern char configLastVersion[];
void enable_queued_mods(); void enable_queued_mods();

View file

@ -14,6 +14,12 @@ static void djui_panel_dynos_apply(struct DjuiBase* caller) {
dynos_pack_set_enabled(caller->tag, caller->bTag); dynos_pack_set_enabled(caller->tag, caller->bTag);
} }
static void djui_panel_dynos_global_player_models(UNUSED struct DjuiBase* caller) {
for (s32 i = 0; i < MAX_PLAYERS; i++) {
network_player_update_model(i);
}
}
static void djui_panel_dynos_refresh(UNUSED struct DjuiBase* base) { static void djui_panel_dynos_refresh(UNUSED struct DjuiBase* base) {
dynos_gfx_init(); dynos_gfx_init();
dynos_packs_init(); dynos_packs_init();
@ -46,6 +52,12 @@ void djui_panel_dynos_create(struct DjuiBase* caller) {
} }
djui_paginated_calculate_height(paginated); djui_paginated_calculate_height(paginated);
struct DjuiRect* space = djui_rect_create(body);
djui_base_set_size_type(&space->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&space->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 32, 1);
djui_base_set_color(&space->base, 220, 220, 220, 255);
djui_checkbox_create(body, DLANG(DYNOS, GLOBAL_PLAYER_MODELS), &configGlobalPlayerModels, djui_panel_dynos_global_player_models);
if (gNetworkType == NT_NONE) { if (gNetworkType == NT_NONE) {
struct DjuiRect* rect1 = djui_rect_container_create(body, 64); struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
{ {
@ -56,7 +68,7 @@ void djui_panel_dynos_create(struct DjuiBase* caller) {
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
panel->bodySize.value = paginated->base.height.value + 16 + 64; panel->bodySize.value = paginated->base.height.value + 16 + 64 + 64;
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -25818,6 +25818,28 @@ int smlua_func_obj_set_billboard(lua_State* L) {
return 1; return 1;
} }
int smlua_func_obj_set_character_model(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_set_character_model", 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_set_character_model"); return 0; }
u16 index = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_set_character_model"); return 0; }
s32 modelID = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_set_character_model"); return 0; }
extern void obj_set_character_model(struct Object* obj, u16 index, s32 modelID);
obj_set_character_model(obj, index, modelID);
return 1;
}
/* /*
int smlua_func_obj_set_collision_data(lua_State* L) { int smlua_func_obj_set_collision_data(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -32855,6 +32877,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "obj_set_angle", smlua_func_obj_set_angle); smlua_bind_function(L, "obj_set_angle", smlua_func_obj_set_angle);
smlua_bind_function(L, "obj_set_behavior", smlua_func_obj_set_behavior); smlua_bind_function(L, "obj_set_behavior", smlua_func_obj_set_behavior);
smlua_bind_function(L, "obj_set_billboard", smlua_func_obj_set_billboard); smlua_bind_function(L, "obj_set_billboard", smlua_func_obj_set_billboard);
smlua_bind_function(L, "obj_set_character_model", smlua_func_obj_set_character_model);
//smlua_bind_function(L, "obj_set_collision_data", smlua_func_obj_set_collision_data); <--- UNIMPLEMENTED //smlua_bind_function(L, "obj_set_collision_data", smlua_func_obj_set_collision_data); <--- UNIMPLEMENTED
smlua_bind_function(L, "obj_set_cylboard", smlua_func_obj_set_cylboard); smlua_bind_function(L, "obj_set_cylboard", smlua_func_obj_set_cylboard);
smlua_bind_function(L, "obj_set_face_angle", smlua_func_obj_set_face_angle); smlua_bind_function(L, "obj_set_face_angle", smlua_func_obj_set_face_angle);

View file

@ -39,7 +39,7 @@ void network_player_update_model(u8 localIndex) {
m->character = &gCharacters[index]; m->character = &gCharacters[index];
if (m->marioObj == NULL) { return; } if (m->marioObj == NULL) { return; }
obj_set_model(m->marioObj, m->character->modelId); obj_set_character_model(m->marioObj, m->playerIndex, m->character->modelId);
} }
bool network_player_any_connected(void) { bool network_player_any_connected(void) {