z_lights fully matched (#80)

* z_lights OK

* Documentation

* Fixup for z_collision_check

* Improve function types of bind functions

* Fixup for types
This commit is contained in:
Rozelette
2021-03-27 14:29:30 -05:00
committed by GitHub
parent 012e3c21ae
commit fee7a49abc
20 changed files with 557 additions and 530 deletions
+26 -26
View File
@@ -27,34 +27,34 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
D_801F8010.type = R_FB_FILTER_TYPE;
D_801F8010.color.red = R_FB_FILTER_PRIM_COLOR(0);
D_801F8010.color.green = R_FB_FILTER_PRIM_COLOR(1);
D_801F8010.color.blue = R_FB_FILTER_PRIM_COLOR(2);
D_801F8010.color.alpha = R_FB_FILTER_A;
D_801F8010.color.r = R_FB_FILTER_PRIM_COLOR(0);
D_801F8010.color.g = R_FB_FILTER_PRIM_COLOR(1);
D_801F8010.color.b = R_FB_FILTER_PRIM_COLOR(2);
D_801F8010.color.a = R_FB_FILTER_A;
func_80140D10(&D_801F8010, &_gfx, arg1);
} else {
if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
D_801F8020.useRgba = (R_FB_FILTER_TYPE == 6);
D_801F8020.primColor.red = R_FB_FILTER_PRIM_COLOR(0);
D_801F8020.primColor.green = R_FB_FILTER_PRIM_COLOR(1);
D_801F8020.primColor.blue = R_FB_FILTER_PRIM_COLOR(2);
D_801F8020.primColor.alpha = R_FB_FILTER_A;
D_801F8020.envColor.red = R_FB_FILTER_ENV_COLOR(0);
D_801F8020.envColor.green = R_FB_FILTER_ENV_COLOR(1);
D_801F8020.envColor.blue = R_FB_FILTER_ENV_COLOR(2);
D_801F8020.envColor.alpha = R_FB_FILTER_A;
D_801F8020.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
D_801F8020.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
D_801F8020.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
D_801F8020.primColor.a = R_FB_FILTER_A;
D_801F8020.envColor.r = R_FB_FILTER_ENV_COLOR(0);
D_801F8020.envColor.g = R_FB_FILTER_ENV_COLOR(1);
D_801F8020.envColor.b = R_FB_FILTER_ENV_COLOR(2);
D_801F8020.envColor.a = R_FB_FILTER_A;
func_80142100(&D_801F8020, &_gfx, arg1);
} else {
if (R_FB_FILTER_TYPE == 7) {
sMonoColors.unk_00 = 0;
sMonoColors.primColor.red = R_FB_FILTER_PRIM_COLOR(0);
sMonoColors.primColor.green = R_FB_FILTER_PRIM_COLOR(1);
sMonoColors.primColor.blue = R_FB_FILTER_PRIM_COLOR(2);
sMonoColors.primColor.alpha = R_FB_FILTER_A;
sMonoColors.envColor.red = R_FB_FILTER_ENV_COLOR(0);
sMonoColors.envColor.green = R_FB_FILTER_ENV_COLOR(1);
sMonoColors.envColor.blue = R_FB_FILTER_ENV_COLOR(2);
sMonoColors.envColor.alpha = R_FB_FILTER_A;
sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0);
sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1);
sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2);
sMonoColors.primColor.a = R_FB_FILTER_A;
sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0);
sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1);
sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2);
sMonoColors.envColor.a = R_FB_FILTER_A;
VisMono_Draw(&sMonoColors, &_gfx, arg1);
}
}
@@ -81,11 +81,11 @@ void GameState_Draw(GameState *ctxt, GraphicsContext *gCtxt) {
if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) {
GameState_SetFBFilter(&nextDisplayList, (u32) gCtxt->zbuffer);
}
if (R_ENABLE_ARENA_DBG < 0) {
R_ENABLE_ARENA_DBG = 0;
}
gSPEndDisplayList(nextDisplayList++);
Graph_BranchDlist(_polyOpa, nextDisplayList);
gCtxt->polyOpa.p = nextDisplayList;
@@ -111,12 +111,12 @@ void Game_ResetSegments(GraphicsContext *gCtxt) {
void func_801736DC(GraphicsContext *gCtxt) {
Gfx* nextDisplayList;
Gfx* _polyOpa;
nextDisplayList = Graph_GfxPlusOne(_polyOpa = gCtxt->polyOpa.p);
gSPDisplayList(gCtxt->overlay.p++, nextDisplayList);
gSPEndDisplayList(nextDisplayList++);
Graph_BranchDlist(_polyOpa, nextDisplayList);
gCtxt->polyOpa.p = nextDisplayList;
}
@@ -207,7 +207,7 @@ lblUnk:;
Gamealloc_Init(&ctxt->alloc);
Game_InitHeap(ctxt, 0x100000);
Game_SetFramerateDivisor(ctxt, 3);
gameStateInit(ctxt);
func_80140CE0(&D_801F8010);
@@ -216,7 +216,7 @@ lblUnk:;
func_80140898(&D_801F8048);
func_801773A0(&D_801F7FF0);
func_8013ED9C();
osSendMesg(&ctxt->gfxCtx->unk5C, NULL, 1);
}
+6 -6
View File
@@ -3828,9 +3828,9 @@ void CollisionCheck_SpawnShieldParticles(GlobalContext* ctxt, Vec3f* v) {
shieldParticleInitMetal.position.x = v->x;
shieldParticleInitMetal.position.y = v->y;
shieldParticleInitMetal.position.z = v->z;
shieldParticleInitMetal.lightParams.posX = shieldParticleInitMetal.position.x;
shieldParticleInitMetal.lightParams.posY = shieldParticleInitMetal.position.y;
shieldParticleInitMetal.lightParams.posZ = shieldParticleInitMetal.position.z;
shieldParticleInitMetal.lightPoint.x = shieldParticleInitMetal.position.x;
shieldParticleInitMetal.lightPoint.y = shieldParticleInitMetal.position.y;
shieldParticleInitMetal.lightPoint.z = shieldParticleInitMetal.position.z;
Effect_Add(ctxt, &effectIndex, 3, 0, 1, &shieldParticleInitMetal);
}
@@ -3883,9 +3883,9 @@ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* ctxt, Vec3f* v, Vec3
shieldParticleInitWood.position.x = v->x;
shieldParticleInitWood.position.y = v->y;
shieldParticleInitWood.position.z = v->z;
shieldParticleInitWood.lightParams.posX = shieldParticleInitWood.position.x;
shieldParticleInitWood.lightParams.posY = shieldParticleInitWood.position.y;
shieldParticleInitWood.lightParams.posZ = shieldParticleInitWood.position.z;
shieldParticleInitWood.lightPoint.x = shieldParticleInitWood.position.x;
shieldParticleInitWood.lightPoint.y = shieldParticleInitWood.position.y;
shieldParticleInitWood.lightPoint.z = shieldParticleInitWood.position.z;
Effect_Add(ctxt, &effectIndex, 3, 0, 1, &shieldParticleInitWood);
func_8019F1C0(pos, 0x1837);
+4 -4
View File
@@ -253,12 +253,12 @@ void EffectSS_DrawParticle(GlobalContext* ctxt, s32 index) {
}
void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
LightMapper* s0;
Lights* s0;
s32 i;
s0 = Lights_CreateMapper(&ctxt->lightCtx, ctxt->state.gfxCtx);
Lights_MapLights(s0, ctxt->lightCtx.lightsHead, 0, ctxt);
Lights_UploadLights(s0, ctxt->state.gfxCtx);
s0 = LightContext_NewLights(&ctxt->lightCtx, ctxt->state.gfxCtx);
Lights_BindAll(s0, ctxt->lightCtx.listHead, 0, ctxt);
Lights_Draw(s0, ctxt->state.gfxCtx);
for (i = 0; i < EffectSS2Info.size; i++) {
if (EffectSS2Info.data_table[i].life > -1) {
+9 -9
View File
@@ -538,11 +538,11 @@ void Math_SmoothScaleMaxS(s16* start, s16 target, s16 scale, s16 maxStep) {
*start += v0;
}
void Color_RGBA8_Copy(ColorRGBA8* dst, ColorRGBA8* src) {
dst->red = src->red;
dst->green = src->green;
dst->blue = src->blue;
dst->alpha = src->alpha;
void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src) {
dst->r = src->r;
dst->g = src->g;
dst->b = src->b;
dst->a = src->a;
}
void func_801000A4(u16 a0) {
@@ -569,11 +569,11 @@ void Lib_TranslateAndRotateYVec3f(Vec3f* translation, s16 rotation, Vec3f* src,
}
#ifdef NON_MATCHING
void Lib_LerpRGB(RGB* a, RGB* b, f32 t, RGB* dst) {
void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst) {
// XXX regalloc is slightly off
dst->red = (f32)a->red + ((f32)b->red - (f32)a->red) * t;
dst->green = (f32)a->green + ((f32)b->green - (f32)a->green) * t;
dst->blue = (f32)a->blue + ((f32)b->blue - (f32)a->blue) * t;
dst->r = (f32)a->r + ((f32)b->r - (f32)a->r) * t;
dst->g = (f32)a->g + ((f32)b->g - (f32)a->g) * t;
dst->b = (f32)a->b + ((f32)b->b - (f32)a->b) * t;
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/Lib_LerpRGB.asm")
+250 -252
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -310,7 +310,7 @@ void Scene_HeaderCommand0C(GlobalContext* ctxt, SceneCmd* entry) {
lightInfo = (LightInfo*)Lib_PtrSegToVirt(entry->lightList.segment);
for (i = 0; i < entry->lightList.num; i++)
{
Lights_Insert(ctxt, &ctxt->lightCtx, lightInfo);
LightContext_InsertLight(ctxt, &ctxt->lightCtx, lightInfo);
lightInfo++;
}
}
+8 -8
View File
@@ -66,7 +66,7 @@ void SceneProc_DrawType1Texture(GlobalContext* ctxt, u32 segment, ScrollingTextu
#ifdef NON_MATCHING
// Slight ordering differences at the beginning
void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTexturePrimColor* primColor, RGBA8* envColor) {
void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTexturePrimColor* primColor, Color_RGBA8* envColor) {
GraphicsContext* gfxCtx;
Gfx* dl;
@@ -108,7 +108,7 @@ void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTex
#endif
void SceneProc_DrawType2Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params) {
RGBA8* envColor;
Color_RGBA8* envColor;
FlashingTexturePrimColor* primColor = (FlashingTexturePrimColor *)Lib_PtrSegToVirt(params->primColors);
u32 pad;
u32 index = gSceneProcStep % params->cycleLength;
@@ -116,7 +116,7 @@ void SceneProc_DrawType2Texture(GlobalContext* ctxt, u32 segment, FlashingTextur
primColor += index;
if (params->envColors) {
envColor = (RGBA8*)Lib_PtrSegToVirt(params->envColors) + index;
envColor = (Color_RGBA8*)Lib_PtrSegToVirt(params->envColors) + index;
} else {
envColor = NULL;
}
@@ -132,18 +132,18 @@ s32 SceneProc_Lerp(s32 a, s32 b, f32 t) {
// Slight ordering and regalloc differences around t = ...
void SceneProc_DrawType3Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params) {
FlashingTextureParams* params2 = params;
RGBA8* envColorTo;
Color_RGBA8* envColorTo;
FlashingTexturePrimColor* primColorTo = (FlashingTexturePrimColor *)Lib_PtrSegToVirt(params2->primColors);
u16* keyFrames = (u16*)Lib_PtrSegToVirt(params2->keyFrames);
s32 index = gSceneProcStep % params2->cycleLength;
s32 pad1;
s32 keyFrameIndex;
RGBA8* envColorPtrIn;
Color_RGBA8* envColorPtrIn;
f32 t;
s32 pad2;
FlashingTexturePrimColor primColorIn;
RGBA8* envColorFrom;
RGBA8 envColorIn;
Color_RGBA8* envColorFrom;
Color_RGBA8 envColorIn;
s32 pad3;
FlashingTexturePrimColor* primColorFrom;
@@ -169,7 +169,7 @@ void SceneProc_DrawType3Texture(GlobalContext* ctxt, u32 segment, FlashingTextur
primColorIn.lodFrac = SceneProc_Lerp(primColorFrom->lodFrac, primColorTo->lodFrac, t);
if (params2->envColors) {
envColorTo = (RGBA8*)Lib_PtrSegToVirt(params2->envColors) + keyFrameIndex;
envColorTo = (Color_RGBA8*)Lib_PtrSegToVirt(params2->envColors) + keyFrameIndex;
envColorFrom = envColorTo - 1;
envColorIn.red = SceneProc_Lerp(envColorFrom->red, envColorTo->red, t);
envColorIn.green = SceneProc_Lerp(envColorFrom->green, envColorTo->green, t);
@@ -82,12 +82,12 @@ void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) {
static ColorRGBA8 D_80A61740[] = { { 255, 255, 170, 255 },
{ 255, 170, 255, 255 },
{ 255, 255, 170, 255 },
{ 170, 255, 255, 255 },
{ 255, 255, 170, 255 } };
static ColorRGBA8 D_80A61754[] = {
static Color_RGBA8 D_80A61740[] = { { 255, 255, 170, 255 },
{ 255, 170, 255, 255 },
{ 255, 255, 170, 255 },
{ 170, 255, 255, 255 },
{ 255, 255, 170, 255 } };
static Color_RGBA8 D_80A61754[] = {
{ 255, 100, 0, 255 }, { 255, 0, 100, 255 }, { 100, 255, 0, 255 }, { 0, 100, 255, 255 }, { 255, 230, 0, 255 }
};
static u8 D_80A61768[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01,
@@ -118,10 +118,10 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPPipeSync(POLY_XLU_DISP++);
gSPMatrix(POLY_XLU_DISP++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, D_80A61740[this->type].red, D_80A61740[this->type].green,
D_80A61740[this->type].blue, 255);
gDPSetEnvColor(POLY_XLU_DISP++, D_80A61754[this->type].red, D_80A61754[this->type].green,
D_80A61754[this->type].blue, 128);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, D_80A61740[this->type].r, D_80A61740[this->type].g,
D_80A61740[this->type].b, 255);
gDPSetEnvColor(POLY_XLU_DISP++, D_80A61754[this->type].r, D_80A61754[this->type].g,
D_80A61754[this->type].b, 128);
gSPDisplayList(POLY_XLU_DISP++, D_0600DEF0);
CLOSE_DISPS(gfxCtx);