Skip to content

Commit

Permalink
Rename cpu behaviour related symbols (#586)
Browse files Browse the repository at this point in the history
* Rename cpu related symbols
  • Loading branch information
coco875 authored Apr 6, 2024
1 parent c4d596d commit 2b66867
Show file tree
Hide file tree
Showing 26 changed files with 1,030 additions and 984 deletions.
2 changes: 1 addition & 1 deletion asm/non_matchings/code_80005FD0/func_8000929C.s
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ glabel func_8000929C
/* 00A1E4 800095E4 AFA70030 */ sw $a3, 0x30($sp)
/* 00A1E8 800095E8 0C0023CE */ jal func_80008F38
/* 00A1EC 800095EC AFA40050 */ sw $a0, 0x50($sp)
/* 00A1F0 800095F0 0C0046B9 */ jal func_80011AE4
/* 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
Expand Down
12 changes: 6 additions & 6 deletions asm/non_matchings/code_80005FD0/func_80009B60.s
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ glabel D_800ECFC8
glabel func_80009B60
/* 00A760 80009B60 3C0E800E */ lui $t6, %hi(gCurrentCourseId)
/* 00A764 80009B64 85CEC5A0 */ lh $t6, %lo(gCurrentCourseId)($t6)
/* 00A768 80009B68 3C01800E */ lui $at, %hi(D_800DCA4C)
/* 00A768 80009B68 3C01800E */ lui $at, %hi(gKartAICourseMaximumWaypointSeparation)
/* 00A76C 80009B6C 3C0A8016 */ lui $t2, %hi(D_80163100) # $t2, 0x8016
/* 00A770 80009B70 000E7880 */ sll $t7, $t6, 2
/* 00A774 80009B74 002F0821 */ addu $at, $at, $t7
/* 00A778 80009B78 C424CA4C */ lwc1 $f4, %lo(D_800DCA4C)($at)
/* 00A778 80009B78 C424CA4C */ lwc1 $f4, %lo(gKartAICourseMaximumWaypointSeparation)($at)
/* 00A77C 80009B7C 27BDFF30 */ addiu $sp, $sp, -0xd0
/* 00A780 80009B80 254A3100 */ addiu $t2, %lo(D_80163100) # addiu $t2, $t2, 0x3100
/* 00A784 80009B84 4600218D */ trunc.w.s $f6, $f4
Expand Down Expand Up @@ -247,7 +247,7 @@ glabel func_80009B60
/* 00AA98 80009E98 24010014 */ li $at, 20
/* 00AA9C 80009E9C 11610003 */ beq $t3, $at, .L80009EAC
/* 00AAA0 80009EA0 00000000 */ nop
/* 00AAA4 80009EA4 0C00478E */ jal func_80011E38
/* 00AAA4 80009EA4 0C00478E */ jal kart_ai_behaviour
/* 00AAA8 80009EA8 8FA400D0 */ lw $a0, 0xd0($sp)
.L80009EAC:
/* 00AAAC 80009EAC 3C0E8016 */ lui $t6, %hi(D_80163378) # $t6, 0x8016
Expand All @@ -257,7 +257,7 @@ glabel func_80009B60
/* 00AABC 80009EBC 318D0001 */ andi $t5, $t4, 1
/* 00AAC0 80009EC0 11ED0003 */ beq $t7, $t5, .L80009ED0
/* 00AAC4 80009EC4 AFAD0030 */ sw $t5, 0x30($sp)
/* 00AAC8 80009EC8 0C006B04 */ jal cpu_use_item_strategy
/* 00AAC8 80009EC8 0C006B04 */ jal kart_ai_use_item_strategy
/* 00AACC 80009ECC 01802025 */ move $a0, $t4
.L80009ED0:
/* 00AAD0 80009ED0 8FA400D0 */ lw $a0, 0xd0($sp)
Expand Down Expand Up @@ -1267,10 +1267,10 @@ glabel func_80009B60
.L8000AD5C:
/* 00B95C 8000AD5C 8FAA0034 */ lw $t2, 0x34($sp)
.L8000AD60:
/* 00B960 8000AD60 3C0D8016 */ lui $t5, %hi(D_801632E8) # 0x8016
/* 00B960 8000AD60 3C0D8016 */ lui $t5, %hi(gKartAIBehaviourState) # 0x8016
/* 00B964 8000AD64 24010002 */ li $at, 2
/* 00B968 8000AD68 01AA6821 */ addu $t5, $t5, $t2
/* 00B96C 8000AD6C 95AD32E8 */ lhu $t5, %lo(D_801632E8)($t5) # 0x32e8($t5)
/* 00B96C 8000AD6C 95AD32E8 */ lhu $t5, %lo(gKartAIBehaviourState)($t5) # 0x32e8($t5)
/* 00B970 8000AD70 15A10013 */ bne $t5, $at, .L8000ADC0
/* 00B974 8000AD74 3C01800F */ lui $at, %hi(D_800ECFB8) # $at, 0x800f
/* 00B978 8000AD78 C424CFB8 */ lwc1 $f4, %lo(D_800ECFB8)($at)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ glabel jpt_800ED4A0

.section .text

glabel cpu_use_item_strategy
glabel kart_ai_use_item_strategy
/* 01B810 8001AC10 000478C0 */ sll $t7, $a0, 3
/* 01B814 8001AC14 01E47823 */ subu $t7, $t7, $a0
/* 01B818 8001AC18 000F7900 */ sll $t7, $t7, 4
Expand Down Expand Up @@ -96,11 +96,11 @@ glabel L8001ACAC
/* 01B928 8001AD28 00032400 */ sll $a0, $v1, 0x10
/* 01B92C 8001AD2C 00046403 */ sra $t4, $a0, 0x10
/* 01B930 8001AD30 01802025 */ move $a0, $t4
/* 01B934 8001AD34 0C01EBDE */ jal gen_random_item_cpu
/* 01B934 8001AD34 0C01EBDE */ jal kart_ai_gen_random_item
/* 01B938 8001AD38 85A50002 */ lh $a1, 2($t5)
/* 01B93C 8001AD3C 8FA40030 */ lw $a0, 0x30($sp)
/* 01B940 8001AD40 02002825 */ move $a1, $s0
/* 01B944 8001AD44 0C006ADD */ jal cpu_decisions_branch_item
/* 01B944 8001AD44 0C006ADD */ jal kart_ai_decisions_branch_item
/* 01B948 8001AD48 00403025 */ move $a2, $v0
/* 01B94C 8001AD4C 10000003 */ b .L8001AD5C
/* 01B950 8001AD50 00000000 */ nop
Expand Down
4 changes: 2 additions & 2 deletions enhancements/flycam.patch
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ index 0000000..5569838
+ // Don't use `bool = !bool` here as the game code can swap these on you.
+ // Which will confuse the code. This forces it to always be correct
+ if (isFlycam) {
+ player->type |= PLAYER_CPU;
+ player->type |= PLAYER_KART_AI;
+ } else {
+ player->type &= PLAYER_CPU;
+ player->type &= PLAYER_KART_AI;
+ }
+
+ gIsHUDVisible = !isFlycam;
Expand Down
4 changes: 2 additions & 2 deletions include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_CPU (1 << 12) // 0x1000
#define PLAYER_KART_AI (1 << 12) // 0x1000
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_HUMAN (1 << 14) // 0x4000
#define PLAYER_EXISTS (1 << 15) // 0x8000

// Compiles to -0x1000 in diff.py
#define PLAYER_HUMAN_AND_CPU PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_CPU | PLAYER_START_SEQUENCE
#define PLAYER_HUMAN_AND_KART_AI PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_KART_AI | PLAYER_START_SEQUENCE

#define ZERO_PLAYERS_SELECTED 0
#define ONE_PLAYERS_SELECTED 1
Expand Down
2 changes: 1 addition & 1 deletion src/actors/kiwano_fruit/update.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void update_actor_kiwano_fruit(struct KiwanoFruit *fruit) {
s32 nearestWaypoint;

player = &gPlayers[fruit->targetPlayer];
if (((player->type & PLAYER_CPU) != 0) || (player->unk_110.unk34 == 0)) {
if (((player->type & PLAYER_KART_AI) != 0) || (player->unk_110.unk34 == 0)) {
fruit->state = 0;
return;
}
Expand Down
Loading

0 comments on commit 2b66867

Please sign in to comment.