mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Added dynos model packs to djui interface
This commit is contained in:
parent
f92857704d
commit
403a90e82b
11 changed files with 100 additions and 7 deletions
|
|
@ -637,6 +637,9 @@ u8 *DynOS_Gfx_TextureConvertToRGBA32(const u8 *aData, u64 aLength, s32 aFormat,
|
||||||
bool DynOS_Gfx_ImportTexture(void **aOutput, void *aPtr, s32 aTile, void *aGfxRApi, void **aHashMap, void *aPool, u32 *aPoolPos, u32 aPoolSize);
|
bool DynOS_Gfx_ImportTexture(void **aOutput, void *aPtr, s32 aTile, void *aGfxRApi, void **aHashMap, void *aPool, u32 *aPoolPos, u32 aPoolSize);
|
||||||
Array<ActorGfx> &DynOS_Gfx_GetActorList();
|
Array<ActorGfx> &DynOS_Gfx_GetActorList();
|
||||||
Array<PackData *> &DynOS_Gfx_GetPacks();
|
Array<PackData *> &DynOS_Gfx_GetPacks();
|
||||||
|
#ifdef COOP
|
||||||
|
Array<bool> &DynOS_Gfx_GetPacksEnabled();
|
||||||
|
#endif
|
||||||
Array<String> DynOS_Gfx_Init();
|
Array<String> DynOS_Gfx_Init();
|
||||||
void DynOS_Gfx_Update();
|
void DynOS_Gfx_Update();
|
||||||
void DynOS_Gfx_SwapAnimations(void *aPtr);
|
void DynOS_Gfx_SwapAnimations(void *aPtr);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
bool dynos_warp_to_level(s32 aLevel, s32 aArea, s32 aAct);
|
bool dynos_warp_to_level(s32 aLevel, s32 aArea, s32 aAct);
|
||||||
|
|
||||||
|
int dynos_packs_get_count(void);
|
||||||
|
const char* dynos_packs_get(s32 index);
|
||||||
|
bool dynos_packs_get_enabled(s32 index);
|
||||||
|
void dynos_packs_set_enabled(s32 index, bool value);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,32 @@
|
||||||
#ifdef COOP
|
#ifdef COOP
|
||||||
#include "dynos.cpp.h"
|
#include "dynos.cpp.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
bool dynos_warp_to_level(s32 aLevel, s32 aArea, s32 aAct) {
|
bool dynos_warp_to_level(s32 aLevel, s32 aArea, s32 aAct) {
|
||||||
return DynOS_Warp_ToLevel(aLevel, aArea, aAct);
|
return DynOS_Warp_ToLevel(aLevel, aArea, aAct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -- dynos packs -- //
|
||||||
|
|
||||||
|
#define DYNOS_PACK_PATH_SPLIT_LEN 12
|
||||||
|
|
||||||
|
int dynos_packs_get_count(void) {
|
||||||
|
return DynOS_Gfx_GetPacks().Count();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* dynos_packs_get(s32 index) {
|
||||||
|
std::string path = DynOS_Gfx_GetPacks()[index]->mPath;
|
||||||
|
return path.substr(path.find(DYNOS_PACKS_FOLDER) + DYNOS_PACK_PATH_SPLIT_LEN).c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dynos_packs_get_enabled(s32 index) {
|
||||||
|
return DynOS_Gfx_GetPacksEnabled()[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
void dynos_packs_set_enabled(s32 index, bool value) {
|
||||||
|
DynOS_Gfx_GetPacksEnabled()[index] = value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,13 @@ Array<PackData *> &DynOS_Gfx_GetPacks() {
|
||||||
return sPacks;
|
return sPacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COOP
|
||||||
|
Array<bool> &DynOS_Gfx_GetPacksEnabled() {
|
||||||
|
static Array<bool> sPacksEnabled;
|
||||||
|
return sPacksEnabled;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Array<String> DynOS_Gfx_Init() {
|
Array<String> DynOS_Gfx_Init() {
|
||||||
|
|
||||||
// Alloc and init the actors gfx list
|
// Alloc and init the actors gfx list
|
||||||
|
|
|
||||||
|
|
@ -103,16 +103,19 @@ void DynOS_Gfx_Update() {
|
||||||
if (gObjectLists) {
|
if (gObjectLists) {
|
||||||
|
|
||||||
// Check packs
|
// Check packs
|
||||||
|
#ifdef COOP
|
||||||
|
Array<bool> &_Enabled = DynOS_Gfx_GetPacksEnabled();
|
||||||
|
const Array<PackData *> &pDynosPacks = DynOS_Gfx_GetPacks();
|
||||||
|
while (_Enabled.Count() < pDynosPacks.Count()) {
|
||||||
|
_Enabled.Add(true);
|
||||||
|
}
|
||||||
|
#else
|
||||||
Array<bool> _Enabled;
|
Array<bool> _Enabled;
|
||||||
const Array<PackData *> &pDynosPacks = DynOS_Gfx_GetPacks();
|
const Array<PackData *> &pDynosPacks = DynOS_Gfx_GetPacks();
|
||||||
for (s32 i = 0; i != pDynosPacks.Count(); ++i) {
|
for (s32 i = 0; i != pDynosPacks.Count(); ++i) {
|
||||||
#ifdef COOP
|
|
||||||
// TODO: needs to be adjusted from djui
|
|
||||||
_Enabled.Add(true);
|
|
||||||
#else
|
|
||||||
_Enabled.Add(DynOS_Opt_GetValue(String("dynos_pack_%d", i)));
|
_Enabled.Add(DynOS_Opt_GetValue(String("dynos_pack_%d", i)));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Loop through all object lists
|
// Loop through all object lists
|
||||||
for (s32 list : { OBJ_LIST_PLAYER, OBJ_LIST_DESTRUCTIVE, OBJ_LIST_GENACTOR, OBJ_LIST_PUSHABLE, OBJ_LIST_LEVEL, OBJ_LIST_DEFAULT, OBJ_LIST_SURFACE, OBJ_LIST_POLELIKE, OBJ_LIST_UNIMPORTANT }) {
|
for (s32 list : { OBJ_LIST_PLAYER, OBJ_LIST_DESTRUCTIVE, OBJ_LIST_GENACTOR, OBJ_LIST_PUSHABLE, OBJ_LIST_LEVEL, OBJ_LIST_DEFAULT, OBJ_LIST_SURFACE, OBJ_LIST_POLELIKE, OBJ_LIST_UNIMPORTANT }) {
|
||||||
|
|
|
||||||
|
|
@ -643,10 +643,10 @@ void DynOS_Opt_Init() {
|
||||||
|
|
||||||
// Model loader
|
// Model loader
|
||||||
DynOS_Opt_CreateModelPacksSubMenu();
|
DynOS_Opt_CreateModelPacksSubMenu();
|
||||||
#endif
|
|
||||||
|
|
||||||
// Init config
|
// Init config
|
||||||
DynOS_Opt_LoadConfig(sDynosMenu);
|
DynOS_Opt_LoadConfig(sDynosMenu);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
#include "djui_panel_controls_n64.h"
|
#include "djui_panel_controls_n64.h"
|
||||||
#include "djui_panel_controls_extra.h"
|
#include "djui_panel_controls_extra.h"
|
||||||
#include "djui_panel_display.h"
|
#include "djui_panel_display.h"
|
||||||
|
#include "djui_panel_dynos.h"
|
||||||
#include "djui_panel_sound.h"
|
#include "djui_panel_sound.h"
|
||||||
#include "djui_panel_confirm.h"
|
#include "djui_panel_confirm.h"
|
||||||
#include "djui_panel_cheats.h"
|
#include "djui_panel_cheats.h"
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ struct DjuiBase {
|
||||||
bool addChildrenToHead;
|
bool addChildrenToHead;
|
||||||
bool abandonAfterChildRenderFail;
|
bool abandonAfterChildRenderFail;
|
||||||
s32 tag;
|
s32 tag;
|
||||||
|
bool bTag;
|
||||||
void (*get_cursor_hover_location)(struct DjuiBase*, f32* x, f32* y);
|
void (*get_cursor_hover_location)(struct DjuiBase*, f32* x, f32* y);
|
||||||
void (*on_child_render)(struct DjuiBase*, struct DjuiBase*);
|
void (*on_child_render)(struct DjuiBase*, struct DjuiBase*);
|
||||||
void (*on_render_pre)(struct DjuiBase*, bool*);
|
void (*on_render_pre)(struct DjuiBase*, bool*);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_panel_display_create(struct DjuiBase* caller) {
|
void djui_panel_display_create(struct DjuiBase* caller) {
|
||||||
f32 bodyHeight = 32 * 7 + 64 * 1 + 16 * 6;
|
f32 bodyHeight = 32 * 7 + 64 * 2 + 16 * 7;
|
||||||
|
|
||||||
struct DjuiBase* defaultBase = NULL;
|
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");
|
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\I\\#00b3ff\\S\\#ffef00\\P\\#ff0800\\L\\#1be700\\A\\#00b3ff\\Y");
|
||||||
|
|
@ -44,6 +44,11 @@ void djui_panel_display_create(struct DjuiBase* caller) {
|
||||||
djui_base_set_size_type(&selectionbox3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
djui_base_set_size_type(&selectionbox3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
djui_base_set_size(&selectionbox3->base, 1.0f, 32);
|
djui_base_set_size(&selectionbox3->base, 1.0f, 32);
|
||||||
|
|
||||||
|
struct DjuiButton* button5 = djui_button_create(&body->base, "DynOS Model Packs");
|
||||||
|
djui_base_set_size_type(&button5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
|
djui_base_set_size(&button5->base, 1.0f, 64);
|
||||||
|
djui_interactable_hook_click(&button5->base, djui_panel_dynos_create);
|
||||||
|
|
||||||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||||
|
|
|
||||||
42
src/pc/djui/djui_panel_dynos.c
Normal file
42
src/pc/djui/djui_panel_dynos.c
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include "djui.h"
|
||||||
|
#include "src/pc/utils/misc.h"
|
||||||
|
#include "src/pc/configfile.h"
|
||||||
|
#include "data/dynos_coop.c.h"
|
||||||
|
|
||||||
|
static void djui_panel_dynos_apply(struct DjuiBase* caller) {
|
||||||
|
dynos_packs_set_enabled(caller->tag, caller->bTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void djui_panel_dynos_create(struct DjuiBase* caller) {
|
||||||
|
int packCount = dynos_packs_get_count();
|
||||||
|
f32 bodyHeight = 32 * (packCount) + 64 * 1 + 16 * (packCount + 1);
|
||||||
|
|
||||||
|
struct DjuiBase* defaultBase = NULL;
|
||||||
|
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\Y\\#00b3ff\\N\\#ffef00\\O\\#ff0800\\S");
|
||||||
|
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||||
|
|
||||||
|
{
|
||||||
|
for (int i = 0; i < packCount; i++) {
|
||||||
|
bool tmp = dynos_packs_get_enabled(i);
|
||||||
|
const char* pack = dynos_packs_get(i);
|
||||||
|
|
||||||
|
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, pack, &tmp);
|
||||||
|
checkbox1->base.tag = i;
|
||||||
|
checkbox1->base.bTag = tmp;
|
||||||
|
checkbox1->value = &checkbox1->base.bTag;
|
||||||
|
|
||||||
|
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
|
djui_base_set_size(&checkbox1->base, 1.0f, 32);
|
||||||
|
djui_interactable_hook_value_change(&checkbox1->base, djui_panel_dynos_apply);
|
||||||
|
if (i == 0) { defaultBase = &checkbox1->base; }
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||||
|
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
|
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||||
|
djui_button_set_style(button6, 1);
|
||||||
|
djui_interactable_hook_click(&button6->base, djui_panel_menu_back);
|
||||||
|
}
|
||||||
|
|
||||||
|
djui_panel_add(caller, &panel->base, defaultBase);
|
||||||
|
}
|
||||||
4
src/pc/djui/djui_panel_dynos.h
Normal file
4
src/pc/djui/djui_panel_dynos.h
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#pragma once
|
||||||
|
#include "djui.h"
|
||||||
|
|
||||||
|
void djui_panel_dynos_create(struct DjuiBase* caller);
|
||||||
Loading…
Add table
Reference in a new issue