Rename bootbufferthing to artifact
This commit is contained in:
parent
7364fb8e0e
commit
03cedcf233
|
|
@ -2718,13 +2718,13 @@ Gfx *bgRenderArtifacts(Gfx *gdl)
|
|||
s32 i;
|
||||
|
||||
if (g_Vars.mplayerisrunning == false && g_NumRoomsWithGlares > 0) {
|
||||
gdl = func0f13d40c(gdl);
|
||||
gdl = artifactsConfigureForGlares(gdl);
|
||||
|
||||
for (i = 0; i < g_NumRoomsWithGlares; i++) {
|
||||
gdl = artifactsRenderGlaresForRoom(gdl, g_GlareRooms[i]);
|
||||
}
|
||||
|
||||
gdl = func0f13d54c(gdl);
|
||||
gdl = artifactsUnconfigureForGlares(gdl);
|
||||
}
|
||||
|
||||
gdl = skyRenderArtifacts(gdl);
|
||||
|
|
|
|||
|
|
@ -22,20 +22,20 @@ u32 var800a41a4;
|
|||
u32 var800a41a8;
|
||||
u32 var800a41ac;
|
||||
|
||||
void func0f13c510(void)
|
||||
void artifactsClear(void)
|
||||
{
|
||||
struct bootbufferthing *thing = bbufGetIndex0Buffer();
|
||||
struct artifact *artifacts = schedGetWriteArtifacts();
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 120; i++) {
|
||||
thing->unk00[0].unk00[i].unk00 = 0;
|
||||
for (i = 0; i < MAX_ARTIFACTS; i++) {
|
||||
artifacts[i].type = ARTIFACTTYPE_FREE;
|
||||
}
|
||||
}
|
||||
|
||||
void func0f13c54c(void)
|
||||
void artifactsTick(void)
|
||||
{
|
||||
bbufIncIndex0();
|
||||
bbufIncIndex1();
|
||||
schedIncrementWriteArtifacts();
|
||||
schedIncrementFrontArtifacts();
|
||||
}
|
||||
|
||||
u16 func0f13c574(f32 arg0)
|
||||
|
|
@ -130,9 +130,9 @@ void artifactsCalculateGlaresForRoom(s32 roomnum)
|
|||
struct coord spc4;
|
||||
struct light *roomlights;
|
||||
s32 index;
|
||||
struct bootbufferthing *spb8 = bbufGetIndex0Buffer();
|
||||
struct artifact *artifacts = schedGetWriteArtifacts();
|
||||
struct coord *campos = &g_Vars.currentplayer->cam_pos;
|
||||
struct bootbufferthingdeep *ptr;
|
||||
struct artifact *artifact;
|
||||
|
||||
if (g_Rooms[roomnum].gfxdata != NULL && g_Rooms[roomnum].loaded240) {
|
||||
numlights = g_Rooms[roomnum].gfxdata->numlights;
|
||||
|
|
@ -313,20 +313,21 @@ void artifactsCalculateGlaresForRoom(s32 roomnum)
|
|||
&& f0 < 32576.0f) {
|
||||
index = envGetCurrent()->numsuns;
|
||||
index *= 8;
|
||||
ptr = &spb8->unk00[0].unk00[index];
|
||||
artifact = artifacts;
|
||||
artifact += index;
|
||||
|
||||
while (ptr->unk00) {
|
||||
while (artifact->type != ARTIFACTTYPE_FREE) {
|
||||
index++;
|
||||
ptr++;
|
||||
artifact++;
|
||||
}
|
||||
|
||||
if (index < 120) {
|
||||
ptr->unk04 = func0f13c574(f0) >> 2;
|
||||
ptr->unk08 = &var800844f0[viGetWidth() * yi + xi];
|
||||
ptr->light = &roomlights[i];
|
||||
ptr->unk00 = 2;
|
||||
ptr->unk0c.u16_2 = xi;
|
||||
ptr->unk0c.u16_1 = yi;
|
||||
if (index < MAX_ARTIFACTS) {
|
||||
artifact->unk04 = func0f13c574(f0) >> 2;
|
||||
artifact->unk08 = &var800844f0[viGetWidth() * yi + xi];
|
||||
artifact->light = &roomlights[i];
|
||||
artifact->type = ARTIFACTTYPE_GLARE;
|
||||
artifact->unk0c.u16_2 = xi;
|
||||
artifact->unk0c.u16_1 = yi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -350,7 +351,7 @@ u8 func0f13d3c4(u8 arg0, u8 arg1)
|
|||
return arg1;
|
||||
}
|
||||
|
||||
Gfx *func0f13d40c(Gfx *gdl)
|
||||
Gfx *artifactsConfigureForGlares(Gfx *gdl)
|
||||
{
|
||||
struct stagetableentry *stage = stageGetCurrent();
|
||||
|
||||
|
|
@ -369,7 +370,7 @@ Gfx *func0f13d40c(Gfx *gdl)
|
|||
return gdl;
|
||||
}
|
||||
|
||||
Gfx *func0f13d54c(Gfx *gdl)
|
||||
Gfx *artifactsUnconfigureForGlares(Gfx *gdl)
|
||||
{
|
||||
gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
|
||||
|
|
@ -381,7 +382,7 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
|
|||
s32 i;
|
||||
s32 j;
|
||||
s32 lightindex;
|
||||
struct bootbufferthingdeep *artifacts;
|
||||
struct artifact *artifacts;
|
||||
u16 min;
|
||||
u16 max;
|
||||
f32 f30;
|
||||
|
|
@ -411,18 +412,18 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
|
|||
bool extra;
|
||||
f32 f26;
|
||||
|
||||
artifacts = (void *) bbufGetIndex1Buffer();
|
||||
artifacts = schedGetFrontArtifacts();
|
||||
f30 = roomGetUnk5c(roomnum);
|
||||
|
||||
if (g_Rooms[roomnum].gfxdata == NULL || g_Rooms[roomnum].loaded240 == 0) {
|
||||
return gdl;
|
||||
}
|
||||
|
||||
for (i = envGetCurrent()->numsuns * 8; i < 120; i++) {
|
||||
for (i = envGetCurrent()->numsuns * 8; i < MAX_ARTIFACTS; i++) {
|
||||
struct light *light2 = artifacts[i].light;
|
||||
count = 0;
|
||||
|
||||
for (j = i; j < 120 && artifacts[j].unk00 == 2 && artifacts[j].light == light2; j++) {
|
||||
for (j = i; j < MAX_ARTIFACTS && artifacts[j].type == ARTIFACTTYPE_GLARE && artifacts[j].light == light2; j++) {
|
||||
count++;
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +468,7 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
|
|||
t2++;
|
||||
}
|
||||
|
||||
artifacts[k].unk00 = 0;
|
||||
artifacts[k].type = ARTIFACTTYPE_FREE;
|
||||
}
|
||||
|
||||
s3[0] = func0f13d3c4(s3[0], t2 * 2);
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ u16 *mblur0f176668(s32 arg0)
|
|||
|
||||
Gfx *mblurRender(Gfx *gdl)
|
||||
{
|
||||
struct bootbufferthing *thing = bbufGetIndex0Buffer();
|
||||
struct artifact *artifacts = schedGetWriteArtifacts();
|
||||
u32 stack;
|
||||
u16 *sp4c = var800844f0;
|
||||
u32 s4 = 0;
|
||||
|
|
@ -152,8 +152,8 @@ Gfx *mblurRender(Gfx *gdl)
|
|||
s32 i;
|
||||
|
||||
viGetBackBuffer();
|
||||
sp44 = mblur0f176668(g_BootBufferIndex0);
|
||||
g_BootBufferDirtyIndexes[g_BootBufferIndex0] = 1;
|
||||
sp44 = mblur0f176668(g_SchedWriteArtifactsIndex);
|
||||
g_SchedSpecialArtifactIndexes[g_SchedWriteArtifactsIndex] = 1;
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetColorImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, viGetBufWidth(), OS_PHYSICAL_TO_K0(sp44));
|
||||
|
|
@ -179,12 +179,12 @@ Gfx *mblurRender(Gfx *gdl)
|
|||
gSPClearGeometryMode(gdl++, G_ZBUFFER);
|
||||
gDPTileSync(gdl++);
|
||||
|
||||
for (i = 0; i < 120; i++) {
|
||||
for (i = 0; i < MAX_ARTIFACTS; i++) {
|
||||
if (1);
|
||||
|
||||
if (thing->unk00[0].unk00[i].unk00) {
|
||||
if (artifacts[i].type != ARTIFACTTYPE_FREE) {
|
||||
s2 = &sp44[s4];
|
||||
image = &sp4c[thing->unk00[0].unk00[i].unk0c.u16_1 * viGetWidth()];
|
||||
image = &sp4c[artifacts[i].unk0c.u16_1 * viGetWidth()];
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetTextureImage(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, image);
|
||||
|
|
@ -195,9 +195,9 @@ Gfx *mblurRender(Gfx *gdl)
|
|||
gSPTextureRectangle(gdl++,
|
||||
s4 << 2, 0,
|
||||
(s4 + 3) << 2, 0,
|
||||
G_TX_RENDERTILE, (thing->unk00[0].unk00[i].unk0c.u16_2 * 32) + 16, 0x0010, 0x1000, 0);
|
||||
G_TX_RENDERTILE, (artifacts[i].unk0c.u16_2 * 32) + 16, 0x0010, 0x1000, 0);
|
||||
|
||||
thing->unk00[0].unk00[i].unk0c.u16p = s2;
|
||||
artifacts[i].unk0c.u16p = s2;
|
||||
s4++;
|
||||
|
||||
if (s2);
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ void lvReset(s32 stagenum)
|
|||
|
||||
func0f011124(false);
|
||||
var80084018 = 1;
|
||||
bbufResetIndexes();
|
||||
schedResetArtifacts();
|
||||
lvSetPaused(0);
|
||||
|
||||
#if PIRACYCHECKS
|
||||
|
|
@ -1140,7 +1140,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
gdl = vi0000b280(gdl);
|
||||
gdl = vi0000b1d0(gdl);
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
func0f13c510();
|
||||
artifactsClear();
|
||||
|
||||
if ((g_Vars.stagenum != STAGE_CITRAINING || (var80087260 <= 0 && g_MenuData.root != MENUROOT_MPSETUP))
|
||||
&& g_Vars.lvframenum <= 5
|
||||
|
|
@ -1642,7 +1642,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
}
|
||||
}
|
||||
|
||||
func0f13c54c();
|
||||
artifactsTick();
|
||||
|
||||
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
|
|
|
|||
|
|
@ -4312,10 +4312,7 @@ glabel var7f1b5104
|
|||
/* f125944: 27bd04d0 */ addiu $sp,$sp,0x4d0
|
||||
);
|
||||
|
||||
/**
|
||||
* With this function stubbed, sun artifacts and glare do not render.
|
||||
*/
|
||||
void sky0f125948(struct bootbufferthingdeep *arg0, s32 x, s32 y)
|
||||
void skyCreateArtifact(struct artifact *artifact, s32 x, s32 y)
|
||||
{
|
||||
s32 viewleft = viGetViewLeft();
|
||||
s32 viewtop = viGetViewTop();
|
||||
|
|
@ -4323,20 +4320,20 @@ void sky0f125948(struct bootbufferthingdeep *arg0, s32 x, s32 y)
|
|||
s32 viewheight = viGetViewHeight();
|
||||
|
||||
if (x >= viewleft && x < viewleft + viewwidth && y >= viewtop && y < viewtop + viewheight) {
|
||||
arg0->unk08 = &var800844f0[(s32)camGetScreenWidth() * y + x];
|
||||
arg0->unk0c.u16_2 = x;
|
||||
arg0->unk0c.u16_1 = y;
|
||||
arg0->unk00 = 1;
|
||||
artifact->unk08 = &var800844f0[(s32)camGetScreenWidth() * y + x];
|
||||
artifact->unk0c.u16_2 = x;
|
||||
artifact->unk0c.u16_1 = y;
|
||||
artifact->type = ARTIFACTTYPE_CIRCLE;
|
||||
}
|
||||
}
|
||||
|
||||
f32 sky0f125a1c(struct bootbufferthingdeep *arg0)
|
||||
f32 sky0f125a1c(struct artifact *artifacts)
|
||||
{
|
||||
f32 sum = 0;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (arg0[i].unk00 == 1 && arg0[i].unk02 == 0xfffc) {
|
||||
if (artifacts[i].type == ARTIFACTTYPE_CIRCLE && artifacts[i].unk02 == 0xfffc) {
|
||||
sum += 0.125f;
|
||||
}
|
||||
}
|
||||
|
|
@ -4356,7 +4353,7 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray)
|
|||
f32 viewtopf;
|
||||
f32 viewwidthf;
|
||||
f32 viewheightf;
|
||||
struct bootbufferthing *thing;
|
||||
struct artifact *artifacts;
|
||||
u8 colour[3];
|
||||
struct environment *env;
|
||||
struct sun *sun;
|
||||
|
|
@ -4427,7 +4424,7 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray)
|
|||
// Sun's centre point is on-screen
|
||||
f32 distfromedge;
|
||||
f32 mindistfromedge;
|
||||
thing = bbufGetIndex0Buffer();
|
||||
artifacts = schedGetWriteArtifacts();
|
||||
onscreen = true;
|
||||
mindistfromedge = 1000;
|
||||
|
||||
|
|
@ -4477,14 +4474,14 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray)
|
|||
g_SunAlphaFracs[i] = 1.0f;
|
||||
}
|
||||
|
||||
sky0f125948(&(i + thing->unk00)->unk00[0], (s32)g_SunScreenXPositions[i] - 7, (s32)g_SunScreenYPositions[i] + 1);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[1], (s32)g_SunScreenXPositions[i] - 5, (s32)g_SunScreenYPositions[i] - 3);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[2], (s32)g_SunScreenXPositions[i] - 3, (s32)g_SunScreenYPositions[i] + 5);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[3], (s32)g_SunScreenXPositions[i] - 1, (s32)g_SunScreenYPositions[i] - 7);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[4], (s32)g_SunScreenXPositions[i] + 1, (s32)g_SunScreenYPositions[i] + 7);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[5], (s32)g_SunScreenXPositions[i] + 3, (s32)g_SunScreenYPositions[i] - 5);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[6], (s32)g_SunScreenXPositions[i] + 5, (s32)g_SunScreenYPositions[i] + 3);
|
||||
sky0f125948(&(i + thing->unk00)->unk00[7], (s32)g_SunScreenXPositions[i] + 7, (s32)g_SunScreenYPositions[i] - 1);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 0], (s32)g_SunScreenXPositions[i] - 7, (s32)g_SunScreenYPositions[i] + 1);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 1], (s32)g_SunScreenXPositions[i] - 5, (s32)g_SunScreenYPositions[i] - 3);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 2], (s32)g_SunScreenXPositions[i] - 3, (s32)g_SunScreenYPositions[i] + 5);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 3], (s32)g_SunScreenXPositions[i] - 1, (s32)g_SunScreenYPositions[i] - 7);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 4], (s32)g_SunScreenXPositions[i] + 1, (s32)g_SunScreenYPositions[i] + 7);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 5], (s32)g_SunScreenXPositions[i] + 3, (s32)g_SunScreenYPositions[i] - 5);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 6], (s32)g_SunScreenXPositions[i] + 5, (s32)g_SunScreenYPositions[i] + 3);
|
||||
skyCreateArtifact(&artifacts[i * 8 + 7], (s32)g_SunScreenXPositions[i] + 7, (s32)g_SunScreenYPositions[i] - 1);
|
||||
}
|
||||
|
||||
if (1);
|
||||
|
|
@ -4519,7 +4516,7 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray)
|
|||
gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
gDPSetTextureLOD(gdl++, G_TL_LOD);
|
||||
|
||||
sp124 = sky0f125a1c(bbufGetIndex1Buffer()->unk00[i].unk00);
|
||||
sp124 = sky0f125a1c(&schedGetFrontArtifacts()[i * 8]);
|
||||
}
|
||||
|
||||
if (onscreen && sp124 > 0.0f) {
|
||||
|
|
@ -6569,8 +6566,8 @@ Gfx *skyRenderArtifacts(Gfx *gdl)
|
|||
|
||||
for (i = 0; i < env->numsuns; i++) {
|
||||
if (sun->lens_flare && g_SunPositions[i].z > 1) {
|
||||
struct bootbufferthing *thing = bbufGetIndex1Buffer();
|
||||
f32 value = sky0f125a1c(thing->unk00[i].unk00);
|
||||
struct artifact *artifact = schedGetFrontArtifacts() + i * 8;
|
||||
f32 value = sky0f125a1c(artifact);
|
||||
|
||||
if (value > 0.0f) {
|
||||
gdl = sky0f126384(gdl, g_SunScreenXPositions[i], g_SunScreenYPositions[i], value, sun->orb_size, g_SunFlareTimers240[i], g_SunAlphaFracs[i]);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ extern OSViMode *var8008dd60[2];
|
|||
extern u32 var8008de08;
|
||||
extern s32 var8008de0c;
|
||||
extern s32 var8008de10;
|
||||
extern u8 g_BootBufferDirtyIndexes[3];
|
||||
extern s32 g_BootBufferIndex0;
|
||||
extern u8 g_SchedSpecialArtifactIndexes[3];
|
||||
extern s32 g_SchedWriteArtifactsIndex;
|
||||
extern OSPiHandle CartRomHandle;
|
||||
extern OSPiHandle LeoDiskHandle;
|
||||
extern OSTimer var80090ab0;
|
||||
|
|
|
|||
|
|
@ -244,6 +244,10 @@
|
|||
#define ANIMHEADERFLAG_40 0x40 // len 5
|
||||
#define ANIMHEADERFLAG_80 0x80 // len 0
|
||||
|
||||
#define ARTIFACTTYPE_FREE 0
|
||||
#define ARTIFACTTYPE_CIRCLE 1 // from a sun lens flare or teleport
|
||||
#define ARTIFACTTYPE_GLARE 2 // from a light
|
||||
|
||||
#define ATTACKFLAG_AIMATBOND 0x0001 // aim/shoot at Jo
|
||||
#define ATTACKFLAG_AIMFORWARD 0x0002 // aim/shoot in front of self
|
||||
#define ATTACKFLAG_AIMATCHR 0x0004 // aim/shoot at chr (ID should be given in entityid)
|
||||
|
|
@ -1467,6 +1471,7 @@
|
|||
#define MA_PUNCHING 54
|
||||
#define MA_END 55
|
||||
|
||||
#define MAX_ARTIFACTS 120
|
||||
#define MAX_CHRWAYPOINTS 6
|
||||
#define MAX_DANGEROUSPROPS 12
|
||||
#define MAX_LIFTS 10
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void func0f13c510(void);
|
||||
void func0f13c54c(void);
|
||||
void artifactsClear(void);
|
||||
void artifactsTick(void);
|
||||
u16 func0f13c574(f32 arg0);
|
||||
s32 func0f13c710(f32 arg0);
|
||||
void artifactsCalculateGlaresForRoom(s32 roomnum);
|
||||
u8 func0f13d3c4(u8 arg0, u8 arg1);
|
||||
Gfx *func0f13d40c(Gfx *gdl);
|
||||
Gfx *func0f13d54c(Gfx *gdl);
|
||||
Gfx *artifactsConfigureForGlares(Gfx *gdl);
|
||||
Gfx *artifactsUnconfigureForGlares(Gfx *gdl);
|
||||
Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ void sky0f1228d0(struct skything18 *arg0, Mtxf *arg1, u16 arg2, f32 arg3, f32 ar
|
|||
bool sky0f122ce8(struct skything38 *arg0, struct skything38 *arg1);
|
||||
Gfx *sky0f122d4c(Gfx *gdl, struct skything38 *arg1, struct skything38 *arg2, struct skything38 *arg3, f32 arg4, bool arg5);
|
||||
Gfx *sky0f123fd4(Gfx *gdl, struct skything38 *arg1, struct skything38 *arg2, struct skything38 *arg3, struct skything38 *arg4, f32 arg5);
|
||||
void sky0f125948(struct bootbufferthingdeep *arg0, s32 x, s32 y);
|
||||
f32 sky0f125a1c(struct bootbufferthingdeep *arg0);
|
||||
void skyCreateArtifact(struct artifact *artifact, s32 x, s32 y);
|
||||
f32 sky0f125a1c(struct artifact *artifacts);
|
||||
Gfx *skyRenderSuns(Gfx *gdl, bool xray);
|
||||
Gfx *sky0f126384(Gfx *gdl, f32 x, f32 y, f32 arg3, f32 orbsize, s32 arg5, f32 arg6);
|
||||
Gfx *sky0f126c3c(Gfx *gdl, f32 x, f32 y, f32 z, f32 arg4, f32 arg5);
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ void __scAppendList(OSSched *sc, OSScTask *t);
|
|||
void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp);
|
||||
void __scMain(void *arg);
|
||||
void __scYield(OSSched *sc);
|
||||
void bbufResetBuffers(void);
|
||||
struct bootbufferthing *bbufGetIndex0Buffer(void);
|
||||
struct bootbufferthing *bbufGetIndex1Buffer(void);
|
||||
void bbufIncIndex0(void);
|
||||
void bbufIncIndex1(void);
|
||||
void bbufUpdateIndex2Buffer(void);
|
||||
void schedInitArtifacts(void);
|
||||
struct artifact *schedGetWriteArtifacts(void);
|
||||
struct artifact *schedGetFrontArtifacts(void);
|
||||
void schedIncrementWriteArtifacts(void);
|
||||
void schedIncrementFrontArtifacts(void);
|
||||
void schedUpdatePendingArtifacts(void);
|
||||
void schedConsiderScreenshot(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3457,8 +3457,8 @@ struct audioconfig {
|
|||
u32 flags;
|
||||
};
|
||||
|
||||
struct bootbufferthingdeep {
|
||||
u16 unk00;
|
||||
struct artifact {
|
||||
u16 type;
|
||||
u16 unk02;
|
||||
u16 unk04;
|
||||
u16 unk06;
|
||||
|
|
@ -3473,14 +3473,6 @@ struct bootbufferthingdeep {
|
|||
struct light *light;
|
||||
};
|
||||
|
||||
struct bootbufferthing2 {
|
||||
struct bootbufferthingdeep unk00[8];
|
||||
};
|
||||
|
||||
struct bootbufferthing {
|
||||
struct bootbufferthing2 unk00[15];
|
||||
};
|
||||
|
||||
struct credit {
|
||||
u8 more : 1;
|
||||
u8 retain : 2;
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ s32 var8008de10;
|
|||
u32 var8008de14;
|
||||
OSTimer g_SchedRspTimer;
|
||||
u32 g_SchedDpCounters[4];
|
||||
struct bootbufferthing g_BootBuffers[3];
|
||||
u8 g_BootBufferDirtyIndexes[3];
|
||||
s32 g_BootBufferIndex0;
|
||||
s32 g_BootBufferIndex1;
|
||||
s32 g_BootBufferIndex2;
|
||||
struct artifact g_ArtifactLists[3][120];
|
||||
u8 g_SchedSpecialArtifactIndexes[3];
|
||||
s32 g_SchedWriteArtifactsIndex;
|
||||
s32 g_SchedFrontArtifactsIndex;
|
||||
s32 g_SchedPendingArtifactsIndex;
|
||||
|
||||
bool g_SchedCrashedUnexpectedly = false;
|
||||
bool g_SchedCrashEnable1 = false;
|
||||
|
|
@ -232,7 +232,7 @@ void __scMain(void *arg)
|
|||
OSSched *sc = (OSSched *)arg;
|
||||
int done = 0;
|
||||
|
||||
bbufResetBuffers();
|
||||
schedInitArtifacts();
|
||||
|
||||
while (!done) {
|
||||
osRecvMesg(&sc->interruptQ, (OSMesg *)&msg, OS_MESG_BLOCK);
|
||||
|
|
@ -439,87 +439,101 @@ u32 *schedGetDpCounters(void)
|
|||
return g_SchedDpCounters;
|
||||
}
|
||||
|
||||
void bbufResetBuffers(void)
|
||||
void schedInitArtifacts(void)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 120; j++) {
|
||||
g_BootBuffers[i].unk00[0].unk00[j].unk00 = 0;
|
||||
for (j = 0; j < MAX_ARTIFACTS; j++) {
|
||||
g_ArtifactLists[i][j].type = ARTIFACTTYPE_FREE;
|
||||
}
|
||||
|
||||
g_BootBufferDirtyIndexes[i] = 0;
|
||||
g_SchedSpecialArtifactIndexes[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct bootbufferthing *bbufGetIndex0Buffer(void)
|
||||
/**
|
||||
* The write list is an artifact list that is not currently being displayed on
|
||||
* the screen. Update logic can write here to put artifacts on the next frame.
|
||||
*/
|
||||
struct artifact *schedGetWriteArtifacts(void)
|
||||
{
|
||||
return &g_BootBuffers[g_BootBufferIndex0];
|
||||
return g_ArtifactLists[g_SchedWriteArtifactsIndex];
|
||||
}
|
||||
|
||||
struct bootbufferthing *bbufGetIndex1Buffer(void)
|
||||
/**
|
||||
* The front list is the artifact list that is currently being displayed on the
|
||||
* screen. Rendering logic reads this list. The list may be re-used for multiple
|
||||
* frames in a row during lag.
|
||||
*/
|
||||
struct artifact *schedGetFrontArtifacts(void)
|
||||
{
|
||||
return &g_BootBuffers[g_BootBufferIndex1];
|
||||
return g_ArtifactLists[g_SchedFrontArtifactsIndex];
|
||||
}
|
||||
|
||||
struct bootbufferthing *bbufGetIndex2Buffer(void)
|
||||
/**
|
||||
* The pending list is possibly misnamed. I'm not sure how this list works.
|
||||
*
|
||||
* @TODO: Investigate.
|
||||
*/
|
||||
struct artifact *schedGetPendingArtifacts(void)
|
||||
{
|
||||
return &g_BootBuffers[g_BootBufferIndex2];
|
||||
return g_ArtifactLists[g_SchedPendingArtifactsIndex];
|
||||
}
|
||||
|
||||
void bbufIncIndex0(void)
|
||||
void schedIncrementWriteArtifacts(void)
|
||||
{
|
||||
g_BootBufferIndex0 = (g_BootBufferIndex0 + 1) % 3;
|
||||
g_SchedWriteArtifactsIndex = (g_SchedWriteArtifactsIndex + 1) % 3;
|
||||
}
|
||||
|
||||
void bbufIncIndex1(void)
|
||||
void schedIncrementFrontArtifacts(void)
|
||||
{
|
||||
g_BootBufferIndex1 = (g_BootBufferIndex1 + 1) % 3;
|
||||
g_SchedFrontArtifactsIndex = (g_SchedFrontArtifactsIndex + 1) % 3;
|
||||
}
|
||||
|
||||
void bbufIncIndex2(void)
|
||||
void schedIncrementPendingArtifacts(void)
|
||||
{
|
||||
g_BootBufferIndex2 = (g_BootBufferIndex2 + 1) % 3;
|
||||
g_SchedPendingArtifactsIndex = (g_SchedPendingArtifactsIndex + 1) % 3;
|
||||
}
|
||||
|
||||
void bbufResetIndexes(void)
|
||||
void schedResetArtifacts(void)
|
||||
{
|
||||
g_BootBufferIndex0 = 0;
|
||||
g_BootBufferIndex1 = 1;
|
||||
g_BootBufferIndex2 = 0;
|
||||
g_SchedWriteArtifactsIndex = 0;
|
||||
g_SchedFrontArtifactsIndex = 1;
|
||||
g_SchedPendingArtifactsIndex = 0;
|
||||
}
|
||||
|
||||
void bbufUpdateIndex2Buffer(void)
|
||||
void schedUpdatePendingArtifacts(void)
|
||||
{
|
||||
struct bootbufferthing *thing = bbufGetIndex2Buffer();
|
||||
struct artifact *artifacts = schedGetPendingArtifacts();
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 120; i++) {
|
||||
struct bootbufferthingdeep *deep = &thing->unk00[0].unk00[i];
|
||||
for (i = 0; i < MAX_ARTIFACTS; i++) {
|
||||
struct artifact *artifact = &artifacts[i];
|
||||
|
||||
if (deep->unk00) {
|
||||
u16 *unk08 = deep->unk08;
|
||||
if (artifact->type != ARTIFACTTYPE_FREE) {
|
||||
u16 *unk08 = artifact->unk08;
|
||||
u16 value08 = unk08[0];
|
||||
|
||||
if (g_BootBufferDirtyIndexes[g_BootBufferIndex2] == 1) {
|
||||
u16 *unk0c = deep->unk0c.u16p;
|
||||
if (g_SchedSpecialArtifactIndexes[g_SchedPendingArtifactsIndex] == 1) {
|
||||
u16 *unk0c = artifact->unk0c.u16p;
|
||||
u16 value0c = unk0c[0];
|
||||
|
||||
if (value0c > value08) {
|
||||
deep->unk02 = value08;
|
||||
artifact->unk02 = value08;
|
||||
} else {
|
||||
deep->unk02 = value0c;
|
||||
artifact->unk02 = value0c;
|
||||
}
|
||||
} else {
|
||||
deep->unk02 = value08;
|
||||
artifact->unk02 = value08;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_BootBufferDirtyIndexes[g_BootBufferIndex2] = 0;
|
||||
g_SchedSpecialArtifactIndexes[g_SchedPendingArtifactsIndex] = 0;
|
||||
|
||||
bbufIncIndex2();
|
||||
schedIncrementPendingArtifacts();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -531,7 +545,7 @@ void __scHandleRDP(OSSched *sc)
|
|||
s32 state;
|
||||
|
||||
if (sc->curRDPTask != NULL) {
|
||||
bbufUpdateIndex2Buffer();
|
||||
schedUpdatePendingArtifacts();
|
||||
|
||||
if (var8005dd18 == 0) {
|
||||
schedConsiderScreenshot();
|
||||
|
|
|
|||
Loading…
Reference in New Issue