Decompile bgExecuteCommandsBranch

This commit is contained in:
Ryan Dwyer
2022-07-12 17:22:49 +10:00
parent d4afa185f9
commit 8d60a8255f
13 changed files with 369 additions and 938 deletions
+2 -2
View File
@@ -3924,12 +3924,12 @@ u8 func1025_unlock_doors_for_buddy[] = {
};
/**
* Unblock the portal in the explosive wall to prevent a flicker
* Open the portal in the explosive wall to prevent a flicker
* where the room isn't rendered on the first frame after exploding.
*/
u8 func1426_setup_portals[] = {
yield
set_portal_flag(0x0072, PORTALFLAG_FORCEUNBLOCKED)
set_portal_flag(0x0072, PORTALFLAG_FORCEOPEN)
set_ailist(CHR_SELF, GAILIST_IDLE)
endlist
};
+324 -859
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -60,11 +60,11 @@ u8 var800aacb8nb[0x140];
#endif
struct var800a6538 var800a6538[16];
u32 var800a65b8;
u32 g_BgRoomTestsDisabled;
u32 var800a65bc;
struct screenbox var800a65c0;
struct screenbox var800a65c8;
u32 g_PortalDisableParentExec;
struct screenbox g_PortalScreenBbox;
u32 g_BgCmdThrowing;
s32 g_BgNumLightsChecksum;
s32 g_BgLightsOffsetChecksum;
u32 var800a65dc;
+5 -5
View File
@@ -2090,12 +2090,12 @@ glabel var7f1b8ef0
/* f191958: 01801825 */ or $v1,$t4,$zero
/* f19195c: 85840028 */ lh $a0,0x28($t4)
.L0f191960:
/* f191960: 0fc575ba */ jal roomIsOnScreen
/* f191960: 0fc575ba */ jal roomIsOnscreen
/* f191964: afa30028 */ sw $v1,0x28($sp)
/* f191968: 14400006 */ bnez $v0,.L0f191984
/* f19196c: 8fa30028 */ lw $v1,0x28($sp)
/* f191970: 84640028 */ lh $a0,0x28($v1)
/* f191974: 0fc575d1 */ jal roomIsOnStandby
/* f191974: 0fc575d1 */ jal roomIsStandby
/* f191978: afa30028 */ sw $v1,0x28($sp)
/* f19197c: 10400005 */ beqz $v0,.L0f191994
/* f191980: 8fa30028 */ lw $v1,0x28($sp)
@@ -2602,12 +2602,12 @@ glabel var7f1b8ef0
/* f191958: 01801825 */ or $v1,$t4,$zero
/* f19195c: 85840028 */ lh $a0,0x28($t4)
.L0f191960:
/* f191960: 0fc575ba */ jal roomIsOnScreen
/* f191960: 0fc575ba */ jal roomIsOnscreen
/* f191964: afa30028 */ sw $v1,0x28($sp)
/* f191968: 14400006 */ bnez $v0,.L0f191984
/* f19196c: 8fa30028 */ lw $v1,0x28($sp)
/* f191970: 84640028 */ lh $a0,0x28($v1)
/* f191974: 0fc575d1 */ jal roomIsOnStandby
/* f191974: 0fc575d1 */ jal roomIsStandby
/* f191978: afa30028 */ sw $v1,0x28($sp)
/* f19197c: 10400005 */ beqz $v0,.L0f191994
/* f191980: 8fa30028 */ lw $v1,0x28($sp)
@@ -3077,7 +3077,7 @@ glabel var7f1b8ef0
// aibot->cheap = true;
//
// for (i = 0; prop->rooms[i] != -1; i++) {
// if (roomIsOnScreen(prop->rooms[i]) || roomIsOnStandby(prop->rooms[i])) {
// if (roomIsOnscreen(prop->rooms[i]) || roomIsStandby(prop->rooms[i])) {
// aibot->cheap = false;
// break;
// }
+1 -1
View File
@@ -25111,7 +25111,7 @@ bool chrIsPosOffScreen(struct coord *pos, s16 *rooms)
if (env0f1666f8(pos, 0)) {
for (i = 0; rooms[i] != -1; i++) {
if (roomIsOnScreen(rooms[i])) {
if (roomIsOnscreen(rooms[i])) {
break;
}
}
+2 -2
View File
@@ -1507,7 +1507,7 @@ bool aiIfChrInOnScreenRoom(void)
if (chr && chr->prop) {
for (i = 0; chr->prop->rooms[i] != -1; i++) {
if (roomIsOnScreen(chr->prop->rooms[i])) {
if (roomIsOnscreen(chr->prop->rooms[i])) {
pass = true;
}
}
@@ -1532,7 +1532,7 @@ bool aiIfRoomIsOnScreen(void)
u16 pad_id = cmd[3] | (cmd[2] << 8);
s32 room_id = chrGetPadRoom(g_Vars.chrdata, pad_id);
if (room_id >= 0 && roomIsOnScreen(room_id)) {
if (room_id >= 0 && roomIsOnscreen(room_id)) {
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
} else {
g_Vars.aioffset += 5;
+1 -1
View File
@@ -616,7 +616,7 @@ void func0f001c0c(void)
var80061420 = mempAlloc(sp68, MEMPOOL_STAGE);
for (i = 0; i < g_NumPortals; i++) {
if ((g_BgPortals[i].flags & PORTALFLAG_BLOCKED) && (g_BgPortals[i].flags & PORTALFLAG_FORCEUNBLOCKED) == 0) {
if (PORTAL_IS_CLOSED(i)) {
var80061438[i] = false;
} else {
var80061438[i] = true;
+1 -1
View File
@@ -6150,7 +6150,7 @@ void propsTickPadEffects(void)
padUnpack(effect->pad, PADFIELD_ROOM, &pad);
if (roomIsOnScreen(pad.room)) {
if (roomIsOnscreen(pad.room)) {
switch (effect->effect) {
case PADEFFECT_SPARKS:
case PADEFFECT_SPARKS2:
+11 -14
View File
@@ -5230,7 +5230,7 @@ void objFree(struct defaultobj *obj, bool freeprop, bool canregen)
if (glass->portalnum >= 0) {
portalSetXluFrac(glass->portalnum, 1);
portalSetUnblocked(glass->portalnum, true);
g_BgPortals[glass->portalnum].flags |= PORTALFLAG_FORCEUNBLOCKED;
g_BgPortals[glass->portalnum].flags |= PORTALFLAG_FORCEOPEN;
}
} else if (obj->type == OBJTYPE_GLASS) {
struct glassobj *glass = (struct glassobj *) obj;
@@ -5244,7 +5244,7 @@ void objFree(struct defaultobj *obj, bool freeprop, bool canregen)
doorActivatePortal(door);
if (door->portalnum >= 0) {
g_BgPortals[door->portalnum].flags |= PORTALFLAG_FORCEUNBLOCKED;
g_BgPortals[door->portalnum].flags |= PORTALFLAG_FORCEOPEN;
}
}
@@ -49947,17 +49947,15 @@ s32 objTickPlayer(struct prop *prop)
struct tintedglassobj *glass = (struct tintedglassobj *)obj;
if (glass->portalnum >= 0) {
pass = (g_BgPortals[glass->portalnum].flags & PORTALFLAG_BLOCKED)
&& (g_BgPortals[glass->portalnum].flags & PORTALFLAG_FORCEUNBLOCKED) == 0;
g_BgPortals[glass->portalnum].flags |= PORTALFLAG_FORCEUNBLOCKED;
pass = PORTAL_IS_CLOSED(glass->portalnum);
g_BgPortals[glass->portalnum].flags |= PORTALFLAG_FORCEOPEN;
}
} else if (obj->type == OBJTYPE_DOOR) {
struct doorobj *door = (struct doorobj *)obj;
if (door->portalnum >= 0) {
pass = (g_BgPortals[door->portalnum].flags & PORTALFLAG_BLOCKED)
&& (g_BgPortals[door->portalnum].flags & PORTALFLAG_FORCEUNBLOCKED) == 0;
g_BgPortals[door->portalnum].flags |= PORTALFLAG_FORCEUNBLOCKED;
pass = PORTAL_IS_CLOSED(door->portalnum);
g_BgPortals[door->portalnum].flags |= PORTALFLAG_FORCEOPEN;
}
}
@@ -54079,7 +54077,7 @@ void glassDestroy(struct defaultobj *obj)
void doorDestroyGlass(struct doorobj *door)
{
struct modelnode *node;
bool bail;
bool closed;
struct prop *prop = door->base.prop;
struct model *model = door->base.model;
union modelrodata *rodata;
@@ -54094,14 +54092,13 @@ void doorDestroyGlass(struct doorobj *door)
// shot from a long distance (such that the glass is opaque) then this
// function returns early and the glass remains in place, despite
// setting the portal as unblocked. On the fourth shot
// PORTALFLAG_FORCEUNBLOCKED is already set, so bail is false and the
// PORTALFLAG_FORCEOPEN is already set, so closed is false and the
// glass is destroyed.
bail = (g_BgPortals[door->portalnum].flags & PORTALFLAG_BLOCKED)
&& (g_BgPortals[door->portalnum].flags & PORTALFLAG_FORCEUNBLOCKED) == 0;
closed = PORTAL_IS_CLOSED(door->portalnum);
g_BgPortals[door->portalnum].flags |= PORTALFLAG_FORCEUNBLOCKED;
g_BgPortals[door->portalnum].flags |= PORTALFLAG_FORCEOPEN;
if (bail) {
if (closed) {
return;
}
}
+3 -3
View File
@@ -223,10 +223,10 @@ extern struct var800a4cf0 var800a4cf0;
extern u32 var800a6470;
extern u32 var800a647c;
extern struct var800a6538 var800a6538[16];
extern u32 var800a65b8;
extern u32 g_BgRoomTestsDisabled;
extern struct screenbox var800a65c0;
extern struct screenbox var800a65c8;
extern u32 g_PortalDisableParentExec;
extern struct screenbox g_PortalScreenBbox;
extern u32 g_BgCmdThrowing;
extern s32 g_BgNumLightsChecksum;
extern s32 g_BgLightsOffsetChecksum;
extern u32 g_FogEnabled;
+6 -37
View File
@@ -80,6 +80,8 @@
// N64 font code uses 0x0f for space, 0x10-0x19 for 0-9 and 0x1a-0x33 for A-Z.
#define N64CHAR(c) (c == ' ' ? 0x0f : (c >= 'A' && c <= 'Z' ? c - 0x27 : c - 0x20))
#define PORTAL_IS_CLOSED(portalnum) ((g_BgPortals[portalnum].flags & PORTALFLAG_CLOSED) && (g_BgPortals[portalnum].flags & PORTALFLAG_FORCEOPEN) == 0)
#if VERSION >= VERSION_NTSC_1_0
#define ROM_COMPANYCODE 0x3459
#else
@@ -3321,43 +3323,10 @@
#define PDMODEPROP_DAMAGE 2
#define PDMODEPROP_ACCURACY 3
#define PORTALCMD_END 0x00
#define PORTALCMD_PUSH 0x01
#define PORTALCMD_POP 0x02
#define PORTALCMD_AND 0x03
#define PORTALCMD_OR 0x04
#define PORTALCMD_NOT 0x05
#define PORTALCMD_XOR 0x06
#define PORTALCMD_14 0x14
#define PORTALCMD_SETMODEVIS 0x1e
#define PORTALCMD_1F 0x1f
#define PORTALCMD_20 0x20
#define PORTALCMD_SETMODEINVIS 0x21
#define PORTALCMD_22 0x22
#define PORTALCMD_23 0x23
#define PORTALCMD_DISABLEROOM 0x24
#define PORTALCMD_DISABLEROOMRANGE 0x25
#define PORTALCMD_LOADROOM 0x26
#define PORTALCMD_LOADROOMRANGE 0x27
#define PORTALCMD_28 0x28
#define PORTALCMD_29 0x29
#define PORTALCMD_2A 0x2a
#define PORTALCMD_50 0x50
#define PORTALCMD_51 0x51
#define PORTALCMD_ENABLEPARENTEXEC 0x52
#define PORTALCMD_IF 0x5a
#define PORTALCMD_TOGGLEEXEC 0x5b
#define PORTALCMD_ENDIF 0x5c
#define PORTALCMD_64 0x64
#define PORTALCMD_TRAILER 0x65
#define PORTALFLAG_BLOCKED 0x01 // Due to door being closed, or player is too far from glass
#define PORTALFLAG_02 0x02
#define PORTALFLAG_FORCEUNBLOCKED 0x04 // Glass is destroyed, or door is freed
#define PORTALFLAG_SKIP 0x08 // DD tower exterior - don't bother processing these
#define PORTALMODE_SHOW 0
#define PORTALMODE_HIDE 1
#define PORTALFLAG_CLOSED 0x01 // Due to door being closed, or player is too far from glass
#define PORTALFLAG_02 0x02
#define PORTALFLAG_FORCEOPEN 0x04 // Glass is destroyed, or door is freed
#define PORTALFLAG_SKIP 0x08 // DD tower exterior - don't bother processing these
#define PRESETANIM_TALK0 0
#define PRESETANIM_TALK1 1
+9 -9
View File
@@ -5,7 +5,7 @@
#include "types.h"
void roomUnpauseProps(u32 roomnum, bool tintedglassonly);
void func0f157e94(s32 room, s32 draworder, struct screenbox *arg2);
void roomSetOnscreen(s32 room, s32 draworder, struct screenbox *arg2);
void func0f158108(s32 roomnum, u8 *arg1, u8 *arg2);
struct var800a4640_00 *func0f158140(s32 roomnum);
u32 func0f158184(void);
@@ -40,13 +40,13 @@ Gfx *currentPlayerScissorWithinViewport(Gfx *gdl, s32 viewleft, s32 viewtop, s32
void func0f15cd28(void);
bool func0f15cd90(u32 room, struct screenbox *arg1);
bool func0f15d08c(struct coord *a, struct coord *b);
bool portal0f15d10c(s32 portal, struct screenbox *arg1);
bool g_PortalGetScreenBbox(s32 portal, struct screenbox *arg1);
Gfx *boxRenderBorder(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2);
bool boxGetIntersection(struct screenbox *a, struct screenbox *b);
void boxExpand(struct screenbox *a, struct screenbox *b);
void boxCopy(struct screenbox *dst, struct screenbox *src);
bool roomIsOnScreen(s32 room);
bool roomIsOnStandby(s32 room);
bool roomIsOnscreen(s32 room);
bool roomIsStandby(s32 room);
bool roomIsOnPlayerScreen(s32 room, u32 playernum);
bool roomIsOnPlayerStandby(s32 room, u32 aibotindex);
s32 portalFindNumByVertices(struct portalvertices *pvertices);
@@ -77,11 +77,11 @@ bool func0f161c08(struct coord *arg0, s16 roomnum);
bool func0f161d30(struct coord *arg0, s16 roomnum);
bool func0f162128(struct coord *arg0, s16 roomnum);
void bgFindRoomsByPos(struct coord *pos, s16 *inrooms, s16 *aboverooms, s32 max, s16 *bestroom);
bool portalPushValue(bool value);
bool portalPopValue(void);
bool portalGetNthValueFromEnd(s32 offset);
struct portalcmd *portalCommandsExecute(struct portalcmd *cmd, bool s2);
struct portalcmd *portalCommandsExecuteForCurrentPlayer(struct portalcmd *cmd);
bool bgPushValue(bool value);
bool bgPopValue(void);
bool bgGetNthValueFromEnd(s32 offset);
struct bgcmd *bgExecuteCommandsBranch(struct bgcmd *cmd, bool s2);
struct bgcmd *bgExecuteCommands(struct bgcmd *cmd);
u32 func0f162d9c(void);
void func0f1632d4(s16 roomnum1, s16 roomnum2, s16 draworder, struct screenbox *box);
void func0f163528(struct var800a4d00 *arg0);
+1 -1
View File
@@ -5139,7 +5139,7 @@ struct var800aabb8 {
u16 unk00_02 : 14;
};
struct portalcmd {
struct bgcmd {
u8 type;
u8 len;
s32 param;