Allow people to disabled downloaded models (from mods)

This commit is contained in:
MysterD 2022-03-16 22:43:43 -07:00
parent 2804a48e4e
commit 68f3203587
6 changed files with 32 additions and 7 deletions

View File

@ -666,6 +666,7 @@ s32 DynOS_String_Width(const u8 *aStr64);
#ifdef COOP
void DynOS_Geo_AddActorCustom(const SysPath &aPackFolder, const char *aActorName);
const void *DynOS_Geo_GetActorLayoutFromName(const char *aActorName);
bool DynOS_Geo_IsCustomActor(s32 aIndex);
#endif
s32 DynOS_Geo_GetActorCount();

View File

@ -3,6 +3,9 @@ extern "C" {
#include "object_fields.h"
#include "game/level_update.h"
#include "game/object_list_processor.h"
#ifdef COOP
#include "pc/configfile.h"
#endif
}
//
@ -129,8 +132,17 @@ void DynOS_Gfx_Update() {
// Replace the object's model and animations
ActorGfx *_ActorGfx = &DynOS_Gfx_GetActorList()[_ActorIndex];
#ifdef COOP
if (configDisableDownloadedModels && _ActorGfx->mPackIndex == 99) {
extern const GeoLayout error_model_geo[];
s32 actorIndex = DynOS_Geo_IsCustomActor(_ActorIndex) ? DynOS_Geo_GetActorIndex(error_model_geo) : _ActorIndex;
const void* geoLayout = DynOS_Geo_GetActorLayout(actorIndex);
_ActorGfx->mPackIndex = -1;
_ActorGfx->mGfxData = NULL;
_ActorGfx->mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(geoLayout, true);
}
#endif
for (s32 i = 0; i != pDynosPacks.Count(); ++i) {
// If enabled and no pack is selected
// load the pack's model and replace the default actor's model
if (_Enabled[i] && _ActorGfx->mPackIndex == -1) {

View File

@ -380,7 +380,7 @@ void DynOS_Geo_AddActorCustom(const SysPath &aPackFolder, const char *aActorName
// Alloc and init the actors gfx list
Array<ActorGfx> &pActorGfxList = DynOS_Gfx_GetActorList();
pActorGfxList.Resize(DynOS_Geo_GetActorCount());
pActorGfxList[index].mPackIndex = -1;
pActorGfxList[index].mPackIndex = 99;
pActorGfxList[index].mGfxData = _GfxData;
pActorGfxList[index].mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(geoLayout, true);
}
@ -420,6 +420,11 @@ s32 DynOS_Geo_GetActorIndex(const void *aGeoLayout) {
return -1;
}
bool DynOS_Geo_IsCustomActor(s32 aIndex) {
s32 arrayCount = (s32) (sizeof(sDynosActors) / (2 * sizeof(sDynosActors[0])));
return aIndex >= arrayCount;
}
#else // NORMAL DYNOS
s32 DynOS_Geo_GetActorCount() {

View File

@ -113,9 +113,8 @@ bool configCameraMouse = false;
bool configSkipIntro = 0;
bool configShareLives = 0;
bool configEnableCheats = 0;
bool configDisablePopups = 0;
bool configBubbleDeath = true;
unsigned int configAmountofPlayers = 16;
unsigned int configAmountofPlayers = 16;
bool configHUD = true;
#ifdef DISCORDRPC
bool configDiscordRPC = true;
@ -134,6 +133,8 @@ unsigned int configPlayerModel = 0;
unsigned int configPlayerPalette = 0;
unsigned int config60Fps = 1;
unsigned int configDrawDistance = 5;
bool configDisablePopups = 0;
bool configDisableDownloadedModels = 0;
static const struct ConfigOption options[] = {
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
@ -187,7 +188,6 @@ static const struct ConfigOption options[] = {
{.name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade},
#endif
{.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro},
{.name = "enable_popups", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisablePopups},
{.name = "enable_cheats", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCheats},
#ifdef DISCORDRPC
{.name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC},
@ -212,6 +212,8 @@ static const struct ConfigOption options[] = {
{.name = "coop_player_palette", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerPalette},
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar},
{.name = "share_lives", .type = CONFIG_TYPE_BOOL , .boolValue = &configShareLives},
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups},
{.name = "disable_downloaded_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableDownloadedModels},
};
// FunctionConfigOption functions

View File

@ -71,7 +71,6 @@ extern bool configHUD;
extern bool configSkipIntro;
extern bool configShareLives;
extern bool configEnableCheats;
extern bool configDisablePopups;
extern bool configBubbleDeath;
extern unsigned int configAmountofPlayers;
#ifdef DISCORDRPC
@ -90,6 +89,8 @@ extern unsigned int configPlayerModel;
extern unsigned int configPlayerPalette;
extern unsigned int config60Fps;
extern unsigned int configDrawDistance;
extern bool configDisablePopups;
extern bool configDisableDownloadedModels;
void configfile_load(const char *filename);
void configfile_save(const char *filename);

View File

@ -7,7 +7,7 @@ static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) {
}
void djui_panel_display_create(struct DjuiBase* caller) {
f32 bodyHeight = 32 * 7 + 64 * 2 + 16 * 8;
f32 bodyHeight = 32 * 8 + 64 * 2 + 16 * 9;
struct DjuiBase* defaultBase = NULL;
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\I\\#00b3ff\\S\\#ffef00\\P\\#ff0800\\L\\#1be700\\A\\#00b3ff\\Y");
@ -33,6 +33,10 @@ void djui_panel_display_create(struct DjuiBase* caller) {
djui_base_set_size_type(&checkbox5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox5->base, 1.0f, 32);
struct DjuiCheckbox* checkbox6 = djui_checkbox_create(&body->base, "Disable Downloaded Models", &configDisableDownloadedModels);
djui_base_set_size_type(&checkbox6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&checkbox6->base, 1.0f, 32);
char* filterChoices[3] = { "Nearest", "Linear", "Tripoint" };
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Filtering", filterChoices, 3, &configFiltering);
djui_base_set_size_type(&selectionbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);