mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-08 18:23:19 -04:00
Decompile currentPlayerAutoWalk
This commit is contained in:
@@ -1942,7 +1942,7 @@ u8 func040d_cass[] = {
|
||||
// 1 player - do force walk (enter room)
|
||||
label(0x20)
|
||||
revoke_control(CHR_BOND, 0)
|
||||
force_walk(CHR_BOND, 0x0019, 0x2837, 0x002e)
|
||||
force_walk(CHR_BOND, 0x0019, 40, 55, 0, 46)
|
||||
|
||||
beginloop(0x23)
|
||||
open_door(OBJ_TOPROOMDOOR)
|
||||
@@ -1951,7 +1951,7 @@ u8 func040d_cass[] = {
|
||||
|
||||
// Second force walk (turn to face Cass)
|
||||
label(0x24)
|
||||
force_walk(CHR_BOND, 0x0018, 0x0041, 0x4100)
|
||||
force_walk(CHR_BOND, 0x0018, 0, 65, 65, 0)
|
||||
open_door(OBJ_TOPROOMDOOR)
|
||||
|
||||
beginloop(0x25)
|
||||
|
||||
@@ -121,7 +121,7 @@ u8 func1002_first_walk[] = {
|
||||
remove_displayed_text
|
||||
revoke_control(CHR_BOND, 0)
|
||||
enter_firstperson
|
||||
force_walk(CHR_BOND, 0x0275, 0x2805, 0x0064)
|
||||
force_walk(CHR_BOND, 0x0275, 40, 5, 0, 100)
|
||||
chr_move_to_pad(CHR_GUARD, 0x0274, 0x01, /*goto*/ 0x0b)
|
||||
|
||||
// Wait for walk to finish
|
||||
@@ -185,7 +185,7 @@ u8 func1007_second_walk[] = {
|
||||
revoke_control(CHR_BOND, 0)
|
||||
enter_firstperson
|
||||
yield
|
||||
force_walk(CHR_BOND, 0x0275, 0x2805, 0x0064)
|
||||
force_walk(CHR_BOND, 0x0275, 40, 5, 0, 100)
|
||||
|
||||
// Place Jon
|
||||
call_rng
|
||||
@@ -265,7 +265,7 @@ u8 func1008_third_walk[] = {
|
||||
remove_displayed_text
|
||||
revoke_control(CHR_BOND, 0)
|
||||
enter_firstperson
|
||||
force_walk(CHR_BOND, 0x0275, 0x2805, 0x0064)
|
||||
force_walk(CHR_BOND, 0x0275, 40, 5, 0, 100)
|
||||
chr_move_to_pad(CHR_TRENT, 0x0272, 0x01, /*goto*/ 0x0b)
|
||||
|
||||
beginloop(0x0b)
|
||||
|
||||
@@ -11969,7 +11969,7 @@ bool aiPlayerAutoWalk(void)
|
||||
bool aiIfPlayerAutoWalkFinished(void)
|
||||
{
|
||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
||||
bool pass = false;
|
||||
bool walking = false;
|
||||
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]);
|
||||
|
||||
if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) {
|
||||
@@ -11977,14 +11977,14 @@ bool aiIfPlayerAutoWalkFinished(void)
|
||||
u32 playernum = propGetPlayerNum(chr->prop);
|
||||
setCurrentPlayerNum(playernum);
|
||||
|
||||
if (g_Vars.tickmode == 7) {
|
||||
pass = true;
|
||||
if (g_Vars.tickmode == TICKMODE_AUTOWALK) {
|
||||
walking = true;
|
||||
}
|
||||
|
||||
setCurrentPlayerNum(prevplayernum);
|
||||
}
|
||||
|
||||
if (pass) {
|
||||
if (walking) {
|
||||
g_Vars.aioffset += 4;
|
||||
} else {
|
||||
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]);
|
||||
|
||||
+9
-32
@@ -12188,38 +12188,15 @@ glabel func0f0bd3c4
|
||||
/* f0bd430: 00000000 */ sll $zero,$zero,0x0
|
||||
);
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel currentPlayerAutoWalk
|
||||
/* f0bd434: 27bdffe8 */ addiu $sp,$sp,-24
|
||||
/* f0bd438: afbf0014 */ sw $ra,0x14($sp)
|
||||
/* f0bd43c: afa40018 */ sw $a0,0x18($sp)
|
||||
/* f0bd440: afa5001c */ sw $a1,0x1c($sp)
|
||||
/* f0bd444: afa60020 */ sw $a2,0x20($sp)
|
||||
/* f0bd448: afa70024 */ sw $a3,0x24($sp)
|
||||
/* f0bd44c: 0fc2e58f */ jal setTickMode
|
||||
/* f0bd450: 24040007 */ addiu $a0,$zero,0x7
|
||||
/* f0bd454: 3c02800a */ lui $v0,%hi(g_Vars)
|
||||
/* f0bd458: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars)
|
||||
/* f0bd45c: 8c4f0284 */ lw $t7,0x284($v0)
|
||||
/* f0bd460: 87ae001a */ lh $t6,0x1a($sp)
|
||||
/* f0bd464: a5ee1ba4 */ sh $t6,0x1ba4($t7)
|
||||
/* f0bd468: 8c590284 */ lw $t9,0x284($v0)
|
||||
/* f0bd46c: 93b8001f */ lbu $t8,0x1f($sp)
|
||||
/* f0bd470: a7381baa */ sh $t8,0x1baa($t9)
|
||||
/* f0bd474: 8c490284 */ lw $t1,0x284($v0)
|
||||
/* f0bd478: 93a80023 */ lbu $t0,0x23($sp)
|
||||
/* f0bd47c: ad281bac */ sw $t0,0x1bac($t1)
|
||||
/* f0bd480: 8c4b0284 */ lw $t3,0x284($v0)
|
||||
/* f0bd484: 93aa0027 */ lbu $t2,0x27($sp)
|
||||
/* f0bd488: a56a1ba6 */ sh $t2,0x1ba6($t3)
|
||||
/* f0bd48c: 8c4d0284 */ lw $t5,0x284($v0)
|
||||
/* f0bd490: 93ac002b */ lbu $t4,0x2b($sp)
|
||||
/* f0bd494: a5ac1ba8 */ sh $t4,0x1ba8($t5)
|
||||
/* f0bd498: 8fbf0014 */ lw $ra,0x14($sp)
|
||||
/* f0bd49c: 27bd0018 */ addiu $sp,$sp,0x18
|
||||
/* f0bd4a0: 03e00008 */ jr $ra
|
||||
/* f0bd4a4: 00000000 */ sll $zero,$zero,0x0
|
||||
);
|
||||
void currentPlayerAutoWalk(s16 aimpad, u8 walkspeed, u8 turnspeed, u8 lookup, u8 dist)
|
||||
{
|
||||
setTickMode(TICKMODE_AUTOWALK);
|
||||
g_Vars.currentplayer->autocontrol_aimpad = aimpad;
|
||||
g_Vars.currentplayer->autocontrol_walkspeed = walkspeed;
|
||||
g_Vars.currentplayer->autocontrol_turnspeed = turnspeed;
|
||||
g_Vars.currentplayer->autocontrol_lookup = lookup;
|
||||
g_Vars.currentplayer->autocontrol_dist = dist;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel func0f0bd4a8
|
||||
|
||||
@@ -3016,12 +3016,14 @@
|
||||
/**
|
||||
* Forces the player to walk to the given pad (eg. Extraction and Duel).
|
||||
*/
|
||||
#define force_walk(chr, pad, unknown1, unknown2) \
|
||||
#define force_walk(chr, aimpad, walkspeed, turnspeed, lookup, dist) \
|
||||
mkshort(0x0177), \
|
||||
chr, \
|
||||
mkshort(pad), \
|
||||
mkshort(unknown1), \
|
||||
mkshort(unknown2),
|
||||
mkshort(aimpad), \
|
||||
walkspeed, \
|
||||
turnspeed, \
|
||||
lookup, \
|
||||
dist,
|
||||
|
||||
/**
|
||||
* Checks if the player's force walk has finished.
|
||||
|
||||
@@ -1745,11 +1745,12 @@
|
||||
#define TEAM_32 0x32
|
||||
#define TEAM_NONCOMBAT 0x80
|
||||
|
||||
#define TICKMODE_0 0
|
||||
#define TICKMODE_1 1
|
||||
#define TICKMODE_3 3
|
||||
#define TICKMODE_4 4
|
||||
#define TICKMODE_6 6
|
||||
#define TICKMODE_0 0
|
||||
#define TICKMODE_1 1
|
||||
#define TICKMODE_3 3
|
||||
#define TICKMODE_4 4
|
||||
#define TICKMODE_6 6
|
||||
#define TICKMODE_AUTOWALK 7
|
||||
|
||||
#define TELEPORTSTATE_STARTING 1
|
||||
#define TELEPORTSTATE_3 3
|
||||
|
||||
@@ -129,7 +129,7 @@ u32 func0f0bcaa0(void);
|
||||
u32 func0f0bce24(void);
|
||||
u32 func0f0bd358(void);
|
||||
u32 func0f0bd3c4(void);
|
||||
void currentPlayerAutoWalk(s16 pad_id, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
void currentPlayerAutoWalk(s16 aimpad, u8 walkspeed, u8 turnspeed, u8 lookup, u8 dist);
|
||||
u32 func0f0bd4a8(void);
|
||||
u32 func0f0bd4e4(void);
|
||||
u32 func0f0bd764(void);
|
||||
|
||||
@@ -52,7 +52,7 @@ struct g_vars {
|
||||
/*0002a0*/ struct player *bond; // Joanna
|
||||
/*0002a4*/ struct player *coop; // Co-op buddy when controlled by human
|
||||
/*0002a8*/ struct player *anti; // Counter-op
|
||||
/*0002ac*/ u32 tickmode; // 7 if mission timer running
|
||||
/*0002ac*/ u32 tickmode;
|
||||
/*0002b0*/ s32 killcount;
|
||||
/*0002b4*/ u32 knockoutcount;
|
||||
/*0002b8*/ struct textoverride *textoverrides;
|
||||
|
||||
+5
-3
@@ -2679,9 +2679,11 @@ struct player {
|
||||
/*0x1b98*/ u32 unk1b98;
|
||||
/*0x1b9c*/ u32 unk1b9c;
|
||||
/*0x1ba0*/ s32 cam_room;
|
||||
/*0x1ba4*/ u32 unk1ba4;
|
||||
/*0x1ba8*/ u32 unk1ba8;
|
||||
/*0x1bac*/ u32 unk1bac;
|
||||
/*0x1ba4*/ s16 autocontrol_aimpad;
|
||||
/*0x1ba6*/ s16 autocontrol_lookup;
|
||||
/*0x1ba8*/ s16 autocontrol_dist;
|
||||
/*0x1baa*/ s16 autocontrol_walkspeed;
|
||||
/*0x1bac*/ s32 autocontrol_turnspeed;
|
||||
/*0x1bb0*/ struct coord cam_pos;
|
||||
/*0x1bbc*/ struct coord cam_look;
|
||||
/*0x1bc8*/ struct coord cam_up;
|
||||
|
||||
@@ -38,7 +38,7 @@ void initGlobalVariables(void)
|
||||
g_Vars.numaibuddies = 0;
|
||||
g_Vars.unk000324 = 1;
|
||||
g_Vars.unk000328 = 1;
|
||||
g_Vars.tickmode = 0;
|
||||
g_Vars.tickmode = TICKMODE_0;
|
||||
g_Vars.roomcount = 350;
|
||||
g_Vars.unk000314 = 0;
|
||||
g_Vars.mplayerisrunning = 0;
|
||||
|
||||
Reference in New Issue
Block a user