Decompile bgRenderScene

This commit is contained in:
Ryan Dwyer
2022-02-07 21:11:30 +10:00
parent 6481a7739c
commit 4636a96857
16 changed files with 351 additions and 781 deletions
+6 -6
View File
@@ -264,14 +264,14 @@ u32 props[] = {
tag(0x3f, 1)
door(0x0100, MODEL_DD_GRATE, PAD_EAR_016A, OBJFLAG_ILLUMINATED, OBJFLAG2_AICANNOTUSE | OBJFLAG2_80000000, 0, 1000, 0x0000f333, 0x00010000, 0x00007fff, 0x00014000, 0x00000666, DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_SLIDING, 0x00000008, 0x00000384, 0x00000000, 0x00000000, 0x00000300)
tag(0x01, 1)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0213, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_40000000, OBJFLAG2_00000001, OBJFLAG3_INTERACTABLE, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0213, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_RENDERPOSTBG, OBJFLAG2_00000001, OBJFLAG3_INTERACTABLE, 1000, 3)
tag(0x02, 1)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0214, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_40000000, OBJFLAG2_00000001, OBJFLAG3_INTERACTABLE, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0214, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_RENDERPOSTBG, OBJFLAG2_00000001, OBJFLAG3_INTERACTABLE, 1000, 3)
tag(0x03, 1)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0215, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_40000000, OBJFLAG2_00000001, OBJFLAG3_INTERACTABLE, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0216, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_40000000, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0217, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_40000000, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0218, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_40000000, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0215, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_RENDERPOSTBG, OBJFLAG2_00000001, OBJFLAG3_INTERACTABLE, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0216, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_RENDERPOSTBG, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0217, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_RENDERPOSTBG, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0218, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040 | OBJFLAG_DEACTIVATED | OBJFLAG_MONITOR_RENDERPOSTBG, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_0219, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_021A, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040, OBJFLAG2_00000001, 0, 1000, 3)
singlemonitor(0x0100, MODEL_TVSCREEN, PAD_EAR_021B, OBJFLAG_00000002 | OBJFLAG_00000020 | OBJFLAG_00000040, OBJFLAG2_00000001, 0, 1000, 3)
+283 -736
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -117,7 +117,7 @@ s32 debug0f11ed70(void)
return 0;
}
bool debugEnableBgRendering(void)
bool debugIsBgRenderingEnabled(void)
{
return true;
}
+2 -2
View File
@@ -1627,8 +1627,8 @@ void setupSingleMonitor(struct singlemonitorobj *monitor, s32 cmdindex)
setupGenericObject(&monitor->base, cmdindex);
}
if (monitor->base.prop && (monitor->base.flags & OBJFLAG_MONITOR_40000000)) {
monitor->base.prop->flags |= PROPFLAG_01;
if (monitor->base.prop && (monitor->base.flags & OBJFLAG_MONITOR_RENDERPOSTBG)) {
monitor->base.prop->flags |= PROPFLAG_RENDERPOSTBG;
}
}
+31 -13
View File
@@ -370,45 +370,63 @@ Gfx *propRender(Gfx *gdl, struct prop *prop, bool withalpha)
return gdl;
}
Gfx *propsRender(Gfx *gdl, s16 arg1, s32 arg2, s16 *arg3)
/**
* Render one pass of all props in the given room number.
*
* The render order is:
* - Opaque components of props (pre-BG)
* - Opaque components of BG
* - Opaque components of props (post-BG)
* - Wall hits
* - Alpha components of BG
* - Alpha components of props
*
* Most props are rendered in the pre-bg pass for performance reasons, as there
* is less BG to draw if it's being obscured by props.
*
* Props can be rendered in multiple passes, such as terminals which render the
* terminal in the pre-bg pass and the screen in the post-bg pass, likely to
* avoid Z-fighting issues.
*/
Gfx *propsRender(Gfx *gdl, s16 renderroomnum, s32 renderpass, s16 *roomnumsbyprop)
{
struct prop **ptr;
struct prop *prop;
s16 *tmp;
s16 *proprooms;
if (arg2 == 0 || arg2 == 2) {
if (renderpass == RENDERPASS_OPAQUE_PREBG || renderpass == RENDERPASS_OPAQUE_POSTBG) {
// Iterate onscreen props near to far
ptr = g_Vars.endonscreenprops - 1;
tmp = arg3 + (g_Vars.endonscreenprops - g_Vars.onscreenprops);
tmp--;
proprooms = roomnumsbyprop + (g_Vars.endonscreenprops - g_Vars.onscreenprops);
proprooms--;
while (ptr >= g_Vars.onscreenprops) {
if (arg1 == *tmp) {
if (renderroomnum == *proprooms) {
prop = *ptr;
if (prop) {
if ((arg2 == 0 && (prop->flags & (PROPFLAG_20 | PROPFLAG_01)) == 0)
|| (arg2 == 2 && (prop->flags & (PROPFLAG_20 | PROPFLAG_01)) == PROPFLAG_01)) {
if ((renderpass == RENDERPASS_OPAQUE_PREBG && (prop->flags & (PROPFLAG_DRAWONTOP | PROPFLAG_RENDERPOSTBG)) == 0)
|| (renderpass == RENDERPASS_OPAQUE_POSTBG && (prop->flags & (PROPFLAG_DRAWONTOP | PROPFLAG_RENDERPOSTBG)) == PROPFLAG_RENDERPOSTBG)) {
gdl = propRender(gdl, prop, false);
}
}
}
ptr--;
tmp--;
proprooms--;
}
} else {
// Iterate onscreen props far to near
ptr = g_Vars.onscreenprops;
tmp = arg3;
proprooms = roomnumsbyprop;
while (ptr < g_Vars.endonscreenprops) {
if (arg1 == *tmp) {
if (renderroomnum == *proprooms) {
prop = *ptr;
if (prop) {
if (prop->flags & PROPFLAG_20) {
if (prop->flags & PROPFLAG_DRAWONTOP) {
gdl = propRender(gdl, prop, false);
}
@@ -417,7 +435,7 @@ Gfx *propsRender(Gfx *gdl, s16 arg1, s32 arg2, s16 *arg3)
}
ptr++;
tmp++;
proprooms++;
}
}
+4 -4
View File
@@ -5032,12 +5032,12 @@ struct prop *objInit(struct defaultobj *obj, struct modelfiledata *filedata, str
objInitToggleNodes(obj);
if (obj->flags3 & OBJFLAG3_00040000) {
prop->flags |= PROPFLAG_01;
if (obj->flags3 & OBJFLAG3_RENDERPOSTBG) {
prop->flags |= PROPFLAG_RENDERPOSTBG;
}
if (obj->flags3 & OBJFLAG3_00080000) {
prop->flags |= PROPFLAG_20;
if (obj->flags3 & OBJFLAG3_DRAWONTOP) {
prop->flags |= PROPFLAG_DRAWONTOP;
}
} else {
if (model) {
+1 -1
View File
@@ -6728,7 +6728,7 @@ glabel func0f140e20
#endif
GLOBAL_ASM(
glabel func0f1411b0
glabel wallhitsRender
/* f1411b0: 000430c0 */ sll $a2,$a0,0x3
/* f1411b4: 00c43021 */ addu $a2,$a2,$a0
/* f1411b8: 3c0e800a */ lui $t6,%hi(g_Rooms)
+9 -5
View File
@@ -2938,7 +2938,7 @@
#define OBJFLAG_HOVERBIKE_MOVINGWHILEEMPTY 0x40000000
#define OBJFLAG_HOVERCAR_40000000 0x40000000
#define OBJFLAG_LIFT_TRIGGERDISABLE 0x40000000
#define OBJFLAG_MONITOR_40000000 0x40000000
#define OBJFLAG_MONITOR_RENDERPOSTBG 0x40000000
#define OBJFLAG_WEAPON_40000000 0x40000000
#define OBJFLAG_80000000 0x80000000
#define OBJFLAG_CHOPPER_INACTIVE 0x80000000 // Or lift disabled, or hovercar something
@@ -2997,8 +2997,8 @@
#define OBJFLAG3_REACTTOSIGHT 0x00008000 // Turn sight blue or red when targeted with R
#define OBJFLAG3_INTERACTABLE 0x00010000
#define OBJFLAG3_SHIELDHIT 0x00020000 // Turns off when shield no longer visible
#define OBJFLAG3_00040000 0x00040000 // Not used in scripts
#define OBJFLAG3_00080000 0x00080000 // Not used in scripts
#define OBJFLAG3_RENDERPOSTBG 0x00040000
#define OBJFLAG3_DRAWONTOP 0x00080000
#define OBJFLAG3_HOVERBEDSHIELD 0x00100000
#define OBJFLAG3_INTERACTSHORTRANGE 0x00200000
#define OBJFLAG3_PLAYERUNDROPPABLE 0x00400000 // Player does not drop item when dead
@@ -3335,12 +3335,12 @@
#define PROJECTILEFLAG_40000000 0x40000000
#define PROJECTILEFLAG_FREE 0x80000000
#define PROPFLAG_01 0x01
#define PROPFLAG_RENDERPOSTBG 0x01
#define PROPFLAG_ONTHISSCREENTHISTICK 0x02
#define PROPFLAG_ENABLED 0x04
#define PROPFLAG_NOTYETTICKED 0x08
#define PROPFLAG_DONTPAUSE 0x10
#define PROPFLAG_20 0x20
#define PROPFLAG_DRAWONTOP 0x20
#define PROPFLAG_ONANYSCREENTHISTICK 0x40
#define PROPFLAG_ONANYSCREENPREVTICK 0x80
@@ -3408,6 +3408,10 @@
#define RACE_EYESPY 3
#define RACE_ROBOT 4
#define RENDERPASS_OPAQUE_PREBG 0
#define RENDERPASS_ALPHA 1
#define RENDERPASS_OPAQUE_POSTBG 2
#define ROOMFLAG_FORCEDISABLED 0x0001
#define ROOMFLAG_VISIBLEBYPLAYER 0x0004
#define ROOMFLAG_VISIBLEBYAIBOT 0x0008
+5 -5
View File
@@ -5,7 +5,7 @@
#include "types.h"
void roomUnpauseProps(u32 roomnum, bool tintedglassonly);
void func0f157e94(s32 room, s32 arg1, struct screenbox *arg2);
void func0f157e94(s32 room, s32 draworder, struct screenbox *arg2);
void func0f158108(s32 roomnum, u8 *arg1, u8 *arg2);
struct var800a4640_00 *func0f158140(s32 roomnum);
u32 func0f158184(void);
@@ -15,8 +15,8 @@ u32 func0f158d9c(void);
u32 func0f1598b4(void);
Gfx *func0f159f1c(Gfx *gdl, s32 roomnum, struct roomgfxdata18 *arg2, s32 arg3, s16 arg4[3]);
Gfx *roomRenderForEraser(Gfx *gdl, s32 roomnum);
u32 func0f15a2c4(void);
Gfx *func0f15a6f4(Gfx *gdl);
Gfx *bgRenderSceneInXray(Gfx *gdl);
Gfx *bgRenderScene(Gfx *gdl);
Gfx *func0f15b114(Gfx *gdl);
void bgLoadFile(void *memaddr, u32 offset, u32 len);
s32 stageGetIndex2(s32 stagenum);
@@ -60,8 +60,8 @@ void bgUnloadAllRooms(void);
void bgGarbageCollectRooms(s32 bytesneeded, bool desparate);
void bgTickRooms(void);
Gfx *func0f15e85c(Gfx *gdl, s32 roomnum, struct roomgfxdata18 *arg2, bool arg3);
Gfx *func0f15eb28(Gfx *gdl, s32 roomnum);
Gfx *func0f15ebd4(Gfx *gdl, s32 roomnum);
Gfx *bgRenderRoomOpaque(Gfx *gdl, s32 roomnum);
Gfx *bgRenderRoomAlpha(Gfx *gdl, s32 roomnum);
u32 func0f15ecd8(void);
void func0f15ef9c(s32 roomnum);
u32 func0f15f20c(void);
+2 -1
View File
@@ -4,9 +4,10 @@
#include "data.h"
#include "types.h"
void debug0f119a80nb(void);
u32 dprint();
s32 debug0f11ed70(void);
bool debugEnableBgRendering(void);
bool debugIsBgRenderingEnabled(void);
bool debugIsPropRenderingEnabled(void);
bool debug0f11edb0(void);
bool debug0f11edb8(void);
+1 -1
View File
@@ -19,7 +19,7 @@ u32 func0f122d4c(void);
u32 func0f123fd4(void);
u32 func0f125948(void);
f32 func0f125a1c(struct bootbufferthingdeep *arg0);
u32 func0f125a6c(void);
Gfx *func0f125a6c(Gfx *gdl, s32 arg1);
Gfx *func0f126384(Gfx *gdl, f32 x, f32 y, f32 arg3, f32 orbsize, s32 arg5, f32 arg6);
Gfx *func0f126c3c(Gfx *gdl, f32 x, f32 y, f32 z, f32 arg4, f32 arg5);
Gfx *func0f126de8(Gfx *gdl);
+1 -1
View File
@@ -8,7 +8,7 @@ void func0f13c510(void);
void func0f13c54c(void);
u16 func0f13c574(f32 arg0);
u32 func0f13c710(void);
u32 func0f13c780(void);
void func0f13c780(s32 arg0);
u8 func0f13d3c4(u8 arg0, u8 arg1);
Gfx *func0f13d40c(Gfx *gdl);
Gfx *func0f13d54c(Gfx *gdl);
+1 -1
View File
@@ -17,7 +17,7 @@ void propDelist(struct prop *prop);
void propReparent(struct prop *mover, struct prop *adopter);
void propDetach(struct prop *prop);
Gfx *propRender(Gfx *gdl, struct prop *prop, bool withalpha);
Gfx *propsRender(Gfx *gdl, s16 arg1, s32 arg2, s16 *arg3);
Gfx *propsRender(Gfx *gdl, s16 renderroomnum, s32 renderpass, s16 *roomnumsbyprop);
void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop);
void func0f060bac(s32 weaponnum, struct prop *prop);
struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struct coord *arg3, struct coord *gunpos, struct coord *dir, u32 arg6, f32 arg7, bool arg8);
+1 -1
View File
@@ -7,6 +7,6 @@
void func0f135c70(void);
u32 func0f135f08(void);
void skyInit(void);
u32 func0f13687c(void);
Gfx *func0f13687c(Gfx *gdl);
#endif
+1 -1
View File
@@ -19,7 +19,7 @@ s32 func0f140750(struct coord *coord);
u32 func0f1408a8(void);
u32 func0f140b7c(void);
Gfx *func0f140e20(Gfx *gdl, struct prop *prop, bool withalpha);
u32 func0f1411b0(void);
Gfx *wallhitsRender(s32 arg0, Gfx *gdl);
void func0f141234(void);
void func0f14159c(struct prop *prop);
void func0f141704(struct prop *prop);
+2 -2
View File
@@ -5252,9 +5252,9 @@ struct portalcmd {
};
struct var800a4640_00 {
s16 unk00;
s16 roomnum;
u8 unk02;
u8 unk03;
u8 draworder;
struct screenbox box;
};