mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-26 20:11:42 +00:00
some fixes for dynos, and a crash fix (#1040)
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
This commit is contained in:
parent
4ed1c878bb
commit
39d351d753
12 changed files with 179 additions and 157 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#ifdef __cplusplus
|
||||
|
||||
#include "dynos.h"
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include "engine/behavior_script.h"
|
||||
|
|
@ -158,6 +159,9 @@ public:
|
|||
|
||||
template <typename T>
|
||||
T *Read(T *aBuffer, s32 aCount) const {
|
||||
if (aCount <= 0 || aBuffer == NULL) {
|
||||
return aBuffer;
|
||||
}
|
||||
if (mOffset + aCount * sizeof(T) <= mSize) {
|
||||
memcpy(aBuffer, mData + mOffset, aCount * sizeof(T));
|
||||
mOffset += aCount * sizeof(T);
|
||||
|
|
@ -176,6 +180,9 @@ public:
|
|||
|
||||
template <typename T>
|
||||
void Write(const T *aBuffer, s32 aCount) {
|
||||
if (aCount <= 0 || aBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
if (!mReadOnly) {
|
||||
Grow(mOffset + aCount * sizeof(T));
|
||||
memcpy(mData + mOffset, aBuffer, aCount * sizeof(T));
|
||||
|
|
@ -304,6 +311,10 @@ public:
|
|||
public:
|
||||
void Read(BinFile *aFile) {
|
||||
s32 _Length = aFile->Read<s32>();
|
||||
if (_Length <= 0) {
|
||||
Resize(0);
|
||||
return;
|
||||
}
|
||||
Resize(_Length);
|
||||
aFile->Read<T>(mBuffer, _Length);
|
||||
}
|
||||
|
|
@ -597,8 +608,8 @@ struct PackData {
|
|||
bool mEnabled;
|
||||
SysPath mPath;
|
||||
String mDisplayName;
|
||||
Array<Pair<const char *, GfxData *>> mGfxData;
|
||||
Array<DataNode<TexData>*> mTextures;
|
||||
std::vector<std::pair<std::string, GfxData *>> mGfxData;
|
||||
std::vector<DataNode<TexData>*> mTextures;
|
||||
bool mLoaded;
|
||||
};
|
||||
|
||||
|
|
@ -878,7 +889,7 @@ void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled);
|
|||
PackData* DynOS_Pack_GetFromIndex(s32 aIndex);
|
||||
PackData* DynOS_Pack_GetFromPath(const SysPath& aPath);
|
||||
PackData* DynOS_Pack_Add(const SysPath& aPath);
|
||||
Pair<const char *, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName);
|
||||
std::pair<std::string, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName);
|
||||
void DynOS_Pack_AddActor(PackData* aPackData, const char* aActorName, GfxData* aGfxData);
|
||||
DataNode<TexData>* DynOS_Pack_GetTex(PackData* aPackData, const char* aTexName);
|
||||
void DynOS_Pack_AddTex(PackData* aPackData, DataNode<TexData>* aTexData);
|
||||
|
|
@ -927,7 +938,7 @@ void DynOS_Tex_ModShutdown();
|
|||
// Lvl Manager
|
||||
//
|
||||
|
||||
Array<Pair<const char*, GfxData*>> &DynOS_Lvl_GetArray();
|
||||
std::vector<std::pair<std::string, GfxData *>> &DynOS_Lvl_GetArray();
|
||||
LevelScript* DynOS_Lvl_GetScript(const char* aScriptEntryName);
|
||||
void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilePath, const char *aLevelName);
|
||||
GfxData* DynOS_Lvl_GetActiveGfx(void);
|
||||
|
|
@ -942,7 +953,7 @@ void DynOS_Lvl_ModShutdown();
|
|||
// Bhv Manager
|
||||
//
|
||||
|
||||
Array<Pair<const char *, GfxData *>> &DynOS_Bhv_GetArray();
|
||||
std::vector<std::pair<std::string, GfxData *>> &DynOS_Bhv_GetArray();
|
||||
void DynOS_Bhv_Activate(s32 modIndex, const SysPath &aFilename, const char *aBehaviorName);
|
||||
GfxData *DynOS_Bhv_GetActiveGfx(BehaviorScript *bhvScript);
|
||||
bool DynOS_Bhv_GetActiveModIndex(BehaviorScript *bhvScript, s32 *modIndex, s32 *modFileIndex);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ typedef Pair<String, u32> PointerData;
|
|||
static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
||||
// Lights
|
||||
for (auto& _Node : aGfxData->mLights) {
|
||||
if (!_Node->mData) { continue; }
|
||||
if (&_Node->mData->l[0] == aPtr) { // Light *, not Lights1 *
|
||||
return { _Node->mName, 1 };
|
||||
}
|
||||
|
|
@ -23,6 +24,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
|
||||
// Light0s
|
||||
for (auto& _Node : aGfxData->mLight0s) {
|
||||
if (!_Node->mData) { continue; }
|
||||
if (&_Node->mData->l[0] == aPtr) { // Light *, not Lights1 *
|
||||
return { _Node->mName, 1 };
|
||||
}
|
||||
|
|
@ -33,6 +35,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
|
||||
// Light_ts
|
||||
for (auto& _Node : aGfxData->mLightTs) {
|
||||
if (!_Node->mData) { continue; }
|
||||
if (&_Node->mData->col[0] == aPtr) {
|
||||
return { _Node->mName, 1 };
|
||||
}
|
||||
|
|
@ -46,6 +49,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
|
||||
// Ambient_ts
|
||||
for (auto& _Node : aGfxData->mAmbientTs) {
|
||||
if (!_Node->mData) { continue; }
|
||||
if (&_Node->mData->col[0] == aPtr) {
|
||||
return { _Node->mName, 1 };
|
||||
}
|
||||
|
|
@ -81,7 +85,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
return { _Node->mName, 0 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Collisions
|
||||
for (auto& _Node : aGfxData->mCollisions) {
|
||||
if (_Node->mData == aPtr) {
|
||||
|
|
@ -153,7 +157,7 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
if (builtinCol != NULL) {
|
||||
return { builtinCol, 0 };
|
||||
}
|
||||
|
||||
|
||||
// Built-in Animations
|
||||
auto builtinAnim = DynOS_Builtin_Anim_GetFromData((const Animation *)aPtr);
|
||||
if (builtinAnim != NULL) {
|
||||
|
|
@ -360,7 +364,7 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
|
|||
return (void *) (_Node->mData + aPtrData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Behavior scripts
|
||||
for (auto &_Node : aGfxData->mBehaviorScripts) {
|
||||
if (_Node->mName == aPtrName) {
|
||||
|
|
@ -432,7 +436,7 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
|
|||
if (builtinCol != NULL) {
|
||||
return (void*)builtinCol;
|
||||
}
|
||||
|
||||
|
||||
// Built-in Animations
|
||||
auto builtinAnim = DynOS_Builtin_Anim_GetFromName(aPtrName.begin());
|
||||
if (builtinAnim != NULL) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ static s32 sDynosCustomLevelSlot[LEVEL_UNKNOWN_2 + 1] = { 0 };
|
|||
|
||||
u64 DynOS_Level_CmdGet(void *aCmd, u64 aOffset) {
|
||||
u64 _Offset = (((aOffset) & 3llu) | (((aOffset) & ~3llu) << (sizeof(void *) >> 3llu)));
|
||||
return *((u64 *) (u64(aCmd) + _Offset));
|
||||
u64 value = 0;
|
||||
memcpy(&value, (void *) ((uintptr_t) aCmd + _Offset), sizeof(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
LvlCmd *DynOS_Level_CmdNext(LvlCmd *aCmd) {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ static std::map<const void*, ActorGfx>& DynosValidActors() {
|
|||
return sDynosValidActors;
|
||||
}
|
||||
|
||||
static Array<Pair<const char*, void *>>& DynosCustomActors() {
|
||||
static Array<Pair<const char*, void *>> sDynosCustomActors;
|
||||
static std::vector<std::pair<std::string, void *>> &DynosCustomActors() {
|
||||
static std::vector<std::pair<std::string, void *>> sDynosCustomActors;
|
||||
return sDynosCustomActors;
|
||||
}
|
||||
|
||||
|
|
@ -35,14 +35,11 @@ std::map<const void *, ActorGfx> &DynOS_Actor_GetValidActors() {
|
|||
bool DynOS_Actor_AddCustom(s32 aModIndex, s32 aModFileIndex, const SysPath &aFilename, const char *aActorName) {
|
||||
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
|
||||
|
||||
u16 actorLen = strlen(aActorName);
|
||||
char* actorName = (char*)calloc(1, sizeof(char) * (actorLen + 1));
|
||||
strcpy(actorName, aActorName);
|
||||
std::string actorName = aActorName;
|
||||
|
||||
GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename, false);
|
||||
GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName.c_str(), aFilename, false);
|
||||
if (!_GfxData) {
|
||||
PrintError(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName, aFilename.c_str());
|
||||
free(actorName);
|
||||
PrintError(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName.c_str(), aFilename.c_str());
|
||||
return false;
|
||||
}
|
||||
_GfxData->mModIndex = aModIndex;
|
||||
|
|
@ -50,8 +47,7 @@ bool DynOS_Actor_AddCustom(s32 aModIndex, s32 aModFileIndex, const SysPath &aFil
|
|||
|
||||
void* geoLayout = (*(_GfxData->mGeoLayouts.end() - 1))->mData;
|
||||
if (!geoLayout) {
|
||||
PrintError(" ERROR: Couldn't load geo layout for \"%s\"", actorName);
|
||||
free(actorName);
|
||||
PrintError(" ERROR: Couldn't load geo layout for \"%s\"", actorName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -62,21 +58,19 @@ bool DynOS_Actor_AddCustom(s32 aModIndex, s32 aModFileIndex, const SysPath &aFil
|
|||
actorGfx.mPackIndex = MOD_PACK_INDEX;
|
||||
actorGfx.mGraphNode = (GraphNode *) DynOS_Model_LoadGeo(&id, MODEL_POOL_SESSION, geoLayout, true);
|
||||
if (!actorGfx.mGraphNode) {
|
||||
PrintError(" ERROR: Couldn't load graph node for \"%s\"", actorName);
|
||||
free(actorName);
|
||||
PrintError(" ERROR: Couldn't load graph node for \"%s\"", actorName.c_str());
|
||||
return false;
|
||||
}
|
||||
actorGfx.mGraphNode->georef = georef;
|
||||
|
||||
// Add to custom actors
|
||||
if (georef == NULL) {
|
||||
DynosCustomActors().Add({ strdup(actorName), geoLayout });
|
||||
DynosCustomActors().emplace_back(actorName, geoLayout);
|
||||
georef = geoLayout;
|
||||
}
|
||||
|
||||
// Add to list
|
||||
DynOS_Actor_Valid(georef, actorGfx);
|
||||
free(actorName);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +89,7 @@ const void *DynOS_Actor_GetLayoutFromName(const char *aActorName) {
|
|||
|
||||
// check custom actors
|
||||
for (auto& pair : DynosCustomActors()) {
|
||||
if (!strcmp(aActorName, pair.first)) {
|
||||
if (pair.first == aActorName) {
|
||||
return pair.second;
|
||||
}
|
||||
}
|
||||
|
|
@ -297,12 +291,10 @@ void DynOS_Actor_RegisterModifiedGraphNode(GraphNode *aNode) {
|
|||
|
||||
void DynOS_Actor_ModShutdown() {
|
||||
auto& _DynosCustomActors = DynosCustomActors();
|
||||
while (_DynosCustomActors.Count() > 0) {
|
||||
auto& pair = _DynosCustomActors[0];
|
||||
for (auto &pair : _DynosCustomActors) {
|
||||
DynOS_Actor_Invalid(pair.second, MOD_PACK_INDEX);
|
||||
free((void*)pair.first);
|
||||
_DynosCustomActors.Remove(0);
|
||||
}
|
||||
_DynosCustomActors.clear();
|
||||
|
||||
auto& _ValidActors = DynosValidActors();
|
||||
for (auto it = _ValidActors.cbegin(); it != _ValidActors.cend();) {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ extern "C" {
|
|||
#include "pc/lua/smlua_hooks.h"
|
||||
}
|
||||
|
||||
Array<Pair<const char *, GfxData *>> &DynOS_Bhv_GetArray() {
|
||||
static Array<Pair<const char *, GfxData *>> sDynosCustomBehaviorScripts;
|
||||
std::vector<std::pair<std::string, GfxData *>> &DynOS_Bhv_GetArray() {
|
||||
static std::vector<std::pair<std::string, GfxData *>> sDynosCustomBehaviorScripts;
|
||||
return sDynosCustomBehaviorScripts;
|
||||
}
|
||||
|
||||
|
|
@ -15,44 +15,37 @@ void DynOS_Bhv_Activate(s32 modIndex, const SysPath &aFilename, const char *aBeh
|
|||
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
|
||||
|
||||
// check for duplicates
|
||||
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
|
||||
if (!strcmp(_CustomBehaviorScripts[i].first, aBehaviorName)) {
|
||||
for (auto &behavior : _CustomBehaviorScripts) {
|
||||
if (behavior.first == aBehaviorName) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
u16 behaviorLen = strlen(aBehaviorName);
|
||||
char *behaviorName = (char *)calloc(1, sizeof(char) * (behaviorLen + 1));
|
||||
strcpy(behaviorName, aBehaviorName);
|
||||
std::string behaviorName = aBehaviorName;
|
||||
|
||||
GfxData *_Node = DynOS_Bhv_LoadFromBinary(aFilename, behaviorName);
|
||||
if (!_Node) {
|
||||
free(behaviorName);
|
||||
return;
|
||||
}
|
||||
GfxData *_Node = DynOS_Bhv_LoadFromBinary(aFilename, behaviorName.c_str());
|
||||
if (!_Node) { return; }
|
||||
|
||||
// Remember index
|
||||
_Node->mModIndex = modIndex;
|
||||
|
||||
// Add to behaviors
|
||||
_CustomBehaviorScripts.Add({ behaviorName, _Node });
|
||||
_CustomBehaviorScripts.emplace_back(behaviorName, _Node);
|
||||
}
|
||||
|
||||
void DynOS_Bhv_ModShutdown() {
|
||||
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
|
||||
while (_CustomBehaviorScripts.Count() > 0) {
|
||||
auto &pair = _CustomBehaviorScripts[0];
|
||||
for (auto &pair : _CustomBehaviorScripts) {
|
||||
Delete(pair.second);
|
||||
free((void *)pair.first);
|
||||
_CustomBehaviorScripts.Remove(0);
|
||||
}
|
||||
_CustomBehaviorScripts.clear();
|
||||
}
|
||||
|
||||
GfxData *DynOS_Bhv_GetActiveGfx(BehaviorScript *bhvScript) {
|
||||
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
|
||||
|
||||
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
|
||||
auto &gfxData = _CustomBehaviorScripts[i].second;
|
||||
for (auto &behavior : _CustomBehaviorScripts) {
|
||||
auto &gfxData = behavior.second;
|
||||
auto &scripts = gfxData->mBehaviorScripts;
|
||||
if (scripts.Count() == 0) { continue; }
|
||||
if (bhvScript == scripts[scripts.Count() - 1]->mData) {
|
||||
|
|
@ -65,8 +58,8 @@ GfxData *DynOS_Bhv_GetActiveGfx(BehaviorScript *bhvScript) {
|
|||
bool DynOS_Bhv_GetActiveModIndex(BehaviorScript *bhvScript, s32 *modIndex, s32 *modFileIndex) {
|
||||
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
|
||||
|
||||
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
|
||||
auto &gfxData = _CustomBehaviorScripts[i].second;
|
||||
for (auto &behavior : _CustomBehaviorScripts) {
|
||||
auto &gfxData = behavior.second;
|
||||
auto &scripts = gfxData->mBehaviorScripts;
|
||||
if (scripts.Count() == 0) { continue; }
|
||||
if (bhvScript == scripts[scripts.Count() - 1]->mData) {
|
||||
|
|
@ -97,17 +90,17 @@ const char *DynOS_Bhv_GetToken(BehaviorScript *bhvScript, u32 index) {
|
|||
void DynOS_Bhv_HookAllCustomBehaviors() {
|
||||
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
|
||||
|
||||
for (s32 i = 0; i < _CustomBehaviorScripts.Count(); ++i) {
|
||||
auto &scriptName = _CustomBehaviorScripts[i].first;
|
||||
auto &aGfxData = _CustomBehaviorScripts[i].second;
|
||||
for (auto &behavior : _CustomBehaviorScripts) {
|
||||
auto &scriptName = behavior.first;
|
||||
auto &aGfxData = behavior.second;
|
||||
if (aGfxData->mBehaviorScripts.Count() == 0) { continue; }
|
||||
auto *node = aGfxData->mBehaviorScripts[aGfxData->mBehaviorScripts.Count() - 1];
|
||||
if (node == nullptr) { continue; }
|
||||
auto &script = node->mData;
|
||||
|
||||
// Theres currently no better place but to do this here.
|
||||
if (smlua_hook_custom_bhv(script, scriptName) == 0) {
|
||||
PrintDataError(" ERROR: Failed to add custom behavior '%s'!", scriptName);
|
||||
if (smlua_hook_custom_bhv(script, scriptName.c_str()) == 0) {
|
||||
PrintDataError(" ERROR: Failed to add custom behavior '%s'!", scriptName.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ extern "C" {
|
|||
#include "pc/mods/mod_fs.h"
|
||||
}
|
||||
|
||||
static Array<Pair<const char*, DataNode<Collision>*>>& DynosCollisions() {
|
||||
static Array<Pair<const char*, DataNode<Collision>*>> sDynosCollisions;
|
||||
static std::vector<std::pair<std::string, DataNode<Collision>*>> &DynosCollisions() {
|
||||
static std::vector<std::pair<std::string, DataNode<Collision>*>> sDynosCollisions;
|
||||
return sDynosCollisions;
|
||||
}
|
||||
|
||||
|
|
@ -13,26 +13,18 @@ bool DynOS_Col_Activate(const SysPath &aFilename, const char *aCollisionName) {
|
|||
auto& _DynosCollisions = DynosCollisions();
|
||||
|
||||
// check for duplicates
|
||||
for (s32 i = 0; i < _DynosCollisions.Count(); ++i) {
|
||||
if (!strcmp(_DynosCollisions[i].first, aCollisionName)) {
|
||||
for (auto &collision : _DynosCollisions) {
|
||||
if (collision.first == aCollisionName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate name
|
||||
u16 collisionLen = strlen(aCollisionName);
|
||||
char* collisionName = (char*)calloc(1, sizeof(char) * (collisionLen + 1));
|
||||
strcpy(collisionName, aCollisionName);
|
||||
|
||||
// Load
|
||||
DataNode<Collision>* _Node = DynOS_Col_LoadFromBinary(aFilename, collisionName);
|
||||
if (!_Node) {
|
||||
free(collisionName);
|
||||
return false;
|
||||
}
|
||||
DataNode<Collision>* _Node = DynOS_Col_LoadFromBinary(aFilename, aCollisionName);
|
||||
if (!_Node) { return false; }
|
||||
|
||||
// Add to collisions
|
||||
_DynosCollisions.Add({ collisionName, _Node });
|
||||
_DynosCollisions.emplace_back(aCollisionName, _Node);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -50,9 +42,9 @@ Collision* DynOS_Col_Get(const char* collisionName) {
|
|||
}
|
||||
|
||||
// check mod actor collisions
|
||||
for (s32 i = 0; i < _DynosCollisions.Count(); ++i) {
|
||||
if (!strcmp(_DynosCollisions[i].first, collisionName)) {
|
||||
return _DynosCollisions[i].second->mData;
|
||||
for (auto &collision : _DynosCollisions) {
|
||||
if (collision.first == collisionName) {
|
||||
return collision.second->mData;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,10 +61,8 @@ Collision* DynOS_Col_Get(const char* collisionName) {
|
|||
|
||||
void DynOS_Col_ModShutdown() {
|
||||
auto& _DynosCollisions = DynosCollisions();
|
||||
while (_DynosCollisions.Count() > 0) {
|
||||
auto& pair = _DynosCollisions[0];
|
||||
free((void*)pair.first);
|
||||
for (auto &pair : _DynosCollisions) {
|
||||
Delete(pair.second);
|
||||
_DynosCollisions.Remove(0);
|
||||
}
|
||||
_DynosCollisions.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,26 +6,26 @@ extern "C" {
|
|||
}
|
||||
|
||||
struct OverrideLevelScript {
|
||||
const void* originalScript;
|
||||
const void* newScript;
|
||||
GfxData* gfxData;
|
||||
const void *originalScript;
|
||||
const void *newScript;
|
||||
GfxData *gfxData;
|
||||
};
|
||||
|
||||
static Array<struct OverrideLevelScript>& DynosOverrideLevelScripts() {
|
||||
static Array<struct OverrideLevelScript> sDynosOverrideLevelScripts;
|
||||
static std::vector<OverrideLevelScript> &DynosOverrideLevelScripts() {
|
||||
static std::vector<OverrideLevelScript> sDynosOverrideLevelScripts;
|
||||
return sDynosOverrideLevelScripts;
|
||||
}
|
||||
|
||||
Array<Pair<const char*, GfxData*>> &DynOS_Lvl_GetArray() {
|
||||
static Array<Pair<const char*, GfxData*>> sDynosCustomLevelScripts;
|
||||
std::vector<std::pair<std::string, GfxData *>> &DynOS_Lvl_GetArray() {
|
||||
static std::vector<std::pair<std::string, GfxData *>> sDynosCustomLevelScripts;
|
||||
return sDynosCustomLevelScripts;
|
||||
}
|
||||
|
||||
LevelScript* DynOS_Lvl_GetScript(const char* aScriptEntryName) {
|
||||
auto& _CustomLevelScripts = DynOS_Lvl_GetArray();
|
||||
for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) {
|
||||
for (size_t i = 0; i < _CustomLevelScripts.size(); ++i) {
|
||||
auto& pair = _CustomLevelScripts[i];
|
||||
if (!strcmp(pair.first, aScriptEntryName)) {
|
||||
if (pair.first == aScriptEntryName) {
|
||||
auto& newScripts = pair.second->mLevelScripts;
|
||||
auto& newScriptNode = newScripts[newScripts.Count() - 1];
|
||||
return newScriptNode->mData;
|
||||
|
|
@ -38,17 +38,16 @@ void DynOS_Lvl_ModShutdown() {
|
|||
DynOS_Level_Unoverride();
|
||||
|
||||
auto& _CustomLevelScripts = DynOS_Lvl_GetArray();
|
||||
while (_CustomLevelScripts.Count() > 0) {
|
||||
if (!_CustomLevelScripts.empty()) {
|
||||
for (auto& pair : _CustomLevelScripts) {
|
||||
DynOS_Tex_Invalid(pair.second);
|
||||
Delete(pair.second);
|
||||
free((void*)pair.first);
|
||||
}
|
||||
_CustomLevelScripts.Clear();
|
||||
_CustomLevelScripts.clear();
|
||||
}
|
||||
|
||||
auto& _OverrideLevelScripts = DynosOverrideLevelScripts();
|
||||
_OverrideLevelScripts.Clear();
|
||||
_OverrideLevelScripts.clear();
|
||||
}
|
||||
|
||||
void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLevelName) {
|
||||
|
|
@ -59,19 +58,16 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
|
|||
DynOS_Level_Init();
|
||||
|
||||
// check for duplicates
|
||||
for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) {
|
||||
if (!strcmp(_CustomLevelScripts[i].first, aLevelName)) {
|
||||
for (auto &customLevel : _CustomLevelScripts) {
|
||||
if (customLevel.first == aLevelName) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
u16 levelLen = strlen(aLevelName);
|
||||
char* levelName = (char*)calloc(1, sizeof(char) * (levelLen + 1));
|
||||
strcpy(levelName, aLevelName);
|
||||
std::string levelName = aLevelName;
|
||||
|
||||
GfxData* _Node = DynOS_Lvl_LoadFromBinary(aFilename, levelName);
|
||||
GfxData* _Node = DynOS_Lvl_LoadFromBinary(aFilename, levelName.c_str());
|
||||
if (!_Node) {
|
||||
free(levelName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +75,7 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
|
|||
_Node->mModIndex = modIndex;
|
||||
|
||||
// Add to levels
|
||||
_CustomLevelScripts.Add({ levelName, _Node });
|
||||
_CustomLevelScripts.emplace_back(levelName, _Node);
|
||||
DynOS_Tex_Valid(_Node);
|
||||
|
||||
// Override vanilla script
|
||||
|
|
@ -96,13 +92,13 @@ void DynOS_Lvl_Activate(s32 modIndex, const SysPath &aFilename, const char *aLev
|
|||
}
|
||||
|
||||
DynOS_Level_Override((void*)originalScript, newScriptNode->mData, modIndex);
|
||||
_OverrideLevelScripts.Add({ originalScript, newScriptNode->mData, _Node});
|
||||
_OverrideLevelScripts.push_back({ originalScript, newScriptNode->mData, _Node});
|
||||
}
|
||||
|
||||
GfxData* DynOS_Lvl_GetActiveGfx(void) {
|
||||
auto& _CustomLevelScripts = DynOS_Lvl_GetArray();
|
||||
for (s32 i = 0; i < _CustomLevelScripts.Count(); ++i) {
|
||||
auto& gfxData = _CustomLevelScripts[i].second;
|
||||
for (auto &lvlEntry : _CustomLevelScripts) {
|
||||
auto& gfxData = lvlEntry.second;
|
||||
auto& scripts = gfxData->mLevelScripts;
|
||||
for (auto& s : scripts) {
|
||||
if (gLevelScriptActive == s->mData) {
|
||||
|
|
@ -200,4 +196,3 @@ void *DynOS_Lvl_Override(void *aCmd) {
|
|||
|
||||
return aCmd;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ struct RegisteredMovtexQC {
|
|||
s16 type;
|
||||
};
|
||||
|
||||
static Array<RegisteredMovtexQC>& DynosRegisteredMovtexQCs() {
|
||||
static Array<RegisteredMovtexQC> sDynosRegisteredMovtexQCs;
|
||||
static std::vector<RegisteredMovtexQC> &DynosRegisteredMovtexQCs() {
|
||||
static std::vector<RegisteredMovtexQC> sDynosRegisteredMovtexQCs;
|
||||
return sDynosRegisteredMovtexQCs;
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ void DynOS_MovtexQC_Register(const char* name, s16 level, s16 area, s16 type) {
|
|||
for (auto& node : lvlPair.second->mMovtexQCs) {
|
||||
if (node->mName == name) {
|
||||
// add it
|
||||
_DynosRegisteredMovtexQCs.Add({
|
||||
_DynosRegisteredMovtexQCs.push_back({
|
||||
.dataNode = node,
|
||||
.level = level,
|
||||
.area = area,
|
||||
|
|
@ -70,9 +70,8 @@ DataNode<MovtexQC>* DynOS_MovtexQC_GetFromIndex(s32 index) {
|
|||
|
||||
void DynOS_MovtexQC_ModShutdown() {
|
||||
auto& _DynosRegisteredMovtexQCs = DynosRegisteredMovtexQCs();
|
||||
while (_DynosRegisteredMovtexQCs.Count() > 0) {
|
||||
auto& registered = _DynosRegisteredMovtexQCs[0];
|
||||
for (auto ®istered : _DynosRegisteredMovtexQCs) {
|
||||
Delete(registered.dataNode);
|
||||
_DynosRegisteredMovtexQCs.Remove(0);
|
||||
}
|
||||
_DynosRegisteredMovtexQCs.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
#include <deque>
|
||||
#include "dynos.cpp.h"
|
||||
extern "C" {
|
||||
#include "engine/graph_node.h"
|
||||
}
|
||||
|
||||
static Array<PackData>& DynosPacks() {
|
||||
static Array<PackData> sDynosPacks;
|
||||
static std::deque<PackData>& DynosPacks() {
|
||||
static std::deque<PackData> sDynosPacks;
|
||||
return sDynosPacks;
|
||||
}
|
||||
|
||||
|
|
@ -37,8 +38,8 @@ static void ScanPackBins(struct PackData* aPack) {
|
|||
}
|
||||
}
|
||||
|
||||
static void DynOS_Pack_ActivateActor(s32 aPackIndex, Pair<const char *, GfxData *>& pair) {
|
||||
const char* aActorName = pair.first;
|
||||
static void DynOS_Pack_ActivateActor(s32 aPackIndex, std::pair<std::string, GfxData *> &pair) {
|
||||
const char* aActorName = pair.first.c_str();
|
||||
GfxData* aGfxData = pair.second;
|
||||
|
||||
auto& geoNode = *(aGfxData->mGeoLayouts.end() - 1);
|
||||
|
|
@ -64,13 +65,13 @@ static void DynOS_Pack_ActivateActor(s32 aPackIndex, Pair<const char *, GfxData
|
|||
DynOS_Actor_Valid(georef, actorGfx);
|
||||
}
|
||||
|
||||
static void DynOS_Pack_DeactivateActor(s32 aPackIndex, Pair<const char *, GfxData *>& pair) {
|
||||
const char* aActorName = pair.first;
|
||||
static void DynOS_Pack_DeactivateActor(s32 aPackIndex, std::pair<std::string, GfxData *> &pair) {
|
||||
const char* aActorName = pair.first.c_str();
|
||||
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
|
||||
DynOS_Actor_Invalid(georef, aPackIndex);
|
||||
|
||||
// figure out which actor to replace it with
|
||||
Pair<const char *, GfxData *>* _Replacement = NULL;
|
||||
std::pair<std::string, GfxData *> *_Replacement = NULL;
|
||||
s32 _ReplacementPackIndex = 0;
|
||||
for (auto& _Pack : DynosPacks()) {
|
||||
if (!_Pack.mEnabled) { continue; }
|
||||
|
|
@ -86,7 +87,7 @@ static void DynOS_Pack_DeactivateActor(s32 aPackIndex, Pair<const char *, GfxDat
|
|||
}
|
||||
|
||||
s32 DynOS_Pack_GetCount() {
|
||||
return DynosPacks().Count();
|
||||
return DynosPacks().size();
|
||||
}
|
||||
|
||||
void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled) {
|
||||
|
|
@ -118,7 +119,7 @@ void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled) {
|
|||
|
||||
PackData* DynOS_Pack_GetFromIndex(s32 aIndex) {
|
||||
auto& _DynosPacks = DynosPacks();
|
||||
if (aIndex < 0 || aIndex >= _DynosPacks.Count()) {
|
||||
if (aIndex < 0 || aIndex >= _DynosPacks.size()) {
|
||||
return NULL;
|
||||
}
|
||||
return &_DynosPacks[aIndex];
|
||||
|
|
@ -163,7 +164,7 @@ PackData* DynOS_Pack_Add(const SysPath& aPath) {
|
|||
|
||||
|
||||
auto& _DynosPacks = DynosPacks();
|
||||
s32 index = _DynosPacks.Count();
|
||||
s32 index = _DynosPacks.size();
|
||||
const PackData packData = {
|
||||
.mIndex = index,
|
||||
.mEnabled = false,
|
||||
|
|
@ -173,21 +174,21 @@ PackData* DynOS_Pack_Add(const SysPath& aPath) {
|
|||
.mTextures = {},
|
||||
.mLoaded = false,
|
||||
};
|
||||
_DynosPacks.Add(packData);
|
||||
_DynosPacks.push_back(packData);
|
||||
|
||||
PackData* _Pack = &_DynosPacks[index];
|
||||
PackData* _Pack = &_DynosPacks.back();
|
||||
|
||||
_Pack->mDisplayName = displayName;
|
||||
|
||||
return _Pack;
|
||||
}
|
||||
|
||||
Pair<const char *, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName) {
|
||||
std::pair<std::string, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName) {
|
||||
if (aPackData == NULL || aActorName == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (auto& pair : aPackData->mGfxData) {
|
||||
if (!strcmp(pair.first, aActorName)) {
|
||||
if (pair.first == aActorName) {
|
||||
return &pair;
|
||||
}
|
||||
}
|
||||
|
|
@ -199,8 +200,8 @@ void DynOS_Pack_AddActor(PackData* aPackData, const char* aActorName, GfxData* a
|
|||
return;
|
||||
}
|
||||
|
||||
s32 index = aPackData->mGfxData.Count();
|
||||
aPackData->mGfxData.Add({ strdup(aActorName), aGfxData });
|
||||
s32 index = aPackData->mGfxData.size();
|
||||
aPackData->mGfxData.emplace_back(aActorName, aGfxData);
|
||||
|
||||
if (aPackData->mEnabled) {
|
||||
DynOS_Pack_ActivateActor(aPackData->mIndex, aPackData->mGfxData[index]);
|
||||
|
|
@ -225,7 +226,7 @@ void DynOS_Pack_AddTex(PackData* aPackData, DataNode<TexData>* aTexData) {
|
|||
return;
|
||||
}
|
||||
|
||||
aPackData->mTextures.Add(aTexData);
|
||||
aPackData->mTextures.push_back(aTexData);
|
||||
|
||||
if (aPackData->mEnabled) {
|
||||
DynOS_Tex_Activate(aTexData, false);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "dynos.cpp.h"
|
||||
extern "C" {
|
||||
#include "pc/gfx/gfx.h"
|
||||
|
|
@ -32,13 +34,13 @@ static std::set<DataNode<TexData> *>& DynosValidTextures() {
|
|||
return sDynosValidTextures;
|
||||
}
|
||||
|
||||
static Array<DataNode<TexData> *>& DynosScheduledInvalidTextures() {
|
||||
static Array<DataNode<TexData> *> sDynosScheduledInvalidTextures;
|
||||
static std::vector<DataNode<TexData> *> &DynosScheduledInvalidTextures() {
|
||||
static std::vector<DataNode<TexData> *> sDynosScheduledInvalidTextures;
|
||||
return sDynosScheduledInvalidTextures;
|
||||
}
|
||||
|
||||
static Array<Pair<const char*, DataNode<TexData>*>>& DynosCustomTexs() {
|
||||
static Array<Pair<const char*, DataNode<TexData>*>> sDynosCustomTexs;
|
||||
static std::vector<std::pair<std::string, DataNode<TexData> *>> &DynosCustomTexs() {
|
||||
static std::vector<std::pair<std::string, DataNode<TexData> *>> sDynosCustomTexs;
|
||||
return sDynosCustomTexs;
|
||||
}
|
||||
|
||||
|
|
@ -284,17 +286,17 @@ void DynOS_Tex_Valid(GfxData* aGfxData) {
|
|||
void DynOS_Tex_Invalid(GfxData* aGfxData) {
|
||||
auto& schedule = DynosScheduledInvalidTextures();
|
||||
for (auto &_Texture : aGfxData->mTextures) {
|
||||
schedule.Add(_Texture);
|
||||
schedule.push_back(_Texture);
|
||||
}
|
||||
}
|
||||
|
||||
void DynOS_Tex_Update() {
|
||||
auto& schedule = DynosScheduledInvalidTextures();
|
||||
if (schedule.Count() == 0) { return; }
|
||||
if (schedule.empty()) { return; }
|
||||
for (auto &_Texture : schedule) {
|
||||
DynosValidTextures().erase(_Texture);
|
||||
}
|
||||
schedule.Clear();
|
||||
schedule.clear();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -368,8 +370,8 @@ void DynOS_Tex_Activate(DataNode<TexData>* aNode, bool aCustomTexture) {
|
|||
// check for duplicates
|
||||
auto& _DynosCustomTexs = DynosCustomTexs();
|
||||
bool _HasCustomTex = false;
|
||||
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
|
||||
if (!strcmp(_DynosCustomTexs[i].first, aNode->mName.begin())) {
|
||||
for (auto &customTex : _DynosCustomTexs) {
|
||||
if (customTex.first == aNode->mName.begin()) {
|
||||
_HasCustomTex = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -389,7 +391,7 @@ void DynOS_Tex_Activate(DataNode<TexData>* aNode, bool aCustomTexture) {
|
|||
|
||||
// Add to custom textures
|
||||
if (!_HasCustomTex && aCustomTexture) {
|
||||
_DynosCustomTexs.Add({ aNode->mName.begin(), aNode });
|
||||
_DynosCustomTexs.emplace_back(aNode->mName.begin(), aNode);
|
||||
}
|
||||
|
||||
// Add to valid
|
||||
|
|
@ -402,10 +404,11 @@ void DynOS_Tex_Deactivate(DataNode<TexData>* aNode) {
|
|||
|
||||
// remove from custom textures
|
||||
auto& _DynosCustomTexs = DynosCustomTexs();
|
||||
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
|
||||
for (size_t i = 0; i < _DynosCustomTexs.size();) {
|
||||
if (_DynosCustomTexs[i].second == aNode) {
|
||||
_DynosCustomTexs.Remove(i);
|
||||
i--;
|
||||
_DynosCustomTexs.erase(_DynosCustomTexs.begin() + i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -421,28 +424,22 @@ void DynOS_Tex_Deactivate(DataNode<TexData>* aNode) {
|
|||
|
||||
// Remove from valid
|
||||
auto& _Schedule = DynosScheduledInvalidTextures();
|
||||
_Schedule.Add(aNode);
|
||||
_Schedule.push_back(aNode);
|
||||
}
|
||||
|
||||
bool DynOS_Tex_AddCustom(const SysPath &aFilename, const char *aTexName) {
|
||||
auto& _DynosCustomTexs = DynosCustomTexs();
|
||||
|
||||
// check for duplicates
|
||||
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
|
||||
if (!strcmp(_DynosCustomTexs[i].first, aTexName)) {
|
||||
for (auto &customTex : _DynosCustomTexs) {
|
||||
if (customTex.first == aTexName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate name
|
||||
u16 texLen = strlen(aTexName);
|
||||
char* _TexName = (char*)calloc(1, sizeof(char) * (texLen + 1));
|
||||
strcpy(_TexName, aTexName);
|
||||
|
||||
// Load
|
||||
SysPath _PackFolder = "";
|
||||
DataNode<TexData>* _Node = DynOS_Tex_LoadFromBinary(_PackFolder, aFilename, _TexName, false);
|
||||
free(_TexName);
|
||||
DataNode<TexData>* _Node = DynOS_Tex_LoadFromBinary(_PackFolder, aFilename, aTexName, false);
|
||||
if (_Node) {
|
||||
DynOS_Tex_Activate(_Node, true);
|
||||
return true;
|
||||
|
|
@ -463,9 +460,9 @@ bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) {
|
|||
|
||||
// check custom textures
|
||||
auto& _DynosCustomTexs = DynosCustomTexs();
|
||||
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
|
||||
if (!strcmp(_DynosCustomTexs[i].first, aTexName)) {
|
||||
auto& _Data = _DynosCustomTexs[i].second->mData;
|
||||
for (auto &customTex : _DynosCustomTexs) {
|
||||
if (customTex.first == aTexName) {
|
||||
auto& _Data = customTex.second->mData;
|
||||
|
||||
// load the texture if it hasn't been yet
|
||||
if (_Data->mRawData.begin() == NULL) {
|
||||
|
|
@ -529,9 +526,9 @@ bool DynOS_Tex_GetFromData(const Texture *aTex, struct TextureInfo* aOutTexInfo)
|
|||
|
||||
static DataNode<TexData> *DynOS_Lua_Tex_RetrieveNode(const char* aName) {
|
||||
auto& _DynosCustomTexs = DynosCustomTexs();
|
||||
for (s32 i = 0; i < _DynosCustomTexs.Count(); ++i) {
|
||||
if (!strcmp(_DynosCustomTexs[i].first, aName)) {
|
||||
return _DynosCustomTexs[i].second;
|
||||
for (auto &customTex : _DynosCustomTexs) {
|
||||
if (customTex.first == aName) {
|
||||
return customTex.second;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -594,7 +591,7 @@ void DynOS_Tex_ModShutdown() {
|
|||
_DynosOverrideLuaTextures.clear();
|
||||
|
||||
auto& _DynosCustomTexs = DynosCustomTexs();
|
||||
while (_DynosCustomTexs.Count() > 0) {
|
||||
while (!_DynosCustomTexs.empty()) {
|
||||
auto& pair = _DynosCustomTexs[0];
|
||||
DynOS_Tex_Deactivate(pair.second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -782,6 +782,13 @@ static struct PlayerColor geo_mario_get_player_color(const struct PlayerPalette
|
|||
return color;
|
||||
}
|
||||
|
||||
void get_player_color(u8 index, u8 part, f32 *out) {
|
||||
const struct PlayerPalette *palette = &gNetworkPlayers[index].overridePalette;
|
||||
out[0] = palette->parts[part][0] / 255.0f;
|
||||
out[1] = palette->parts[part][1] / 255.0f;
|
||||
out[2] = palette->parts[part][2] / 255.0f;
|
||||
}
|
||||
|
||||
static Gfx *geo_mario_create_player_colors_dl(s32 index, Gfx *capEnemyGfx, Gfx *capEnemyDecalGfx) {
|
||||
s32 size = ((PLAYER_PART_MAX * 2) + 1) + (capEnemyGfx != NULL) + (capEnemyDecalGfx != NULL);
|
||||
Gfx *gfx = alloc_display_list(size * sizeof(Gfx));
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void calc_face_normal(struct ObjFace *face) {
|
|||
p3.z = vtx3->pos.z;
|
||||
|
||||
// calculate the cross product of edges (p2 - p1) and (p3 - p2)
|
||||
// not sure why each component is multiplied by 1000. maybe to avoid loss of precision when normalizing?
|
||||
// not sure why each component is multiplied by 1000. maybe to avoid loss of precision when normalizing?
|
||||
normal.x = (((p2.y - p1.y) * (p3.z - p2.z)) - ((p2.z - p1.z) * (p3.y - p2.y))) * mul;
|
||||
normal.y = (((p2.z - p1.z) * (p3.x - p2.x)) - ((p2.x - p1.x) * (p3.z - p2.z))) * mul;
|
||||
normal.z = (((p2.x - p1.x) * (p3.y - p2.y)) - ((p2.y - p1.y) * (p3.x - p2.x))) * mul;
|
||||
|
|
@ -1366,6 +1366,37 @@ s32 load_mario_head(void (*aniFn)(struct ObjAnimator *)) {
|
|||
particle->shapePtr = gShapeRedSpark;
|
||||
addto_group(gGdLightGroup, &particle->header);
|
||||
|
||||
f32 color[3];
|
||||
void get_player_color(u8 index, u8 part, f32 *out);
|
||||
|
||||
struct ObjGroup *mtls = (struct ObjGroup *) d_use_obj("N224l"); // DYNOBJ_MARIO_FACE_MTL_GROUP
|
||||
for (struct ListNode *n = mtls->firstMember; n; n = n->next) {
|
||||
struct ObjMaterial *m = (struct ObjMaterial *)n->obj;
|
||||
|
||||
switch (m->id) {
|
||||
// skin color
|
||||
case 1:
|
||||
get_player_color(0, 5, color);
|
||||
break;
|
||||
|
||||
// hair color
|
||||
case 5:
|
||||
get_player_color(0, 4, color);
|
||||
break;
|
||||
|
||||
// cap color
|
||||
case 7:
|
||||
get_player_color(0, 6, color);
|
||||
break;
|
||||
|
||||
// skip this part
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
m->Ka = (struct GdColour) { color[0], color[1], color[2] };
|
||||
m->Kd = (struct GdColour) { color[0], color[1], color[2] };
|
||||
}
|
||||
|
||||
mainShapesGrp = (struct ObjGroup *) d_use_obj("N1000l"); // DYNOBJ_MARIO_MAIN_SHAPES_GROUP
|
||||
create_gddl_for_shapes(mainShapesGrp);
|
||||
sp38 = gGdObjectList;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue