Name almost all BG symbols
This commit is contained in:
parent
4017d5cba5
commit
92075c6fe7
|
@ -140,7 +140,7 @@ The decomp project wraps all decompiled piracy checks in `#if PIRACYCHECKS` stat
|
|||
|
||||
**Payload:** Corrupts `bgReset` by writing 16 bytes of 0x12 to a random address within that function.
|
||||
|
||||
### func0f15c920
|
||||
### bgTickCounter
|
||||
|
||||
**When Called:** On every frame.
|
||||
|
||||
|
|
1378
src/game/bg.c
1378
src/game/bg.c
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,7 @@ u8 var800aacb8nb[0x140];
|
|||
struct var800a6538 var800a6538[16];
|
||||
u32 g_BgRoomTestsDisabled;
|
||||
u32 var800a65bc;
|
||||
struct screenbox var800a65c0;
|
||||
struct screenbox g_BgCmdScreenBox;
|
||||
struct screenbox g_PortalScreenBbox;
|
||||
u32 g_BgCmdThrowing;
|
||||
s32 g_BgNumLightsChecksum;
|
||||
|
|
|
@ -662,7 +662,7 @@ void botCheckPickups(struct chrdata *chr)
|
|||
roomsCopy(chr->prop->rooms, allrooms);
|
||||
|
||||
for (i = 0; chr->prop->rooms[i] != -1; i++) {
|
||||
roomGetNeighbours(chr->prop->rooms[i], neighbours, 10);
|
||||
bgRoomGetNeighbours(chr->prop->rooms[i], neighbours, 10);
|
||||
roomsAppend(neighbours, allrooms, 20);
|
||||
}
|
||||
|
||||
|
@ -800,9 +800,9 @@ bool botIsAboutToAttack(struct chrdata *chr, bool arg1)
|
|||
}
|
||||
|
||||
if (chr->aibot->config->difficulty >= BOTDIFF_NORMAL) {
|
||||
if (roomsAreNeighbours(chr->prop->rooms[0], target->rooms[0])
|
||||
if (bgRoomsAreNeighbours(chr->prop->rooms[0], target->rooms[0])
|
||||
|| chr->aibot->chrrooms[mpindex] == target->rooms[0]
|
||||
|| roomsAreNeighbours(chr->aibot->chrrooms[mpindex], target->rooms[0])) {
|
||||
|| bgRoomsAreNeighbours(chr->aibot->chrrooms[mpindex], target->rooms[0])) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
@ -870,7 +870,7 @@ s32 botTick(struct prop *prop)
|
|||
aibot->cheap = true;
|
||||
|
||||
for (i = 0; prop->rooms[i] != -1; i++) {
|
||||
if (roomIsOnscreen(prop->rooms[i]) || roomIsStandby(prop->rooms[i])) {
|
||||
if (bgRoomIsOnscreen(prop->rooms[i]) || bgRoomIsStandby(prop->rooms[i])) {
|
||||
aibot->cheap = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -497,7 +497,7 @@ bool cam0f0b5b9c(struct coord *arg0, f32 arg1)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg2)
|
||||
bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct drawslot *drawslot)
|
||||
{
|
||||
struct coord sp74;
|
||||
f32 sp70;
|
||||
|
@ -522,7 +522,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg
|
|||
return false;
|
||||
}
|
||||
|
||||
sp38 = (arg2->box.xmin - g_Vars.currentplayer->c_screenleft - g_Vars.currentplayer->c_halfwidth) * g_Vars.currentplayer->c_scalex;
|
||||
sp38 = (drawslot->box.xmin - g_Vars.currentplayer->c_screenleft - g_Vars.currentplayer->c_halfwidth) * g_Vars.currentplayer->c_scalex;
|
||||
|
||||
sp3c = 1.0f / sqrtf(sp38 * sp38 + 1.0f);
|
||||
sp38 *= sp3c;
|
||||
|
@ -538,7 +538,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg
|
|||
return false;
|
||||
}
|
||||
|
||||
sp38 = -(arg2->box.xmax - g_Vars.currentplayer->c_screenleft - g_Vars.currentplayer->c_halfwidth) * g_Vars.currentplayer->c_scalex;
|
||||
sp38 = -(drawslot->box.xmax - g_Vars.currentplayer->c_screenleft - g_Vars.currentplayer->c_halfwidth) * g_Vars.currentplayer->c_scalex;
|
||||
sp30 = 1.0f / sqrtf(sp38 * sp38 + 1.0f);
|
||||
sp38 *= sp30;
|
||||
sp20 = -sp30;
|
||||
|
@ -553,7 +553,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg
|
|||
return false;
|
||||
}
|
||||
|
||||
sp34 = (g_Vars.currentplayer->c_halfheight - (arg2->box.ymin - g_Vars.currentplayer->c_screentop)) * g_Vars.currentplayer->c_scaley;
|
||||
sp34 = (g_Vars.currentplayer->c_halfheight - (drawslot->box.ymin - g_Vars.currentplayer->c_screentop)) * g_Vars.currentplayer->c_scaley;
|
||||
sp2c = 1.0f / sqrtf(sp34 * sp34 + 1.0f);
|
||||
sp34 *= sp2c;
|
||||
sp1c = -sp2c;
|
||||
|
@ -568,7 +568,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg
|
|||
return false;
|
||||
}
|
||||
|
||||
sp34 = -(g_Vars.currentplayer->c_halfheight - (arg2->box.ymax - g_Vars.currentplayer->c_screentop)) * g_Vars.currentplayer->c_scaley;
|
||||
sp34 = -(g_Vars.currentplayer->c_halfheight - (drawslot->box.ymax - g_Vars.currentplayer->c_screentop)) * g_Vars.currentplayer->c_scaley;
|
||||
sp28 = 1.0f / sqrtf(sp34 * sp34 + 1.0f);
|
||||
sp34 *= sp28;
|
||||
sp18 = -sp28;
|
||||
|
@ -587,27 +587,27 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg
|
|||
}
|
||||
|
||||
/**
|
||||
* This function is building a struct var800a4640_00 on the stack so it can
|
||||
* pass it to camIsPosInScreenBox, however if we allocate this struct then it
|
||||
* uses too much stack and creates a mismatch.
|
||||
* This function is building a drawslot on the stack so it can pass it to
|
||||
* camIsPosInScreenBox, however if we allocate this struct then it uses too much
|
||||
* stack and creates a mismatch.
|
||||
*
|
||||
* We resolve this by allocating a screenbox instead, which is a substruct of
|
||||
* var800a4640_00 and is all we need in this function. screenbox isn't at the
|
||||
* start of var800a4640_00 though, so we use a negative array index to pass the
|
||||
* drawslot and is all we need in this function. screenbox isn't at the
|
||||
* start of drawslot though, so we use a negative array index to pass the
|
||||
* correct address to camIsPosInScreenBox so it can interpret the pointer as a
|
||||
* struct var800a4640_00.
|
||||
* drawslot.
|
||||
*/
|
||||
bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2)
|
||||
{
|
||||
s32 i;
|
||||
s16 room;
|
||||
bool hasdata = false;
|
||||
struct var800a4640_00 *thisthing;
|
||||
struct drawslot *thisthing;
|
||||
struct screenbox box;
|
||||
|
||||
for (i = 0, room = rooms[i]; room != -1; i++, room = rooms[i]) {
|
||||
if (g_Rooms[room].flags & ROOMFLAG_ONSCREEN) {
|
||||
thisthing = func0f158140(room);
|
||||
thisthing = bgGetRoomDrawSlot(room);
|
||||
|
||||
if (hasdata == false) {
|
||||
box.xmin = thisthing->box.xmin;
|
||||
|
@ -640,5 +640,5 @@ bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2)
|
|||
return false;
|
||||
}
|
||||
|
||||
return camIsPosInScreenBox(pos, arg2, (struct var800a4640_00 *) (&box.array[-1][0]));
|
||||
return camIsPosInScreenBox(pos, arg2, (struct drawslot *) (&box.array[-1][0]));
|
||||
}
|
||||
|
|
|
@ -3426,9 +3426,9 @@ Gfx *chrRender(struct prop *prop, Gfx *gdl, bool xlupass)
|
|||
}
|
||||
|
||||
if (func0f08e5a8(prop->rooms, &screenbox) > 0 && (chr->chrflags & CHRCFLAG_UNPLAYABLE) == 0) {
|
||||
gdl = currentPlayerScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
gdl = bgScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
} else {
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
}
|
||||
|
||||
renderdata.flags = sp100;
|
||||
|
|
|
@ -14758,7 +14758,7 @@ bool chrSetChrPresetToChrNearPos(u8 checktype, struct chrdata *chr, f32 distance
|
|||
roomsCopy(rooms, allrooms);
|
||||
|
||||
for (i = 0; rooms[i] != -1; i++) {
|
||||
roomGetNeighbours(rooms[i], neighbours, 10);
|
||||
bgRoomGetNeighbours(rooms[i], neighbours, 10);
|
||||
roomsAppend(neighbours, allrooms, 20);
|
||||
}
|
||||
|
||||
|
@ -14935,14 +14935,14 @@ bool chrIsPosOffScreen(struct coord *pos, s16 *rooms)
|
|||
|
||||
if (env0f1666f8(pos, 0)) {
|
||||
for (i = 0; rooms[i] != -1; i++) {
|
||||
if (roomIsOnscreen(rooms[i])) {
|
||||
if (bgRoomIsOnscreen(rooms[i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rooms[i] != -1) {
|
||||
// Room is visible by player
|
||||
offscreen = !camIsPosInScreenBox(pos, 200, func0f158140(rooms[i]));
|
||||
offscreen = !camIsPosInScreenBox(pos, 200, bgGetRoomDrawSlot(rooms[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15432,9 +15432,9 @@ s32 chrAssignCoverByCriteria(struct chrdata *chr, u16 criteria, s32 refdist)
|
|||
rooms[1] = -1;
|
||||
|
||||
if (criteria & COVERCRITERIA_ALLOWNEIGHBOURINGROOMS) {
|
||||
roomGetNeighbours(roomprop->rooms[0], &rooms[1], 6);
|
||||
bgRoomGetNeighbours(roomprop->rooms[0], &rooms[1], 6);
|
||||
} else if (criteria & COVERCRITERIA_ONLYNEIGHBOURINGROOMS) {
|
||||
roomGetNeighbours(roomprop->rooms[0], &rooms[0], 7);
|
||||
bgRoomGetNeighbours(roomprop->rooms[0], &rooms[0], 7);
|
||||
}
|
||||
|
||||
if (((criteria & COVERCRITERIA_0040) == 0 || !arrayIntersects(cover.rooms, rooms))
|
||||
|
|
|
@ -1507,7 +1507,7 @@ bool aiIfChrInOnScreenRoom(void)
|
|||
|
||||
if (chr && chr->prop) {
|
||||
for (i = 0; chr->prop->rooms[i] != -1; i++) {
|
||||
if (roomIsOnscreen(chr->prop->rooms[i])) {
|
||||
if (bgRoomIsOnscreen(chr->prop->rooms[i])) {
|
||||
pass = true;
|
||||
}
|
||||
}
|
||||
|
@ -1532,7 +1532,7 @@ bool aiIfRoomIsOnScreen(void)
|
|||
u16 pad_id = cmd[3] | (cmd[2] << 8);
|
||||
s32 room_id = chrGetPadRoom(g_Vars.chrdata, pad_id);
|
||||
|
||||
if (room_id >= 0 && roomIsOnscreen(room_id)) {
|
||||
if (room_id >= 0 && bgRoomIsOnscreen(room_id)) {
|
||||
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
|
||||
} else {
|
||||
g_Vars.aioffset += 5;
|
||||
|
@ -4980,7 +4980,7 @@ bool aiObjectDoAnimation(void)
|
|||
modelSetAnimPlaySpeed(obj->model, 1.2, 0);
|
||||
#endif
|
||||
modelSetAnimation(obj->model, anim_id, 0, fstartframe, thing, 0);
|
||||
modelSetAnimScale(obj->model, func0f15c888() * obj->model->scale * 100.0f);
|
||||
modelSetAnimScale(obj->model, bgGetStageTranslationThing() * obj->model->scale * 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -303,8 +303,8 @@ void roomSetDefaults(struct room *room)
|
|||
room->br_settled_regional = 0;
|
||||
room->lightop = LIGHTOP_NONE;
|
||||
room->flags &= ~(ROOMFLAG_BRIGHTNESS_DIRTY_PERM | ROOMFLAG_LIGHTS_DIRTY | ROOMFLAG_RENDERALWAYS | ROOMFLAG_BRIGHTNESS_CALCED);
|
||||
room->unk6c = 1;
|
||||
room->unk70 = 1;
|
||||
room->volume = 1;
|
||||
room->surfacearea = 1;
|
||||
room->lightop_cur_frac = 1;
|
||||
room->lightop_to_frac = 0;
|
||||
room->lightop_from_frac = 0;
|
||||
|
@ -579,7 +579,7 @@ void func0f001c0c(void)
|
|||
|
||||
var80061440 = 0;
|
||||
|
||||
func0f0023b8();
|
||||
lightsCalculateRoomDimensions();
|
||||
|
||||
if (1);
|
||||
for (g_NumPortals = 0; g_BgPortals[g_NumPortals].verticesoffset != 0; g_NumPortals++);
|
||||
|
@ -737,18 +737,18 @@ void func0f00215c(u8 *arg0)
|
|||
|
||||
f32 func0f002334(s32 roomnum, f32 mult, s32 portalnum1, s32 portalnum2)
|
||||
{
|
||||
f32 fVar2 = 0;
|
||||
f32 surfacearea = 0;
|
||||
f32 result;
|
||||
|
||||
if (portalnum1 != -1) {
|
||||
fVar2 = portal0f15b274(portalnum1);
|
||||
surfacearea = bgCalculatePortalSurfaceArea(portalnum1);
|
||||
}
|
||||
|
||||
result = (portal0f15b274(portalnum2) / (g_Rooms[roomnum].unk70 - fVar2)) * mult;
|
||||
result = (bgCalculatePortalSurfaceArea(portalnum2) / (g_Rooms[roomnum].surfacearea - surfacearea)) * mult;
|
||||
return result;
|
||||
}
|
||||
|
||||
void func0f0023b8(void)
|
||||
void lightsCalculateRoomDimensions(void)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
@ -756,23 +756,23 @@ void func0f0023b8(void)
|
|||
for (i = 0; i < g_Vars.roomcount; i++) {
|
||||
bool valid = true;
|
||||
|
||||
g_Rooms[i].unk6c = 1.0f;
|
||||
g_Rooms[i].unk70 = 1.0f;
|
||||
g_Rooms[i].volume = 1.0f;
|
||||
g_Rooms[i].surfacearea = 1.0f;
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
f32 diff = g_Rooms[i].bbmax[j] - g_Rooms[i].bbmin[j];
|
||||
|
||||
if (diff > 0.0f) {
|
||||
g_Rooms[i].unk6c *= (g_Rooms[i].bbmax[j] - g_Rooms[i].bbmin[j]) / 100.0f;
|
||||
g_Rooms[i].volume *= (g_Rooms[i].bbmax[j] - g_Rooms[i].bbmin[j]) / 100.0f;
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
g_Rooms[i].unk6c += 1.0f;
|
||||
g_Rooms[i].volume += 1.0f;
|
||||
|
||||
if (g_Rooms[i].unk6c > 60.0f) {
|
||||
g_Rooms[i].unk6c = 60.0f;
|
||||
if (g_Rooms[i].volume > 60.0f) {
|
||||
g_Rooms[i].volume = 60.0f;
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
|
@ -792,9 +792,9 @@ void func0f0023b8(void)
|
|||
zdiff = -zdiff;
|
||||
}
|
||||
|
||||
g_Rooms[i].unk70 = 2.0f * (xdiff * ydiff + xdiff * zdiff + ydiff * zdiff);
|
||||
g_Rooms[i].surfacearea = 2.0f * (xdiff * ydiff + xdiff * zdiff + ydiff * zdiff);
|
||||
} else {
|
||||
g_Rooms[i].unk70 = 20000000.0f;
|
||||
g_Rooms[i].surfacearea = 20000000.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ void func0f00259c(s32 roomnum)
|
|||
var80061434[i] = 0.0f;
|
||||
}
|
||||
|
||||
var80061434[roomnum] = sqrtf(g_Rooms[roomnum].unk6c) * 255.0f;
|
||||
var80061434[roomnum] = sqrtf(g_Rooms[roomnum].volume) * 255.0f;
|
||||
if (1);
|
||||
|
||||
if (g_Rooms[roomnum].numportals != 0) {
|
||||
|
@ -819,13 +819,13 @@ void func0f00259c(s32 roomnum)
|
|||
}
|
||||
|
||||
for (i = 0; i < g_Rooms[roomnum].numportals; i++) {
|
||||
f20 += portal0f15b274(g_RoomPortals[g_Rooms[roomnum].roomportallistoffset + i]);
|
||||
f20 += bgCalculatePortalSurfaceArea(g_RoomPortals[g_Rooms[roomnum].roomportallistoffset + i]);
|
||||
}
|
||||
|
||||
sp58 = (g_Rooms[roomnum].unk70 - f20) / g_Rooms[roomnum].unk70;
|
||||
sp58 = (g_Rooms[roomnum].surfacearea - f20) / g_Rooms[roomnum].surfacearea;
|
||||
|
||||
for (i = 1; i < g_Vars.roomcount; i++) {
|
||||
var80061434[i] *= 3.0f / sqrtf(g_Rooms[i].unk6c);
|
||||
var80061434[i] *= 3.0f / sqrtf(g_Rooms[i].volume);
|
||||
}
|
||||
|
||||
if (var80061434[roomnum] > 255.0f) {
|
||||
|
@ -1570,8 +1570,8 @@ void roomHighlight(s32 roomnum)
|
|||
f32 mult;
|
||||
u32 stack;
|
||||
|
||||
if (var8007fc3c != g_Rooms[roomnum].unk56 && g_Rooms[roomnum].loaded240 != 0) {
|
||||
g_Rooms[roomnum].unk56 = var8007fc3c;
|
||||
if (g_BgFrameCount != g_Rooms[roomnum].hlupdatedframe && g_Rooms[roomnum].loaded240 != 0) {
|
||||
g_Rooms[roomnum].hlupdatedframe = g_BgFrameCount;
|
||||
|
||||
if ((g_Rooms[roomnum].flags & ROOMFLAG_BRIGHTNESS_CALCED) == 0) {
|
||||
g_Rooms[roomnum].flags |= ROOMFLAG_BRIGHTNESS_DIRTY_PERM;
|
||||
|
|
|
@ -155,7 +155,7 @@ void env0f1657f8(void)
|
|||
|
||||
viGetZRange(&zrange);
|
||||
|
||||
scale = currentPlayerGetScaleBg2Gfx();
|
||||
scale = bgGetScaleBg2Gfx();
|
||||
|
||||
zrange.near /= scale;
|
||||
zrange.far /= scale;
|
||||
|
|
|
@ -390,7 +390,7 @@ bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exproom
|
|||
for (k = 0; k < g_Rooms[exproom].numportals; k++) {
|
||||
portalnum = g_RoomPortals[g_Rooms[exproom].roomportallistoffset + k];
|
||||
|
||||
portalFindBbox(portalnum, &portalbbmin, &portalbbmax);
|
||||
bgCalculatePortalBbox(portalnum, &portalbbmin, &portalbbmax);
|
||||
|
||||
if (bgIsBboxOverlapping(&portalbbmin, &portalbbmax, &spd4, &spc8)) {
|
||||
otherroom2 = -1;
|
||||
|
@ -402,9 +402,9 @@ bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exproom
|
|||
otherroom = g_BgPortals[portalnum].roomnum1;
|
||||
}
|
||||
|
||||
spac.f[0] = (var800a4ccc + portalnum)->coord.f[0];
|
||||
spac.f[1] = (var800a4ccc + portalnum)->coord.f[1];
|
||||
spac.f[2] = (var800a4ccc + portalnum)->coord.f[2];
|
||||
spac.f[0] = (g_PortalMetrics + portalnum)->normal.f[0];
|
||||
spac.f[1] = (g_PortalMetrics + portalnum)->normal.f[1];
|
||||
spac.f[2] = (g_PortalMetrics + portalnum)->normal.f[2];
|
||||
|
||||
if (spac.f[0] < 0.0f) {
|
||||
spac.f[0] = -spac.f[0];
|
||||
|
@ -459,7 +459,7 @@ bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exproom
|
|||
portalnum2 = g_RoomPortals[g_Rooms[otherroom].roomportallistoffset + j];
|
||||
|
||||
if (portalnum2 != portalnum) {
|
||||
portalFindBbox(portalnum2, &portal2bbmin, &portal2bbmax);
|
||||
bgCalculatePortalBbox(portalnum2, &portal2bbmin, &portal2bbmax);
|
||||
|
||||
if (portal2bbmin.f[indexplus1] <= portalbbmin.f[indexplus1] + 10.0f * mult
|
||||
&& portal2bbmin.f[indexplus2] <= portalbbmin.f[indexplus2] + 10.0f * mult
|
||||
|
@ -1293,9 +1293,9 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass)
|
|||
s32 tmp;
|
||||
|
||||
if (func0f08e5a8(prop->rooms, &screenbox) > 0) {
|
||||
gdl = currentPlayerScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
gdl = bgScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
} else {
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
}
|
||||
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH | G_FOG);
|
||||
|
|
|
@ -142,7 +142,7 @@ void artifactsCalculateGlaresForRoom(s32 roomnum)
|
|||
s1 = &var800a41a0[g_Rooms[roomnum].gfxdata->lightsindex * 3];
|
||||
|
||||
roomPopulateMtx(&sp138, roomnum);
|
||||
mtx00015f88(currentPlayerGetScaleBg2Gfx(), &sp138);
|
||||
mtx00015f88(bgGetScaleBg2Gfx(), &sp138);
|
||||
mtx4MultMtx4(camGetMtxF006c(), &sp138, &spf8);
|
||||
|
||||
viewwidth = viGetViewWidth();
|
||||
|
|
|
@ -1022,7 +1022,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
|
||||
gdl = vi0000b1d0(gdl);
|
||||
gdl = viRenderViewportEdges(gdl);
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
gdl = menuRender(gdl);
|
||||
} else if (g_Vars.stagenum == STAGE_4MBMENU) {
|
||||
gSPClipRatio(gdl++, FRUSTRATIO_2);
|
||||
|
@ -1047,7 +1047,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
mtx00016748(1);
|
||||
|
||||
gdl = vi0000b1d0(gdl);
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
gdl = menuRender(gdl);
|
||||
|
||||
if (g_Vars.currentplayer->pausemode != PAUSEMODE_UNPAUSED) {
|
||||
|
@ -1148,7 +1148,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
zbufSwap();
|
||||
gdl = viPrepareZbuf(gdl);
|
||||
gdl = vi0000b1d0(gdl);
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
artifactsClear();
|
||||
|
||||
if ((g_Vars.stagenum != STAGE_CITRAINING || (var80087260 <= 0 && g_MenuData.root != MENUROOT_MPSETUP))
|
||||
|
@ -1173,7 +1173,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
g_Vars.lockscreen--;
|
||||
} else if (var8009dfc0) {
|
||||
gdl = viRenderViewportEdges(gdl);
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
mtx00016748(1);
|
||||
|
||||
if (g_Vars.currentplayer->menuisactive) {
|
||||
|
@ -1622,7 +1622,7 @@ Gfx *lvRender(Gfx *gdl)
|
|||
spc8[j] = -1;
|
||||
|
||||
for (j = 0; sp9c[j] != -1; j++) {
|
||||
roomGetNeighbours(sp9c[j], spb0, 10);
|
||||
bgRoomGetNeighbours(sp9c[j], spb0, 10);
|
||||
roomsAppend(spb0, spc8, 20);
|
||||
}
|
||||
|
||||
|
@ -2071,7 +2071,7 @@ void lvTick(void)
|
|||
for (otherplayernum = 0; otherplayernum < PLAYERCOUNT(); otherplayernum++) {
|
||||
if (playernum != otherplayernum
|
||||
&& g_Vars.players[otherplayernum]->isdead == false
|
||||
&& roomIsOnPlayerScreen(rooms[r], otherplayernum)) {
|
||||
&& bgRoomIsOnPlayerScreen(rooms[r], otherplayernum)) {
|
||||
foundnearbychr = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -932,7 +932,7 @@ Gfx *gasRender(Gfx *gdl)
|
|||
campos.z = g_Vars.currentplayer->cam_pos.z;
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (roomContainsCoord(&campos, gasrooms[i])) {
|
||||
if (bgRoomContainsCoord(&campos, gasrooms[i])) {
|
||||
show = true;
|
||||
}
|
||||
}
|
||||
|
@ -950,7 +950,7 @@ Gfx *gasRender(Gfx *gdl)
|
|||
intensityfrac = gasGetDoorFrac(0x32);
|
||||
}
|
||||
} else {
|
||||
if (roomContainsCoord(&campos, 0x91)) {
|
||||
if (bgRoomContainsCoord(&campos, 0x91)) {
|
||||
// In the small room between the first two doors
|
||||
f32 frac1 = gasGetDoorFrac(0x30);
|
||||
f32 frac2 = gasGetDoorFrac(0x31);
|
||||
|
|
|
@ -56,7 +56,7 @@ struct waypoint *waypointFindClosestToPos(struct coord *pos, s16 *rooms)
|
|||
allrooms[i] = -1;
|
||||
|
||||
for (i = 0; rooms[i] != -1; i++) {
|
||||
roomGetNeighbours(rooms[i], neighbours, ARRAYCOUNT(neighbours));
|
||||
bgRoomGetNeighbours(rooms[i], neighbours, ARRAYCOUNT(neighbours));
|
||||
roomsAppend(neighbours, allrooms, ARRAYCOUNT(allrooms));
|
||||
}
|
||||
|
||||
|
|
|
@ -265,11 +265,11 @@ f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms
|
|||
bestsqdist = sqdist;
|
||||
}
|
||||
|
||||
if (roomIsOnPlayerScreen(pad.room, i)) {
|
||||
if (bgRoomIsOnPlayerScreen(pad.room, i)) {
|
||||
verybadpads[p] = true;
|
||||
}
|
||||
|
||||
if (verybadpads[p] || roomIsOnPlayerStandby(pad.room, i)) {
|
||||
if (verybadpads[p] || bgRoomIsOnPlayerStandby(pad.room, i)) {
|
||||
badpads[p] = true;
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ f32 playerChooseSpawnLocation(f32 chrradius, struct coord *dstpos, s16 *dstrooms
|
|||
tmppadrooms[0] = pad.room;
|
||||
tmppadrooms[1] = -1;
|
||||
|
||||
roomGetNeighbours(pad.room, neighbours, 20);
|
||||
bgRoomGetNeighbours(pad.room, neighbours, 20);
|
||||
|
||||
for (i = 0; i < g_BotCount; i++) {
|
||||
if (g_MpBotChrPtrs[i]->prop
|
||||
|
@ -1873,7 +1873,7 @@ void playerTickCutscene(bool arg0)
|
|||
struct coord scale;
|
||||
u8 frameslot;
|
||||
Mtxf rotmtx;
|
||||
f32 translatescale = func0f15c888();
|
||||
f32 translatescale = bgGetStageTranslationThing();
|
||||
f32 fovy;
|
||||
s32 endframe;
|
||||
s8 contpadnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex);
|
||||
|
@ -2132,7 +2132,7 @@ void playerUpdateZoom(void)
|
|||
}
|
||||
|
||||
stage = stageGetCurrent();
|
||||
currentPlayerSetScaleBg2Gfx((1 - (1 - stage->unk34) * (1 - scale) * (10.f / 9.0f)) * scale);
|
||||
bgSetScaleBg2Gfx((1 - (1 - stage->unk34) * (1 - scale) * (10.f / 9.0f)) * scale);
|
||||
}
|
||||
|
||||
void playerStopAudioForPause(void)
|
||||
|
@ -4211,7 +4211,7 @@ void playerAllocateMatrices(struct coord *cam_pos, struct coord *cam_look, struc
|
|||
s32 i;
|
||||
s32 j;
|
||||
|
||||
scale = currentPlayerGetScaleBg2Gfx();
|
||||
scale = bgGetScaleBg2Gfx();
|
||||
playerSetGlobalDrawWorldOffset(g_Vars.currentplayer->cam_room);
|
||||
|
||||
g_Vars.currentplayer->mtxl005c = gfxAllocateMatrix();
|
||||
|
@ -4938,7 +4938,7 @@ void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, str
|
|||
// Remove values from sp54 (room numbers) if that room doesn't contain
|
||||
// the coord, and shuffle the array back when removing values.
|
||||
for (i = 0; sp54[i] != -1; i++) {
|
||||
if (!roomContainsCoord(pos, sp54[i])) {
|
||||
if (!bgRoomContainsCoord(pos, sp54[i])) {
|
||||
s32 j;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
|
@ -4967,8 +4967,8 @@ void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, str
|
|||
|
||||
if (!done) {
|
||||
for (i = 0; sp54[i] != -1; i++) {
|
||||
if ((g_Rooms[sp54[i]].flags & ROOMFLAG_0010) == 0) {
|
||||
if (func0f162128(pos, sp54[i])) {
|
||||
if ((g_Rooms[sp54[i]].flags & ROOMFLAG_COMPLICATEDPORTALS) == 0) {
|
||||
if (bgTestPosInRoom(pos, sp54[i])) {
|
||||
playerSetCamPropertiesWithRoom(pos, up, look, sp54[i]);
|
||||
done = true;
|
||||
break;
|
||||
|
@ -4977,11 +4977,11 @@ void player0f0c1840(struct coord *pos, struct coord *up, struct coord *look, str
|
|||
}
|
||||
}
|
||||
|
||||
// The same thing again but inverted flag check
|
||||
// The same thing again but for rooms which have complicated portals
|
||||
if (!done) {
|
||||
for (i = 0; sp54[i] != -1; i++) {
|
||||
if (g_Rooms[sp54[i]].flags & ROOMFLAG_0010) {
|
||||
if (func0f162128(pos, sp54[i])) {
|
||||
if (g_Rooms[sp54[i]].flags & ROOMFLAG_COMPLICATEDPORTALS) {
|
||||
if (bgTestPosInRoom(pos, sp54[i])) {
|
||||
playerSetCamPropertiesWithRoom(pos, up, look, sp54[i]);
|
||||
done = true;
|
||||
break;
|
||||
|
|
|
@ -16,8 +16,8 @@ glabel portalConvertCoordinates
|
|||
addiu $a3, $a3, %lo(g_Vars)
|
||||
lw $a3, 0x284($a3)
|
||||
lw $a3, 0x1740($a3)
|
||||
lui $t0, %hi(var800a4cf0)
|
||||
addiu $t0, $t0, %lo(var800a4cf0)
|
||||
lui $t0, %hi(g_BgSnake)
|
||||
addiu $t0, $t0, %lo(g_BgSnake)
|
||||
lui $at, %hi(var7f1b76d0)
|
||||
lwc1 $f13, %lo(var7f1b76d0)($at)
|
||||
lwc1 $f12, 0xc($t0)
|
||||
|
|
|
@ -441,7 +441,7 @@ Gfx *propsRender(Gfx *gdl, s16 renderroomnum, s32 renderpass, s16 *roomnumsbypro
|
|||
}
|
||||
}
|
||||
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
|
||||
return gdl;
|
||||
}
|
||||
|
@ -688,7 +688,8 @@ struct prop *shotCalculateHits(s32 handnum, bool arg1, struct coord *arg2, struc
|
|||
roomsptr++;
|
||||
}
|
||||
|
||||
roomsGetActive(roomsptr, 100);
|
||||
// Note this is being appended to rooms
|
||||
bgGetForceOnscreenRooms(roomsptr, 100);
|
||||
|
||||
for (i = 0; rooms[i] != -1; i++) {
|
||||
if (bgTestHitInRoom(&shotdata.gunpos, &hitpos, rooms[i], &sp664)) {
|
||||
|
@ -2223,7 +2224,7 @@ void propsTickPadEffects(void)
|
|||
|
||||
padUnpack(effect->pad, PADFIELD_ROOM, &pad);
|
||||
|
||||
if (roomIsOnscreen(pad.room)) {
|
||||
if (bgRoomIsOnscreen(pad.room)) {
|
||||
switch (effect->effect) {
|
||||
case PADEFFECT_SPARKS:
|
||||
case PADEFFECT_SPARKS2:
|
||||
|
@ -2313,7 +2314,7 @@ void propsTestForPickup(void)
|
|||
roomsCopy(g_Vars.currentplayer->prop->rooms, allrooms);
|
||||
|
||||
for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) {
|
||||
roomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], tmp, 10);
|
||||
bgRoomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], tmp, 10);
|
||||
roomsAppend(tmp, allrooms, 20);
|
||||
}
|
||||
|
||||
|
@ -3069,7 +3070,7 @@ void func0f065d1c(struct coord *pos, s16 *rooms, struct coord *newpos, s16 *newr
|
|||
index = 0;
|
||||
|
||||
for (i = 0; stackrooms[i] != -1; i++) {
|
||||
if (roomContainsCoord(newpos, stackrooms[i])) {
|
||||
if (bgRoomContainsCoord(newpos, stackrooms[i])) {
|
||||
newrooms[index] = stackrooms[i];
|
||||
index++;
|
||||
}
|
||||
|
|
|
@ -2445,7 +2445,7 @@ void objFree(struct defaultobj *obj, bool freeprop, bool canregen)
|
|||
|
||||
if (glass->portalnum >= 0) {
|
||||
portalSetXluFrac(glass->portalnum, 1);
|
||||
portalSetOpen(glass->portalnum, true);
|
||||
bgSetPortalOpenState(glass->portalnum, true);
|
||||
g_BgPortals[glass->portalnum].flags |= PORTALFLAG_FORCEOPEN;
|
||||
}
|
||||
} else if (obj->type == OBJTYPE_GLASS) {
|
||||
|
@ -3262,12 +3262,13 @@ s32 func0f06cd00(struct defaultobj *obj, struct coord *pos, struct coord *arg2,
|
|||
ptr++;
|
||||
}
|
||||
|
||||
roomsGetActive(ptr, 100);
|
||||
// Note this being appended to spcc
|
||||
bgGetForceOnscreenRooms(ptr, 100);
|
||||
|
||||
for (i = 0; spcc[i] != -1; i++) {
|
||||
s0 = false;
|
||||
|
||||
if (roomIsLoaded(spcc[i])) {
|
||||
if (bgRoomIsLoaded(spcc[i])) {
|
||||
if (bgTestHitInRoom(&prop->pos, &sp1c4, spcc[i], &hitthing)) {
|
||||
hitthing.unk00.x *= scale;
|
||||
hitthing.unk00.y *= scale;
|
||||
|
@ -10740,9 +10741,9 @@ void glassUpdatePortal(struct prop *prop, s32 playercount, bool *arg2)
|
|||
|
||||
if (glass->portalnum >= 0 && playercount == 1) {
|
||||
if (glass->opacity == 255) {
|
||||
portalSetOpen(glass->portalnum, false);
|
||||
bgSetPortalOpenState(glass->portalnum, false);
|
||||
} else {
|
||||
portalSetOpen(glass->portalnum, true);
|
||||
bgSetPortalOpenState(glass->portalnum, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13672,9 +13673,9 @@ Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass)
|
|||
}
|
||||
|
||||
if ((obj->flags2 & OBJFLAG2_CANFILLVIEWPORT) == 0 && func0f08e5a8(prop->rooms, &screenbox) > 0) {
|
||||
gdl = currentPlayerScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
gdl = bgScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
} else {
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
}
|
||||
|
||||
renderdata.flags = sp84;
|
||||
|
@ -19285,14 +19286,14 @@ void func0f08d460(struct doorobj *door)
|
|||
void doorActivatePortal(struct doorobj *door)
|
||||
{
|
||||
if (door->portalnum >= 0) {
|
||||
portalSetOpen(door->portalnum, true);
|
||||
bgSetPortalOpenState(door->portalnum, true);
|
||||
}
|
||||
}
|
||||
|
||||
void doorDeactivatePortal(struct doorobj *door)
|
||||
{
|
||||
if (door->portalnum >= 0) {
|
||||
portalSetOpen(door->portalnum, false);
|
||||
bgSetPortalOpenState(door->portalnum, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19811,30 +19812,30 @@ s32 func0f08e5a8(s16 *rooms2, struct screenbox *box)
|
|||
s32 roomnum = *rooms;
|
||||
|
||||
while (roomnum != -1) {
|
||||
struct var800a4640_00 *thing = func0f158140(roomnum);
|
||||
struct drawslot *drawslot = bgGetRoomDrawSlot(roomnum);
|
||||
|
||||
if (thing != var8007fc24) {
|
||||
if (drawslot != g_BgSpecialDrawSlot) {
|
||||
if (result) {
|
||||
if (box->xmin > thing->box.xmin) {
|
||||
box->xmin = thing->box.xmin;
|
||||
if (box->xmin > drawslot->box.xmin) {
|
||||
box->xmin = drawslot->box.xmin;
|
||||
}
|
||||
|
||||
if (box->ymin > thing->box.ymin) {
|
||||
box->ymin = thing->box.ymin;
|
||||
if (box->ymin > drawslot->box.ymin) {
|
||||
box->ymin = drawslot->box.ymin;
|
||||
}
|
||||
|
||||
if (box->xmax < thing->box.xmax) {
|
||||
box->xmax = thing->box.xmax;
|
||||
if (box->xmax < drawslot->box.xmax) {
|
||||
box->xmax = drawslot->box.xmax;
|
||||
}
|
||||
|
||||
if (box->ymax < thing->box.ymax) {
|
||||
box->ymax = thing->box.ymax;
|
||||
if (box->ymax < drawslot->box.ymax) {
|
||||
box->ymax = drawslot->box.ymax;
|
||||
}
|
||||
} else {
|
||||
box->xmin = thing->box.xmin;
|
||||
box->ymin = thing->box.ymin;
|
||||
box->xmax = thing->box.xmax;
|
||||
box->ymax = thing->box.ymax;
|
||||
box->xmin = drawslot->box.xmin;
|
||||
box->ymin = drawslot->box.ymin;
|
||||
box->xmax = drawslot->box.xmax;
|
||||
box->ymax = drawslot->box.ymax;
|
||||
}
|
||||
|
||||
result = true;
|
||||
|
|
|
@ -1003,7 +1003,7 @@ s32 setupGetPortalByPad(s32 padnum)
|
|||
centre.y = centre.y - pad.up.y * mult;
|
||||
centre.z = centre.z - pad.up.z * mult;
|
||||
|
||||
return bg0f164e8c(¢re, &coord);
|
||||
return bgFindPortalBetweenPositions(¢re, &coord);
|
||||
}
|
||||
|
||||
s32 setupGetPortalByDoorPad(s32 padnum)
|
||||
|
@ -1027,7 +1027,7 @@ s32 setupGetPortalByDoorPad(s32 padnum)
|
|||
centre.y = centre.y - pad.normal.y * mult;
|
||||
centre.z = centre.z - pad.normal.z * mult;
|
||||
|
||||
return bg0f164e8c(¢re, &coord);
|
||||
return bgFindPortalBetweenPositions(¢re, &coord);
|
||||
}
|
||||
|
||||
void setupCreateDoor(struct doorobj *door, s32 cmdindex)
|
||||
|
@ -1055,15 +1055,15 @@ void setupCreateDoor(struct doorobj *door, s32 cmdindex)
|
|||
|
||||
// If the door has a portal, adjust the pad's bbox to match the portal's dimensions
|
||||
if (portalnum >= 0) {
|
||||
struct var800a4ccc *ptr = &var800a4ccc[portalnum];
|
||||
f32 f0 = pad.pos.f[0] * ptr->coord.f[0] + pad.pos.f[1] * ptr->coord.f[1] + pad.pos.f[2] * ptr->coord.f[2];
|
||||
struct portalmetric *ptr = &g_PortalMetrics[portalnum];
|
||||
f32 f0 = pad.pos.f[0] * ptr->normal.f[0] + pad.pos.f[1] * ptr->normal.f[1] + pad.pos.f[2] * ptr->normal.f[2];
|
||||
f32 min = ptr->min;
|
||||
struct coord sp150;
|
||||
f0 = (f0 - min) * (g_DoorScale - 1);
|
||||
|
||||
sp150.x = ptr->coord.x * f0;
|
||||
sp150.y = ptr->coord.y * f0;
|
||||
sp150.z = ptr->coord.z * f0;
|
||||
sp150.x = ptr->normal.x * f0;
|
||||
sp150.y = ptr->normal.y * f0;
|
||||
sp150.z = ptr->normal.z * f0;
|
||||
|
||||
f0 = sp150.f[0] * pad.normal.f[0] + sp150.f[1] * pad.normal.f[1] + sp150.f[2] * pad.normal.f[2];
|
||||
pad.bbox.xmin += f0;
|
||||
|
|
|
@ -647,9 +647,9 @@ Gfx *smokeRender(struct prop *prop, Gfx *gdl, bool xlupass)
|
|||
}
|
||||
|
||||
if (func0f08e5a8(prop->rooms, &screenbox) > 0) {
|
||||
gdl = currentPlayerScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
gdl = bgScissorWithinViewport(gdl, screenbox.xmin, screenbox.ymin, screenbox.xmax, screenbox.ymax);
|
||||
} else {
|
||||
gdl = currentPlayerScissorToViewport(gdl);
|
||||
gdl = bgScissorToViewport(gdl);
|
||||
}
|
||||
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH | G_FOG);
|
||||
|
|
|
@ -11,7 +11,7 @@ void stageParseTiles(void);
|
|||
|
||||
void tilesReset(void)
|
||||
{
|
||||
s32 index = stageGetIndex2(g_Vars.stagenum);
|
||||
s32 index = bgGetStageIndex(g_Vars.stagenum);
|
||||
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
|
|
|
@ -1281,7 +1281,7 @@ void frEndSession(bool hidetargets)
|
|||
roomsCopy(g_Vars.currentplayer->prop->rooms, rooms);
|
||||
|
||||
for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) {
|
||||
roomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], rooms2, 10);
|
||||
bgRoomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], rooms2, 10);
|
||||
roomsAppend(rooms2, rooms, 20);
|
||||
}
|
||||
|
||||
|
@ -1555,7 +1555,7 @@ bool frIsAmmoWasted(void)
|
|||
roomsCopy(g_Vars.currentplayer->prop->rooms, rooms20);
|
||||
|
||||
for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) {
|
||||
roomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], rooms10, 10);
|
||||
bgRoomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], rooms10, 10);
|
||||
roomsAppend(rooms10, rooms20, 20);
|
||||
}
|
||||
|
||||
|
|
|
@ -1572,7 +1572,7 @@ glabel var7f1b5780
|
|||
/* f133958: 8e240000 */ lw $a0,0x0($s1)
|
||||
/* f13395c: 02602825 */ or $a1,$s3,$zero
|
||||
/* f133960: 24060014 */ addiu $a2,$zero,0x14
|
||||
/* f133964: 0fc5916a */ jal roomGetNeighbours
|
||||
/* f133964: 0fc5916a */ jal bgRoomGetNeighbours
|
||||
/* f133968: 00001025 */ or $v0,$zero,$zero
|
||||
/* f13396c: 1840004a */ blez $v0,.L0f133a98
|
||||
/* f133970: 26520001 */ addiu $s2,$s2,0x1
|
||||
|
@ -2043,7 +2043,7 @@ glabel var7f1b5780
|
|||
/* f13404c: 000e70c0 */ sll $t6,$t6,0x3
|
||||
/* f134050: 27ac0258 */ addiu $t4,$sp,0x258
|
||||
/* f134054: 01cc3021 */ addu $a2,$t6,$t4
|
||||
/* f134058: 0fc57c83 */ jal func0f15f20c
|
||||
/* f134058: 0fc57c83 */ jal bgTestLineIntersectsIntBbox
|
||||
/* f13405c: 24c7000c */ addiu $a3,$a2,0xc
|
||||
/* f134060: 50400003 */ beqzl $v0,.L0f134070
|
||||
/* f134064: 8fb90708 */ lw $t9,0x708($sp)
|
||||
|
@ -2807,7 +2807,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2)
|
|||
|
||||
// 3950
|
||||
for (s2 = 0; s2 < s4; s2++) {
|
||||
numneighbours = roomGetNeighbours(spcb8[s2], sp128, ARRAYCOUNT(sp128));
|
||||
numneighbours = bgRoomGetNeighbours(spcb8[s2], sp128, ARRAYCOUNT(sp128));
|
||||
|
||||
// 396c
|
||||
for (j2 = 0; j2 < numneighbours; j2++) {
|
||||
|
@ -2969,7 +2969,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2)
|
|||
&& spc9c.f[1] <= g_Rooms[spbbc[s0]].bbmax[1]
|
||||
&& spca8.f[1] >= g_Rooms[spbbc[s0]].bbmin[1]
|
||||
&& var8007f0f8
|
||||
&& func0f15f20c(&spc90, &spfc, &sp258[s0][0], &sp258[s0][3])) {
|
||||
&& bgTestLineIntersectsIntBbox(&spc90, &spfc, &sp258[s0][0], &sp258[s0][3])) {
|
||||
s3 = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3499,7 +3499,7 @@ glabel var7f1b5790
|
|||
/* f134c68: afa81268 */ sw $t0,0x1268($sp)
|
||||
/* f134c6c: 02602825 */ or $a1,$s3,$zero
|
||||
/* f134c70: 24060014 */ addiu $a2,$zero,0x14
|
||||
/* f134c74: 0fc5916a */ jal roomGetNeighbours
|
||||
/* f134c74: 0fc5916a */ jal bgRoomGetNeighbours
|
||||
/* f134c78: 00001025 */ or $v0,$zero,$zero
|
||||
/* f134c7c: 8fa81268 */ lw $t0,0x1268($sp)
|
||||
/* f134c80: 8fac00ac */ lw $t4,0xac($sp)
|
||||
|
@ -4743,7 +4743,7 @@ Gfx *weatherRenderSnow(Gfx *gdl, struct weatherdata *weather, s32 arg2)
|
|||
|
||||
// 4c54
|
||||
for (i = 0; i < sp1268; i++) {
|
||||
numneighbours = roomGetNeighbours(sp126c[i], sp144, ARRAYCOUNT(sp144));
|
||||
numneighbours = bgRoomGetNeighbours(sp126c[i], sp144, ARRAYCOUNT(sp144));
|
||||
|
||||
for (j2 = 0; j2 < numneighbours; j2++) {
|
||||
a0 = true;
|
||||
|
|
|
@ -216,14 +216,14 @@ extern struct room *g_Rooms;
|
|||
extern u8 *g_MpRoomVisibility;
|
||||
extern struct bgroom *g_BgRooms;
|
||||
extern struct bgportal *g_BgPortals;
|
||||
extern struct var800a4ccc *var800a4ccc;
|
||||
extern struct portalmetric *g_PortalMetrics;
|
||||
extern u8 *g_BgLightsFileData;
|
||||
extern s16 *g_RoomPortals;
|
||||
extern struct var800a4cf0 var800a4cf0;
|
||||
extern struct bgsnake g_BgSnake;
|
||||
extern f32 var800a6470[16 * 3];
|
||||
extern struct var800a6538 var800a6538[16];
|
||||
extern u32 g_BgRoomTestsDisabled;
|
||||
extern struct screenbox var800a65c0;
|
||||
extern struct screenbox g_BgCmdScreenBox;
|
||||
extern struct screenbox g_PortalScreenBbox;
|
||||
extern u32 g_BgCmdThrowing;
|
||||
extern s32 g_BgNumLightsChecksum;
|
||||
|
|
|
@ -3482,7 +3482,7 @@
|
|||
#define ROOMFLAG_HASDYNTEX 0x0002 // Has dynamic textures such as water
|
||||
#define ROOMFLAG_ONSCREEN 0x0004
|
||||
#define ROOMFLAG_STANDBY 0x0008 // Neighbour of an onscreen room - usually loaded as well
|
||||
#define ROOMFLAG_0010 0x0010
|
||||
#define ROOMFLAG_COMPLICATEDPORTALS 0x0010 // Room has portals that aren't on the room's bounding box
|
||||
#define ROOMFLAG_LOADCANDIDATE 0x0020 // Room is a good candidate for loading on this tick
|
||||
#define ROOMFLAG_BRIGHTNESS_CALCED 0x0040
|
||||
#define ROOMFLAG_RENDERALWAYS 0x0080
|
||||
|
|
|
@ -431,9 +431,9 @@ extern struct fontchar *g_CharsHandelGothicLg;
|
|||
extern bool var8007fb9c;
|
||||
extern s32 g_StageIndex;
|
||||
extern s16 var8007fc0c;
|
||||
extern struct var800a4640_00 *var8007fc24;
|
||||
extern u16 var8007fc3c;
|
||||
extern s32 g_NumPortalThings;
|
||||
extern struct drawslot *g_BgSpecialDrawSlot;
|
||||
extern u16 g_BgFrameCount;
|
||||
extern s32 g_BgNumPortalCameraCacheItems;
|
||||
extern f32 var8007fcb4;
|
||||
extern struct stagetableentry g_Stages[61];
|
||||
extern s32 g_RoomMtxNumSlots;
|
||||
|
|
|
@ -4,56 +4,56 @@
|
|||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void roomUnpauseProps(u32 roomnum, bool tintedglassonly);
|
||||
void roomSetOnscreen(s32 room, s32 draworder, struct screenbox *arg2);
|
||||
void bgUnpausePropsInRoom(u32 roomnum, bool tintedglassonly);
|
||||
void bgSetRoomOnscreen(s32 room, s32 draworder, struct screenbox *arg2);
|
||||
void bgGetRoomBrightnessRange(s32 roomnum, u8 *min, u8 *max);
|
||||
struct var800a4640_00 *func0f158140(s32 roomnum);
|
||||
Gfx *bg0f158184(Gfx *gdl, struct xraydata *xraydata);
|
||||
Gfx *func0f158400(Gfx *gdl, struct xraydata *xraydata, s16 vertices1[3], s16 vertices2[3], s16 vertices3[3], u32 colour1, u32 colour2, u32 colour3);
|
||||
struct drawslot *bgGetRoomDrawSlot(s32 roomnum);
|
||||
Gfx *bgRenderXrayData(Gfx *gdl, struct xraydata *xraydata);
|
||||
Gfx *bgAddXrayTri(Gfx *gdl, struct xraydata *xraydata, s16 vertices1[3], s16 vertices2[3], s16 vertices3[3], u32 colour1, u32 colour2, u32 colour3);
|
||||
void bgChooseXrayVtxColour(bool *inrange, s16 vertex[3], u32 *colour, struct xraydata *xraydata);
|
||||
Gfx *func0f158d9c(Gfx *gdl, struct xraydata *xraydata, s16 arg2[3], s16 arg3[3], s16 arg4[3], s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10);
|
||||
Gfx *bg0f1598b4(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3]);
|
||||
Gfx *bgProcessXrayTri(Gfx *gdl, struct xraydata *xraydata, s16 arg2[3], s16 arg3[3], s16 arg4[3], s32 arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10);
|
||||
Gfx *bgRenderGdlInXray(Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, s16 arg3[3]);
|
||||
Gfx *bgRenderRoomXrayPass(Gfx *gdl, s32 roomnum, struct roomblock *blocks, bool recurse, s16 arg4[3]);
|
||||
Gfx *bgRenderRoomInXray(Gfx *gdl, s32 roomnum);
|
||||
Gfx *bgRenderSceneInXray(Gfx *gdl);
|
||||
Gfx *bgRenderScene(Gfx *gdl);
|
||||
Gfx *bgRenderArtifacts(Gfx *gdl);
|
||||
void bgLoadFile(void *memaddr, u32 offset, u32 len);
|
||||
s32 stageGetIndex2(s32 stagenum);
|
||||
f32 portal0f15b274(s32 portal);
|
||||
u8 func0f15b4c0(s32 portal);
|
||||
s32 bgGetStageIndex(s32 stagenum);
|
||||
f32 bgCalculatePortalSurfaceArea(s32 portal);
|
||||
u8 bgCalculatePortalAlpha(s32 portal);
|
||||
u32 not(u32 arg);
|
||||
u32 xorBabebabe(u32 value);
|
||||
u32 bgXorBabebabe(u32 value);
|
||||
void bgReset(s32 stagenum);
|
||||
void bgBuildTables(s32 stagenum);
|
||||
void bgStop(void);
|
||||
void func0f15c880(f32 arg0);
|
||||
f32 func0f15c888(void);
|
||||
f32 currentPlayerGetScaleBg2Gfx(void);
|
||||
void currentPlayerSetScaleBg2Gfx(f32 arg0);
|
||||
void func0f15c920(void);
|
||||
void bgSetStageTranslationThing(f32 arg0);
|
||||
f32 bgGetStageTranslationThing(void);
|
||||
f32 bgGetScaleBg2Gfx(void);
|
||||
void bgSetScaleBg2Gfx(f32 arg0);
|
||||
void bgTickCounter(void);
|
||||
void bgTick(void);
|
||||
Gfx *bgRender(Gfx *gdl);
|
||||
Gfx *currentPlayerScissorToViewport(Gfx *gdl);
|
||||
Gfx *currentPlayerScissorWithinViewportF(Gfx *gdl, f32 viewleft, f32 viewtop, f32 viewright, f32 viewbottom);
|
||||
Gfx *currentPlayerScissorWithinViewport(Gfx *gdl, s32 viewleft, s32 viewtop, s32 viewright, s32 viewbottom);
|
||||
void func0f15cd28(void);
|
||||
bool func0f15cd90(u32 room, struct screenbox *arg1);
|
||||
bool func0f15d08c(struct coord *a, struct coord *b);
|
||||
bool portalGetScreenBbox(s32 portal, struct screenbox *arg1);
|
||||
Gfx *boxRenderBorder(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2);
|
||||
bool boxGetIntersection(struct screenbox *a, struct screenbox *b);
|
||||
void boxExpand(struct screenbox *a, struct screenbox *b);
|
||||
void boxCopy(struct screenbox *dst, struct screenbox *src);
|
||||
bool roomIsOnscreen(s32 room);
|
||||
bool roomIsStandby(s32 room);
|
||||
bool roomIsOnPlayerScreen(s32 room, u32 playernum);
|
||||
bool roomIsOnPlayerStandby(s32 room, u32 aibotindex);
|
||||
s32 portalFindNumByVertices(struct portalvertices *pvertices);
|
||||
Gfx *bgScissorToViewport(Gfx *gdl);
|
||||
Gfx *bgScissorWithinViewportF(Gfx *gdl, f32 viewleft, f32 viewtop, f32 viewright, f32 viewbottom);
|
||||
Gfx *bgScissorWithinViewport(Gfx *gdl, s32 viewleft, s32 viewtop, s32 viewright, s32 viewbottom);
|
||||
void bgClearPortalCameraCache(void);
|
||||
bool bgRoomIntersectsScreenBox(s32 room, struct screenbox *arg1);
|
||||
bool bg3dPosTo2dPos(struct coord *cornerpos, struct coord *screenpos);
|
||||
bool bgGetPortalScreenBbox(s32 portal, struct screenbox *arg1);
|
||||
Gfx *bgDrawBoxEdge(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2);
|
||||
bool bgGetBoxIntersection(struct screenbox *a, struct screenbox *b);
|
||||
void bgExpandBox(struct screenbox *a, struct screenbox *b);
|
||||
void bgCopyBox(struct screenbox *dst, struct screenbox *src);
|
||||
bool bgRoomIsOnscreen(s32 room);
|
||||
bool bgRoomIsStandby(s32 room);
|
||||
bool bgRoomIsOnPlayerScreen(s32 room, u32 playernum);
|
||||
bool bgRoomIsOnPlayerStandby(s32 room, u32 aibotindex);
|
||||
s32 bgFindPortalByVertices(struct portalvertices *pvertices);
|
||||
u32 bgInflate(u8 *src, u8 *dst, u32 len);
|
||||
Gfx *roomGetNextGdlInBlock(struct roomblock *block, Gfx *start, Gfx *end);
|
||||
Gfx *roomGetNextGdlInLayer(s32 roomnum, Gfx *start, u32 types);
|
||||
struct gfxvtx *roomFindVerticesForGdl(s32 roomnum, Gfx *gdl);
|
||||
Gfx *bgGetNextGdlInBlock(struct roomblock *block, Gfx *start, Gfx *end);
|
||||
Gfx *bgGetNextGdlInLayer(s32 roomnum, Gfx *start, u32 types);
|
||||
struct gfxvtx *bgFindVerticesForGdl(s32 roomnum, Gfx *gdl);
|
||||
void bgLoadRoom(s32 roomnum);
|
||||
void bgUnloadRoom(s32 room);
|
||||
void bgUnloadAllRooms(void);
|
||||
|
@ -64,43 +64,43 @@ Gfx *bgRenderRoomOpaque(Gfx *gdl, s32 roomnum);
|
|||
Gfx *bgRenderRoomXlu(Gfx *gdl, s32 roomnum);
|
||||
s32 bgPopulateVtxBatchType(s32 roomnum, struct vtxbatch *batches, Gfx *gdl, s32 batchindex, struct gfxvtx *vertices, s32 arg5);
|
||||
void bgFindRoomVtxBatches(s32 roomnum);
|
||||
bool func0f15f20c(struct coord *arg0, struct coord *arg1, s32 *arg2, s32 *arg3);
|
||||
bool bgTestLineIntersectsIntBbox(struct coord *arg0, struct coord *arg1, s32 *arg2, s32 *arg3);
|
||||
bool bgTestLineIntersectsBbox(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3);
|
||||
bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2, Gfx *gdl, Gfx *gdl2, struct gfxvtx *vertices, struct hitthing *hitthing);
|
||||
bool bgTestHitOnChr(struct model *model, struct coord *arg1, struct coord *arg2, struct coord *arg3, Gfx *arg4, Gfx *arg5, struct gfxvtx *vertices, f32 *arg7, struct hitthing *hitthing);
|
||||
bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct vtxbatch *batches, s32 roomnum, struct hitthing *hitthing);
|
||||
s32 bg0f1612e4(struct coord *bbmin, struct coord *bbmax, struct coord *arg2, struct coord *arg3, struct coord *arg4, struct coord *arg5);
|
||||
s32 bg0f1612e4(struct coord *bbmin, struct coord *bbmax, struct coord *frompos, struct coord *dist, struct coord *arg4, struct coord *arg5);
|
||||
bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, struct hitthing *hitthing);
|
||||
bool roomIsLoaded(s32 room);
|
||||
bool roomContainsCoord(struct coord *pos, s16 roomnum);
|
||||
bool func0f161c08(struct coord *arg0, s16 roomnum);
|
||||
bool func0f161d30(struct coord *arg0, s16 roomnum);
|
||||
bool func0f162128(struct coord *arg0, s16 roomnum);
|
||||
bool bgRoomIsLoaded(s32 room);
|
||||
bool bgRoomContainsCoord(struct coord *pos, s16 roomnum);
|
||||
bool bgTestPosInRoomCheap(struct coord *pos, s16 roomnum);
|
||||
bool bgTestPosInRoomExpensive(struct coord *pos, s16 roomnum);
|
||||
bool bgTestPosInRoom(struct coord *pos, s16 roomnum);
|
||||
void bgFindRoomsByPos(struct coord *pos, s16 *inrooms, s16 *aboverooms, s32 max, s16 *bestroom);
|
||||
bool bgPushValue(bool value);
|
||||
bool bgPopValue(void);
|
||||
bool bgGetNthValueFromEnd(s32 offset);
|
||||
struct bgcmd *bgExecuteCommandsBranch(struct bgcmd *cmd, bool s2);
|
||||
struct bgcmd *bgExecuteCommands(struct bgcmd *cmd);
|
||||
bool bgCmdPushValue(bool value);
|
||||
bool bgCmdPopValue(void);
|
||||
bool bgCmdGetNthValueFromEnd(s32 offset);
|
||||
struct bgcmd *bgCmdExecuteBranch(struct bgcmd *cmd, bool s2);
|
||||
struct bgcmd *bgCmdExecute(struct bgcmd *cmd);
|
||||
void bgTickPortalsXray(void);
|
||||
void func0f1632d4(s16 roomnum1, s16 roomnum2, s16 draworder, struct screenbox *box);
|
||||
void func0f163528(struct var800a4d00 *arg0);
|
||||
bool func0f163904(void);
|
||||
void bgAddToSnake(s16 fromroomnum, s16 roomnum, s16 draworder, struct screenbox *box);
|
||||
void bgConsumeSnakeItem(struct bgsnakeitem *arg0);
|
||||
bool bgTryConsumeSnake(void);
|
||||
void bgChooseRoomsToLoad(void);
|
||||
void bgTickPortals(void);
|
||||
Gfx *func0f164150(Gfx *gdl);
|
||||
s32 roomsGetActive(s16 *rooms, s32 len);
|
||||
s32 roomGetNeighbours(s32 room, s16 *rooms, s32 len);
|
||||
bool roomsAreNeighbours(s32 roomnum1, s32 roomnum2);
|
||||
void currentPlayerCalculateScreenProperties(void);
|
||||
Gfx *bgRenderSceneAndLoadCandidate(Gfx *gdl);
|
||||
s32 bgGetForceOnscreenRooms(s16 *rooms, s32 len);
|
||||
s32 bgRoomGetNeighbours(s32 room, s16 *rooms, s32 len);
|
||||
bool bgRoomsAreNeighbours(s32 roomnum1, s32 roomnum2);
|
||||
void bgCalculateScreenProperties(void);
|
||||
void bgExpandRoomToPortals(s32 roomnum);
|
||||
void portalSwapRooms(s32 portal);
|
||||
void func0f164ab8(s32 portalnum);
|
||||
void room0f164c64(s32 roomnum);
|
||||
void portalSetOpen(s32 portal, bool open);
|
||||
s32 bg0f164e8c(struct coord *arg0, struct coord *arg1);
|
||||
void bgPortalSwapRooms(s32 portal);
|
||||
void bgInitPortal(s32 portalnum);
|
||||
void bgInitRoom(s32 roomnum);
|
||||
void bgSetPortalOpenState(s32 portal, bool open);
|
||||
s32 bgFindPortalBetweenPositions(struct coord *pos1, struct coord *pos2);
|
||||
bool bgIsBboxOverlapping(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3);
|
||||
void portalFindBbox(s32 portalnum, struct coord *bbmin, struct coord *bbmax);
|
||||
void bgCalculatePortalBbox(s32 portalnum, struct coord *bbmin, struct coord *bbmax);
|
||||
void bgFindEnteredRooms(struct coord *bbmin, struct coord *upper, s16 *rooms, s32 maxlen, bool arg4);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ f32 camGetScreenTop(void);
|
|||
f32 camGetPerspAspect(void);
|
||||
void cam0f0b5838(void);
|
||||
bool cam0f0b5b9c(struct coord *arg0, f32 arg1);
|
||||
bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg2);
|
||||
bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct drawslot *drawslot);
|
||||
bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@ void roomSetLightBroken(s32 roomnum, s32 lightnum);
|
|||
void lightsReset(void);
|
||||
void func0f001c0c(void);
|
||||
void func0f00215c(u8 *arg0);
|
||||
void func0f0023b8(void);
|
||||
void lightsCalculateRoomDimensions(void);
|
||||
void func0f00259c(s32 roomnum);
|
||||
void func0f002844(s32 roomnum, f32 arg1, s32 arg2, s32 portalnum);
|
||||
void func0f002a98(void);
|
||||
|
|
|
@ -4,9 +4,13 @@
|
|||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
#define PORTALINTERSECTION_NONE 0
|
||||
#define PORTALINTERSECTION_BEHINDTOFRONT 1
|
||||
#define PORTALINTERSECTION_FRONTTOBEHIND 2
|
||||
|
||||
void portalGetAvgVertexPos(s32 portalnum, struct coord *avg);
|
||||
void portal00017dc4(s16 *rooms, s16 roomnum);
|
||||
s32 portal00017e30(s32 portalnum, struct coord *arg1, struct coord *arg2);
|
||||
s32 portalCalculateIntersection(s32 portalnum, struct coord *pos1, struct coord *pos2);
|
||||
void portal00018148(struct coord *pos, struct coord *pos2, s16 *rooms, s16 *arg3, s16 *arg4, s32 arg5);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3595,7 +3595,7 @@ struct room {
|
|||
/*0x02*/ s16 loaded240; // 0 when unloaded, 1 when visible, ticks up to 120 when recently visible
|
||||
/*0x04*/ u8 portalrecursioncount;
|
||||
/*0x05*/ s8 numportals;
|
||||
/*0x06*/ u8 unk06;
|
||||
/*0x06*/ u8 snakecount;
|
||||
/*0x07*/ u8 unk07;
|
||||
/*0x08*/ s8 numlights;
|
||||
/*0x09*/ u8 numwaypoints; // note: excludes waypoints with PADFLAG_AIDROP
|
||||
|
@ -3650,14 +3650,14 @@ struct room {
|
|||
// such as gunfire or lightning.
|
||||
/*0x52*/ s16 br_flash;
|
||||
/*0x54*/ s16 lightop_timer240;
|
||||
/*0x56*/ u16 unk56;
|
||||
/*0x56*/ u16 hlupdatedframe;
|
||||
/*0x58*/ struct colour *colours;
|
||||
/*0x5c*/ f32 lightop_cur_frac;
|
||||
/*0x60*/ f32 lightop_to_frac;
|
||||
/*0x64*/ f32 lightop_from_frac;
|
||||
/*0x68*/ f32 lightop_duration240;
|
||||
/*0x6c*/ f32 unk6c;
|
||||
/*0x70*/ f32 unk70;
|
||||
/*0x6c*/ f32 volume; // in metres
|
||||
/*0x70*/ f32 surfacearea; // in centimetres
|
||||
/*0x74*/ f32 highlightfrac_r;
|
||||
/*0x78*/ f32 highlightfrac_g;
|
||||
/*0x7c*/ f32 highlightfrac_b;
|
||||
|
@ -4496,19 +4496,19 @@ struct bgportal {
|
|||
u8 flags;
|
||||
};
|
||||
|
||||
struct portalthing {
|
||||
u16 unk00;
|
||||
s16 unk02;
|
||||
u16 unk04;
|
||||
s16 unk06;
|
||||
struct portalcamcacheitem {
|
||||
u16 updatedframe1;
|
||||
s16 side;
|
||||
u16 updatedframe2;
|
||||
s16 bboxisvalid;
|
||||
s16 xmin;
|
||||
s16 ymin;
|
||||
s16 xmax;
|
||||
s16 ymax;
|
||||
};
|
||||
|
||||
struct var800a4ccc { // related to portals
|
||||
struct coord coord;
|
||||
struct portalmetric { // related to portals
|
||||
struct coord normal;
|
||||
f32 min;
|
||||
f32 max;
|
||||
};
|
||||
|
@ -5167,18 +5167,13 @@ struct bgcmd {
|
|||
s32 param;
|
||||
};
|
||||
|
||||
struct var800a4640_00 {
|
||||
struct drawslot {
|
||||
s16 roomnum;
|
||||
u8 unk02;
|
||||
u8 draworder;
|
||||
struct screenbox box;
|
||||
};
|
||||
|
||||
struct var800a4640 {
|
||||
/*0x000*/ struct var800a4640_00 unk000[60];
|
||||
/*0x2d0*/ struct var800a4640_00 unk2d0;
|
||||
};
|
||||
|
||||
struct zrange {
|
||||
union {
|
||||
struct {
|
||||
|
@ -5189,21 +5184,21 @@ struct zrange {
|
|||
};
|
||||
};
|
||||
|
||||
struct var800a4d00 {
|
||||
struct bgsnakeitem {
|
||||
/*0x00*/ s16 roomnum;
|
||||
/*0x02*/ s16 roomnums[5];
|
||||
/*0x0c*/ u8 draworder;
|
||||
/*0x02*/ s16 fromroomnums[5];
|
||||
/*0x0c*/ u8 depth;
|
||||
/*0x0d*/ u8 numportals;
|
||||
/*0x0e*/ s16 roomportallistoffset;
|
||||
/*0x10*/ struct screenbox screenbox;
|
||||
};
|
||||
|
||||
struct var800a4cf0 {
|
||||
s16 unk00;
|
||||
s16 index; // index into unk10
|
||||
s16 unk04; // also an index into unk10
|
||||
struct bgsnake {
|
||||
s16 count;
|
||||
s16 headindex;
|
||||
s16 tailindex;
|
||||
struct zrange zrange;
|
||||
struct var800a4d00 unk10[250];
|
||||
struct bgsnakeitem items[250];
|
||||
};
|
||||
|
||||
struct menuinputs {
|
||||
|
@ -5462,9 +5457,9 @@ struct boltbeam {
|
|||
f32 speed;
|
||||
};
|
||||
|
||||
struct var800a4ce8 {
|
||||
u16 unk00;
|
||||
s16 unk02;
|
||||
struct drawslotpointer {
|
||||
u16 updatedframe;
|
||||
s16 slotnum;
|
||||
};
|
||||
|
||||
struct seqchannel {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "game/atan2f.h"
|
||||
#include "game/padhalllv.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_17ce0.h"
|
||||
#include "lib/mtx.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
@ -74,7 +75,18 @@ void portal00017dc4(s16 *rooms, s16 roomnum)
|
|||
}
|
||||
}
|
||||
|
||||
s32 portal00017e30(s32 portalnum, struct coord *arg1, struct coord *arg2)
|
||||
/**
|
||||
* Determine whether a line from pos1 to pos2 intersects the portal,
|
||||
* and if so then in which direction.
|
||||
*
|
||||
* Return one of:
|
||||
* PORTALINTERSECTION_NONE
|
||||
* PORTALINTERSECTION_BEHINDTOFRONT
|
||||
* PORTALINTERSECTION_FRONTTOBEHIND
|
||||
*
|
||||
* The portal's normal vector is the front.
|
||||
*/
|
||||
s32 portalCalculateIntersection(s32 portalnum, struct coord *pos1, struct coord *pos2)
|
||||
{
|
||||
s32 i;
|
||||
struct coord sp60;
|
||||
|
@ -92,22 +104,22 @@ s32 portal00017e30(s32 portalnum, struct coord *arg1, struct coord *arg2)
|
|||
|
||||
lastside = 0;
|
||||
pvertices = (struct portalvertices *)((uintptr_t)g_BgPortals + g_BgPortals[portalnum].verticesoffset);
|
||||
value1 = arg1->f[0] * (var800a4ccc + portalnum)->coord.f[0] + arg1->f[1] * (var800a4ccc + portalnum)->coord.f[1] + arg1->f[2] * (var800a4ccc + portalnum)->coord.f[2];
|
||||
value2 = arg2->f[0] * (var800a4ccc + portalnum)->coord.f[0] + arg2->f[1] * (var800a4ccc + portalnum)->coord.f[1] + arg2->f[2] * (var800a4ccc + portalnum)->coord.f[2];
|
||||
value1 = pos1->f[0] * (g_PortalMetrics + portalnum)->normal.f[0] + pos1->f[1] * (g_PortalMetrics + portalnum)->normal.f[1] + pos1->f[2] * (g_PortalMetrics + portalnum)->normal.f[2];
|
||||
value2 = pos2->f[0] * (g_PortalMetrics + portalnum)->normal.f[0] + pos2->f[1] * (g_PortalMetrics + portalnum)->normal.f[1] + pos2->f[2] * (g_PortalMetrics + portalnum)->normal.f[2];
|
||||
|
||||
if (value1 < (var800a4ccc + portalnum)->min) {
|
||||
if (value2 < (var800a4ccc + portalnum)->min) {
|
||||
return 0;
|
||||
if (value1 < (g_PortalMetrics + portalnum)->min) {
|
||||
if (value2 < (g_PortalMetrics + portalnum)->min) {
|
||||
return PORTALINTERSECTION_NONE;
|
||||
}
|
||||
} else if ((var800a4ccc + portalnum)->max < value1 && (var800a4ccc + portalnum)->max < value2) {
|
||||
return 0;
|
||||
} else if ((g_PortalMetrics + portalnum)->max < value1 && (g_PortalMetrics + portalnum)->max < value2) {
|
||||
return PORTALINTERSECTION_NONE;
|
||||
}
|
||||
|
||||
sp60.f[0] = arg2->f[0] - arg1->f[0];
|
||||
sp60.f[1] = arg2->f[1] - arg1->f[1];
|
||||
sp60.f[2] = arg2->f[2] - arg1->f[2];
|
||||
sp60.f[0] = pos2->f[0] - pos1->f[0];
|
||||
sp60.f[1] = pos2->f[1] - pos1->f[1];
|
||||
sp60.f[2] = pos2->f[2] - pos1->f[2];
|
||||
|
||||
var8007fcb4 = (value1 + value2) * 0.5f - (var800a4ccc + portalnum)->min;
|
||||
var8007fcb4 = (value1 + value2) * 0.5f - (g_PortalMetrics + portalnum)->min;
|
||||
|
||||
curr = &pvertices->vertices[0];
|
||||
next = &pvertices->vertices[1];
|
||||
|
@ -128,21 +140,21 @@ s32 portal00017e30(s32 portalnum, struct coord *arg1, struct coord *arg2)
|
|||
tmp = sp34.f[0] * sp34.f[0] + sp34.f[1] * sp34.f[1] + sp34.f[2] * sp34.f[2];
|
||||
|
||||
if (tmp == 0.0f) {
|
||||
return 0;
|
||||
return PORTALINTERSECTION_NONE;
|
||||
}
|
||||
|
||||
sp40[0] = sp34.f[0] * curr->f[0] + sp34.f[1] * curr->f[1] + sp34.f[2] * curr->f[2];
|
||||
tmp = sp34.f[0] * arg1->f[0] + sp34.f[1] * arg1->f[1] + sp34.f[2] * arg1->f[2];
|
||||
tmp = sp34.f[0] * pos1->f[0] + sp34.f[1] * pos1->f[1] + sp34.f[2] * pos1->f[2];
|
||||
|
||||
if (tmp < sp40[0]) {
|
||||
if (lastside == 2) {
|
||||
return 0;
|
||||
return PORTALINTERSECTION_NONE;
|
||||
}
|
||||
|
||||
lastside = 1;
|
||||
} else {
|
||||
if (lastside == 1) {
|
||||
return 0;
|
||||
return PORTALINTERSECTION_NONE;
|
||||
}
|
||||
|
||||
lastside = 2;
|
||||
|
@ -152,7 +164,9 @@ s32 portal00017e30(s32 portalnum, struct coord *arg1, struct coord *arg2)
|
|||
next++;
|
||||
}
|
||||
|
||||
return (value1 < (var800a4ccc + portalnum)->min) ? 1 : 2;
|
||||
return (value1 < (g_PortalMetrics + portalnum)->min)
|
||||
? PORTALINTERSECTION_BEHINDTOFRONT
|
||||
: PORTALINTERSECTION_FRONTTOBEHIND;
|
||||
}
|
||||
|
||||
void portal00018148(struct coord *pos1, struct coord *pos2, s16 *rooms1, s16 *rooms2, s16 *rooms3, s32 arg5)
|
||||
|
@ -178,7 +192,7 @@ void portal00018148(struct coord *pos1, struct coord *pos2, s16 *rooms1, s16 *ro
|
|||
var8005ef20++;
|
||||
|
||||
if (var8005ef20 == 255) {
|
||||
for (i = 0; i < g_NumPortalThings; i++) {
|
||||
for (i = 0; i < g_BgNumPortalCameraCacheItems; i++) {
|
||||
var8009a4e0[i][0] = 0xff;
|
||||
}
|
||||
|
||||
|
@ -198,23 +212,23 @@ void portal00018148(struct coord *pos1, struct coord *pos2, s16 *rooms1, s16 *ro
|
|||
|
||||
if (s1[0] != var8005ef20) {
|
||||
s1[0] = var8005ef20;
|
||||
s1[1] = portal00017e30(portalnum, pos1, pos2);
|
||||
s1[1] = portalCalculateIntersection(portalnum, pos1, pos2);
|
||||
}
|
||||
|
||||
if (s1[1] != 0) {
|
||||
if (s1[1] == 1) {
|
||||
if (s1[1] != PORTALINTERSECTION_NONE) {
|
||||
if (s1[1] == PORTALINTERSECTION_BEHINDTOFRONT) {
|
||||
if (roomnum == g_BgPortals[portalnum].roomnum1) {
|
||||
portal00017dc4(rooms7c, g_BgPortals[portalnum].roomnum2);
|
||||
portal00017dc4(rooms5c, g_BgPortals[portalnum].roomnum2);
|
||||
s1[1] = 0;
|
||||
s1[1] = PORTALINTERSECTION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (s1[1] == 2) {
|
||||
if (s1[1] == PORTALINTERSECTION_FRONTTOBEHIND) {
|
||||
if (roomnum == g_BgPortals[portalnum].roomnum2) {
|
||||
portal00017dc4(rooms7c, g_BgPortals[portalnum].roomnum1);
|
||||
portal00017dc4(rooms5c, g_BgPortals[portalnum].roomnum1);
|
||||
s1[1] = 0;
|
||||
s1[1] = PORTALINTERSECTION_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1148,7 +1148,7 @@ void modelUpdatePositionNodeMtx(struct modelrenderdata *renderdata, struct model
|
|||
modelPositionJointUsingQuatRot(renderdata, model, node, sp68, &translate1, &scale1);
|
||||
}
|
||||
} else if (sp128) {
|
||||
f32 mult = func0f15c888();
|
||||
f32 mult = bgGetStageTranslationThing();
|
||||
|
||||
translate1.x *= mult;
|
||||
translate1.y *= mult;
|
||||
|
@ -1826,7 +1826,7 @@ void modelSetAnimation2(struct model *model, s16 animnum, s32 flip, f32 fstartfr
|
|||
f32 z;
|
||||
|
||||
if (g_Anims[anim->animnum].flags & ANIMFLAG_ABSOLUTETRANSLATION) {
|
||||
sp64 = func0f15c888();
|
||||
sp64 = bgGetStageTranslationThing();
|
||||
animLoadHeader(anim->animnum);
|
||||
frameslot = animLoadFrame(anim->animnum, anim->framea);
|
||||
animForgetFrameBirths();
|
||||
|
@ -2233,7 +2233,7 @@ void modelSetAnimFrame2WithChrStuff(struct model *model, f32 curframe, f32 endfr
|
|||
}
|
||||
|
||||
if (g_Anims[anim->animnum].flags & ANIMFLAG_ABSOLUTETRANSLATION) {
|
||||
f20 = func0f15c888();
|
||||
f20 = bgGetStageTranslationThing();
|
||||
|
||||
if (floorend != anim->framea) {
|
||||
s0frame = modelConstrainOrWrapAnimFrame(floorend, anim->animnum, anim->endframe);
|
||||
|
|
|
@ -174,7 +174,7 @@ void piracy_patch_checksums(void)
|
|||
patch(algo09, "bgunTickGunLoad", "tagsReset");
|
||||
patch(algo10, "explosionAlertChrs", "glassDestroy");
|
||||
patch(algo11, "menuTickTimers", "mtxGetObfuscatedRomBase");
|
||||
patch(algo12, "func0f15c920", "menuTickTimers");
|
||||
patch(algo12, "bgTickCounter", "menuTickTimers");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue