Decompile aiYield and add some structs including chrdata

This commit is contained in:
Ryan Dwyer 2019-10-05 22:25:21 +10:00
parent 505f1e8e36
commit 980d3b6032
5 changed files with 300 additions and 57 deletions

View File

@ -87868,57 +87868,26 @@ bool aiLabel(void)
/**
* @cmd 0003
*/
GLOBAL_ASM(
glabel ai0003
/* f04dc58: 3c03800a */ lui $v1,0x800a
/* f04dc5c: 24639fc0 */ addiu $v1,$v1,-24640
/* f04dc60: 8c6e0438 */ lw $t6,0x438($v1)
/* f04dc64: 8c620424 */ lw $v0,0x424($v1)
/* f04dc68: 25cf0002 */ addiu $t7,$t6,0x2
/* f04dc6c: 10400008 */ beqz $v0,.L0f04dc90
/* f04dc70: ac6f0438 */ sw $t7,0x438($v1)
/* f04dc74: 8c780434 */ lw $t8,0x434($v1)
/* f04dc78: ac580108 */ sw $t8,0x108($v0)
/* f04dc7c: 8c680424 */ lw $t0,0x424($v1)
/* f04dc80: 8c790438 */ lw $t9,0x438($v1)
/* f04dc84: 24020001 */ addiu $v0,$zero,0x1
/* f04dc88: 03e00008 */ jr $ra
/* f04dc8c: a519010c */ sh $t9,0x10c($t0)
.L0f04dc90:
/* f04dc90: 8c620428 */ lw $v0,0x428($v1)
/* f04dc94: 50400009 */ beqzl $v0,.L0f04dcbc
/* f04dc98: 8c62042c */ lw $v0,0x42c($v1)
/* f04dc9c: 8c690434 */ lw $t1,0x434($v1)
/* f04dca0: ac49005c */ sw $t1,0x5c($v0)
/* f04dca4: 8c6b0428 */ lw $t3,0x428($v1)
/* f04dca8: 8c6a0438 */ lw $t2,0x438($v1)
/* f04dcac: 24020001 */ addiu $v0,$zero,0x1
/* f04dcb0: 03e00008 */ jr $ra
/* f04dcb4: a56a0060 */ sh $t2,0x60($t3)
/* f04dcb8: 8c62042c */ lw $v0,0x42c($v1)
.L0f04dcbc:
/* f04dcbc: 50400009 */ beqzl $v0,.L0f04dce4
/* f04dcc0: 8c620430 */ lw $v0,0x430($v1)
/* f04dcc4: 8c6c0434 */ lw $t4,0x434($v1)
/* f04dcc8: ac4c005c */ sw $t4,0x5c($v0)
/* f04dccc: 8c6e042c */ lw $t6,0x42c($v1)
/* f04dcd0: 8c6d0438 */ lw $t5,0x438($v1)
/* f04dcd4: 24020001 */ addiu $v0,$zero,0x1
/* f04dcd8: 03e00008 */ jr $ra
/* f04dcdc: a5cd0060 */ sh $t5,0x60($t6)
/* f04dce0: 8c620430 */ lw $v0,0x430($v1)
.L0f04dce4:
/* f04dce4: 10400006 */ beqz $v0,.L0f04dd00
/* f04dce8: 00000000 */ sll $zero,$zero,0x0
/* f04dcec: 8c6f0434 */ lw $t7,0x434($v1)
/* f04dcf0: ac4f005c */ sw $t7,0x5c($v0)
/* f04dcf4: 8c790430 */ lw $t9,0x430($v1)
/* f04dcf8: 8c780438 */ lw $t8,0x438($v1)
/* f04dcfc: a7380060 */ sh $t8,0x60($t9)
.L0f04dd00:
/* f04dd00: 03e00008 */ jr $ra
/* f04dd04: 24020001 */ addiu $v0,$zero,0x1
);
bool aiYield(void)
{
g_Vars.aioffset += 2;
if (g_Vars.chrdata) {
g_Vars.chrdata->ailist = g_Vars.ailist;
g_Vars.chrdata->aioffset = g_Vars.aioffset;
} else if (g_Vars.objdata) {
g_Vars.objdata->ailist = g_Vars.ailist;
g_Vars.objdata->aioffset = g_Vars.aioffset;
} else if (g_Vars.aicdata) {
g_Vars.aicdata->ailist = g_Vars.ailist;
g_Vars.aicdata->aioffset = g_Vars.aioffset;
} else if (g_Vars.aiddata) {
g_Vars.aiddata->ailist = g_Vars.ailist;
g_Vars.aiddata->aioffset = g_Vars.aioffset;
}
return true;
}
/**
* @cmd 0005

View File

@ -6,7 +6,7 @@
/*0x0000*/ bool aiGoToNext(void);
/*0x0001*/ bool aiGoToFirst(void);
/*0x0002*/ bool aiLabel(void);
/*0x0003*/ bool ai0003(void);
/*0x0003*/ bool aiYield(void);
/*0x0004*/ bool ai0004(void);
/*0x0005*/ bool ai0005(void);
/*0x0006*/ bool ai0006(void);

View File

@ -1,4 +1,5 @@
#include "ultra64.h"
#include "src/include/types.h"
struct g_vars {
// Known member names based on debug strings:
@ -280,10 +281,10 @@ struct g_vars {
/*0418*/ u32 unk0418;
/*041c*/ u32 unk041c;
/*0420*/ u32 unk0420;
/*0424*/ u32 unk0424;
/*0428*/ u32 unk0428;
/*042c*/ u32 unk042c;
/*0430*/ u32 unk0430;
/*0424*/ struct chrdata *chrdata;
/*0428*/ struct defaultobj *objdata;
/*042c*/ struct otheraidata *aicdata;
/*0430*/ struct otheraidata *aiddata;
/*0434*/ u8 *ailist;
/*0438*/ u32 aioffset;
/*043c*/ u32 unk043c;

View File

@ -4,6 +4,279 @@
#include "ultra64.h"
#include "constants.h"
struct coord {
float x;
float y;
float z;
};
struct position {
u16 unk00;
u16 room;
u32 unk04;
float x;
float y;
float z;
};
struct chrdata {
/*0x000*/ u16 chrnum;
/*0x002*/ u8 accuracyrating;
/*0x003*/ u8 speedrating;
/*0x004*/ u16 firecount;
/*0x006*/ u8 headnum;
/*0x007*/ u8 actiontype;
/*0x008*/ u8 sleep;
/*0x009*/ u8 invalidmove;
/*0x00a*/ u8 numclosearghs;
/*0x00b*/ u8 numarghs;
/*0x00c*/ u8 fadealpha;
/*0x00d*/ u8 arghrating;
/*0x00e*/ u8 aimendcount;
/*0x00f*/ u8 grenadeprob;
/*0x010*/ u16 bodynum;
/*0x012*/ u8 flinchcnt;
/*0x013*/ u8 path;
/*0x014*/ u32 hidden;
/*0x018*/ u32 chrflags;
/*0x01c*/ struct position *pos;
/*0x020*/ u32 unk020;
/*0x024*/ u32 chrwidth;
/*0x028*/ u32 chrheight;
/*0x02c*/ u32 unk02c;
/*0x030*/ u32 unk030;
/*0x034*/ u32 unk034;
/*0x038*/ u32 unk038;
/*0x03c*/ u32 unk03c;
/*0x040*/ u32 unk040;
/*0x044*/ u32 unk044;
/*0x048*/ u32 unk048;
/*0x04c*/ u32 unk04c;
/*0x050*/ u32 unk050;
/*0x054*/ u32 unk054;
/*0x058*/ u32 unk058;
/*0x05c*/ u32 unk05c;
/*0x060*/ u32 unk060;
/*0x064*/ u32 unk064;
/*0x068*/ u32 unk068;
/*0x06c*/ u32 unk06c;
/*0x070*/ u32 unk070;
/*0x074*/ u32 unk074;
/*0x078*/ u32 unk078;
/*0x07c*/ u32 unk07c;
/*0x080*/ u32 unk080;
/*0x084*/ u32 unk084;
/*0x088*/ u32 unk088;
/*0x08c*/ u32 unk08c;
/*0x090*/ u32 unk090;
/*0x094*/ u32 unk094;
/*0x098*/ u32 unk098;
/*0x09c*/ u32 unk09c;
/*0x0a0*/ u32 unk0a0;
/*0x0a4*/ u32 unk0a4;
/*0x0a8*/ u32 unk0a8;
/*0x0ac*/ u32 unk0ac;
/*0x0b0*/ u32 sumground;
/*0x0b4*/ u32 manground;
/*0x0b8*/ u32 ground;
/*0x0bc*/ struct coord fallspeed;
/*0x0c8*/ struct coord prevpos;
/*0x0d4*/ u32 lastwalk60;
/*0x0d8*/ u32 lastmoveok60;
/*0x0dc*/ float visionrange;
/*0x0e0*/ u32 lastseetarget60;
/*0x0e4*/ u32 lastvisibletarg;
/*0x0e8*/ void *unk0e8;
/*0x0ec*/ u16 lastshooter;
/*0x0ee*/ u16 timeshooter;
/*0x0f0*/ float hearingscale;
/*0x0f4*/ u32 lastheartarget60;
/*0x0f8*/ u32 shadecol;
/*0x0fc*/ u32 nextcol;
/*0x100*/ float damage;
/*0x104*/ float maxdamage;
/*0x108*/ u8 *ailist;
/*0x10c*/ u16 aioffset;
/*0x10e*/ u16 aireturnlist;
/*0x110*/ u16 aishotlist;
/*0x112*/ u8 morale;
/*0x113*/ u8 alertness;
/*0x114*/ u32 flags;
/*0x118*/ u32 flags2;
/*0x11c*/ u32 timer60;
/*0x120*/ u32 soundtimer;
/*0x124*/ u8 random;
/*0x125*/ u8 team;
/*0x126*/ u8 soundgap;
/*0x128*/ u16 padpreset1;
/*0x12a*/ u16 chrpreset1;
/*0x12c*/ u16 proppreset1;
/*0x12e*/ u16 chrseeshot;
/*0x130*/ u16 chrseedie;
/*0x132*/ u16 chrdup;
/*0x134*/ u32 unk134;
/*0x138*/ u32 unk138;
/*0x13c*/ u32 unk13c;
/*0x140*/ u32 unk140;
/*0x144*/ u32 unk144;
/*0x148*/ u32 unk148;
/*0x14c*/ u32 shotbondsum;
/*0x150*/ u32 aimuplshoulder;
/*0x154*/ u32 aimuprshoulder;
/*0x158*/ u32 aimupback;
/*0x15c*/ u32 aimsideback;
/*0x160*/ u32 aimendlshoulder;
/*0x164*/ u32 aimendrshoulder;
/*0x168*/ u32 aimendback;
/*0x16c*/ u32 aimendsideback;
/*0x170*/ u32 unk170;
/*0x174*/ u32 unk174;
/*0x178*/ u32 unk178;
/*0x17c*/ u16 fireslot;
/*0x17e*/ u16 target;
/*0x180*/ u32 cshield;
/*0x184*/ u8 cmnum;
/*0x185*/ u8 cmnum2;
/*0x186*/ u8 cmnum3;
/*0x187*/ u8 cmnum4;
/*0x188*/ u16 cmcount;
/*0x18a*/ u16 floorcol;
/*0x18c*/ u32 oldframe;
/*0x190*/ u8 footstep;
/*0x191*/ u8 floortype;
/*0x192*/ u16 hidden2;
/*0x194*/ u32 magicframe;
/*0x198*/ u32 magicspeed;
/*0x19c*/ u16 magicanim;
/*0x19e*/ u16 goposforce;
/*0x1a0*/ u8 bdlist[240];
/*0x290*/ u8 bdstart;
/*0x291*/ u8 goposhitcount;
/*0x292*/ u16 cover;
/*0x294*/ struct coord dtargetlastseenp;
/*0x2a0*/ u8 myaction;
/*0x2a1*/ u8 orders;
/*0x2a2*/ u8 squadron;
/*0x2a3*/ u8 listening;
/*0x2a4*/ u32 convtalk;
/*0x2a8*/ u32 talktimer;
/*0x2ac*/ u8 question;
/*0x2ad*/ u8 talkgap;
/*0x2ae*/ u16 unk2ae;
/*0x2b0*/ u8 tude;
/*0x2b1*/ u8 voicebox;
/*0x2b2*/ u16 floorroom;
/*0x2b4*/ u32 unk2b4;
/*0x2b8*/ u16 oldrooms[8];
/*0x2c8*/ struct coord runfrompos;
/*0x2d4*/ u32 unk2d4;
/*0x2d8*/ u16 blurdrugamount;
/*0x2da*/ u16 cloakpause;
/*0x2dc*/ u32 drugheadsway;
/*0x2e0*/ u8 drugheadcount;
/*0x2e1*/ u8 cloakfade;
/*0x2e2*/ u8 teamscandist;
/*0x2e3*/ u8 naturalanim;
/*0x2e4*/ u32 myspecial;
/*0x2e8*/ u32 timeextra;
/*0x2ec*/ u32 elapseextra;
/*0x2f0*/ struct coord extraspeed;
/*0x2fc*/ u8 yvisang;
/*0x2fd*/ u8 ivebeenhit;
/*0x2fe*/ u8 race;
/*0x2ff*/ u8 blurnumtimesdied;
/*0x300*/ struct position *gungroundpos;
/*0x304*/ double pushspeed;
/*0x30c*/ double gunroty;
/*0x314*/ double gunrotx;
/*0x31c*/ u32 onladder;
/*0x320*/ struct coord laddernormal;
/*0x32c*/ u8 liftaction;
/*0x32d*/ u16 BITFIELD;
/*0x32f*/ u8 specialdie;
/*0x330*/ u16 roomtosearch;
/*0x332*/ u8 propsoundcount;
/*0x333*/ u8 patrolnextstep;
/*0x334*/ u8 BulletsTaken;
/*0x335*/ u8 WoundedSplatsA;
/*0x336*/ u16 TicksSinceSplat;
/*0x338*/ u8 SplatsDroppedHe;
/*0x339*/ u8 StdSplatsAdded;
/*0x33a*/ u8 DeadDropSplatsA;
/*0x33b*/ u8 aimtesttimer60;
/*0x33c*/ struct coord LastDropPos;
/*0x340*/ u32 unk340;
/*0x344*/ u32 unk344;
/*0x348*/ u32 unk348;
/*0x34c*/ u32 unk34c;
/*0x350*/ u32 unk350;
/*0x354*/ u16 aipunchdodgelist;
/*0x356*/ u16 aishootingatmel;
/*0x358*/ u16 poisonCounter;
/*0x35a*/ u16 aidarkroomlist;
/*0x35c*/ u16 aiplayerdeadlist;
/*0x35e*/ u8 dodgerating;
/*0x35f*/ u8 maxdodgerating;
/*0x360*/ u8 unarmeddodgerat;
/*0x361*/ u8 lastfootsample;
/*0x362*/ u8 onlift;
/*0x364*/ u32 unk364;
/*0x368*/ u32 m_SoundEndTime;
};
struct defaultobj {
/*0x00*/ u16 extrascale;
/*0x02*/ u8 hidden2;
/*0x03*/ u8 type;
/*0x04*/ u16 obj;
/*0x06*/ u16 pad;
/*0x08*/ u32 flags;
/*0x0c*/ u32 flags2;
/*0x10*/ u32 flags3;
/*0x14*/ u32 unk14;
/*0x18*/ u32 unk18;
/*0x1c*/ float realrot[9];
/*0x40*/ u32 hidden;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x4c*/ u16 damage;
/*0x4e*/ u16 maxdamage;
/*0x50*/ u32 shadecol;
/*0x54*/ u32 nextcol;
/*0x58*/ u16 floorcol;
/*0x5a*/ u8 numtiles;
/*0x5c*/ u8 *ailist;
/*0x60*/ u16 aioffset;
};
struct otheraidata {
/*0x00*/ u32 unk00;
/*0x04*/ u32 unk04;
/*0x08*/ u32 unk08;
/*0x0c*/ u32 unk0c;
/*0x10*/ u32 unk10;
/*0x14*/ u32 unk14;
/*0x18*/ u32 unk18;
/*0x1c*/ u32 unk1c;
/*0x20*/ u32 unk20;
/*0x24*/ u32 unk24;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x34*/ u32 unk34;
/*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c;
/*0x40*/ u32 unk40;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x4c*/ u32 unk4c;
/*0x50*/ u32 unk50;
/*0x54*/ u32 unk54;
/*0x58*/ u32 unk58;
/*0x5c*/ u8 *ailist;
/*0x60*/ u16 aioffset;
};
struct ailists {
u8 *list;
u32 id;

View File

@ -13950,7 +13950,7 @@ bool (*command_pointers[])(void) = {
/*0x0000*/ aiGoToNext,
/*0x0001*/ aiGoToFirst,
/*0x0002*/ aiLabel,
/*0x0003*/ ai0003,
/*0x0003*/ aiYield,
/*0x0004*/ ai0004,
/*0x0005*/ ai0005,
/*0x0006*/ ai0006,