Decompile tagGetCommandIndex
This commit is contained in:
parent
376ae2d7c7
commit
f72b9300d6
|
|
@ -5017,10 +5017,10 @@ bool ai0179(void)
|
|||
bool ai00d0(void)
|
||||
{
|
||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
||||
s16 thing1 = cmd[4] | (cmd[3] << 8);
|
||||
s16 thing2 = cmd[6] | (cmd[5] << 8);
|
||||
s16 padnum = cmd[4] | (cmd[3] << 8);
|
||||
s16 sound = cmd[6] | (cmd[5] << 8);
|
||||
|
||||
func0f0939f8(0, NULL, thing2, thing1, -1, 2, 0, 0, 0, -1, 0, -1, -1, -1, -1);
|
||||
func0f0939f8(0, NULL, sound, padnum, -1, 2, 0, 0, 0, -1, 0, -1, -1, -1, -1);
|
||||
|
||||
g_Vars.aioffset += 7;
|
||||
|
||||
|
|
@ -5201,7 +5201,7 @@ bool aiEndLevel(void)
|
|||
{
|
||||
if (debugAllowEndLevel()) {
|
||||
if (var800624a4) {
|
||||
func0000e95c(90);
|
||||
func0000e95c(STAGE_TITLE);
|
||||
} else if (g_Vars.unk0004d3) {
|
||||
g_Vars.unk0004d6 = 1;
|
||||
} else {
|
||||
|
|
@ -5464,10 +5464,10 @@ bool ai00df(void)
|
|||
struct tag *tag = tagFindById(cmd[2]);
|
||||
|
||||
if (tag) {
|
||||
s32 a = func0f092098(tag);
|
||||
s32 cmdindex = tagGetCommandIndex(tag);
|
||||
|
||||
if (a >= 0) {
|
||||
u32 *ptr = setupGetPtrToCommandByIndex(tag->unk06 + a);
|
||||
if (cmdindex >= 0) {
|
||||
u32 *ptr = setupGetPtrToCommandByIndex(cmdindex + tag->cmdoffset);
|
||||
func0f0b9bac(ptr, cmd[4] | (cmd[3] << 8), cmd[6] | (cmd[5] << 8));
|
||||
}
|
||||
}
|
||||
|
|
@ -9044,19 +9044,19 @@ bool aiShuffleInvestigationTerminals(void)
|
|||
// Place the good terminal
|
||||
if (rand1 == 0) {
|
||||
pc = tagFindById(cmd[4]);
|
||||
goodtag->unk06 = pc->unk06;
|
||||
goodtag->cmdoffset = pc->cmdoffset;
|
||||
goodtag->obj = pc->obj;
|
||||
} else if (rand1 == 1) {
|
||||
pc = tagFindById(cmd[5]);
|
||||
goodtag->unk06 = pc->unk06;
|
||||
goodtag->cmdoffset = pc->cmdoffset;
|
||||
goodtag->obj = pc->obj;
|
||||
} else if (rand1 == 2) {
|
||||
pc = tagFindById(cmd[6]);
|
||||
goodtag->unk06 = pc->unk06;
|
||||
goodtag->cmdoffset = pc->cmdoffset;
|
||||
goodtag->obj = pc->obj;
|
||||
} else {
|
||||
pc = tagFindById(cmd[7]);
|
||||
goodtag->unk06 = pc->unk06;
|
||||
goodtag->cmdoffset = pc->cmdoffset;
|
||||
goodtag->obj = pc->obj;
|
||||
}
|
||||
|
||||
|
|
@ -9070,19 +9070,19 @@ bool aiShuffleInvestigationTerminals(void)
|
|||
// Place the alarm terminal
|
||||
if (rand2 == 0) {
|
||||
pc = tagFindById(cmd[4]);
|
||||
badtag->unk06 = pc->unk06;
|
||||
badtag->cmdoffset = pc->cmdoffset;
|
||||
badtag->obj = pc->obj;
|
||||
} else if (rand2 == 1) {
|
||||
pc = tagFindById(cmd[5]);
|
||||
badtag->unk06 = pc->unk06;
|
||||
badtag->cmdoffset = pc->cmdoffset;
|
||||
badtag->obj = pc->obj;
|
||||
} else if (rand2 == 2) {
|
||||
pc = tagFindById(cmd[6]);
|
||||
badtag->unk06 = pc->unk06;
|
||||
badtag->cmdoffset = pc->cmdoffset;
|
||||
badtag->obj = pc->obj;
|
||||
} else {
|
||||
pc = tagFindById(cmd[7]);
|
||||
badtag->unk06 = pc->unk06;
|
||||
badtag->cmdoffset = pc->cmdoffset;
|
||||
badtag->obj = pc->obj;
|
||||
}
|
||||
}
|
||||
|
|
@ -10515,32 +10515,32 @@ bool aiShuffleRuinsPillars(void)
|
|||
|
||||
// Pillar/mine 1
|
||||
src = tagFindById(pillars[marked1index]);
|
||||
ptr1->unk06 = src->unk06;
|
||||
ptr1->cmdoffset = src->cmdoffset;
|
||||
ptr1->obj = src->obj;
|
||||
|
||||
ptr1 = tagFindById(cmd[10]);
|
||||
src = tagFindById(mines[marked1index]);
|
||||
ptr1->unk06 = src->unk06;
|
||||
ptr1->cmdoffset = src->cmdoffset;
|
||||
ptr1->obj = src->obj;
|
||||
|
||||
// Pillar/mine 2
|
||||
src = tagFindById(pillars[marked2index]);
|
||||
ptr2->unk06 = src->unk06;
|
||||
ptr2->cmdoffset = src->cmdoffset;
|
||||
ptr2->obj = src->obj;
|
||||
|
||||
ptr2 = tagFindById(cmd[11]);
|
||||
src = tagFindById(mines[marked2index]);
|
||||
ptr2->unk06 = src->unk06;
|
||||
ptr2->cmdoffset = src->cmdoffset;
|
||||
ptr2->obj = src->obj;
|
||||
|
||||
// Pillar/mine 3
|
||||
src = tagFindById(pillars[marked3index]);
|
||||
ptr3->unk06 = src->unk06;
|
||||
ptr3->cmdoffset = src->cmdoffset;
|
||||
ptr3->obj = src->obj;
|
||||
|
||||
ptr3 = tagFindById(cmd[12]);
|
||||
src = tagFindById(mines[marked3index]);
|
||||
ptr3->unk06 = src->unk06;
|
||||
ptr3->cmdoffset = src->cmdoffset;
|
||||
ptr3->obj = src->obj;
|
||||
|
||||
g_Vars.aioffset += 18;
|
||||
|
|
@ -10675,7 +10675,7 @@ bool aiShufflePelagicSwitches(void)
|
|||
if (buttonsdone[index] == 0) {
|
||||
// Switch has not yet been mapped
|
||||
button = tagFindById(index);
|
||||
tag->unk06 = button->unk06;
|
||||
tag->cmdoffset = button->cmdoffset;
|
||||
tag->obj = button->obj;
|
||||
buttonsdone[index] = 1;
|
||||
} else {
|
||||
|
|
@ -10683,7 +10683,7 @@ bool aiShufflePelagicSwitches(void)
|
|||
for (j = 0; buttonsdone[j]; j++);
|
||||
|
||||
button = tagFindById(j);
|
||||
tag->unk06 = button->unk06;
|
||||
tag->cmdoffset = button->cmdoffset;
|
||||
tag->obj = button->obj;
|
||||
buttonsdone[j] = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,48 +126,25 @@ glabel setupGetPtrToCommandByIndex
|
|||
/* f092094: 27bd0028 */ addiu $sp,$sp,0x28
|
||||
);
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel func0f092098
|
||||
/* f092098: 27bdffd8 */ addiu $sp,$sp,-40
|
||||
/* f09209c: afb00014 */ sw $s0,0x14($sp)
|
||||
/* f0920a0: 3c10800a */ lui $s0,%hi(g_StageSetup+0x10)
|
||||
/* f0920a4: 8e10d040 */ lw $s0,%lo(g_StageSetup+0x10)($s0)
|
||||
/* f0920a8: afb30020 */ sw $s3,0x20($sp)
|
||||
/* f0920ac: 00809825 */ or $s3,$a0,$zero
|
||||
/* f0920b0: afbf0024 */ sw $ra,0x24($sp)
|
||||
/* f0920b4: afb2001c */ sw $s2,0x1c($sp)
|
||||
/* f0920b8: 12000012 */ beqz $s0,.L0f092104
|
||||
/* f0920bc: afb10018 */ sw $s1,0x18($sp)
|
||||
/* f0920c0: 920e0003 */ lbu $t6,0x3($s0)
|
||||
/* f0920c4: 24120034 */ addiu $s2,$zero,0x34
|
||||
/* f0920c8: 00008825 */ or $s1,$zero,$zero
|
||||
/* f0920cc: 524e000e */ beql $s2,$t6,.L0f092108
|
||||
/* f0920d0: 2402ffff */ addiu $v0,$zero,-1
|
||||
.L0f0920d4:
|
||||
/* f0920d4: 16130003 */ bne $s0,$s3,.L0f0920e4
|
||||
/* f0920d8: 00000000 */ sll $zero,$zero,0x0
|
||||
/* f0920dc: 1000000a */ beqz $zero,.L0f092108
|
||||
/* f0920e0: 02201025 */ or $v0,$s1,$zero
|
||||
.L0f0920e4:
|
||||
/* f0920e4: 0fc24784 */ jal setupGetCommandLength
|
||||
/* f0920e8: 02002025 */ or $a0,$s0,$zero
|
||||
/* f0920ec: 00027880 */ sll $t7,$v0,0x2
|
||||
/* f0920f0: 01f08021 */ addu $s0,$t7,$s0
|
||||
/* f0920f4: 92180003 */ lbu $t8,0x3($s0)
|
||||
/* f0920f8: 26310001 */ addiu $s1,$s1,0x1
|
||||
/* f0920fc: 1658fff5 */ bne $s2,$t8,.L0f0920d4
|
||||
/* f092100: 00000000 */ sll $zero,$zero,0x0
|
||||
.L0f092104:
|
||||
/* f092104: 2402ffff */ addiu $v0,$zero,-1
|
||||
.L0f092108:
|
||||
/* f092108: 8fbf0024 */ lw $ra,0x24($sp)
|
||||
/* f09210c: 8fb00014 */ lw $s0,0x14($sp)
|
||||
/* f092110: 8fb10018 */ lw $s1,0x18($sp)
|
||||
/* f092114: 8fb2001c */ lw $s2,0x1c($sp)
|
||||
/* f092118: 8fb30020 */ lw $s3,0x20($sp)
|
||||
/* f09211c: 03e00008 */ jr $ra
|
||||
/* f092120: 27bd0028 */ addiu $sp,$sp,0x28
|
||||
);
|
||||
s32 tagGetCommandIndex(struct tag *tag)
|
||||
{
|
||||
u32 *cmd = g_StageSetup.props;
|
||||
|
||||
if (cmd) {
|
||||
s32 cmdindex = 0;
|
||||
|
||||
while ((u8)cmd[0] != OBJTYPE_END) {
|
||||
if ((struct tag *)cmd == tag) {
|
||||
return cmdindex;
|
||||
}
|
||||
|
||||
cmd = cmd + setupGetCommandLength(cmd);
|
||||
cmdindex++;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel func0f092124
|
||||
|
|
|
|||
|
|
@ -4144,7 +4144,7 @@ void func0f0b9a20(void)
|
|||
void func0f0b9afc(void)
|
||||
{
|
||||
if (var800624a4) {
|
||||
func0000e95c(0x5a);
|
||||
func0000e95c(STAGE_TITLE);
|
||||
} else if (g_Vars.unk0004d3) {
|
||||
g_Vars.unk0004d6 = 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
u32 setupGetCommandLength(u32 *cmd);
|
||||
u32 *setupGetPtrToCommandByIndex(u32 cmdindex);
|
||||
u32 func0f092098(struct tag *tag);
|
||||
s32 tagGetCommandIndex(struct tag *tag);
|
||||
u32 func0f092124(void);
|
||||
bool propLoad(s32 propnum);
|
||||
bool func0f09220c(struct defaultobj *obj, struct coord *pos, f32 *realrot, u32 arg3, u32 arg4);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ u32 func0f093508(void);
|
|||
u32 func0f093630(void);
|
||||
u32 func0f093790(void);
|
||||
u32 func0f0938ec(void);
|
||||
u32 func0f0939f8(void *arg0, struct prop *prop, s16 sound, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, f32 arg9, s32 arg10, s32 arg11, f32 arg12, f32 arg13, f32 arg14);
|
||||
u32 func0f0939f8(void *arg0, struct prop *prop, s16 sound, s32 padnum, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, f32 arg9, s32 arg10, s32 arg11, f32 arg12, f32 arg13, f32 arg14);
|
||||
void audioMuteChannel(s32 channel);
|
||||
u32 audioIfChannelIdle(s32 channel);
|
||||
bool audioPlayFromProp2(s8 channel_id, s32 audio_id, s32 volumemaybe, struct prop *prop, u32 arg4, s32 arg5, s32 arg6, s32 arg7);
|
||||
|
|
|
|||
|
|
@ -1131,13 +1131,11 @@ struct chopperobj {
|
|||
};
|
||||
|
||||
struct tag {
|
||||
// These three words are possibly the same values as defined in the setup
|
||||
// file, but this just a guess.
|
||||
u32 unk00;
|
||||
u16 unk04;
|
||||
s16 unk06;
|
||||
u32 unk08;
|
||||
struct defaultobj *obj;
|
||||
/*0x00*/ u32 identifier; // always 0x00000016
|
||||
/*0x04*/ u16 tagnum;
|
||||
/*0x06*/ s16 cmdoffset;
|
||||
/*0x08*/ u32 unk08;
|
||||
/*0x0c*/ struct defaultobj *obj;
|
||||
};
|
||||
|
||||
struct eyespy {
|
||||
|
|
|
|||
Loading…
Reference in New Issue