mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
match 3 object functions (#507)
* match func_8001CC48 * match decrypt_magic_codes * comment * update score * update score once again * match func_80014814 * run formatter * rename function
This commit is contained in:
@@ -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 April 10, 2025, this is our current score:
|
||||
As of April 11, 2025, this is our current score:
|
||||
|
||||
    Decomp progress: 78.72%
|
||||
    Decomp progress: 78.84%
|
||||
|
||||
    Documentation progress: 49.86%
|
||||
<!-- README_SCORE_SUMMARY_END -->
|
||||
@@ -117,30 +117,30 @@ s32 is_drumstick_unlocked(void) {
|
||||
```
|
||||
|
||||
<!-- README_SCORE_BEGIN -->
|
||||
As of April 10, 2025, this is our current score:
|
||||
As of April 11, 2025, this is our current score:
|
||||
```
|
||||
====================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
-------------- 78.72% Complete (81.31% NON_MATCHING) ---------------
|
||||
# Decompiled functions: 1846
|
||||
# GLOBAL_ASM remaining: 105
|
||||
# NON_MATCHING functions: 13
|
||||
# NON_EQUIVALENT WIP functions: 33
|
||||
--------------------------- Game Status ----------------------------
|
||||
Balloons: 37/47, Keys: 4/4, Trophies: 3/5
|
||||
T.T. Amulets: 4/4, Wizpig Amulets: 3/4
|
||||
--------------------------------------------------------------------
|
||||
We are collecting silver coins in Boulder Canyon. (8/8 silver coins)
|
||||
====================================================================
|
||||
===================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
-------------- 78.84% Complete (81.41% NON_MATCHING) --------------
|
||||
# Decompiled functions: 1849
|
||||
# GLOBAL_ASM remaining: 102
|
||||
# NON_MATCHING functions: 12
|
||||
# NON_EQUIVALENT WIP functions: 31
|
||||
--------------------------- Game Status ---------------------------
|
||||
Balloons: 38/47, Keys: 4/4, Trophies: 3/5
|
||||
T.T. Amulets: 4/4, Wizpig Amulets: 3/4
|
||||
-------------------------------------------------------------------
|
||||
We are collecting silver coins in Haunted Woods. (0/8 silver coins)
|
||||
===================================================================
|
||||
ADVENTURE TWO (Cleanup & Documentation)
|
||||
------------------------- 49.86% Complete --------------------------
|
||||
# Documented functions: 1089
|
||||
------------------------- 49.86% Complete -------------------------
|
||||
# Documented functions: 1089
|
||||
# Undocumented remaining: 565
|
||||
--------------------------- Game Status ----------------------------
|
||||
--------------------------- Game Status ---------------------------
|
||||
Balloons: 24/47, Keys: 3/4, Trophies: 2/5
|
||||
T.T. Amulets: 2/4, Wizpig Amulets: 2/4
|
||||
--------------------------------------------------------------------
|
||||
T.T. Amulets: 2/4, Wizpig Amulets: 2/4
|
||||
-------------------------------------------------------------------
|
||||
We are racing in Pirate Lagoon. (Lap 3/3)
|
||||
====================================================================
|
||||
===================================================================
|
||||
```
|
||||
<!-- README_SCORE_END -->
|
||||
|
||||
@@ -1374,9 +1374,9 @@ void obj_loop_stopwatchman(Object *obj, s32 updateRate) {
|
||||
tt->nodeCurrent = ainode_find_nearest(obj->segment.trans.x_position, obj->segment.trans.y_position,
|
||||
obj->segment.trans.z_position, FALSE);
|
||||
if (tt->nodeCurrent != NODE_NONE) {
|
||||
tt->nodeBack2 = func_8001CC48(tt->nodeCurrent, -1, 0);
|
||||
tt->nodeForward1 = func_8001CC48(tt->nodeBack2, tt->nodeCurrent, 0);
|
||||
tt->nodeForward2 = func_8001CC48(tt->nodeForward1, tt->nodeBack2, 0);
|
||||
tt->nodeBack2 = ainode_find_next(tt->nodeCurrent, -1, 0);
|
||||
tt->nodeForward1 = ainode_find_next(tt->nodeBack2, tt->nodeCurrent, 0);
|
||||
tt->nodeForward2 = ainode_find_next(tt->nodeForward1, tt->nodeBack2, 0);
|
||||
tt->nodeBack1 = tt->nodeCurrent;
|
||||
}
|
||||
} else {
|
||||
@@ -3001,9 +3001,9 @@ void obj_loop_parkwarden(Object *obj, s32 updateRate) {
|
||||
taj->nodeCurrent = ainode_find_nearest(obj->segment.trans.x_position, obj->segment.trans.y_position,
|
||||
obj->segment.trans.z_position, FALSE);
|
||||
if (taj->nodeCurrent != NODE_NONE) {
|
||||
taj->nodeBack2 = func_8001CC48(taj->nodeCurrent, -1, 0);
|
||||
taj->nodeForward1 = func_8001CC48(taj->nodeBack2, taj->nodeCurrent, 0);
|
||||
taj->nodeForward2 = func_8001CC48(taj->nodeForward1, taj->nodeBack2, 0);
|
||||
taj->nodeBack2 = ainode_find_next(taj->nodeCurrent, -1, 0);
|
||||
taj->nodeForward1 = ainode_find_next(taj->nodeBack2, taj->nodeCurrent, 0);
|
||||
taj->nodeForward2 = ainode_find_next(taj->nodeForward1, taj->nodeBack2, 0);
|
||||
taj->nodeBack1 = taj->nodeCurrent;
|
||||
}
|
||||
} else {
|
||||
@@ -3466,9 +3466,9 @@ void obj_loop_goldenballoon(Object *obj, s32 updateRate) {
|
||||
obj64->nodeCurrent = ainode_find_nearest(obj->segment.trans.x_position, obj->segment.trans.y_position,
|
||||
obj->segment.trans.z_position, FALSE);
|
||||
if (obj64->nodeCurrent != 255) {
|
||||
obj64->nodeBack2 = func_8001CC48(obj64->nodeCurrent, -1, 0);
|
||||
obj64->nodeForward1 = func_8001CC48(obj64->nodeBack2, obj64->nodeCurrent, 0);
|
||||
obj64->nodeForward2 = func_8001CC48(obj64->nodeForward1, obj64->nodeBack2, 0);
|
||||
obj64->nodeBack2 = ainode_find_next(obj64->nodeCurrent, -1, 0);
|
||||
obj64->nodeForward1 = ainode_find_next(obj64->nodeBack2, obj64->nodeCurrent, 0);
|
||||
obj64->nodeForward2 = ainode_find_next(obj64->nodeForward1, obj64->nodeBack2, 0);
|
||||
obj64->nodeBack1 = obj64->nodeCurrent;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -443,7 +443,7 @@ void obj_init_fish(Object *fishObj, LevelObjectEntry_Fish *fishEntry, s32 param)
|
||||
void obj_init_midifade(Object *obj, LevelObjectEntry_MidiFade *entry);
|
||||
void obj_loop_butterfly(Object *butterflyObj, s32 updateRate);
|
||||
s32 ainode_find_nearest(f32 diffX, f32 diffY, f32 diffZ, s32 useElevation);
|
||||
s32 func_8001CC48(s32, s32, s32);
|
||||
s32 ainode_find_next(s32, s32, s32);
|
||||
f32 func_8001C6C4(Object_64 *, Object *, f32, f32, s32);
|
||||
void func_8000CBF0(Object*, s32);
|
||||
void try_to_collect_egg(Object *, Object_CollectEgg*);
|
||||
|
||||
+97
-86
@@ -263,7 +263,7 @@ s32 D_8011AE70;
|
||||
Object **D_8011AE74; // Pointer to an array of Animation objects
|
||||
s16 D_8011AE78; // Number of Animation objects in D_8011AE74
|
||||
s16 gCutsceneID;
|
||||
s16 D_8011AE7C;
|
||||
s16 gFirstActiveObjectId;
|
||||
s8 D_8011AE7E;
|
||||
s16 gTTGhostTimeToBeat;
|
||||
s16 gPrevTimeTrialVehicle; // Current Vehicle being used in track?
|
||||
@@ -607,35 +607,41 @@ void allocate_object_pools(void) {
|
||||
clear_object_pointers();
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
// Decrypts cheats
|
||||
void decrypt_magic_codes(s32 *data, s32 length) {
|
||||
u8 sp3;
|
||||
u8 sp2;
|
||||
u8 sp1;
|
||||
u8 sp0;
|
||||
// s32 numWords;
|
||||
s32 i;
|
||||
s32 j;
|
||||
u8 *ptr = (u8 *) data;
|
||||
u8 temp[4];
|
||||
|
||||
// numWords = length / 4;
|
||||
for (i = 0; i < (length >> 2); i++) {
|
||||
// Swap bits according to the following pattern:
|
||||
// AABBCCDD EEFFGGHH IIJJKKLL MMNNOOPP -> AAEEIIMM BBFFJJNN CCGGKKOO DDHHLLPP
|
||||
// clang-format off
|
||||
temp[0] = ((ptr[0] & 0xC0) ) |
|
||||
((ptr[1] & 0xC0) >> 2) |
|
||||
((ptr[2] & 0xC0) >> 4) |
|
||||
((ptr[3] & 0xC0) >> 6);
|
||||
temp[1] = ((ptr[0] & 0x30) << 2) |
|
||||
((ptr[1] & 0x30) ) |
|
||||
((ptr[2] & 0x30) >> 2) |
|
||||
((ptr[3] & 0x30) >> 4);
|
||||
temp[2] = ((ptr[0] & 0x0C) << 4) |
|
||||
((ptr[1] & 0x0C) << 2) |
|
||||
((ptr[2] & 0x0C) ) |
|
||||
((ptr[3] & 0x0C) >> 2);
|
||||
temp[3] = ((ptr[0] & 0x03) << 6) |
|
||||
((ptr[1] & 0x03) << 4) |
|
||||
((ptr[2] & 0x03) << 2) |
|
||||
((ptr[3] & 0x03) );
|
||||
// clang-format on
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
sp0 = ((data[i + 3] & 0xC0) >> 6) | (data[i + 0] & 0xC0) | ((data[i + 1] & 0xC0) >> 2) |
|
||||
((data[i + 2] & 0xC0) >> 4);
|
||||
sp1 = ((data[i + 3] & 0x30) >> 4) | ((data[i + 0] & 0x30) << 2) | (data[i + 1] & 0x30) |
|
||||
((data[i + 2] & 0x30) >> 2);
|
||||
sp2 =
|
||||
((data[i + 3] & 0xC) >> 2) | ((data[i + 0] & 0xC) << 4) | ((data[i + 1] & 0xC) << 2) | (data[i + 2] & 0xC);
|
||||
sp3 = (data[i + 3] & 3) | (data[i + 0] << 6) | ((data[i + 1] & 3) << 4) | ((data[i + 2] & 3) << 2);
|
||||
data[i + 0] = ((sp0 & 0x55) << 1) | ((sp0 & 0xAA) >> 1);
|
||||
data[i + 1] = ((sp1 & 0x55) << 1) | ((sp1 & 0xAA) >> 1);
|
||||
data[i + 2] = ((sp2 & 0x55) << 1) | ((sp2 & 0xAA) >> 1);
|
||||
data[i + 3] = ((sp3 & 0x55) << 1) | ((sp3 & 0xAA) >> 1);
|
||||
// Swap the odd and even bits
|
||||
for (j = 0; j < 4; j++) {
|
||||
*ptr++ = (((temp[j] & 0xAA) >> 1) | ((temp[j] & 0x55) << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/objects/decrypt_magic_codes.s")
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set all object counters and headers to zero, effectively telling the game there are no objects currently in the
|
||||
@@ -676,7 +682,7 @@ void clear_object_pointers(void) {
|
||||
D_8011ADD4 = 0;
|
||||
gCutsceneID = 0;
|
||||
D_8011AE7E = 1;
|
||||
D_8011AE7C = 0;
|
||||
gFirstActiveObjectId = 0;
|
||||
gTransformTimer = 0;
|
||||
gIsTajChallenge = FALSE;
|
||||
gTajRaceInit = 0;
|
||||
@@ -2242,8 +2248,8 @@ void gParticlePtrList_flush(void) {
|
||||
|
||||
// if object found
|
||||
if (search_indx != -1) {
|
||||
if (search_indx < D_8011AE7C) {
|
||||
D_8011AE7C--;
|
||||
if (search_indx < gFirstActiveObjectId) {
|
||||
gFirstActiveObjectId--;
|
||||
}
|
||||
gObjectCount--;
|
||||
if (0) {} // Fakematch
|
||||
@@ -3649,51 +3655,63 @@ s32 render_mesh(ObjectModel *objModel, Object *obj, s32 startIndex, s32 flags, s
|
||||
return i;
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
s32 func_80014814(s32 *retObjCount) {
|
||||
s32 i;
|
||||
s32 maxObjCount;
|
||||
s32 curObjCount;
|
||||
s32 get_first_active_object(s32 *retObjCount) {
|
||||
s32 i, j;
|
||||
s32 minIndex, maxIndex;
|
||||
s32 breakLoop;
|
||||
|
||||
*retObjCount = gObjectCount;
|
||||
if (D_8011AE7C) {
|
||||
return D_8011AE7C;
|
||||
if (gFirstActiveObjectId != 0) {
|
||||
// Already sorted
|
||||
return gFirstActiveObjectId;
|
||||
}
|
||||
curObjCount = gObjectListStart;
|
||||
maxObjCount = gObjectCount - 1;
|
||||
while (maxObjCount >= curObjCount) {
|
||||
for (i = 0; maxObjCount >= curObjCount && i == 0; i++) {
|
||||
if (!(gObjPtrList[curObjCount]->segment.trans.flags & OBJ_FLAGS_DEACTIVATED)) {
|
||||
if (gObjPtrList[curObjCount]->segment.header->flags & 1) {
|
||||
curObjCount++;
|
||||
|
||||
i = gObjectListStart;
|
||||
j = gObjectCount - 1;
|
||||
minIndex = i;
|
||||
maxIndex = j;
|
||||
|
||||
while (i <= j) {
|
||||
breakLoop = 0;
|
||||
while (i <= maxIndex && breakLoop == 0) {
|
||||
if (!(gObjPtrList[i]->segment.trans.flags & OBJ_FLAGS_DEACTIVATED)) {
|
||||
if (gObjPtrList[i]->segment.header->flags & 1) {
|
||||
i++;
|
||||
} else {
|
||||
// Break the loop if neither OBJ_FLAGS_DEACTIVATED nor bit 1 in header->flags is set
|
||||
breakLoop = -1;
|
||||
}
|
||||
i = -1;
|
||||
} else {
|
||||
curObjCount++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for (i = 0; maxObjCount >= curObjCount && i == 0; i++) {
|
||||
if (gObjPtrList[maxObjCount]->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) {
|
||||
i = -1;
|
||||
} else if (!(gObjPtrList[maxObjCount]->segment.header->flags & 1)) {
|
||||
maxObjCount--;
|
||||
|
||||
breakLoop = 0;
|
||||
while (j >= minIndex && breakLoop == 0) {
|
||||
if (gObjPtrList[j]->segment.trans.flags & OBJ_FLAGS_DEACTIVATED) {
|
||||
// Break the loop if OBJ_FLAGS_DEACTIVATED is set
|
||||
breakLoop = -1;
|
||||
} else if (!(gObjPtrList[j]->segment.header->flags & 1)) {
|
||||
j--;
|
||||
} else {
|
||||
i = -1;
|
||||
// Break the loop if bit 1 in header->flags is set
|
||||
breakLoop = -1;
|
||||
}
|
||||
}
|
||||
if (curObjCount > maxObjCount) {
|
||||
gObjPtrList[curObjCount] = gObjPtrList[maxObjCount];
|
||||
gObjPtrList[maxObjCount] = gObjPtrList[curObjCount];
|
||||
curObjCount++;
|
||||
maxObjCount--;
|
||||
|
||||
if (i < j) {
|
||||
// Swap active and inactive objects
|
||||
Object *tempObject = gObjPtrList[i];
|
||||
gObjPtrList[i] = gObjPtrList[j];
|
||||
gObjPtrList[j] = tempObject;
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
}
|
||||
D_8011AE7C = curObjCount;
|
||||
return curObjCount;
|
||||
|
||||
gFirstActiveObjectId = i;
|
||||
return i;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_80014814.s")
|
||||
#endif
|
||||
|
||||
UNUSED void func_800149C0(unk800149C0 *arg0, UNUSED s32 arg1, s32 arg2, s32 arg3, s32 *arg4, s32 *arg5, s32 arg6) {
|
||||
UNUSED s32 pad;
|
||||
@@ -5356,50 +5374,43 @@ s32 ainode_find_nearest(f32 diffX, f32 diffY, f32 diffZ, s32 useElevation) {
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_8001C6C4.s")
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// ainode_find_next
|
||||
s32 func_8001CC48(s32 nodeCurrent, s32 arg1, s32 direction) {
|
||||
s32 ainode_find_next(s32 nodeId, s32 arg1, s32 direction) {
|
||||
Object *aiNodeObj;
|
||||
LevelObjectEntry_AiNode *entry;
|
||||
Object *someObj;
|
||||
Object_AiNode *someObj64;
|
||||
s32 someCount;
|
||||
Object_AiNode *aiNode;
|
||||
s32 nextIndex;
|
||||
s32 i;
|
||||
s32 someIndex;
|
||||
s32 test;
|
||||
s32 someCount;
|
||||
|
||||
if ((nodeCurrent < -1) || (nodeCurrent >= AINODE_COUNT)) {
|
||||
if (nodeId < -1 || nodeId >= AINODE_COUNT) {
|
||||
return NODE_NONE;
|
||||
}
|
||||
someObj = (*gAINodes)[nodeCurrent];
|
||||
if (someObj == NULL) {
|
||||
aiNodeObj = (*gAINodes)[nodeId];
|
||||
if (aiNodeObj == NULL) {
|
||||
return NODE_NONE;
|
||||
}
|
||||
entry = &someObj->segment.level_entry->aiNode;
|
||||
someObj64 = &someObj->unk64->ai_node;
|
||||
test = direction & 3;
|
||||
|
||||
// Swapping these messes up the registers.
|
||||
entry = &aiNodeObj->segment.level_entry->aiNode;
|
||||
aiNode = &aiNodeObj->unk64->ai_node;
|
||||
direction = direction & 3;
|
||||
someCount = 0;
|
||||
someIndex = (someObj64->directions[test] + 1) & 3;
|
||||
nextIndex = (aiNode->directions[direction] + 1) & 3;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (entry->adjacent[someIndex] != NODE_NONE) {
|
||||
if (entry->adjacent[someIndex] != arg1) {
|
||||
someObj64->directions[test] = someIndex;
|
||||
i = 4;
|
||||
someCount++;
|
||||
}
|
||||
if (entry->adjacent[nextIndex] != NODE_NONE && arg1 != entry->adjacent[nextIndex]) {
|
||||
aiNode->directions[direction] = nextIndex;
|
||||
i = 4; // break
|
||||
someCount++;
|
||||
}
|
||||
someIndex = (someIndex + 1) & 3;
|
||||
nextIndex = (nextIndex + 1) & 3;
|
||||
}
|
||||
|
||||
if (someCount == 0) {
|
||||
return NODE_NONE;
|
||||
} else {
|
||||
return entry->adjacent[aiNode->directions[direction]];
|
||||
}
|
||||
return entry->adjacent[someObj64->directions[test]];
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_8001CC48.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
s16 func_8001CD28(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
@@ -5854,7 +5865,7 @@ void func_8001E4C4(void) {
|
||||
}
|
||||
}
|
||||
gObjectListStart = i;
|
||||
D_8011AE7C = 0;
|
||||
gFirstActiveObjectId = 0;
|
||||
}
|
||||
|
||||
void func_8001E6EC(s8 arg0) {
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@ s32 obj_animate(Object *obj);
|
||||
void calc_dynamic_lighting_for_object_1(Object *, ObjectModel *, s16, Object *, f32, f32);
|
||||
void calc_dynamic_lighting_for_object_2(Object *, ObjectModel *, s16, f32);
|
||||
void decrypt_magic_codes(s32 *data, s32 length);
|
||||
s32 func_80014814(s32 *);
|
||||
s32 get_first_active_object(s32 *);
|
||||
Object *spawn_object(LevelObjectEntryCommon *entry, s32);
|
||||
s32 func_8001F460(Object*, s32, Object*);
|
||||
void func_8000B750(Object *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
|
||||
+17
-11
@@ -512,7 +512,7 @@ void bgdraw_texture_init(TextureHeader *tex1, TextureHeader *tex2, u32 shiftX) {
|
||||
* Seems to render the background screen after a race finishes while you're at the menu deciding what to do next.
|
||||
* https://i.imgur.com/MHbUD2a.png is an example. The left is correct, and the right is incorrect rendering.
|
||||
* Official Name: rcpMosaicClear
|
||||
*/
|
||||
*/
|
||||
void bgdraw_texture(Gfx **dList) {
|
||||
s32 widthAndHeight;
|
||||
// The following variables use the (30.2) fixed-point format
|
||||
@@ -520,14 +520,14 @@ void bgdraw_texture(Gfx **dList) {
|
||||
s32 videoHeight;
|
||||
s32 videoWidth;
|
||||
s32 texWidth;
|
||||
s32 texHeight;
|
||||
s32 texHeight;
|
||||
s32 xOffset;
|
||||
s32 uly;
|
||||
s32 ulx;
|
||||
|
||||
widthAndHeight = fb_size();
|
||||
videoWidth = GET_VIDEO_WIDTH(widthAndHeight);
|
||||
videoHeight = GET_VIDEO_HEIGHT(widthAndHeight) & 0xFFFF;
|
||||
videoHeight = GET_VIDEO_HEIGHT(widthAndHeight) & 0xFFFF;
|
||||
gSPDisplayList((*dList)++, dRaceFinishBackgroundSettings);
|
||||
|
||||
if (gTexBGTex2 == NULL) {
|
||||
@@ -540,9 +540,11 @@ void bgdraw_texture(Gfx **dList) {
|
||||
for (xOffset = 0, uly = 0; uly < videoHeight; uly += texHeight) {
|
||||
for (ulx = -xOffset; ulx < videoWidth; ulx += texWidth) {
|
||||
if (ulx < 0) {
|
||||
gSPTextureRectangle((*dList)++, 0, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, -(ulx << 3), 0, 1024, 1024);
|
||||
gSPTextureRectangle((*dList)++, 0, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE,
|
||||
-(ulx << 3), 0, 1024, 1024);
|
||||
} else {
|
||||
gSPTextureRectangle((*dList)++, ulx, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, 0, 0, 1024, 1024);
|
||||
gSPTextureRectangle((*dList)++, ulx, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, 0, 0,
|
||||
1024, 1024);
|
||||
}
|
||||
}
|
||||
xOffset = (xOffset + gTexBGShiftX) & (texWidth - 1);
|
||||
@@ -553,15 +555,17 @@ void bgdraw_texture(Gfx **dList) {
|
||||
videoWidth <<= 2;
|
||||
videoHeight <<= 2;
|
||||
uly = 0;
|
||||
texWidth = gTexBGTex1->width << 2;
|
||||
texHeight = gTexBGTex1->height << 2;
|
||||
texWidth = gTexBGTex1->width << 2;
|
||||
texHeight = gTexBGTex1->height << 2;
|
||||
sumTextureHeights = (gTexBGTex2->height << 2) + texHeight;
|
||||
for (xOffset = 0; uly < videoHeight; uly += sumTextureHeights) {
|
||||
for (ulx = -xOffset; ulx < videoWidth; ulx += texWidth) {
|
||||
if (ulx < 0) {
|
||||
gSPTextureRectangle((*dList)++, 0, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, -(ulx << 3), 0, 1024, 1024);
|
||||
gSPTextureRectangle((*dList)++, 0, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE,
|
||||
-(ulx << 3), 0, 1024, 1024);
|
||||
} else {
|
||||
gSPTextureRectangle((*dList)++, ulx, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, 0, 0, 1024, 1024);
|
||||
gSPTextureRectangle((*dList)++, ulx, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, 0, 0,
|
||||
1024, 1024);
|
||||
}
|
||||
}
|
||||
xOffset = (xOffset + gTexBGShiftX) & (texWidth - 1);
|
||||
@@ -577,9 +581,11 @@ void bgdraw_texture(Gfx **dList) {
|
||||
for (xOffset = 0; uly < videoHeight; uly += sumTextureHeights) {
|
||||
for (ulx = -xOffset; ulx < videoWidth; ulx += texWidth) {
|
||||
if (ulx < 0) {
|
||||
gSPTextureRectangle((*dList)++, 0, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, -(ulx << 3), 0, 1024, 1024);
|
||||
gSPTextureRectangle((*dList)++, 0, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE,
|
||||
-(ulx << 3), 0, 1024, 1024);
|
||||
} else {
|
||||
gSPTextureRectangle((*dList)++, ulx, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, 0, 0, 1024, 1024);
|
||||
gSPTextureRectangle((*dList)++, ulx, uly, ulx + texWidth, uly + texHeight, G_TX_RENDERTILE, 0, 0,
|
||||
1024, 1024);
|
||||
}
|
||||
}
|
||||
xOffset = (xOffset + gTexBGShiftX) & (texWidth - 1);
|
||||
|
||||
+1
-1
@@ -1401,7 +1401,7 @@ void render_level_geometry_and_objects(void) {
|
||||
gAntiAliasing = TRUE;
|
||||
}
|
||||
|
||||
sp160 = func_80014814(&objCount);
|
||||
sp160 = get_first_active_object(&objCount);
|
||||
|
||||
if (gCurrentLevelModel->numberOfSegments > 1) {
|
||||
numberOfSegments = 0;
|
||||
|
||||
+9
-9
@@ -71,10 +71,10 @@ Object *gLensFlare = NULL;
|
||||
s32 gLensFlareOff = TRUE;
|
||||
s32 gLensFlareOverrideObjs = 0;
|
||||
Vec2f gRainQuad[4] = {
|
||||
{ -200.0f, 200.0f },
|
||||
{ 200.0f, 200.0f },
|
||||
{ 200.0f, -200.0f },
|
||||
{ -200.0f, -200.0f }
|
||||
{ -200.0f, 200.0f },
|
||||
{ 200.0f, 200.0f },
|
||||
{ 200.0f, -200.0f },
|
||||
{ -200.0f, -200.0f },
|
||||
};
|
||||
|
||||
Vertex gRainVertices[16] = {
|
||||
@@ -1087,12 +1087,12 @@ void render_rain_overlay(RainGfxData *rainGfx, s32 time) {
|
||||
TextureHeader *tex;
|
||||
Gfx *curDL;
|
||||
Triangle *tri;
|
||||
|
||||
|
||||
if (rainGfx->tex == NULL) {
|
||||
return;
|
||||
}
|
||||
tex = rainGfx->tex;
|
||||
|
||||
|
||||
horizontal = tex->width << 5;
|
||||
vertical = tex->height << 5;
|
||||
maskU = (horizontal * 2) - 1;
|
||||
@@ -1115,15 +1115,15 @@ void render_rain_overlay(RainGfxData *rainGfx, s32 time) {
|
||||
|
||||
horizontal += u0;
|
||||
vertical += v0;
|
||||
|
||||
|
||||
zSin = sins_f(gWeatherCamera->trans.rotation.z);
|
||||
zCos = coss_f(gWeatherCamera->trans.rotation.z);
|
||||
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gRainQuad); i++) {
|
||||
gRainVertices[gRainVertexFlip + i].x = gRainQuad[i].x * zCos - gRainQuad[i].y * zSin;
|
||||
gRainVertices[gRainVertexFlip + i].y = gRainQuad[i].y * zCos + gRainQuad[i].x * zSin;
|
||||
}
|
||||
|
||||
|
||||
curDL = gCurrWeatherDisplayList;
|
||||
tri = gCurrWeatherTriList;
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ render_racer_magnet = 0x80013DCC;
|
||||
func_80014090 = 0x80014090;
|
||||
obj_tick_anims = 0x800142B8;
|
||||
render_mesh = 0x800143A8;
|
||||
func_80014814 = 0x80014814;
|
||||
get_first_active_object = 0x80014814;
|
||||
func_800149C0 = 0x800149C0;
|
||||
func_80014B50 = 0x80014B50;
|
||||
sort_objects_by_dist = 0x80015348;
|
||||
@@ -330,7 +330,7 @@ obj_elevation = 0x8001C418;
|
||||
ainode_register = 0x8001C48C;
|
||||
ainode_find_nearest = 0x8001C524;
|
||||
func_8001C6C4 = 0x8001C6C4;
|
||||
func_8001CC48 = 0x8001CC48;
|
||||
ainode_find_next = 0x8001CC48;
|
||||
func_8001CD28 = 0x8001CD28;
|
||||
ainode_enable = 0x8001D1AC;
|
||||
ainode_tail_set = 0x8001D1BC;
|
||||
@@ -3639,7 +3639,7 @@ D_8011AE70 = 0x8011C8E0;
|
||||
D_8011AE74 = 0x8011C8E4;
|
||||
D_8011AE78 = 0x8011C8E8;
|
||||
gCutsceneID = 0x8011C8EA;
|
||||
D_8011AE7C = 0x8011C8EC;
|
||||
gFirstActiveObjectId = 0x8011C8EC;
|
||||
D_8011AE7E = 0x8011C8EE;
|
||||
gTTGhostTimeToBeat = 0x8011C8F0;
|
||||
gPrevTimeTrialVehicle = 0x8011C8F2;
|
||||
|
||||
@@ -266,7 +266,7 @@ render_racer_magnet = 0x80013DCC;
|
||||
func_80014090 = 0x80014090;
|
||||
obj_tick_anims = 0x800142B8;
|
||||
render_mesh = 0x800143A8;
|
||||
func_80014814 = 0x80014814;
|
||||
get_first_active_object = 0x80014814;
|
||||
func_800149C0 = 0x800149C0;
|
||||
func_80014B50 = 0x80014B50;
|
||||
sort_objects_by_dist = 0x80015348;
|
||||
@@ -330,7 +330,7 @@ obj_elevation = 0x8001C418;
|
||||
ainode_register = 0x8001C48C;
|
||||
ainode_find_nearest = 0x8001C524;
|
||||
func_8001C6C4 = 0x8001C6C4;
|
||||
func_8001CC48 = 0x8001CC48;
|
||||
ainode_find_next = 0x8001CC48;
|
||||
func_8001CD28 = 0x8001CD28;
|
||||
ainode_enable = 0x8001D1AC;
|
||||
ainode_tail_set = 0x8001D1BC;
|
||||
@@ -3386,7 +3386,7 @@ D_8011AE70 = 0x8011AF00;
|
||||
D_8011AE74 = 0x8011AF04;
|
||||
D_8011AE78 = 0x8011AF08;
|
||||
gCutsceneID = 0x8011AF0A;
|
||||
D_8011AE7C = 0x8011AF0C;
|
||||
gFirstActiveObjectId = 0x8011AF0C;
|
||||
D_8011AE7E = 0x8011AF0E;
|
||||
gTTGhostTimeToBeat = 0x8011AF10;
|
||||
gPrevTimeTrialVehicle = 0x8011AF12;
|
||||
|
||||
@@ -266,7 +266,7 @@ render_racer_magnet = 0x80013DCC;
|
||||
func_80014090 = 0x80014090;
|
||||
obj_tick_anims = 0x800142B8;
|
||||
render_mesh = 0x800143A8;
|
||||
func_80014814 = 0x80014814;
|
||||
get_first_active_object = 0x80014814;
|
||||
func_800149C0 = 0x800149C0;
|
||||
func_80014B50 = 0x80014B50;
|
||||
sort_objects_by_dist = 0x80015348;
|
||||
@@ -330,7 +330,7 @@ obj_elevation = 0x8001C44C;
|
||||
ainode_register = 0x8001C4C0;
|
||||
ainode_find_nearest = 0x8001C558;
|
||||
func_8001C6C4 = 0x8001C6F8;
|
||||
func_8001CC48 = 0x8001CC7C;
|
||||
ainode_find_next = 0x8001CC7C;
|
||||
func_8001CD28 = 0x8001CD5C;
|
||||
ainode_enable = 0x8001D1E0;
|
||||
ainode_tail_set = 0x8001D1F0;
|
||||
@@ -3316,7 +3316,7 @@ D_8011AE70 = 0x8011B480;
|
||||
D_8011AE74 = 0x8011B484;
|
||||
D_8011AE78 = 0x8011B488;
|
||||
gCutsceneID = 0x8011B48A;
|
||||
D_8011AE7C = 0x8011B48C;
|
||||
gFirstActiveObjectId = 0x8011B48C;
|
||||
D_8011AE7E = 0x8011B48E;
|
||||
gTTGhostTimeToBeat = 0x8011B490;
|
||||
gPrevTimeTrialVehicle = 0x8011B492;
|
||||
|
||||
@@ -266,7 +266,7 @@ render_racer_magnet = 0x80013DCC;
|
||||
func_80014090 = 0x80014090;
|
||||
obj_tick_anims = 0x800142B8;
|
||||
render_mesh = 0x800143A8;
|
||||
func_80014814 = 0x80014814;
|
||||
get_first_active_object = 0x80014814;
|
||||
func_800149C0 = 0x800149C0;
|
||||
func_80014B50 = 0x80014B50;
|
||||
sort_objects_by_dist = 0x80015348;
|
||||
@@ -330,7 +330,7 @@ obj_elevation = 0x8001C418;
|
||||
ainode_register = 0x8001C48C;
|
||||
ainode_find_nearest = 0x8001C524;
|
||||
func_8001C6C4 = 0x8001C6C4;
|
||||
func_8001CC48 = 0x8001CC48;
|
||||
ainode_find_next = 0x8001CC48;
|
||||
func_8001CD28 = 0x8001CD28;
|
||||
ainode_enable = 0x8001D1AC;
|
||||
ainode_tail_set = 0x8001D1BC;
|
||||
@@ -3763,7 +3763,7 @@ D_8011AE70 = 0x8011AE70;
|
||||
D_8011AE74 = 0x8011AE74;
|
||||
D_8011AE78 = 0x8011AE78;
|
||||
gCutsceneID = 0x8011AE7A;
|
||||
D_8011AE7C = 0x8011AE7C;
|
||||
gFirstActiveObjectId = 0x8011AE7C;
|
||||
D_8011AE7E = 0x8011AE7E;
|
||||
gTTGhostTimeToBeat = 0x8011AE80;
|
||||
gPrevTimeTrialVehicle = 0x8011AE82;
|
||||
|
||||
@@ -266,7 +266,7 @@ render_racer_magnet = 0x80013DCC;
|
||||
func_80014090 = 0x80014090;
|
||||
obj_tick_anims = 0x800142B8;
|
||||
render_mesh = 0x800143A8;
|
||||
func_80014814 = 0x80014814;
|
||||
get_first_active_object = 0x80014814;
|
||||
func_800149C0 = 0x800149C0;
|
||||
func_80014B50 = 0x80014B50;
|
||||
sort_objects_by_dist = 0x80015348;
|
||||
@@ -330,7 +330,7 @@ obj_elevation = 0x8001C44C;
|
||||
ainode_register = 0x8001C4C0;
|
||||
ainode_find_nearest = 0x8001C558;
|
||||
func_8001C6C4 = 0x8001C6F8;
|
||||
func_8001CC48 = 0x8001CC7C;
|
||||
ainode_find_next = 0x8001CC7C;
|
||||
func_8001CD28 = 0x8001CD5C;
|
||||
ainode_enable = 0x8001D1E0;
|
||||
ainode_tail_set = 0x8001D1F0;
|
||||
@@ -3312,7 +3312,7 @@ D_8011AE70 = 0x8011B3F0;
|
||||
D_8011AE74 = 0x8011B3F4;
|
||||
D_8011AE78 = 0x8011B3F8;
|
||||
gCutsceneID = 0x8011B3FA;
|
||||
D_8011AE7C = 0x8011B3FC;
|
||||
gFirstActiveObjectId = 0x8011B3FC;
|
||||
D_8011AE7E = 0x8011B3FE;
|
||||
gTTGhostTimeToBeat = 0x8011B400;
|
||||
gPrevTimeTrialVehicle = 0x8011B402;
|
||||
|
||||
Reference in New Issue
Block a user