match: func_80011264, improve match% for func_80059208 (#548)

* match: func_80011264, improve match% for func_80059208

* refac: use TEX_INDEX_NO_TEXTURE instead of magic number

* Update src/objects.c

Co-authored-by: David Benepe <benepe96@gmail.com>

* refac: make fake match less ungodly

---------

Co-authored-by: David Benepe <benepe96@gmail.com>
This commit is contained in:
Dominik Peters
2025-05-05 01:35:07 +02:00
committed by GitHub
co-authored by David Benepe
parent 4aa7b9a8c1
commit 7063517833
3 changed files with 33 additions and 34 deletions
+7 -7
View File
@@ -5,9 +5,9 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the
All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified.
<!-- README_SCORE_SUMMARY_BEGIN -->
As of May 4, 2025, this is our current score:
As of May 5, 2025, this is our current score:
&emsp;&emsp;&emsp;&emsp;Decomp progress: 84.43%
&emsp;&emsp;&emsp;&emsp;Decomp progress: 84.46%
&emsp;&emsp;&emsp;&emsp;Documentation progress: 53.79%
<!-- README_SCORE_SUMMARY_END -->
@@ -117,15 +117,15 @@ s32 is_drumstick_unlocked(void) {
```
<!-- README_SCORE_BEGIN -->
As of May 4, 2025, this is our current score:
As of May 5, 2025, this is our current score:
```
========================================================
ADVENTURE ONE (ASM -> C Decompilation)
-------- 84.43% Complete (85.98% NON_MATCHING) ---------
# Decompiled functions: 1877
# GLOBAL_ASM remaining: 74
-------- 84.46% Complete (86.01% NON_MATCHING) ---------
# Decompiled functions: 1878
# GLOBAL_ASM remaining: 73
# NON_MATCHING functions: 8
# NON_EQUIVALENT WIP functions: 27
# NON_EQUIVALENT WIP functions: 26
--------------------- Game Status ----------------------
Balloons: 39/47, Keys: 4/4, Trophies: 4/5
T.T. Amulets: 4/4, Wizpig Amulets: 4/4
+22 -23
View File
@@ -2447,41 +2447,40 @@ void func_80011134(Object *arg0, s32 arg1) {
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_80011134.s")
#endif
#ifdef NON_EQUIVALENT
// Probably NON_MATCHING, but not sure.
// This is a function for doors
void func_80011264(ObjectModel *model, Object *obj) {
Object_64 *obj64;
s32 current;
s32 remaining;
s32 i;
Object_Door *door;
TriangleBatchInfo *batch;
if (model->unk50 > 0) {
batch = &model->batches[0];
door = &obj->unk64->door;
current = ((door->balloonCount / 10) - 1) << 2;
if (model->textures[batch->textureIndex].texture) {} // fakematch
if (1) { // fakematch
remaining = ((door->balloonCount % 10) << 2);
}
for (i = 0; i < model->numberOfBatches; i++, batch++) {
if (batch->flags & 0x10000) {
if (batch->textureIndex != 0xFF) { // 0xFF = No Texture
if (model->textures[batch->textureIndex].texture->numOfTextures > 0x900) {
batch->unk7 = remaining;
} else if (current >= 0) {
batch->unk7 = current;
}
if (door) {} // fakematch
if (model->unk50 <= 0) {
return;
}
obj64 = obj->unk64;
remaining = obj64->door.balloonCount;
current = ((remaining / 10) - 1) << 2;
remaining = (remaining % 10) << 2;
i = 0;
batch = model->batches;
while (i < model->numberOfBatches) {
if (batch[i].flags & 0x10000) {
if (batch[i].textureIndex != TEX_INDEX_NO_TEXTURE) {
// Fakematch
if (model->textures[batch[i].textureIndex].texture) {}
if ((model->textures[batch[i].textureIndex].texture->numOfTextures) > 0x900) {
batch[i].unk7 = remaining;
} else if (current >= 0) {
batch[i].unk7 = current;
}
}
}
i++;
}
}
#else
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_80011264.s")
#endif
/**
* Do nothing. Unused.
+4 -4
View File
@@ -6438,11 +6438,11 @@ void func_80059208(Object *obj, Object_Racer *racer, s32 updateRate) {
if (temp_v0_4->altRouteID == -1) {
racer->unk1C8 = 0;
}
counter = racer->checkpoint - 1;
if (counter < 0) {
counter += temp_v0;
angle = racer->checkpoint - 1;
if (angle < 0) {
angle += temp_v0;
}
temp_v0_4 = get_checkpoint_node(counter);
temp_v0_4 = get_checkpoint_node(angle);
if (temp_v0_4->altRouteID == -1) {
racer->unk1C8 = 0;
}