Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc code 80005fd0 #697

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Conversation

coco875
Copy link
Contributor

@coco875 coco875 commented Jan 2, 2025

No description provided.

@coco875
Copy link
Contributor Author

coco875 commented Jan 2, 2025

I will rename file once 684 are merge

@coco875
Copy link
Contributor Author

coco875 commented Jan 2, 2025

need also HarbourMasters/Torch#166

@@ -69,14 +69,14 @@ glabel func_800088D8
/* 0095D0 800089D0 03193821 */ addu $a3, $t8, $t9
/* 0095D4 800089D4 3C0E800E */ lui $t6, %hi(gDemoMode)
/* 0095D8 800089D8 95CEC51C */ lhu $t6, %lo(gDemoMode)($t6)
/* 0095DC 800089DC 3C048016 */ lui $a0, %hi(D_80164450) # $a0, 0x8016
/* 0095E0 800089E0 24844450 */ addiu $a0, %lo(D_80164450) # addiu $a0, $a0, 0x4450
/* 0095DC 800089DC 3C048016 */ lui $a0, %hi(gLapProgressScore) # $a0, 0x8016
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is gLapProgressScore? The confusing part is score

Players don't really get scored on the progress in the course. I would imagine that gLapProgress would track which waypoint you're on in the course. But we already have this variable gNearestWaypoint or whatever.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be numPathPointsTraversed?

/* 0096E8 80008AE8 3C0B8016 */ lui $t3, %hi(D_80163478) # $t3, 0x8016
/* 0096EC 80008AEC 856B3478 */ lh $t3, %lo(D_80163478)($t3)
/* 0096E8 80008AE8 3C0B8016 */ lui $t3, %hi(gPlayerInFront) # $t3, 0x8016
/* 0096EC 80008AEC 856B3478 */ lh $t3, %lo(gPlayerInFront)($t3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean 'player in 1st place' or 'a player in front of another player'

If it's in 1st place. We need a name morel ike gPlayerInFirstPlace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's say in two player with player have the best rank, so in one player it's always player one but in two player mode it can be player one or player two even if both and in 7th and 8th

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gBestRankedPlayer

Copy link
Contributor Author

@coco875 coco875 Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but all player are name player so it's player who can be play only

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gBestRankedHumanPlayer ?

@@ -141,24 +141,24 @@ glabel func_8000B140
/* 00BF2C 8000B32C 3125FFFF */ andi $a1, $t1, 0xffff
/* 00BF30 8000B330 00003025 */ move $a2, $zero
/* 00BF34 8000B334 24070014 */ li $a3, 20
/* 00BF38 8000B338 3C0C8016 */ lui $t4, %hi(D_80164430) # $t4, 0x8016
/* 00BF38 8000B338 3C0C8016 */ lui $t4, %hi(gCurrentWaypointCountByPathIndex) # $t4, 0x8016
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gCurrentPathCount?

D_80164430 = gWaypointCountByPathIndex[pathIndex];
We're taking the array of paths. And selecting a path.

gSelectedPathCount?

/* 00BF58 8000B358 A7A300E4 */ sh $v1, 0xe4($sp)
/* 00BF5C 8000B35C AFA800FC */ sw $t0, 0xfc($sp)
/* 00BF60 8000B360 A7A900E6 */ sh $t1, 0xe6($sp)
/* 00BF64 8000B364 AFAA00F0 */ sw $t2, 0xf0($sp)
/* 00BF68 8000B368 E7A000DC */ swc1 $f0, 0xdc($sp)
/* 00BF6C 8000B36C E7A20060 */ swc1 $f2, 0x60($sp)
/* 00BF70 8000B370 0C001EFE */ jal func_80007BF8
/* 00BF70 8000B370 0C001EFE */ jal is_waypoint_in_range
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_path_point_in_range

// @return bool If path point is in the range
range_path_point
?

My only thought here, is it would be nice if we found a way to be less verbose kinda like how python does someVar.range()
but whatever.
You can ignore this one if u want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a little more complex then a bool
return

  • 1: waypoint is within normal range
  • -1: waypoint is within wrapped range
  • 2: waypoint is out of range
  • 0: invalid range parameters

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add that in the comments of the function if you have not already.

I also think we should use path point

@@ -782,7 +782,7 @@ glabel L8001B6AC
/* 01C330 8001B730 100001C0 */ b .L8001BE34
/* 01C334 8001B734 86020004 */ lh $v0, 4($s0)
glabel L8001B738
/* 01C338 8001B738 0C006AFB */ jal func_8001ABEC
/* 01C338 8001B738 0C006AFB */ jal reset_strategy_if_actor_valid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's reset the item strategy it have no link with behaviour

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if_actor_valid should not be included in the function name.

Code validation should typically be expected.

Copy link
Collaborator

@MegaMech MegaMech Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset_cpu_item_strategy ?

/* 00A1EC 800095EC AFA40050 */ sw $a0, 0x50($sp)
/* 00A1F0 800095F0 0C0046B9 */ jal reset_kart_ai_behaviour
/* 00A1F4 800095F4 8FA40050 */ lw $a0, 0x50($sp)
/* 00A1F8 800095F8 8FA40050 */ lw $a0, 0x50($sp)
/* 00A1FC 800095FC 3C0F8016 */ lui $t7, %hi(D_8016348C) # $t7, 0x8016
/* 00A200 80009600 85EF348C */ lh $t7, %lo(D_8016348C)($t7)
/* 00A204 80009604 3C018016 */ lui $at, %hi(D_801642D8 + 0x6) # 0x8016
/* 00A204 80009604 3C018016 */ lui $at, %hi(gCpuItemStrategy + 0x6) # 0x8016
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gCPU ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by memory once I name a variable with CPU in uppercase but you say no so I rename with cpu in pascal case

/* 009F88 80009388 8CC63448 */ lw $a2, %lo(D_80163448)($a2)
/* 009F80 80009380 3C068016 */ lui $a2, %hi(gActualPath) # $a2, 0x8016
/* 009F84 80009384 0C002E57 */ jal update_player_position_factor
/* 009F88 80009388 8CC63448 */ lw $a2, %lo(gActualPath)($a2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if actual path refers to the path the AI use. We should make this clear this is like the gMainPath or gCoursePath or gAIPath or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I think it's a little more general then just AI

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being set to a path index of a player.

gPlayerPathIndex or something

/* 0AD424 800AC824 3C048016 */ lui $a0, %hi(D_80164478) # $a0, 0x8016
/* 0AD428 800AC828 24844478 */ addiu $a0, %lo(D_80164478) # addiu $a0, $a0, 0x4478
/* 0AD424 800AC824 3C048016 */ lui $a0, %hi(gCharacterPlayer) # $a0, 0x8016
/* 0AD428 800AC828 24844478 */ addiu $a0, %lo(gCharacterPlayer) # addiu $a0, $a0, 0x4478
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gCharacterIdDup ?

src/code_80005FD0.c Outdated Show resolved Hide resolved
src/code_80005FD0.c Outdated Show resolved Hide resolved
src/code_80005FD0.c Outdated Show resolved Hide resolved
src/code_80005FD0.c Show resolved Hide resolved
src/code_80005FD0.c Outdated Show resolved Hide resolved
@MegaMech
Copy link
Collaborator

MegaMech commented Jan 15, 2025

The file name cpu_logic doesn't encompass everything that goes on in this function:

  • vehicles
  • camera demo/end of race stuff
  • cpu logic

Could you try splitting the file? Or is that what this is?

@@ -58,7 +58,7 @@ s32 gCountBChangement[8];
bool gIsPlayerTripleBButtonCombo[8];
s32 gTimerBoostTripleBCombo[8];

s16 chooseKartAIPlayers[7];
s16 chooseCPUPlayers[7];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpu_chooseCharacters ?

/* 0x6 */ s16 laps; // confirm?
/* 0x8 */ s32 blank;
/* 0xC */ s32 unkC;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it that this struct is deleted. and yet replaced with CpuItemStrategyData which is 2 struct members bigger?
It makes sense that they might be the same, but it's weird that it matched like that. Sort of

@@ -782,7 +782,7 @@ glabel L8001B6AC
/* 01C330 8001B730 100001C0 */ b .L8001BE34
/* 01C334 8001B734 86020004 */ lh $v0, 4($s0)
glabel L8001B738
/* 01C338 8001B738 0C006AFB */ jal func_8001ABEC
/* 01C338 8001B738 0C006AFB */ jal reset_strategy_if_actor_valid
Copy link
Collaborator

@MegaMech MegaMech Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset_cpu_item_strategy ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants