Name all env symbols

This commit is contained in:
Ryan Dwyer 2023-05-24 21:54:47 +10:00
parent 740be5e96b
commit 5cc44be4da
19 changed files with 313 additions and 279 deletions

View File

@ -3571,7 +3571,7 @@ glabel bgLoadRoom
/* f15e2b8: 24a90014 */ addiu $t1,$a1,0x14
/* f15e2bc: 00e9082b */ sltu $at,$a3,$t1
/* f15e2c0: 14200026 */ bnez $at,.L0f15e35c
/* f15e2c4: 3c19800a */ lui $t9,%hi(var800a65e4)
/* f15e2c4: 3c19800a */ lui $t9,%hi(g_EnvHasTransparency)
/* f15e2c8: 90a20000 */ lbu $v0,0x0($a1)
.L0f15e2cc:
/* f15e2cc: 50400006 */ beqzl $v0,.L0f15e2e8
@ -3638,7 +3638,7 @@ glabel bgLoadRoom
/* f15e3a4: 10000014 */ b .L0f15e3f8
/* f15e3a8: 00000000 */ nop
.L0f15e3ac:
/* f15e3ac: 8f3965e4 */ lw $t9,%lo(var800a65e4)($t9)
/* f15e3ac: 8f3965e4 */ lw $t9,%lo(g_EnvHasTransparency)($t9)
/* f15e3b0: 3c0b800a */ lui $t3,%hi(g_Rooms)
/* f15e3b4: 8fac0054 */ lw $t4,0x54($sp)
/* f15e3b8: 1720000f */ bnez $t9,.L0f15e3f8
@ -4160,7 +4160,7 @@ glabel bgLoadRoom
/* f158ab0: 24a90014 */ addiu $t1,$a1,0x14
/* f158ab4: 00e9082b */ sltu $at,$a3,$t1
/* f158ab8: 14200026 */ bnez $at,.NB0f158b54
/* f158abc: 3c0e800b */ lui $t6,%hi(var800a65e4)
/* f158abc: 3c0e800b */ lui $t6,%hi(g_EnvHasTransparency)
/* f158ac0: 90a20000 */ lbu $v0,0x0($a1)
.NB0f158ac4:
/* f158ac4: 50400006 */ beqzl $v0,.NB0f158ae0
@ -4227,7 +4227,7 @@ glabel bgLoadRoom
/* f158b9c: 10000014 */ beqz $zero,.NB0f158bf0
/* f158ba0: 00000000 */ sll $zero,$zero,0x0
.NB0f158ba4:
/* f158ba4: 8dceaea4 */ lw $t6,%lo(var800a65e4)($t6)
/* f158ba4: 8dceaea4 */ lw $t6,%lo(g_EnvHasTransparency)($t6)
/* f158ba8: 3c18800b */ lui $t8,%hi(g_Rooms)
/* f158bac: 8faf0050 */ lw $t7,0x50($sp)
/* f158bb0: 15c0000f */ bnez $t6,.NB0f158bf0
@ -4530,7 +4530,7 @@ void bgLoadRoom(s32 roomnum)
if (g_FogEnabled) {
gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->opablocks, 1);
gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->xlublocks, 5);
} else if (var800a65e4 == 0) {
} else if (!g_EnvHasTransparency) {
gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->opablocks, 6);
gfxReplaceGbiCommandsRecursively(g_Rooms[roomnum].gfxdata->xlublocks, 7);
}

View File

@ -20,7 +20,3 @@ struct screenbox g_PortalScreenBbox;
u32 g_BgCmdThrowing;
s32 g_BgNumLightsChecksum;
s32 g_BgLightsOffsetChecksum;
u32 var800a65dc;
u32 g_FogEnabled;
u32 var800a65e4;
struct coord *var800a65e8;

View File

@ -3329,8 +3329,8 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
{
struct chrdata *chr = prop->chr;
struct model *model = chr->model;
f32 sp108[4];
s32 sp104;
f32 shadecolourfracs[4];
s32 shademode;
s32 sp100;
s32 alpha;
struct eyespy *eyespy;
@ -3366,7 +3366,7 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
chrGetBloodColour(chr->bodynum, spec, NULL);
chr0f0246e4(spec);
alpha *= func0f08e6bc(prop, modelGetEffectiveScale(model));
alpha *= objCalculateFadeDistOpacityFrac(prop, modelGetEffectiveScale(model));
if (g_Vars.currentplayer->visionmode == VISIONMODE_XRAY) {
f32 fadedist;
@ -3408,14 +3408,14 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
}
}
sp104 = env0f1667f4(prop, sp108);
shademode = envGetObjShadeMode(prop, shadecolourfracs);
if (chr->unk32c_18) {
propCalculateShadeColour(chr->prop, chr->nextcol, chr->floorcol);
chr->unk32c_18 = false;
}
if (sp104 && alpha > 0) {
if (shademode != SHADEMODE_XLU && alpha > 0) {
struct modelrenderdata renderdata = {0, 1, 3};
struct screenbox screenbox;
s32 colour[4]; // rgba levels, but allowing > 256 temporarily
@ -3464,7 +3464,7 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
}
}
func0f069750(colour, sp104, sp108);
objMergeColourFracs(colour, shademode, shadecolourfracs);
// Configure colours for night vision if in use
if (USINGDEVICE(DEVICE_NIGHTVISION)) {
@ -3591,8 +3591,8 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
if (chr->chrflags & CHRCFLAG_NOSHADOW) {
shadowalpha = 0;
} else if (sp104 == 1) {
shadowalpha = (1.0f - sp108[3]) * ((alpha * 100) >> 8);
} else if (shademode == SHADEMODE_FRAC) {
shadowalpha = (1.0f - shadecolourfracs[3]) * ((alpha * 100) >> 8);
} else {
shadowalpha = (s32)(alpha * 100) >> 8;
}

View File

@ -6669,7 +6669,7 @@ bool chrCheckCanSeeTarget(struct chrdata *chr)
|| (sqdistance < 40000.0f && (angle < 1.9195564985275f || angle > 4.3626284599304f))) {
result = false;
if (sqdistance < env0f1657e4()) {
if (sqdistance < envGetSquaredFogMax()) {
f32 tmp;
s32 iVar8 = (sqrtf(sqdistance) * 0.0018749999580905f);
s32 tmp2;
@ -14933,7 +14933,7 @@ bool chrIsPosOffScreen(struct coord *pos, s16 *rooms)
bool offscreen = true;
s32 i;
if (env0f1666f8(pos, 0)) {
if (envIsPosInFogMaxDistance(pos, 0)) {
for (i = 0; rooms[i] != -1; i++) {
if (bgRoomIsOnscreen(rooms[i])) {
break;

View File

@ -3,120 +3,129 @@
#include "game/tex.h"
#include "game/camera.h"
#include "game/bg.h"
#include "game/env.h"
#include "bss.h"
#include "lib/vi.h"
#include "data.h"
#include "types.h"
struct coord var800a65f0;
bool g_FogEnabled;
bool g_EnvHasTransparency;
struct distfadesettings *g_EnvDistFadeSettingsPtr;
struct distfadesettings g_EnvDistFadeSettings;
u32 var800a65fc;
struct var800a6600 var800a6600;
f32 var800a6618;
f32 var800a661c;
struct envtype1 *var800a6620;
struct envtype1 *g_EnvTransitionFrom;
struct envtype1 *g_EnvTransitionTo;
struct shadesettings g_EnvShadeSettings;
f32 g_EnvFogMaxFrac;
f32 g_EnvFogMinFrac;
struct fogenvironment *g_EnvOrigFogEnvironment;
struct fogenvironment *g_EnvTransitionFrom;
struct fogenvironment *g_EnvTransitionTo;
f32 var80081050 = MAXFLOAT;
f32 var80081054 = 0;
f32 g_EnvFogMax = MAXFLOAT;
f32 g_EnvFogMin = 0;
struct environment g_Env = {900, 1000};
u32 var800810a8 = 0;
u32 var800810ac = 0;
// lensflare, r, g, b, x, y, z, texture size, orb size
struct sun suns_00[] = { 1, 0xff, 0xff, 0xff, -1000000, 200000, 50000, 20, 48 };
struct sun suns_area51[] = { 0, 0xff, 0xe0, 0x80, -200000, 310000, 1000000, 20, 48 };
struct sun suns_villa[] = { 1, 0xff, 0xff, 0xff, -1000000, 200000, 50000, 20, 48 };
struct sun suns_ci[] = { 1, 0xff, 0xff, 0xff, 400000, 600000, -1000000, 20, 48 };
#define RGB(col) col >> 16, (col >> 8) & 0xff, col & 0xff
#define NO_SUNS 0, NULL
#define SUNS(arr) ARRAYCOUNT(arr), arr
// lensflare, colour, x, y, z, texture size, orb size
struct sun suns_00[] = { 1, RGB(0xffffff), -1000000, 200000, 50000, 20, 48 };
struct sun suns_area51[] = { 0, RGB(0xffe080), -200000, 310000, 1000000, 20, 48 };
struct sun suns_villa[] = { 1, RGB(0xffffff), -1000000, 200000, 50000, 20, 48 };
struct sun suns_ci[] = { 1, RGB(0xffffff), 400000, 600000, -1000000, 20, 48 };
struct sun suns_skedar[] = {
{ 1, 0xff, 0xff, 0xff, -400000, 600000, 1000000, 20, 48 },
{ 1, 0xff, 0xff, 0xff, 0, 1000000, 1000000, 25, 60 },
{ 1, 0xff, 0xff, 0xff, 400000, 600000, 1000000, 15, 36 },
{ 1, RGB(0xffffff), -400000, 600000, 1000000, 20, 48 },
{ 1, RGB(0xffffff), 0, 1000000, 1000000, 25, 60 },
{ 1, RGB(0xffffff), 400000, 600000, 1000000, 15, 36 },
};
struct sun suns_crashsite[] = { 1, 0xff, 0xd7, 0xf2, 1900000, 300000, -1400000, 22, 48 };
struct sun suns_airbase[] = { 1, 0xff, 0xd7, 0xf2, -1200000, 200000, 150000, 30, 60 };
struct sun suns_crashsite[] = { 1, RGB(0xffd7f2), 1900000, 300000, -1400000, 22, 48 };
struct sun suns_airbase[] = { 1, RGB(0xffd7f2), -1200000, 200000, 150000, 30, 60 };
struct envtype1 g_EnvironmentsType1[] = {
// |--- fog ----| |---- sky -----| |----------- clouds -----------| |--------------- water ---------------|
// stage near far 06 08 0a min max r g b sun e scale 1c r g b 20 21 scale type r g b 28
{ STAGE_CRASHSITE, 15, 10000, 0, 0, 0, 0x03e2, 0x03e8, 0x9b, 0x2d, 0x1e, 1, suns_crashsite, 1, 1500, 0x00, 0xfa, 0xfa, 0x00, 0, 0, -5000, 0, 0x00, 0x00, 0x00, 0x00 },
{ STAGE_PELAGIC, 15, 15000, 3333, 4444, 600, 0x03e3, 0x03e8, 0x2d, 0x3e, 0x60, 0, NULL, 1, 5000, 0x00, 0xf0, 0xf0, 0xf0, 0, 0, -2000, 0, 0x14, 0x21, 0x2b, 0x00 },
{ STAGE_VILLA, 15, 20000, 0, 0, 0, 0x03d5, 0x0417, 0x46, 0xa0, 0xff, 1, suns_villa, 1, 5000, 0x00, 0xff, 0xff, 0xff, 0, 0, -1850, 1, 0x00, 0xff, 0xff, 0x00 },
{ STAGE_PELAGIC + 900, 30, 15000, 3333, 4444, 600, 0x03e3, 0x03e8, 0x10, 0x30, 0x60, 0, NULL, 1, 5000, 0x00, 0xff, 0xff, 0xff, 0, 0, -1000, 0, 0x00, 0x00, 0x00, 0x00 },
{ STAGE_24, 2, 25000, 0, 0, 0, 0x03e4, 0x03e8, 0x00, 0x00, 0x00, 0, NULL, 1, 10000, 0x00, 0xff, 0xff, 0xff, 0, 0, 0, 1, 0x00, 0xff, 0xff, 0x07 },
{ STAGE_2B, 2, 2000, 2500, 3055, 750, 0x03bd, 0x03e8, 0x20, 0x10, 0x10, 0, NULL, 1, 5000, 0x00, 0x3a, 0x11, 0x00, 0, 0, -1000, 1, 0x00, 0xff, 0xff, 0x14 },
{ STAGE_2B + 900, 2, 8000, 6000, 8000, 800, 0x03df, 0x03e8, 0x20, 0x10, 0x10, 0, NULL, 1, 5000, 0x00, 0x3a, 0x11, 0x00, 0, 0, -1000, 1, 0x00, 0xff, 0xff, 0x00 },
{ 238, 10, 6000, 0, 0, 0, 0x03e4, 0x03e8, 0x18, 0x18, 0x18, 0, NULL, 1, 10000, 0x00, 0x78, 0x78, 0x78, 0, 0, -500, 0, 0x00, 0x00, 0x00, 0x00 },
{ 338, 10, 6000, 0, 0, 0, 0x03e4, 0x03e8, 0x18, 0x18, 0x18, 0, NULL, 1, 10000, 0x00, 0x78, 0x78, 0x78, 0, 0, -500, 0, 0x00, 0x00, 0x00, 0x00 },
{ 438, 10, 6000, 0, 0, 0, 0x03e4, 0x03e8, 0x18, 0x18, 0x18, 0, NULL, 1, 10000, 0x00, 0x78, 0x78, 0x78, 0, 0, -500, 0, 0x00, 0x00, 0x00, 0x00 },
{ 200, 10, 7500, 0, 0, 0, 0x03e4, 0x03e8, 0x00, 0x00, 0x00, 0, NULL, 0, 0, 0x00, 0x00, 0x00, 0x00, 0, 0, 0, 0, 0x00, 0x00, 0x00, 0x00 },
{ 300, 10, 6000, 0, 0, 0, 0x03e4, 0x03e8, 0x00, 0x00, 0x00, 0, NULL, 0, 0, 0x00, 0x00, 0x00, 0x00, 0, 0, 0, 0, 0x00, 0x00, 0x00, 0x00 },
{ 400, 10, 5000, 0, 0, 0, 0x03e4, 0x03e8, 0x00, 0x00, 0x00, 0, NULL, 0, 0, 0x00, 0x00, 0x00, 0x00, 0, 0, 0, 0, 0x00, 0x00, 0x00, 0x00 },
{ 0, 0, 0, 0, 0, 0, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0, NULL, 0, 0, 0x00, 0x00, 0x00, 0x00, 0, 0, 0, 0, 0x00, 0x00, 0x00, 0x00 },
struct fogenvironment g_FogEnvironments[] = {
// |- distfade --| |- fog -| |---------- clouds ---------| |--------- water ---------|
// stage near far opa% xlu% ref min max sky colour e scale type colour e scale type colour clouds_height
{ STAGE_CRASHSITE, 15, 10000, 0, 0, 0, 994, 1000, RGB(0x9b2d1e), SUNS(suns_crashsite), 1, 1500, 0, RGB(0xfafa00), 0, -5000, 0, RGB(0x000000), 0 },
{ STAGE_PELAGIC, 15, 15000, 3333, 4444, 600, 995, 1000, RGB(0x2d3e60), NO_SUNS, 1, 5000, 0, RGB(0xf0f0f0), 0, -2000, 0, RGB(0x14212b), 0 },
{ STAGE_VILLA, 15, 20000, 0, 0, 0, 981, 1047, RGB(0x46a0ff), SUNS(suns_villa), 1, 5000, 0, RGB(0xffffff), 0, -1850, 1, RGB(0x00ffff), 0 },
{ STAGE_PELAGIC + 900, 30, 15000, 3333, 4444, 600, 995, 1000, RGB(0x103060), NO_SUNS, 1, 5000, 0, RGB(0xffffff), 0, -1000, 0, RGB(0x000000), 0 },
{ STAGE_24, 2, 25000, 0, 0, 0, 996, 1000, RGB(0x000000), NO_SUNS, 1, 10000, 0, RGB(0xffffff), 0, 0, 1, RGB(0x00ffff), 7 },
{ STAGE_2B, 2, 2000, 2500, 3055, 750, 957, 1000, RGB(0x201010), NO_SUNS, 1, 5000, 0, RGB(0x3a1100), 0, -1000, 1, RGB(0x00ffff), 20 },
{ STAGE_2B + 900, 2, 8000, 6000, 8000, 800, 991, 1000, RGB(0x201010), NO_SUNS, 1, 5000, 0, RGB(0x3a1100), 0, -1000, 1, RGB(0x00ffff), 0 },
{ 238, 10, 6000, 0, 0, 0, 996, 1000, RGB(0x181818), NO_SUNS, 1, 10000, 0, RGB(0x787878), 0, -500, 0, RGB(0x000000), 0 },
{ 338, 10, 6000, 0, 0, 0, 996, 1000, RGB(0x181818), NO_SUNS, 1, 10000, 0, RGB(0x787878), 0, -500, 0, RGB(0x000000), 0 },
{ 438, 10, 6000, 0, 0, 0, 996, 1000, RGB(0x181818), NO_SUNS, 1, 10000, 0, RGB(0x787878), 0, -500, 0, RGB(0x000000), 0 },
{ 200, 10, 7500, 0, 0, 0, 996, 1000, RGB(0x000000), NO_SUNS, 0, 0, 0, RGB(0x000000), 0, 0, 0, RGB(0x000000), 0 },
{ 300, 10, 6000, 0, 0, 0, 996, 1000, RGB(0x000000), NO_SUNS, 0, 0, 0, RGB(0x000000), 0, 0, 0, RGB(0x000000), 0 },
{ 400, 10, 5000, 0, 0, 0, 996, 1000, RGB(0x000000), NO_SUNS, 0, 0, 0, RGB(0x000000), 0, 0, 0, RGB(0x000000), 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, 0, 0, RGB(0x000000), 0, 0, 0, RGB(0x000000), 0 },
};
struct envtype2 g_EnvironmentsType2[] = {
// |-------- clouds --------| |------------ water ------------|
// stage near far 08 0a 0c r g b sun e r g b scale 20 e r g b scale type 30 34
{ -1, 15, 10000, 0, 0, 0, 0x00, 0x10, 0x40, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 0 },
{ STAGE_RESCUE, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_MAIANSOS, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_ATTACKSHIP, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 0 },
{ STAGE_INFILTRATION, 15, 12000, 0, 0, 0, 0x00, 0x00, 0x00, 1, suns_area51, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_ESCAPE, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 1, suns_area51, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_TEST_ARCH, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 0 },
{ STAGE_DEEPSEA, 15, 10000, 0, 0, 0, 0x05, 0x00, 0x00, 0, NULL, 0, 0x9b, 0x9b, 0x9b, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 0 },
{ STAGE_TEST_DEST, 15, 10000, 0, 0, 0, 0x10, 0x30, 0x60, 0, NULL, 1, 0xe6, 0xe6, 0xe6, 3000, 0, 1, 0xff, 0xff, 0x96, -150, 2, 0, 0 },
{ STAGE_TEST_LEN, 15, 10000, 0, 0, 0, 0x30, 0x40, 0x10, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 0 },
{ STAGE_TEST_ASH, 15, 25000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_DEFENSE, 15, 10000, 0, 0, 0, 0x65, 0xb2, 0xff, 1, suns_ci, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_CITRAINING, 15, 10000, 0, 0, 0, 0x65, 0xb2, 0xff, 1, suns_ci, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_DUEL, 10, 10000, 0, 0, 0, 0x65, 0xb2, 0xff, 1, suns_ci, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_RETAKING, 15, 10000, 0, 0, 0, 0x65, 0xb2, 0xff, 1, suns_ci, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_DEFECTION, 10, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x3a, 0x11, 0x00, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_MBR, 10, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x3a, 0x11, 0x00, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_EXTRACTION, 10, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x3a, 0x11, 0x00, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_SKEDARRUINS, 15, 10000, 0, 0, 0, 0x65, 0x65, 0xff, 3, suns_skedar, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_WAR, 15, 10000, 0, 0, 0, 0x65, 0x65, 0xff, 3, suns_skedar, 0, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_TEST_RUN, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x3a, 0x11, 0x00, 5000, 0, 0, 0x00, 0x00, 0x00, 0, 0, 0, 1 },
{ STAGE_MP_SKEDAR, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x3a, 0x11, 0x00, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
{ STAGE_TEST_SILO, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x3a, 0x11, 0x00, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
{ STAGE_CHICAGO, 10, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x50, 0x28, 0x0a, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
{ STAGE_G5BUILDING, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x50, 0x28, 0x0a, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
{ STAGE_AIRFORCEONE, 15, 20000, 0, 0, 0, 0x00, 0x10, 0x40, 0, NULL, 1, 0xff, 0xff, 0xff, 5000, 0, 1, 0xff, 0xff, 0xff, -5000, 2, 0, 1 },
{ STAGE_MP_RAVINE, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x50, 0x28, 0x0a, 5000, 0, 0, 0x00, 0x00, 0x00, -31000, 0, 0, 1 },
{ STAGE_AIRBASE, 15, 20000, 0, 0, 0, 0x00, 0x10, 0x40, 1, suns_airbase, 1, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
{ STAGE_INVESTIGATION, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
{ STAGE_MP_PIPES, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x08, 0, NULL, 1, 0x46, 0xc7, 0xba, 4500, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_G5BUILDING, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x08, 0, NULL, 1, 0x5a, 0x90, 0xa5, 4500, 0, 0, 0x00, 0x00, 0x00, -20000, 0, 0, 0 },
{ STAGE_MP_TEMPLE, 15, 10000, 0, 0, 0, 0x00, 0x10, 0x80, 0, NULL, 1, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0xff, 0xff, -1850, 1, 0, 1 },
{ STAGE_MP_COMPLEX, 15, 10000, 0, 0, 0, 0x02, 0x00, 0x00, 0, NULL, 1, 0x82, 0xaa, 0xc8, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_UFF, 10, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_OLD, 15, 30000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_LAM, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_BASE, 15, 20000, 0, 0, 0, 0x04, 0x00, 0x00, 0, NULL, 1, 0x82, 0xb4, 0x64, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP2, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x08, 0, NULL, 1, 0x46, 0xc7, 0xba, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_AREA52, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x08, 0, NULL, 1, 0x46, 0xc7, 0xba, 4500, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_WAREHOUSE, 15, 10000, 0, 0, 0, 0x02, 0x00, 0x00, 0, NULL, 1, 0x82, 0xaa, 0xc8, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_CARPARK, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x64, 0xc8, 0x86, 5500, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP6, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP7, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP8, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_RUINS, 15, 10000, 0, 0, 0, 0x03, 0x00, 0x00, 0, NULL, 1, 0x82, 0xe6, 0xaa, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_SEWERS, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x64, 0x64, 0x64, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_FELICITY, 10, 10000, 0, 0, 0, 0x04, 0x05, 0x00, 0, NULL, 1, 0x64, 0xd2, 0x82, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_FORTRESS, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x08, 0, NULL, 1, 0x5a, 0x90, 0xa5, 5500, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_VILLA, 15, 10000, 0, 0, 0, 0x88, 0x88, 0xdc, 0, NULL, 1, 0xff, 0xaa, 0x2a, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP14, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_MP_GRID, 15, 10000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP16, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP17, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 1, 0x64, 0xc8, 0x86, 10000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP18, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP19, 15, 20000, 0, 0, 0, 0x00, 0x00, 0x00, 0, NULL, 0, 0x1e, 0x1e, 0x1e, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 0 },
{ STAGE_TEST_MP20, 15, 20000, 0, 0, 0, 0x00, 0x10, 0x3c, 0, NULL, 1, 0xff, 0xff, 0xff, 5000, 0, 0, 0x00, 0x00, 0x00, -5000, 0, 0, 1 },
struct nofogenvironment g_NoFogEnvironments[] = {
// clouds_height
// |distfade | |--------- clouds ---------| |----------- water ----------| | transparency
// stage near far opa xlu ref sky colour e colour scale type e colour scale type | |
{ -1, 15, 10000, 0, 0, 0, RGB(0x001040), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 0 },
{ STAGE_RESCUE, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_MAIANSOS, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_ATTACKSHIP, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 0 },
{ STAGE_INFILTRATION, 15, 12000, 0, 0, 0, RGB(0x000000), SUNS(suns_area51), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_ESCAPE, 15, 10000, 0, 0, 0, RGB(0x000000), SUNS(suns_area51), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_TEST_ARCH, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 0 },
{ STAGE_DEEPSEA, 15, 10000, 0, 0, 0, RGB(0x050000), NO_SUNS, 0, RGB(0x9b9b9b), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 0 },
{ STAGE_TEST_DEST, 15, 10000, 0, 0, 0, RGB(0x103060), NO_SUNS, 1, RGB(0xe6e6e6), 3000, 0, 1, RGB(0xffff96), -150, 2, 0, 0 },
{ STAGE_TEST_LEN, 15, 10000, 0, 0, 0, RGB(0x304010), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 0 },
{ STAGE_TEST_ASH, 15, 25000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_DEFENSE, 15, 10000, 0, 0, 0, RGB(0x65b2ff), SUNS(suns_ci), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_CITRAINING, 15, 10000, 0, 0, 0, RGB(0x65b2ff), SUNS(suns_ci), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_DUEL, 10, 10000, 0, 0, 0, RGB(0x65b2ff), SUNS(suns_ci), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_RETAKING, 15, 10000, 0, 0, 0, RGB(0x65b2ff), SUNS(suns_ci), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_DEFECTION, 10, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x3a1100), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_MBR, 10, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x3a1100), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_EXTRACTION, 10, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x3a1100), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_SKEDARRUINS, 15, 10000, 0, 0, 0, RGB(0x6565ff), SUNS(suns_skedar), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_WAR, 15, 10000, 0, 0, 0, RGB(0x6565ff), SUNS(suns_skedar), 0, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_TEST_RUN, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x3a1100), 5000, 0, 0, RGB(0x000000), 0, 0, 0, 1 },
{ STAGE_MP_SKEDAR, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x3a1100), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ STAGE_TEST_SILO, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x3a1100), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ STAGE_CHICAGO, 10, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x50280a), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ STAGE_G5BUILDING, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x50280a), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ STAGE_AIRFORCEONE, 15, 20000, 0, 0, 0, RGB(0x001040), NO_SUNS, 1, RGB(0xffffff), 5000, 0, 1, RGB(0xffffff), -5000, 2, 0, 1 },
{ STAGE_MP_RAVINE, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x50280a), 5000, 0, 0, RGB(0x000000), -31000, 0, 0, 1 },
{ STAGE_AIRBASE, 15, 20000, 0, 0, 0, RGB(0x001040), SUNS(suns_airbase), 1, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ STAGE_INVESTIGATION, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ STAGE_MP_PIPES, 15, 10000, 0, 0, 0, RGB(0x000008), NO_SUNS, 1, RGB(0x46c7ba), 4500, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_G5BUILDING, 15, 10000, 0, 0, 0, RGB(0x000008), NO_SUNS, 1, RGB(0x5a90a5), 4500, 0, 0, RGB(0x000000), -20000, 0, 0, 0 },
{ STAGE_MP_TEMPLE, 15, 10000, 0, 0, 0, RGB(0x001080), NO_SUNS, 1, RGB(0xffffff), 5000, 0, 0, RGB(0x00ffff), -1850, 1, 0, 1 },
{ STAGE_MP_COMPLEX, 15, 10000, 0, 0, 0, RGB(0x020000), NO_SUNS, 1, RGB(0x82aac8), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_UFF, 10, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_OLD, 15, 30000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_LAM, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_BASE, 15, 20000, 0, 0, 0, RGB(0x040000), NO_SUNS, 1, RGB(0x82b464), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP2, 15, 20000, 0, 0, 0, RGB(0x000008), NO_SUNS, 1, RGB(0x46c7ba), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_AREA52, 15, 10000, 0, 0, 0, RGB(0x000008), NO_SUNS, 1, RGB(0x46c7ba), 4500, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_WAREHOUSE, 15, 10000, 0, 0, 0, RGB(0x020000), NO_SUNS, 1, RGB(0x82aac8), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_CARPARK, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x64c886), 5500, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP6, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP7, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP8, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_RUINS, 15, 10000, 0, 0, 0, RGB(0x030000), NO_SUNS, 1, RGB(0x82e6aa), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_SEWERS, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x646464), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_FELICITY, 10, 10000, 0, 0, 0, RGB(0x040500), NO_SUNS, 1, RGB(0x64d282), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_FORTRESS, 15, 10000, 0, 0, 0, RGB(0x000008), NO_SUNS, 1, RGB(0x5a90a5), 5500, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_VILLA, 15, 10000, 0, 0, 0, RGB(0x8888dc), NO_SUNS, 1, RGB(0xffaa2a), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP14, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_MP_GRID, 15, 10000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP16, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP17, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 1, RGB(0x64c886), 10000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP18, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP19, 15, 20000, 0, 0, 0, RGB(0x000000), NO_SUNS, 0, RGB(0x1e1e1e), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 0 },
{ STAGE_TEST_MP20, 15, 20000, 0, 0, 0, RGB(0x00103c), NO_SUNS, 1, RGB(0xffffff), 5000, 0, 0, RGB(0x000000), -5000, 0, 0, 1 },
{ 0 },
};
@ -130,17 +139,17 @@ struct environment *envGetCurrent(void)
return &g_Env;
}
f32 env0f1657d8(void)
f32 envGetFogMax(void)
{
return var80081050;
return g_EnvFogMax;
}
f32 env0f1657e4(void)
f32 envGetSquaredFogMax(void)
{
return var80081050 * var80081050;
return g_EnvFogMax * g_EnvFogMax;
}
void env0f1657f8(void)
void envTick(void)
{
struct zrange zrange;
f32 scale;
@ -160,28 +169,30 @@ void env0f1657f8(void)
zrange.near /= scale;
zrange.far /= scale;
var800a661c = g_Env.fogmin * 0.001f;
var800a6618 = g_Env.fogmax * 0.001f;
// g_Env.fogmin and fogmax are a percentage of the draw distance, where a
// value of 1000 is 100%. So this is changing it back to a frac (0-1).
g_EnvFogMinFrac = g_Env.fogmin * 0.001f;
g_EnvFogMaxFrac = g_Env.fogmax * 0.001f;
var80081050 = (zrange.far - zrange.near) * var800a6618 + zrange.f[0];
var80081054 = (zrange.far - zrange.near) * var800a661c + zrange.f[0];
g_EnvFogMax = (zrange.far - zrange.near) * g_EnvFogMaxFrac + zrange.f[0];
g_EnvFogMin = (zrange.far - zrange.near) * g_EnvFogMinFrac + zrange.f[0];
var800a6600.znear = zrange.near;
var800a6600.zfar = zrange.far;
g_EnvShadeSettings.znear = zrange.near;
g_EnvShadeSettings.zfar = zrange.far;
zfar = var800a6600.zfar;
znear = var800a6600.znear;
sp28 = 128.0f / (var800a6618 - var800a661c);
sp24 = (0.5f - var800a661c) * 256.0f / (var800a6618 - var800a661c);
zfar = g_EnvShadeSettings.zfar;
znear = g_EnvShadeSettings.znear;
sp28 = 128.0f / (g_EnvFogMaxFrac - g_EnvFogMinFrac);
sp24 = (0.5f - g_EnvFogMinFrac) * 256.0f / (g_EnvFogMaxFrac - g_EnvFogMinFrac);
var800a6600.unk10 = -sp28 * zfar * (znear + 1.0f) / (zfar - znear) / 255.0f;
var800a6600.unk14 = ((zfar + 1.0f) * sp28 / (zfar - znear) + sp24) / 255.0f;
g_EnvShadeSettings.alphafar = -sp28 * zfar * (znear + 1.0f) / (zfar - znear) / 255.0f;
g_EnvShadeSettings.alphanear = (sp28 * (zfar + 1.0f) / (zfar - znear) + sp24) / 255.0f;
}
void envApplyType1(struct envtype1 *env)
void envApplyFogEnvironment(struct fogenvironment *env)
{
g_FogEnabled = true;
var800a65e4 = 0;
g_EnvHasTransparency = false;
viSetZRange(env->near, env->far);
@ -200,7 +211,7 @@ void envApplyType1(struct envtype1 *env)
g_Env.clouds_enabled = env->clouds_enabled;
g_Env.clouds_scale = env->clouds_scale;
g_Env.unk18 = env->unk1c;
g_Env.clouds_type = env->clouds_type;
g_Env.clouds_r = env->clouds_r;
g_Env.clouds_g = env->clouds_g;
g_Env.clouds_b = env->clouds_b;
@ -211,21 +222,21 @@ void envApplyType1(struct envtype1 *env)
g_Env.water_r = env->water_r;
g_Env.water_g = env->water_g;
g_Env.water_b = env->water_b;
g_Env.unk40 = env->unk28;
g_Env.clouds_height = env->clouds_height;
if (!env->unk06) {
var800a65e8 = NULL;
if (!env->opaperc) {
g_EnvDistFadeSettingsPtr = NULL;
} else {
var800a65f0.x = env->unk06;
var800a65f0.y = env->unk08;
var800a65f0.z = env->unk0a;
var800a65e8 = &var800a65f0;
g_EnvDistFadeSettings.opaperc = env->opaperc;
g_EnvDistFadeSettings.xluperc = env->xluperc;
g_EnvDistFadeSettings.refdist = env->refdist;
g_EnvDistFadeSettingsPtr = &g_EnvDistFadeSettings;
}
env0f1657f8();
envTick();
}
void envApplyType2(struct envtype2 *env)
void envApplyNoFogEnvironment(struct nofogenvironment *env)
{
struct zrange zrange;
@ -243,7 +254,7 @@ void envApplyType2(struct envtype2 *env)
g_Env.suns = env->suns;
g_Env.clouds_enabled = env->clouds_enabled;
g_Env.clouds_scale = env->clouds_scale;
g_Env.unk18 = env->unk20;
g_Env.clouds_type = env->clouds_type;
g_Env.clouds_r = env->clouds_r;
g_Env.clouds_g = env->clouds_g;
@ -256,20 +267,20 @@ void envApplyType2(struct envtype2 *env)
g_Env.water_r = env->water_r;
g_Env.water_g = env->water_g;
g_Env.water_b = env->water_b;
g_Env.unk40 = env->unk30;
g_Env.clouds_height = env->clouds_height;
if (!env->unk08) {
var800a65e8 = NULL;
if (!env->opaperc) {
g_EnvDistFadeSettingsPtr = NULL;
} else {
var800a65f0.x = env->unk08;
var800a65f0.y = env->unk0a;
var800a65f0.z = env->unk0c;
var800a65e8 = &var800a65f0;
g_EnvDistFadeSettings.opaperc = env->opaperc;
g_EnvDistFadeSettings.xluperc = env->xluperc;
g_EnvDistFadeSettings.refdist = env->refdist;
g_EnvDistFadeSettingsPtr = &g_EnvDistFadeSettings;
}
g_FogEnabled = false;
var800a65e4 = env->unk34;
g_EnvHasTransparency = env->transparency;
}
void envDisableSky(void)
@ -290,38 +301,42 @@ void envSetStageNum(s32 stagenum)
void envChooseAndApply(s32 stagenum, bool allowoverride)
{
struct envtype2 *finalenv = NULL;
struct envtype2 *env2;
struct envtype1 *env1;
struct nofogenvironment *finalenv = NULL;
struct nofogenvironment *env2;
struct fogenvironment *env1;
if (PLAYERCOUNT());
var80081050 = MAXFLOAT;
var80081054 = 0;
g_EnvFogMax = MAXFLOAT;
g_EnvFogMin = 0;
// If allowoverride is set, try to find an env1 with stage + 900.
// But allowoverride is never set, so this never happens.
if (allowoverride) {
for (env1 = &g_EnvironmentsType1[0]; env1->stage != 0; env1++) {
for (env1 = &g_FogEnvironments[0]; env1->stage != 0; env1++) {
if (env1->stage == stagenum + 900) {
var800a6620 = env1;
g_EnvOrigFogEnvironment = env1;
g_EnvTransitionFrom = env1;
g_EnvTransitionTo = env1 + 1;
envApplyType1(var800a6620);
envApplyFogEnvironment(g_EnvOrigFogEnvironment);
return;
}
}
}
for (env1 = &g_EnvironmentsType1[0]; env1->stage != 0; env1++) {
// Try to find an env1
for (env1 = &g_FogEnvironments[0]; env1->stage != 0; env1++) {
if (env1->stage == stagenum) {
var800a6620 = env1;
g_EnvOrigFogEnvironment = env1;
g_EnvTransitionFrom = env1;
g_EnvTransitionTo = env1 + 1;
envApplyType1(var800a6620);
envApplyFogEnvironment(g_EnvOrigFogEnvironment);
return;
}
}
for (env2 = &g_EnvironmentsType2[0]; env2->stage != 0; env2++) {
// Try to find an env2
for (env2 = &g_NoFogEnvironments[0]; env2->stage != 0; env2++) {
if (env2->stage == stagenum) {
finalenv = env2;
}
@ -330,17 +345,17 @@ void envChooseAndApply(s32 stagenum, bool allowoverride)
if (env2);
if (finalenv == NULL) {
finalenv = &g_EnvironmentsType2[0];
finalenv = &g_NoFogEnvironments[0];
}
envApplyType2(finalenv);
envApplyNoFogEnvironment(finalenv);
var800a6620 = NULL;
g_EnvOrigFogEnvironment = NULL;
}
void envApplyTransitionFrac(f32 frac)
{
static struct envtype1 tmp;
static struct fogenvironment tmp;
tmp = *g_EnvTransitionFrom;
@ -357,7 +372,7 @@ void envApplyTransitionFrac(f32 frac)
tmp.sky_g &= 0xf8;
tmp.sky_b &= 0xf8;
envApplyType1(&tmp);
envApplyFogEnvironment(&tmp);
}
Gfx *envStartFog(Gfx *gdl, bool xlupass)
@ -391,7 +406,7 @@ Gfx *envStopFog(Gfx *gdl)
return gdl;
}
bool env0f1666f8(struct coord *pos, f32 arg1)
bool envIsPosInFogMaxDistance(struct coord *pos, f32 tolerance)
{
struct coord sp24;
Mtxf *mtx;
@ -416,44 +431,44 @@ bool env0f1666f8(struct coord *pos, f32 arg1)
tmp = sp24.f[0] * mtx->m[0][0] + sp24.f[1] * mtx->m[0][1] + sp24.f[2] * mtx->m[0][2];
if (var80081050 + arg1 < tmp) {
if (tmp > g_EnvFogMax + tolerance) {
return false;
}
return true;
}
struct coord *env0f1667e8(void)
struct distfadesettings *envGetDistFadeSettings(void)
{
return var800a65e8;
return g_EnvDistFadeSettingsPtr;
}
s32 env0f1667f4(struct prop *prop, f32 arg1[4])
s32 envGetObjShadeMode(struct prop *prop, f32 out[4])
{
if (!g_FogEnabled) {
return 2;
return SHADEMODE_OPA;
}
if (prop->z < 0.0f) {
return 2;
return SHADEMODE_OPA;
}
if (g_Vars.currentplayer->visionmode == VISIONMODE_XRAY) {
return 2;
return SHADEMODE_OPA;
}
arg1[0] = g_Env.skyredfrac;
arg1[1] = g_Env.skygreenfrac;
arg1[2] = g_Env.skybluefrac;
arg1[3] = var800a6600.unk14 + var800a6600.unk10 / prop->z;
out[0] = g_Env.skyredfrac;
out[1] = g_Env.skygreenfrac;
out[2] = g_Env.skybluefrac;
out[3] = g_EnvShadeSettings.alphanear + g_EnvShadeSettings.alphafar / prop->z;
if (arg1[3] < 0.0f) {
return 2;
if (out[3] < 0.0f) {
return SHADEMODE_OPA;
}
if (arg1[3] > 1.0f) {
return 0;
if (out[3] > 1.0f) {
return SHADEMODE_XLU;
}
return 1;
return SHADEMODE_FRAC;
}

View File

@ -22,7 +22,7 @@ Gfx g_GfxGroup00[] = {
};
/**
* Enable fog? (opaque displaylist)
* Enable fog (opaque displaylist)
*/
Gfx g_GfxGroup01[] = {
gsDPSetRenderMode(G_RM_PASS, G_RM_AA_ZB_OPA_SURF2),
@ -71,7 +71,7 @@ Gfx g_GfxGroup01[] = {
};
/**
* Enable fog? (translucent displaylist)
* Enable fog (translucent displaylist)
*/
Gfx g_GfxGroup05[] = {
gsDPSetRenderMode(G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2),

View File

@ -1144,7 +1144,7 @@ Gfx *lvRender(Gfx *gdl)
viSetFovAspectAndSize(g_Vars.currentplayer->fovy, g_Vars.currentplayer->aspect,
g_Vars.currentplayer->viewwidth, g_Vars.currentplayer->viewheight);
mtx00016748(g_Vars.currentplayerstats->scale_bg2gfx);
env0f1657f8();
envTick();
zbufSwap();
gdl = viPrepareZbuf(gdl);
gdl = vi0000b1d0(gdl);

View File

@ -1724,26 +1724,26 @@ void colourTween(u8 *col, u8 *nextcol)
}
}
void func0f069750(s32 *arg0, s32 arg1, f32 arg2[4])
void objMergeColourFracs(s32 *colour, s32 shademode, f32 fracs[4])
{
if (arg1 == 1) {
if (shademode == SHADEMODE_FRAC) {
f32 tmp;
arg2[0] *= 255.0f;
arg2[1] *= 255.0f;
arg2[2] *= 255.0f;
fracs[0] *= 255.0f;
fracs[1] *= 255.0f;
fracs[2] *= 255.0f;
tmp = arg0[0];
arg0[0] = tmp + (arg2[0] - tmp) * arg2[3];
tmp = colour[0];
colour[0] = tmp + (fracs[0] - tmp) * fracs[3];
tmp = arg0[1];
arg0[1] = tmp + (arg2[1] - tmp) * arg2[3];
tmp = colour[1];
colour[1] = tmp + (fracs[1] - tmp) * fracs[3];
tmp = arg0[2];
arg0[2] = tmp + (arg2[2] - tmp) * arg2[3];
tmp = colour[2];
colour[2] = tmp + (fracs[2] - tmp) * fracs[3];
tmp = arg0[3];
arg0[3] = tmp + (255.0f - tmp) * arg2[3];
tmp = colour[3];
colour[3] = tmp + (255.0f - tmp) * fracs[3];
}
}
@ -13553,8 +13553,8 @@ Gfx *objRenderShadow(struct defaultobj *obj, Gfx *gdl)
Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass)
{
f32 spe8[4];
s32 spe4;
f32 shadecolourfracs[4];
s32 shademode;
struct defaultobj *obj = prop->obj;
struct modelrenderdata renderdata = {NULL, true, 3};
struct screenbox screenbox;
@ -13576,14 +13576,14 @@ Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass)
f32 objdist;
s32 i;
spe4 = env0f1667f4(prop, spe8);
shademode = envGetObjShadeMode(prop, shadecolourfracs);
if (spe4 == 0) {
if (shademode == SHADEMODE_XLU) {
return gdl;
}
if (obj->type != OBJTYPE_TINTEDGLASS) {
frac = func0f08e6bc(prop, modelGetEffectiveScale(obj->model));
frac = objCalculateFadeDistOpacityFrac(prop, modelGetEffectiveScale(obj->model));
if (prop->timetoregen > 0 && prop->timetoregen < TICKS(60)) {
frac *= (TICKS(60.0f) - prop->timetoregen) * (PAL ? 0.019999999552965f : 0.016666667535901f);
@ -13760,7 +13760,7 @@ Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass)
colour[3] = 0xff;
}
func0f069750(colour, spe4, spe8);
objMergeColourFracs(colour, shademode, shadecolourfracs);
if (USINGDEVICE(DEVICE_NIGHTVISION)) {
if ((obj->flags & OBJFLAG_PATHBLOCKER) == 0) {
@ -19848,47 +19848,61 @@ s32 func0f08e5a8(s16 *rooms2, struct screenbox *box)
return result;
}
f32 func0f08e6bc(struct prop *prop, f32 arg1)
/**
* If the stage's environment allows it, objects in the distance fade out after
* a certain point.
*
* The settings are not quite a opa/xlu distance. They are implemented as
* percentages of a reference distance.
*
* Example settings:
* refdist = 600
* opaperc = 3333 (600 + 33.33% of 600)
* xluperc = 4444 (600 + 44.44% of 600)
*
* This feature is only used on Pelagic II.
*/
f32 objCalculateFadeDistOpacityFrac(struct prop *prop, f32 modelscale)
{
f32 result = 1;
struct coord *coord = env0f1667e8();
struct distfadesettings *settings = envGetDistFadeSettings();
if (coord != NULL && coord->z < prop->z) {
if (settings != NULL && prop->z > settings->refdist) {
f32 scalez = camGetLodScaleZ();
f32 value = ((prop->z - coord->z) * 100.0f / arg1 + coord->z) * scalez;
f32 distperc = ((prop->z - settings->refdist) * 100.0f / modelscale + settings->refdist) * scalez;
if (value >= coord->y) {
if (distperc >= settings->xluperc) {
result = 0;
} else if (value > coord->x) {
result = (coord->y - value) / (coord->y - coord->x);
} else if (distperc > settings->opaperc) {
result = (settings->xluperc - distperc) / (settings->xluperc - settings->opaperc);
}
}
return result;
}
bool func0f08e794(struct coord *coord, f32 arg1)
bool posIsInObjFadeDistance(struct coord *pos, f32 modelscale)
{
bool result = true;
struct coord *ptr = env0f1667e8();
struct distfadesettings *settings = envGetDistFadeSettings();
struct coord tmp;
f32 sp20;
if (ptr != NULL) {
if (settings != NULL) {
struct coord *campos = &g_Vars.currentplayer->cam_pos;
Mtxf *mtx = camGetWorldToScreenMtxf();
tmp.x = coord->x - campos->x;
tmp.y = coord->y - campos->y;
tmp.z = coord->z - campos->z;
tmp.x = pos->x - campos->x;
tmp.y = pos->y - campos->y;
tmp.z = pos->z - campos->z;
sp20 = tmp.f[0] * mtx->m[0][0] + tmp.f[1] * mtx->m[0][1] + tmp.f[2] * mtx->m[0][2];
if (sp20 > ptr->z) {
if (sp20 > settings->refdist) {
f32 scalez = camGetLodScaleZ();
sp20 = ((sp20 - ptr->z) * 100 / arg1 + ptr->z) * scalez;
sp20 = ((sp20 - settings->refdist) * 100 / modelscale + settings->refdist) * scalez;
if (sp20 >= ptr->y) {
if (sp20 >= settings->xluperc) {
result = false;
}
}
@ -19909,7 +19923,7 @@ bool func0f08e8ac(struct prop *prop, struct coord *pos, f32 arg2, bool arg3)
while (roomnum != -1) {
if (g_Rooms[roomnum].flags & ROOMFLAG_ONSCREEN) {
if (env0f1666f8(pos, arg2) && (!arg3 || func0f08e794(pos, arg2))) {
if (envIsPosInFogMaxDistance(pos, arg2) && (!arg3 || posIsInObjFadeDistance(pos, arg2))) {
result = camIsPosInFovAndVisibleRoom(prop->rooms, pos, arg2);
if (result) {
@ -19944,7 +19958,7 @@ bool posIsInDrawDistance(struct coord *pos)
f32 aggregate = x * x + y * y + z * z;
bool result = true;
if (aggregate > 1024000000) {
if (aggregate > 32000 * 32000) {
result = false;
}

View File

@ -36,7 +36,7 @@ void sky0f11f000(f32 left, f32 top, struct coord *arg2)
f32 pos[2];
pos[0] = left + camGetScreenLeft();
pos[1] = top + camGetScreenTop() + envGetCurrent()->unk40;
pos[1] = top + camGetScreenTop() + envGetCurrent()->clouds_height;
cam0f0b4c3c(pos, arg2, 100);
mtx4RotateVecInPlace(mtx, arg2);
@ -783,7 +783,7 @@ Gfx *skyRender(Gfx *gdl)
} else {
gDPPipeSync(gdl++);
texSelect(&gdl, &g_TexWaterConfigs[env->water_type], 1, 0, 2, 1, NULL);
texSelect(&gdl, &g_TexSkyWaterConfigs[env->water_type], 1, 0, 2, 1, NULL);
gDPSetRenderMode(gdl++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
@ -1181,7 +1181,7 @@ Gfx *skyRender(Gfx *gdl)
gDPPipeSync(gdl++);
texSelect(&gdl, &g_TexWaterConfigs[env->unk18], 1, 0, 2, 1, NULL);
texSelect(&gdl, &g_TexSkyWaterConfigs[env->clouds_type], 1, 0, 2, 1, NULL);
if (1);
@ -1319,7 +1319,7 @@ void sky0f1228d0(struct skything18 *arg0, Mtxf *arg1, u16 arg2, f32 arg3, f32 ar
arg5->unk20 = sp60;
arg5->unk24 = sp64;
arg5->unk28 = sp38[0];
arg5->unk2c = sp38[1] - envGetCurrent()->unk40 * 4.0f;
arg5->unk2c = sp38[1] - envGetCurrent()->clouds_height * 4.0f;
arg5->unk30 = sp38[2];
arg5->unk34 = f22;

View File

@ -39,8 +39,8 @@ struct textureconfig *g_TexShadowConfigs;
struct textureconfig *g_TexShieldConfigs;
struct textureconfig *g_TexShardConfigs;
struct textureconfig *g_TexScreenConfigs;
struct textureconfig *g_TexWaterConfigs;
struct textureconfig *g_TexSkyConfigs;
struct textureconfig *g_TexSkyWaterConfigs;
struct textureconfig *g_TexGroup11Configs;
struct textureconfig *g_TexLightGlareConfigs;
struct textureconfig *g_TexSparkConfigs;
struct textureconfig *g_TexGeneralConfigs;

View File

@ -35,7 +35,7 @@ extern u8 *g_TextureConfigSegment;
extern u32 g_TexBase;
extern Gfx *g_TexGdl3;
extern struct textureconfig *g_TexRedLinesConfigs;
extern struct textureconfig *g_TexSkyConfigs;
extern struct textureconfig *g_TexGroup11Configs;
extern u8 _textureconfigSegmentRomStart;
extern u8 _textureconfigSegmentStart;
@ -61,12 +61,12 @@ void texReset(void)
g_TexGroup03Configs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcGroup03Configs);
g_TexGeCrosshairConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcGeCrosshairConfigs);
g_TexRedLinesConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcRedLineConfigs);
g_TexShadowConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcGroup06Configs);
g_TexShadowConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcShadowConfigs);
g_TexShieldConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcShieldConfigs);
g_TexShardConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcShardConfigs);
g_TexScreenConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcScreenConfigs);
g_TexWaterConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcWaterConfigs);
g_TexSkyConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcSkyConfigs);
g_TexSkyWaterConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcSkyWaterConfigs);
g_TexGroup11Configs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcGroup11Configs);
g_TexLightGlareConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcLightGlareConfigs);
g_TexSparkConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcSparkConfigs);
g_TexGeneralConfigs = (struct textureconfig *)(g_TexBase + (uintptr_t)g_TcGeneralConfigs);
@ -98,11 +98,11 @@ void texReset(void)
texLoadFromConfig(&g_TexBeamConfigs[i]);
}
for (i = 0; i < ARRAYCOUNT(g_TcWaterConfigs); i++) {
texLoadFromConfig(&g_TexWaterConfigs[i]);
for (i = 0; i < ARRAYCOUNT(g_TcSkyWaterConfigs); i++) {
texLoadFromConfig(&g_TexSkyWaterConfigs[i]);
}
for (i = 0; i < ARRAYCOUNT(g_TcGroup06Configs); i++) {
for (i = 0; i < ARRAYCOUNT(g_TcShadowConfigs); i++) {
texLoadFromConfig(&g_TexShadowConfigs[i]);
}

View File

@ -228,9 +228,9 @@ extern struct screenbox g_PortalScreenBbox;
extern u32 g_BgCmdThrowing;
extern s32 g_BgNumLightsChecksum;
extern s32 g_BgLightsOffsetChecksum;
extern u32 g_FogEnabled;
extern u32 var800a65e4;
extern struct coord *var800a65e8;
extern bool g_FogEnabled;
extern bool g_EnvHasTransparency;
extern struct distfadesettings *g_EnvDistFadeSettingsPtr;
extern u8 *g_RoomMtxAges;
extern s16 *g_RoomMtxLinkedRooms;
extern s16 *g_RoomMtxBaseRooms;
@ -270,7 +270,7 @@ extern struct textureconfig *g_TexShadowConfigs;
extern struct textureconfig *g_TexShieldConfigs;
extern struct textureconfig *g_TexShardConfigs;
extern struct textureconfig *g_TexScreenConfigs;
extern struct textureconfig *g_TexWaterConfigs;
extern struct textureconfig *g_TexSkyWaterConfigs;
extern struct textureconfig *g_TexLightGlareConfigs;
extern struct textureconfig *g_TexSparkConfigs;
extern struct textureconfig *g_TexGeneralConfigs;

View File

@ -2218,7 +2218,7 @@
/**
* Switch to the stage's alternative sky/fog settings. The switch is instant.
*
* The stage must use a type 1 sky (in the g_EnvironmentsType1 table) and the
* The stage must use a type 1 sky (in the g_FogEnvironments table) and the
* alternative sky must be placed immediately after it.
*/
#define switch_to_alt_sky \

View File

@ -3555,6 +3555,10 @@
#define SCREENSPLIT_HORIZONTAL 0
#define SCREENSPLIT_VERTICAL 1
#define SHADEMODE_XLU 0
#define SHADEMODE_FRAC 1
#define SHADEMODE_OPA 2
#define SHARDTYPE_GLASS 0
#define SHARDTYPE_BOTTLE 1
#define SHARDTYPE_WOOD 2

View File

@ -4,18 +4,24 @@
#include "data.h"
#include "types.h"
struct distfadesettings {
f32 opaperc;
f32 xluperc;
f32 refdist;
};
struct environment *envGetCurrent(void);
f32 env0f1657e4(void);
void env0f1657f8(void);
void envApplyType1(struct envtype1 *sky);
void envApplyType2(struct envtype2 *sky);
f32 envGetSquaredFogMax(void);
void envTick(void);
void envApplyFogEnvironment(struct fogenvironment *sky);
void envApplyNoFogEnvironment(struct nofogenvironment *sky);
void envSetStageNum(s32 stagenum);
void envChooseAndApply(s32 stagenum, bool allowoverride);
void envApplyTransitionFrac(f32 arg0);
Gfx *envStartFog(Gfx *gdl, bool xlupass);
Gfx *envStopFog(Gfx *gdl);
bool env0f1666f8(struct coord *pos, f32 arg1);
struct coord *env0f1667e8(void);
s32 env0f1667f4(struct prop *prop, f32 arg1[4]);
bool envIsPosInFogMaxDistance(struct coord *pos, f32 tolerance);
struct distfadesettings *envGetDistFadeSettings(void);
s32 envGetObjShadeMode(struct prop *prop, f32 arg1[4]);
#endif

View File

@ -88,7 +88,7 @@ s32 func0f068fc8(struct prop *prop, bool arg1);
void propCalculateShadeColour(struct prop *prop, u8 *nextcol, u16 floorcol);
void propCalculateShadeInfo(struct prop *prop, u8 *nextcol, u16 floorcol);
void colourTween(u8 *col, u8 *nextcol);
void func0f069750(s32 *arg0, s32 arg1, f32 arg2[4]);
void objMergeColourFracs(s32 *colour, s32 shademode, f32 fracs[4]);
void func0f069850(struct defaultobj *obj, struct coord *pos, f32 rot[3][3], struct geocyl *cyl);
void func0f069b4c(struct defaultobj *obj);
void func0f069c1c(struct defaultobj *obj);
@ -322,8 +322,8 @@ void doorsRequestMode(struct doorobj *door, s32 newmode);
s32 doorIsClosed(struct doorobj *door);
s32 doorIsOpen(struct doorobj *door);
s32 func0f08e5a8(s16 *rooms, struct screenbox *box);
f32 func0f08e6bc(struct prop *prop, f32 arg1);
bool func0f08e794(struct coord *coord, f32 arg1);
f32 objCalculateFadeDistOpacityFrac(struct prop *prop, f32 modelscale);
bool posIsInObjFadeDistance(struct coord *coord, f32 modelscale);
bool func0f08e8ac(struct prop *prop, struct coord *pos, f32 arg2, bool arg3);
bool posIsInDrawDistance(struct coord *arg);
void doorCreateSparks(struct doorobj *door);

View File

@ -12,12 +12,12 @@ extern struct textureconfig g_TcLaserConfigs[1];
extern struct textureconfig g_TcGroup03Configs[1];
extern struct textureconfig g_TcGeCrosshairConfigs[1];
extern struct textureconfig g_TcRedLineConfigs[1];
extern struct textureconfig g_TcGroup06Configs[1];
extern struct textureconfig g_TcShadowConfigs[1];
extern struct textureconfig g_TcShieldConfigs[1];
extern struct textureconfig g_TcShardConfigs[2];
extern struct textureconfig g_TcScreenConfigs[96];
extern struct textureconfig g_TcWaterConfigs[3];
extern struct textureconfig g_TcSkyConfigs[6];
extern struct textureconfig g_TcSkyWaterConfigs[3];
extern struct textureconfig g_TcGroup11Configs[6];
extern struct textureconfig g_TcLightGlareConfigs[10];
extern struct textureconfig g_TcSparkConfigs[1];
extern struct textureconfig g_TcGeneralConfigs[56];

View File

@ -3156,13 +3156,13 @@ struct stagemusic {
s16 xtrack;
};
struct var800a6600 {
struct shadesettings {
f32 znear;
f32 zfar;
u32 unk08;
u32 unk0c;
f32 unk10;
f32 unk14;
f32 alphafar;
f32 alphanear;
};
struct environment {
@ -3175,7 +3175,7 @@ struct environment {
/*0x0c*/ struct sun *suns;
/*0x10*/ u8 clouds_enabled;
/*0x14*/ f32 clouds_scale;
/*0x18*/ s16 unk18;
/*0x18*/ s16 clouds_type;
/*0x1c*/ f32 clouds_r;
/*0x20*/ f32 clouds_g;
/*0x24*/ f32 clouds_b;
@ -3185,7 +3185,7 @@ struct environment {
/*0x34*/ f32 water_r;
/*0x38*/ f32 water_g;
/*0x3c*/ f32 water_b;
/*0x40*/ f32 unk40;
/*0x40*/ f32 clouds_height;
/*0x44*/ f32 skyredfrac;
/*0x48*/ f32 skygreenfrac;
/*0x4c*/ f32 skybluefrac;
@ -3201,13 +3201,13 @@ struct sun {
/*0x12*/ s16 orb_size;
};
struct envtype1 {
struct fogenvironment {
/*0x00*/ s16 stage;
/*0x02*/ s16 near;
/*0x04*/ s16 far;
/*0x06*/ s16 unk06;
/*0x08*/ s16 unk08;
/*0x0a*/ s16 unk0a;
/*0x06*/ s16 opaperc;
/*0x08*/ s16 xluperc;
/*0x0a*/ s16 refdist;
/*0x0c*/ s16 fogmin;
/*0x0e*/ s16 fogmax;
/*0x10*/ u8 sky_r;
@ -3217,27 +3217,26 @@ struct envtype1 {
/*0x14*/ struct sun *suns;
/*0x18*/ u8 clouds_enabled;
/*0x1a*/ s16 clouds_scale;
/*0x1c*/ u8 unk1c;
/*0x1c*/ u8 clouds_type;
/*0x1d*/ u8 clouds_r;
/*0x1e*/ u8 clouds_g;
/*0x1f*/ u8 clouds_b;
/*0x20*/ u8 water_enabled;
/*0x21*/ u8 unk21;
/*0x22*/ s16 water_scale;
/*0x24*/ u8 water_type;
/*0x25*/ u8 water_r;
/*0x26*/ u8 water_g;
/*0x27*/ u8 water_b;
/*0x28*/ u8 unk28;
/*0x28*/ u8 clouds_height;
};
struct envtype2 {
struct nofogenvironment {
/*0x00*/ s32 stage;
/*0x04*/ s16 near;
/*0x06*/ s16 far;
/*0x08*/ s16 unk08;
/*0x0a*/ s16 unk0a;
/*0x0c*/ s16 unk0c;
/*0x08*/ s16 opaperc;
/*0x0a*/ s16 xluperc;
/*0x0c*/ s16 refdist;
/*0x0e*/ u8 sky_r;
/*0x0f*/ u8 sky_g;
/*0x10*/ u8 sky_b;
@ -3248,15 +3247,15 @@ struct envtype2 {
/*0x1a*/ u8 clouds_g;
/*0x1b*/ u8 clouds_b;
/*0x1c*/ f32 clouds_scale;
/*0x20*/ s16 unk20;
/*0x20*/ s16 clouds_type;
/*0x22*/ u8 water_enabled;
/*0x23*/ u8 water_r;
/*0x24*/ u8 water_g;
/*0x25*/ u8 water_b;
/*0x28*/ f32 water_scale;
/*0x2c*/ s16 water_type;
/*0x30*/ f32 unk30;
/*0x34*/ u32 unk34;
/*0x30*/ f32 clouds_height;
/*0x34*/ bool transparency;
};
struct menuitemdata_controller {

View File

@ -116,7 +116,7 @@ struct textureconfig g_TcRedLineConfigs[] = {
/*0*/ { 0x0c31, 32, 32, 0, G_IM_FMT_RGBA, G_IM_SIZ_32b, G_TX_WRAP, G_TX_WRAP },
};
struct textureconfig g_TcGroup06Configs[] = {
struct textureconfig g_TcShadowConfigs[] = {
/*0*/ { 0x000c, 32, 32, 0, G_IM_FMT_IA, G_IM_SIZ_8b, G_TX_CLAMP, G_TX_CLAMP },
};
@ -228,13 +228,13 @@ struct textureconfig g_TcScreenConfigs[] = {
/*95*/ { 0x0c8f, 32, 32, 5, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TX_WRAP, G_TX_WRAP },
};
struct textureconfig g_TcWaterConfigs[] = {
struct textureconfig g_TcSkyWaterConfigs[] = {
/*0*/ { 0x0013, 64, 64, 0, G_IM_FMT_IA, G_IM_SIZ_8b, G_TX_WRAP, G_TX_WRAP },
/*1*/ { 0x0c90, 64, 64, 0, G_IM_FMT_I, G_IM_SIZ_8b, G_TX_WRAP, G_TX_WRAP },
/*2*/ { 0x0014, 32, 32, 5, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TX_WRAP, G_TX_WRAP },
};
struct textureconfig g_TcSkyConfigs[] = {
struct textureconfig g_TcGroup11Configs[] = {
/*0*/ { 0x0001, 32, 28, 0, G_IM_FMT_RGBA, G_IM_SIZ_32b, G_TX_WRAP, G_TX_CLAMP },
/*1*/ { 0x0001, 32, 28, 0, G_IM_FMT_RGBA, G_IM_SIZ_32b, G_TX_WRAP, G_TX_CLAMP },
/*2*/ { 0x0001, 122, 18, 0, G_IM_FMT_IA, G_IM_SIZ_8b, G_TX_CLAMP, G_TX_CLAMP },