mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
fix scrolling textures again
now that only vanilla vertices are duplicated
This commit is contained in:
parent
6527ee1b7a
commit
25ff0c93c4
6 changed files with 6 additions and 44 deletions
|
|
@ -97,7 +97,6 @@ bool dynos_vtx_delete(Vtx *vtx);
|
||||||
|
|
||||||
// -- other -- //
|
// -- other -- //
|
||||||
void dynos_mod_shutdown(void);
|
void dynos_mod_shutdown(void);
|
||||||
void dynos_pending_scroll_targets_clear(void);
|
|
||||||
void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size);
|
void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size);
|
||||||
|
|
||||||
// -- smlua -- //
|
// -- smlua -- //
|
||||||
|
|
|
||||||
|
|
@ -1120,8 +1120,6 @@ bool DynOS_Bin_IsCompressed(const SysPath &aFilename);
|
||||||
bool DynOS_Bin_Compress(const SysPath &aFilename);
|
bool DynOS_Bin_Compress(const SysPath &aFilename);
|
||||||
BinFile *DynOS_Bin_Decompress(const SysPath &aFilename);
|
BinFile *DynOS_Bin_Decompress(const SysPath &aFilename);
|
||||||
|
|
||||||
void DynOS_Find_Pending_Scroll_Target(Vtx *data, Vtx *newData);
|
|
||||||
void DynOS_Pending_Scroll_Targets_Clear();
|
|
||||||
void DynOS_Add_Scroll_Target(u32 index, const char *name, u32 offset, u32 size);
|
void DynOS_Add_Scroll_Target(u32 index, const char *name, u32 offset, u32 size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -318,8 +318,4 @@ void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size)
|
||||||
DynOS_Add_Scroll_Target(index, name, offset, size);
|
DynOS_Add_Scroll_Target(index, name, offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dynos_pending_scroll_targets_clear(void) {
|
|
||||||
DynOS_Pending_Scroll_Targets_Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ static Vtx *DynOS_Vtx_Duplicate(Vtx *aVtx, u32 vtxCount, bool shouldDuplicate) {
|
||||||
size_t vtxSize = vtxCount * sizeof(Vtx);
|
size_t vtxSize = vtxCount * sizeof(Vtx);
|
||||||
Vtx *vtxDuplicate = vtx_allocate_internal(vtxCount);
|
Vtx *vtxDuplicate = vtx_allocate_internal(vtxCount);
|
||||||
memcpy(vtxDuplicate, aVtx, vtxSize);
|
memcpy(vtxDuplicate, aVtx, vtxSize);
|
||||||
DynOS_Find_Pending_Scroll_Target(aVtx, vtxDuplicate);
|
|
||||||
sRomToRamGfxVtxMap[aVtx] = { (void *) vtxDuplicate, vtxSize };
|
sRomToRamGfxVtxMap[aVtx] = { (void *) vtxDuplicate, vtxSize };
|
||||||
return vtxDuplicate;
|
return vtxDuplicate;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
#include "dynos.cpp.h"
|
#include "dynos.cpp.h"
|
||||||
#ifdef max
|
|
||||||
#undef max
|
|
||||||
#endif
|
|
||||||
#include <vector>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "game/scroll_targets.h"
|
#include "game/scroll_targets.h"
|
||||||
}
|
}
|
||||||
|
|
@ -105,41 +101,16 @@ s32 DynOS_String_Width(const u8 *aStr64) {
|
||||||
// Scroll Targets
|
// Scroll Targets
|
||||||
//
|
//
|
||||||
|
|
||||||
struct PendingScrollTarget {
|
|
||||||
u32 mIndex;
|
|
||||||
u32 mOffset;
|
|
||||||
u32 mSize;
|
|
||||||
Vtx *mData;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::vector<struct PendingScrollTarget> sPendingScrollTargets;
|
|
||||||
|
|
||||||
// Finds a pending scroll target and registers it with the new vtx buffer
|
|
||||||
void DynOS_Find_Pending_Scroll_Target(Vtx *data, Vtx *newData) {
|
|
||||||
for (auto it = sPendingScrollTargets.begin(); it != sPendingScrollTargets.end(); ++it) {
|
|
||||||
if (it->mData == data) {
|
|
||||||
add_vtx_scroll_target(it->mIndex, &newData[it->mOffset], it->mSize, it->mOffset > 0);
|
|
||||||
sPendingScrollTargets.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynOS_Pending_Scroll_Targets_Clear() {
|
|
||||||
sPendingScrollTargets.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynOS_Add_Scroll_Target(u32 index, const char* name, u32 offset, u32 size) {
|
void DynOS_Add_Scroll_Target(u32 index, const char* name, u32 offset, u32 size) {
|
||||||
for (auto& lvlPair : DynOS_Lvl_GetArray()) {
|
for (auto& lvlPair : DynOS_Lvl_GetArray()) {
|
||||||
for (auto& node : lvlPair.second->mVertices) {
|
for (auto& node : lvlPair.second->mVertices) {
|
||||||
if (node->mName.Find(name) >= 0) {
|
if (node->mName.Find(name) >= 0) {
|
||||||
struct PendingScrollTarget scroll = {
|
add_vtx_scroll_target(
|
||||||
.mIndex = index,
|
index,
|
||||||
.mOffset = offset,
|
&node->mData[offset],
|
||||||
.mSize = (size > 0 && size < node->mSize) ? size : node->mSize,
|
(size > 0 && size < node->mSize) ? size : node->mSize,
|
||||||
.mData = node->mData,
|
offset > 0
|
||||||
};
|
);
|
||||||
sPendingScrollTargets.push_back(scroll);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,6 @@ void free_vtx_scroll_targets(void) {
|
||||||
}
|
}
|
||||||
hmap_destroy(sScrollTargets);
|
hmap_destroy(sScrollTargets);
|
||||||
sScrollTargets = NULL;
|
sScrollTargets = NULL;
|
||||||
dynos_pending_scroll_targets_clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void patch_scroll_targets_before(void) {
|
void patch_scroll_targets_before(void) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue