-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Lang_Change on Decomp * Decomp progress * 2 / 4 WarpBall funcs remaining * RefreshCard
- Loading branch information
Showing
13 changed files
with
402 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
decompile/WorkInProgress/src/231/231_028_RB_Warpball_NewPathNode.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include <common.h> | ||
|
||
struct CheckpointNode* DECOMP_RB_Warpball_NewPathNode(struct CheckpointNode *cn, struct Driver *d) | ||
{ | ||
u_char currPoint; | ||
u_int currIndex; | ||
u_char boolPointExists = false; | ||
|
||
struct GameTracker *gGT = sdata->gGT; | ||
|
||
// if no driver is chased | ||
if (d == NULL) | ||
{ | ||
RETURN_NEXT_INDEX: | ||
return &gGT->level1->ptr_restart_points[cn->nextIndex_forward]; | ||
} | ||
|
||
// pathPoint -> left index | ||
currIndex = cn->nextIndex_left; | ||
|
||
// if driver is not near that point | ||
if (d->unknown_lap_related[0] != currIndex) | ||
{ | ||
// if left point is valid | ||
if (cn->nextIndex_left != 0xff) | ||
{ | ||
struct CheckpointNode *currNode = cn; | ||
for (int i = 0; i < 3; i++) | ||
{ | ||
// path index | ||
if (currNode->nextIndex_left == -1) | ||
{ | ||
currPoint = currNode->nextIndex_forward; | ||
} | ||
|
||
// path index | ||
else | ||
{ | ||
currPoint = currNode->nextIndex_left; | ||
} | ||
|
||
// path node | ||
currNode = gGT->level1->ptr_restart_points[currPoint]; | ||
|
||
// compare path index | ||
if (d->unknown_lap_related[0] == currNode->nextIndex_forward) | ||
{ | ||
boolPointExists = true; | ||
break; | ||
} | ||
} | ||
} | ||
if (!boolPointExists) | ||
goto RETURN_NEXT_INDEX; | ||
currIndex = cn->nextIndex_left; | ||
} | ||
|
||
// new path node | ||
return &gGT->level1->ptr_restart_points[currIndex]; | ||
} |
119 changes: 119 additions & 0 deletions
119
decompile/WorkInProgress/src/231/231_030_RB_Warpball_GetDriverTarget.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#include <common.h> | ||
|
||
struct Driver* RB_Warpball_GetDriverTarget(struct TrackerWeapon *tw, struct Instance *inst) | ||
{ | ||
u_int distToFinish; | ||
int currDistance; | ||
int index; | ||
int iVar4; | ||
|
||
struct Driver* currDriver = NULL; | ||
struct Driver* hitDriver = NULL; | ||
|
||
// if 10 wumpa fruit were not used | ||
if ((tw->flags & 1) == 0) | ||
{ | ||
for (index = 0; index < 8; index++) | ||
{ | ||
// check next driver until you get the driver | ||
// farthest in the lead, that has not finished race | ||
currDriver = sdata->gGT->drivers[index]; | ||
|
||
// if driver is valid | ||
if (((currDriver != NULL) && | ||
|
||
// if driver is not the same as driver that fired warpball | ||
(currDriver != tw->driverParent)) && | ||
|
||
// if the race is not over for this driver | ||
((currDriver->actionsFlagSet & 0x2000000) == 0)) | ||
{ | ||
return currDriver; | ||
} | ||
} | ||
} | ||
|
||
// if 10 wumpa fruit were used | ||
else | ||
{ | ||
// start of lev->path | ||
struct CheckpointNode* cn = &sdata->gGT->level1->ptr_restart_points[0]; | ||
|
||
// node1 | ||
struct CheckpointNode* node1 = &cn[tw->ptrNodeCurr->nextIndex_forward]; | ||
|
||
// node2 | ||
struct CheckpointNode* node2 = &cn[node1->nextIndex_forward]; | ||
|
||
u_int distToFinish = cn->distToFinish * 8; | ||
|
||
short vec1[4]; | ||
// direction from node1 to node2 | ||
vec1[0] = node1->pos[0] - node2->pos[0]; | ||
vec1[1] = node1->pos[1] - node2->pos[1]; | ||
vec1[2] = node1->pos[2] - node2->pos[2]; | ||
|
||
MATH_VectorNormalize(&vec1[0]); | ||
|
||
short vec2[4]; | ||
// direction from orb to node1 | ||
vec2[0] = inst->matrix.t[0] - node1.pos[0]; | ||
vec2[1] = inst->matrix.t[1] - node1.pos[1]; | ||
vec2[2] = inst->matrix.t[2] - node1.pos[2]; | ||
|
||
// replace R11R12 and R13R21 | ||
gte_ldsvrtrow0(&vec1[0]); | ||
|
||
gte_ldv0(&vec2[0]); | ||
|
||
gte_mvmva(0,0,0,3,0); | ||
|
||
// replace stMAC1 | ||
gte_stlvnl0(&iVar4); | ||
|
||
u_int maxDistance = 0x7fffffff; | ||
|
||
iVar4 = node1->distanceToFinish * 8 + (iVar4 >> 0xc) + 0x200; | ||
|
||
#if 0 | ||
if (uVar1 == 0) | ||
{ | ||
trap(0x1c00); | ||
} | ||
if ((distToFinish == -1) && (iVar4 == -0x80000000)) | ||
{ | ||
trap(0x1800); | ||
} | ||
#endif | ||
|
||
for (index = 0; index < 8; index++) | ||
{ | ||
// pointer to structure of each player | ||
currDriver = sdata->gGT->drivers[index]; | ||
|
||
// if driver is valid | ||
if (((currDriver != NULL) && | ||
((tw->driversHit & 1 << (index & 0x1fU)) == 0)) && | ||
(( | ||
// If the race is not over for this player | ||
(currDriver->actionsFlagSet & 0x2000000) == 0 && | ||
|
||
// If you are not being mask-grabbed | ||
(currDriver->kartState != KS_MASK_GRABBED)))) | ||
{ | ||
currDistance = iVar4 % distToFinish - currDriver->distanceToFinish_curr; | ||
|
||
if (currDistance < 0) | ||
{ | ||
currDistance += distToFinish; | ||
} | ||
if (currDistance < maxDistance) | ||
{ | ||
maxDistance = currDistance; | ||
hitDriver = currDriver; | ||
} | ||
} | ||
} | ||
} | ||
return hitDriver; | ||
} |
79 changes: 79 additions & 0 deletions
79
decompile/WorkInProgress/src/231/231_031_RB_Warpball_SetTargetDriver.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <common.h> | ||
|
||
void RB_Warpball_SetTargetDriver(struct TrackerWeapon *tw) | ||
{ | ||
int distance; | ||
int i, j; | ||
int local_20; | ||
int local_1c; | ||
|
||
struct GameTracker *gGT = sdata->gGT; | ||
|
||
// driver being chased | ||
struct Driver *target = tw->driverTarget; | ||
|
||
// if driver is valid | ||
if (target == NULL) | ||
return; | ||
|
||
distance = target->distanceToFinish_curr; | ||
|
||
// path node | ||
struct CheckpointNode *firstNode = &gGT->level->ptr_restart_points[0]; | ||
struct CheckpointNode *currNode = &first[target->unknown_lap_related]; | ||
|
||
// distance is less than path node distance | ||
while ((distance <= (thisNode->distToFinish << 3) && | ||
|
||
// path node is not first node | ||
(currNode != firstNode))) | ||
{ | ||
currNode = RB_Warpball_NewPathNode(currNode, tw->driverTarget); | ||
} | ||
|
||
target = NULL; | ||
local_1c = 0; | ||
thisNode = tw->ptrNodeCurr; | ||
|
||
if ((tw->flags & 4) == 0) | ||
{ | ||
for (i = 0; i < 2; i++) | ||
{ | ||
distance = *(int *)((int)&local_20 + (distance >> 0xe)); | ||
if (distance != 0) | ||
{ | ||
thisNode = 0; | ||
for (j = 0; j < 3; j++) | ||
{ | ||
if (distance == currNode) | ||
{ | ||
tw->flags = tw->flags & 0xfff7 | 4; | ||
break; | ||
} | ||
if (*(byte *)(distance + 0xb) != 0xff) | ||
{ | ||
// path node | ||
local_1c = *(int *)(*(int *)(gGT + 0x160) + 0x14c) + | ||
(uint) * (byte *)(distance + 0xb) * 0xc; | ||
} | ||
|
||
// path node | ||
distance = *(int *)(*(int *)(gGT + 0x160) + 0x14c) + (uint) * (byte *)(distance + 10) * 0xc; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// path node | ||
thisNode = tw->ptrNodeCurr; | ||
|
||
for (i = 0; i < 3; i++) | ||
{ | ||
if (thisNode == currNode) | ||
{ | ||
tw->flags = tw->flags & ~(8) | 4; | ||
return; | ||
} | ||
target = RB_Warpball_NewPathNode(target, tw->driverTarget); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
decompile/WorkInProgress/src/RefreshCard/RefreshCard_BoolGhostForLEV.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
int RefreshCard_BoolGhostForLEV(u_short trackID) | ||
{ | ||
short numGhost = 0; | ||
|
||
// if ghost profiles are present | ||
if (sdata->numGhostProfilesSaved){ | ||
// loop through ghost profiles | ||
for (char i = 0; i < sdata->numGhostProfilesSaved - 1; i++) | ||
{ | ||
// Check trackID of each profile | ||
if (sdata->ghostProfile_memcard[i].trackID == trackID) | ||
{ | ||
numGhost++; | ||
} | ||
} | ||
} | ||
return numGhost; | ||
} |
23 changes: 23 additions & 0 deletions
23
decompile/WorkInProgress/src/RefreshCard/RefreshCard_GetResult.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <common.h> | ||
|
||
u_int RefreshCard_GetResult(short searchResult) | ||
{ | ||
// MC_RESULT_FINISHED | ||
if ((searchResult == 8) && | ||
((sdata->memcardUnk1 & 6) != 0)) | ||
{ | ||
return true; | ||
} | ||
|
||
u_int boolFound = false; | ||
|
||
if (((sdata->memcardUnk1 & 6) == 0) && | ||
// if frame3 == frame4 | ||
(sdata->frame3_memcardAction == sdata->frame4_memcardAction) && | ||
(sdata->frame3_memcardSlot == sdata->frame4_memcardSlot)) | ||
{ | ||
// is desired_memcardResult == WhatYouLookFor? | ||
boolFound = (sdata->desired_memcardResult == searchResult); | ||
} | ||
return boolFound; | ||
} |
Oops, something went wrong.