mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-17 12:59:41 -04:00
Add support for non-matching ntsc-final builds
This commit is contained in:
+935
-922
File diff suppressed because it is too large
Load Diff
+86
-84
@@ -21,6 +21,7 @@ struct stageheadlimit g_StageHeadLimits[3] = {
|
||||
u32 var80061708 = 0x00000000;
|
||||
u32 var8006170c = 0x00000000;
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel bodiesReset
|
||||
/* f00b820: 27bdffd0 */ addiu $sp,$sp,-48
|
||||
@@ -267,92 +268,93 @@ glabel bodiesReset
|
||||
/* f00bb68: 03e00008 */ jr $ra
|
||||
/* f00bb6c: 27bd0030 */ addiu $sp,$sp,0x30
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatches:
|
||||
// - Address of var80062b14 Should be loaded to a callee-save register
|
||||
// - PLAYERCOUNT() calculation is more spread out
|
||||
// (does other register preparation during calculation)
|
||||
// - Loop at 950 is calculated differently
|
||||
//void bodiesReset(s32 stagenum)
|
||||
//{
|
||||
// s32 *headsavailablelist;
|
||||
// s32 headsavailablelen;
|
||||
// bool done;
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
//
|
||||
// for (i = 0; g_HeadsAndBodies[i].bodyfileid; i++) {
|
||||
// g_HeadsAndBodies[i].unk0c = NULL;
|
||||
// }
|
||||
//
|
||||
// var80062c80 = random() % g_NumBondBodies;
|
||||
// var80062b14 = 0;
|
||||
// var80062b18 = 0;
|
||||
//
|
||||
// if (PLAYERCOUNT() >= 2) {
|
||||
// g_NumActiveHeadsPerGender = 4;
|
||||
// } else {
|
||||
// // 950
|
||||
// g_NumActiveHeadsPerGender = 8;
|
||||
//
|
||||
// for (i = 0; i < ARRAYCOUNT(g_StageHeadLimits); i++) {
|
||||
// if (g_StageHeadLimits[i].stagenum == stagenum) {
|
||||
// g_NumActiveHeadsPerGender = g_StageHeadLimits[i].maxheads;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Male heads
|
||||
// if (cheatIsActive(CHEAT_TEAMHEADSONLY)) {
|
||||
// headsavailablelist = g_MaleGuardTeamHeads;
|
||||
// headsavailablelen = g_NumMaleGuardTeamHeads;
|
||||
// } else {
|
||||
// headsavailablelist = g_MaleGuardHeads;
|
||||
// headsavailablelen = g_NumMaleGuardHeads;
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < g_NumActiveHeadsPerGender; i++) {
|
||||
// do {
|
||||
// done = true;
|
||||
// g_ActiveMaleHeads[i] = headsavailablelist[random() % headsavailablelen];
|
||||
//
|
||||
// if (headsavailablelen > g_NumActiveHeadsPerGender) {
|
||||
// for (j = 0; j < i; j++) {
|
||||
// if (g_ActiveMaleHeads[i] == g_ActiveMaleHeads[j]) {
|
||||
// done = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } while (!done);
|
||||
// }
|
||||
//
|
||||
// // Female heads
|
||||
// if (cheatIsActive(CHEAT_TEAMHEADSONLY)) {
|
||||
// headsavailablelist = g_FemaleGuardTeamHeads;
|
||||
// headsavailablelen = g_NumFemaleGuardTeamHeads;
|
||||
// } else {
|
||||
// headsavailablelist = g_FemaleGuardHeads;
|
||||
// headsavailablelen = g_NumFemaleGuardHeads;
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < g_NumActiveHeadsPerGender; i++) {
|
||||
// do {
|
||||
// done = true;
|
||||
// g_ActiveFemaleHeads[i] = headsavailablelist[random() % headsavailablelen];
|
||||
//
|
||||
// if (headsavailablelen > g_NumActiveHeadsPerGender) {
|
||||
// for (j = 0; j < i; j++) {
|
||||
// if (g_ActiveFemaleHeads[i] == g_ActiveFemaleHeads[j]) {
|
||||
// done = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } while (!done);
|
||||
// }
|
||||
//
|
||||
// g_ActiveMaleHeadsIndex = 0;
|
||||
// g_ActiveFemaleHeadsIndex = 0;
|
||||
//
|
||||
// for (i = 0; i < g_NumActiveHeadsPerGender; i++);
|
||||
// for (i = 0; i < g_NumActiveHeadsPerGender; i++);
|
||||
//}
|
||||
void bodiesReset(s32 stagenum)
|
||||
{
|
||||
s32 *headsavailablelist;
|
||||
s32 headsavailablelen;
|
||||
bool done;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
for (i = 0; g_HeadsAndBodies[i].filenum; i++) {
|
||||
g_HeadsAndBodies[i].filedata = NULL;
|
||||
}
|
||||
|
||||
var80062c80 = random() % g_NumBondBodies;
|
||||
var80062b14 = 0;
|
||||
var80062b18 = 0;
|
||||
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
g_NumActiveHeadsPerGender = 4;
|
||||
} else {
|
||||
// 950
|
||||
g_NumActiveHeadsPerGender = 8;
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_StageHeadLimits); i++) {
|
||||
if (g_StageHeadLimits[i].stagenum == stagenum) {
|
||||
g_NumActiveHeadsPerGender = g_StageHeadLimits[i].maxheads;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Male heads
|
||||
if (cheatIsActive(CHEAT_TEAMHEADSONLY)) {
|
||||
headsavailablelist = g_MaleGuardTeamHeads;
|
||||
headsavailablelen = g_NumMaleGuardTeamHeads;
|
||||
} else {
|
||||
headsavailablelist = g_MaleGuardHeads;
|
||||
headsavailablelen = g_NumMaleGuardHeads;
|
||||
}
|
||||
|
||||
for (i = 0; i < g_NumActiveHeadsPerGender; i++) {
|
||||
do {
|
||||
done = true;
|
||||
g_ActiveMaleHeads[i] = headsavailablelist[random() % headsavailablelen];
|
||||
|
||||
if (headsavailablelen > g_NumActiveHeadsPerGender) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (g_ActiveMaleHeads[i] == g_ActiveMaleHeads[j]) {
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!done);
|
||||
}
|
||||
|
||||
// Female heads
|
||||
if (cheatIsActive(CHEAT_TEAMHEADSONLY)) {
|
||||
headsavailablelist = g_FemaleGuardTeamHeads;
|
||||
headsavailablelen = g_NumFemaleGuardTeamHeads;
|
||||
} else {
|
||||
headsavailablelist = g_FemaleGuardHeads;
|
||||
headsavailablelen = g_NumFemaleGuardHeads;
|
||||
}
|
||||
|
||||
for (i = 0; i < g_NumActiveHeadsPerGender; i++) {
|
||||
do {
|
||||
done = true;
|
||||
g_ActiveFemaleHeads[i] = headsavailablelist[random() % headsavailablelen];
|
||||
|
||||
if (headsavailablelen > g_NumActiveHeadsPerGender) {
|
||||
for (j = 0; j < i; j++) {
|
||||
if (g_ActiveFemaleHeads[i] == g_ActiveFemaleHeads[j]) {
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!done);
|
||||
}
|
||||
|
||||
g_ActiveMaleHeadsIndex = 0;
|
||||
g_ActiveFemaleHeadsIndex = 0;
|
||||
|
||||
for (i = 0; i < g_NumActiveHeadsPerGender; i++);
|
||||
for (i = 0; i < g_NumActiveHeadsPerGender; i++);
|
||||
}
|
||||
#endif
|
||||
|
||||
+472
-466
@@ -7410,6 +7410,7 @@ struct guncmd var80070200[2] = {
|
||||
{ GUNCMD_END },
|
||||
};
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel bgunAutoSwitchWeapon
|
||||
/* f0a1df4: 27bdff98 */ addiu $sp,$sp,-104
|
||||
@@ -7600,7 +7601,7 @@ glabel bgunAutoSwitchWeapon
|
||||
/* f0a2088: 03e00008 */ jr $ra
|
||||
/* f0a208c: 27bd0068 */ addiu $sp,$sp,0x68
|
||||
);
|
||||
|
||||
#else
|
||||
/**
|
||||
* Automatically choose and equip a new weapon after trying to fire a weapon
|
||||
* which is out of ammo.
|
||||
@@ -7629,121 +7630,122 @@ glabel bgunAutoSwitchWeapon
|
||||
// Mismatch: First loop should store pointer to current item in s3 and do an
|
||||
// address comparison for the end, but the below stores index in s4 and does an
|
||||
// integer comparison. Variable refcounts affects this so might be related.
|
||||
//void bgunAutoSwitchWeapon(void)
|
||||
//{
|
||||
// s32 i;
|
||||
// bool foundcurrent2;
|
||||
// s32 firstweaponnum2;
|
||||
// bool usable;
|
||||
// s32 firstweaponnum = -1; // 50
|
||||
// s32 newweaponnum = -1;
|
||||
// bool foundcurrent = false; // 48
|
||||
// s32 curweaponnum = g_Vars.currentplayer->gunctrl.weaponnum; // 44
|
||||
// s32 foundsuperdragon = 0;
|
||||
// s32 wantammo = false; // 40
|
||||
// s32 weaponnum;
|
||||
// struct weapon *weapon;
|
||||
// struct weaponfunc *func;
|
||||
// s32 weaponnum2;
|
||||
//
|
||||
// if (g_Vars.tickmode == TICKMODE_CUTSCENE) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Loop through g_AutoSwitchWeaponsPrimary, checking which weapons the
|
||||
// // player has which are usable. Stop when both any usable weapon is found
|
||||
// // and when the player's current weapon is found. Note the first and last
|
||||
// // usable weapons.
|
||||
// for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsPrimary) && (newweaponnum == -1 || !foundcurrent); i++) {
|
||||
// usable = false;
|
||||
//
|
||||
// if (invHasSingleWeaponIncAllGuns(g_AutoSwitchWeaponsPrimary[i])) {
|
||||
// weaponnum = g_AutoSwitchWeaponsPrimary[i];
|
||||
// weapon = weaponFindById(weaponnum);
|
||||
// func = weaponGetFunctionById(weaponnum, FUNC_PRIMARY);
|
||||
//
|
||||
// if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) {
|
||||
// usable = true;
|
||||
// }
|
||||
//
|
||||
// if (weaponnum == WEAPON_SUPERDRAGON && !foundsuperdragon) {
|
||||
// foundsuperdragon++;
|
||||
// } else {
|
||||
// func = weaponGetFunctionById(weaponnum, FUNC_SECONDARY);
|
||||
//
|
||||
// if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) {
|
||||
// usable = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (weaponnum == curweaponnum) {
|
||||
// foundcurrent = true;
|
||||
// } else if (usable) {
|
||||
// newweaponnum = weaponnum;
|
||||
//
|
||||
// if (firstweaponnum == -1) {
|
||||
// firstweaponnum = weaponnum;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// foundcurrent2 = false;
|
||||
// firstweaponnum2 = -1;
|
||||
//
|
||||
// if (!foundcurrent) {
|
||||
// newweaponnum = firstweaponnum;
|
||||
// }
|
||||
//
|
||||
// if (newweaponnum == -1) {
|
||||
// newweaponnum = WEAPON_UNARMED;
|
||||
// }
|
||||
//
|
||||
// if (newweaponnum == WEAPON_UNARMED) {
|
||||
// // No usable weapon was found in the primary array,
|
||||
// // so search the secondary array.
|
||||
// for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsSecondary); i++) {
|
||||
// weaponnum2 = g_AutoSwitchWeaponsSecondary[i];
|
||||
//
|
||||
// if (invHasSingleWeaponIncAllGuns(weaponnum2)) {
|
||||
// if (weaponnum2 == curweaponnum) {
|
||||
// foundcurrent2 = true;
|
||||
// }
|
||||
//
|
||||
// if (firstweaponnum2 == -1) {
|
||||
// firstweaponnum2 = weaponnum2;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// newweaponnum = firstweaponnum2;
|
||||
//
|
||||
// if (newweaponnum == -1) {
|
||||
// newweaponnum = WEAPON_UNARMED;
|
||||
// }
|
||||
//
|
||||
// if (foundcurrent2) {
|
||||
// newweaponnum = -1;
|
||||
// }
|
||||
//
|
||||
// wantammo = true;
|
||||
// }
|
||||
//
|
||||
// // Switch to newweaponnum
|
||||
// if (newweaponnum >= 0 && newweaponnum != curweaponnum) {
|
||||
// if (invHasDoubleWeaponIncAllGuns(newweaponnum, newweaponnum)) {
|
||||
// g_Vars.currentplayer->gunctrl.dualwielding = true;
|
||||
// } else {
|
||||
// g_Vars.currentplayer->gunctrl.dualwielding = false;
|
||||
// }
|
||||
//
|
||||
// bgunEquipWeapon(newweaponnum);
|
||||
//
|
||||
// if (wantammo) {
|
||||
// g_Vars.currentplayer->gunctrl.wantammo = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void bgunAutoSwitchWeapon(void)
|
||||
{
|
||||
s32 i;
|
||||
bool foundcurrent2;
|
||||
s32 firstweaponnum2;
|
||||
bool usable;
|
||||
s32 firstweaponnum = -1; // 50
|
||||
s32 newweaponnum = -1;
|
||||
bool foundcurrent = false; // 48
|
||||
s32 curweaponnum = g_Vars.currentplayer->gunctrl.weaponnum; // 44
|
||||
s32 foundsuperdragon = 0;
|
||||
s32 wantammo = false; // 40
|
||||
s32 weaponnum;
|
||||
struct weapon *weapon;
|
||||
struct weaponfunc *func;
|
||||
s32 weaponnum2;
|
||||
|
||||
if (g_Vars.tickmode == TICKMODE_CUTSCENE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Loop through g_AutoSwitchWeaponsPrimary, checking which weapons the
|
||||
// player has which are usable. Stop when both any usable weapon is found
|
||||
// and when the player's current weapon is found. Note the first and last
|
||||
// usable weapons.
|
||||
for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsPrimary) && (newweaponnum == -1 || !foundcurrent); i++) {
|
||||
usable = false;
|
||||
|
||||
if (invHasSingleWeaponIncAllGuns(g_AutoSwitchWeaponsPrimary[i])) {
|
||||
weaponnum = g_AutoSwitchWeaponsPrimary[i];
|
||||
weapon = weaponFindById(weaponnum);
|
||||
func = weaponGetFunctionById(weaponnum, FUNC_PRIMARY);
|
||||
|
||||
if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) {
|
||||
usable = true;
|
||||
}
|
||||
|
||||
if (weaponnum == WEAPON_SUPERDRAGON && !foundsuperdragon) {
|
||||
foundsuperdragon++;
|
||||
} else {
|
||||
func = weaponGetFunctionById(weaponnum, FUNC_SECONDARY);
|
||||
|
||||
if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) {
|
||||
usable = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (weaponnum == curweaponnum) {
|
||||
foundcurrent = true;
|
||||
} else if (usable) {
|
||||
newweaponnum = weaponnum;
|
||||
|
||||
if (firstweaponnum == -1) {
|
||||
firstweaponnum = weaponnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foundcurrent2 = false;
|
||||
firstweaponnum2 = -1;
|
||||
|
||||
if (!foundcurrent) {
|
||||
newweaponnum = firstweaponnum;
|
||||
}
|
||||
|
||||
if (newweaponnum == -1) {
|
||||
newweaponnum = WEAPON_UNARMED;
|
||||
}
|
||||
|
||||
if (newweaponnum == WEAPON_UNARMED) {
|
||||
// No usable weapon was found in the primary array,
|
||||
// so search the secondary array.
|
||||
for (i = 0; i < ARRAYCOUNT(g_AutoSwitchWeaponsSecondary); i++) {
|
||||
weaponnum2 = g_AutoSwitchWeaponsSecondary[i];
|
||||
|
||||
if (invHasSingleWeaponIncAllGuns(weaponnum2)) {
|
||||
if (weaponnum2 == curweaponnum) {
|
||||
foundcurrent2 = true;
|
||||
}
|
||||
|
||||
if (firstweaponnum2 == -1) {
|
||||
firstweaponnum2 = weaponnum2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newweaponnum = firstweaponnum2;
|
||||
|
||||
if (newweaponnum == -1) {
|
||||
newweaponnum = WEAPON_UNARMED;
|
||||
}
|
||||
|
||||
if (foundcurrent2) {
|
||||
newweaponnum = -1;
|
||||
}
|
||||
|
||||
wantammo = true;
|
||||
}
|
||||
|
||||
// Switch to newweaponnum
|
||||
if (newweaponnum >= 0 && newweaponnum != curweaponnum) {
|
||||
if (invHasDoubleWeaponIncAllGuns(newweaponnum, newweaponnum)) {
|
||||
g_Vars.currentplayer->gunctrl.dualwielding = true;
|
||||
} else {
|
||||
g_Vars.currentplayer->gunctrl.dualwielding = false;
|
||||
}
|
||||
|
||||
bgunEquipWeapon(newweaponnum);
|
||||
|
||||
if (wantammo) {
|
||||
g_Vars.currentplayer->gunctrl.wantammo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bgunEquipWeapon2(s32 handnum, s32 weaponnum)
|
||||
{
|
||||
@@ -8974,6 +8976,7 @@ void bgun0f0a45d0(struct hand *hand, struct modelfiledata *filedata, bool isdeto
|
||||
}
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel bgun0f0a46a4
|
||||
@@ -11187,107 +11190,108 @@ glabel var7f1ac918
|
||||
/* f0a4e40: 27bd00e0 */ addiu $sp,$sp,0xe0
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
/**
|
||||
* With this function stubbed, the tranquilizer's spent ammo does not detach
|
||||
* when reloading, and the pulled pin on grenades and nbombs appears to move
|
||||
* with the model rather than detaching properly.
|
||||
*/
|
||||
//void bgun0f0a46a4(struct hand *hand, struct modelfiledata *modeldef, bool isdetonator)
|
||||
//{
|
||||
// struct coord spd0;
|
||||
// Mtxf sp90;
|
||||
// struct coord sp84;
|
||||
// Mtxf sp44;
|
||||
// s32 i;
|
||||
// f32 lvupdate;
|
||||
// f32 newval;
|
||||
// f32 sumval;
|
||||
//
|
||||
// switch (hand->unk0d0e_00) {
|
||||
// case 1:
|
||||
// // 6e4
|
||||
// switch (hand->unk0d0e_04) {
|
||||
// case 0:
|
||||
// // 710
|
||||
// hand->unk0d20.f[0] = (RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 0.5333333f;
|
||||
// hand->unk0d20.f[1] = 0.0f;
|
||||
// hand->unk0d20.f[2] = RANDOMFRAC() * 2.5f * 0.0625f + 2.5f;
|
||||
// spd0.f[0] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f;
|
||||
// spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f;
|
||||
// spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f;
|
||||
// break;
|
||||
// case 1:
|
||||
// // 8b8
|
||||
// hand->unk0d20.f[0] = -((RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 3.0f * 0.5333333f);
|
||||
// hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f;
|
||||
// hand->unk0d20.f[2] = -(RANDOMFRAC() + 1.0f);
|
||||
// spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 208.0f;
|
||||
// spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f;
|
||||
// spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f;
|
||||
// break;
|
||||
// case 2:
|
||||
// // aa4
|
||||
// hand->unk0d20.f[0] = 0.0f;
|
||||
// hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f;
|
||||
// hand->unk0d20.f[2] = (RANDOMFRAC() + 1.0f) * 0.25f;
|
||||
// spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 368.0f;
|
||||
// spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f;
|
||||
// spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // c28
|
||||
// hand->unk0d10 = hand->unk0d14 - 200.0f;
|
||||
//
|
||||
// mtx4LoadRotation(&spd0, &sp90);
|
||||
// mtx4ToMtx3(&sp90, hand->unk0d50);
|
||||
//
|
||||
// if (g_Vars.lvupdate240 > 0 && hand->unk0d0e_04) {
|
||||
// sp84.x = (hand->posmtx.m[3][0] - hand->prevmtx.m[3][0]) / g_Vars.lvupdate240f;
|
||||
// sp84.y = (hand->posmtx.m[3][1] - hand->prevmtx.m[3][1]) / g_Vars.lvupdate240f;
|
||||
// sp84.z = (hand->posmtx.m[3][2] - hand->prevmtx.m[3][2]) / g_Vars.lvupdate240f;
|
||||
//
|
||||
// mtx00017588(hand->posmtx.m, sp44.m);
|
||||
// mtx4RotateVecInPlace(&sp44, &sp84);
|
||||
//
|
||||
// hand->unk0d20.f[0] += sp84.x * 0.3f;
|
||||
// hand->unk0d20.f[1] += sp84.y * 0.3f;
|
||||
// hand->unk0d20.f[2] += sp84.z * 0.3f;
|
||||
// }
|
||||
//
|
||||
// hand->unk0d0e_00 = 2;
|
||||
// break;
|
||||
// case 2:
|
||||
// // d28
|
||||
// lvupdate = g_Vars.lvupdate240f;
|
||||
//
|
||||
// if (g_Vars.currentplayer->isdead && lvupdate > 1.5f) {
|
||||
// lvupdate = 1.5f;
|
||||
// }
|
||||
//
|
||||
// newval = hand->unk0d20.f[1] - lvupdate * 0.2777778f;
|
||||
//
|
||||
// if (hand->unk0d18 < hand->unk0d10) {
|
||||
// hand->unk0d0e_00 = 3;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// sumval = hand->unk0d20.f[1] + newval;
|
||||
//
|
||||
// hand->unk0d20.f[1] = newval;
|
||||
//
|
||||
// hand->unk0d14 += lvupdate * hand->unk0d20.f[0];
|
||||
// hand->unk0d18 += lvupdate * 0.5f * sumval;
|
||||
// hand->unk0d1c += lvupdate * hand->unk0d20.f[2];
|
||||
//
|
||||
// for (i = 0; i < g_Vars.lvupdate240; i++) {
|
||||
// mtx00016110(hand->unk0d50, hand->unk0d2c);
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
void bgun0f0a46a4(struct hand *hand, struct modelfiledata *modeldef, bool isdetonator)
|
||||
{
|
||||
struct coord spd0;
|
||||
Mtxf sp90;
|
||||
struct coord sp84;
|
||||
Mtxf sp44;
|
||||
s32 i;
|
||||
f32 lvupdate;
|
||||
f32 newval;
|
||||
f32 sumval;
|
||||
|
||||
switch (hand->unk0d0e_00) {
|
||||
case 1:
|
||||
// 6e4
|
||||
switch (hand->unk0d0e_04) {
|
||||
case 0:
|
||||
// 710
|
||||
hand->unk0d20.f[0] = (RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 0.5333333f;
|
||||
hand->unk0d20.f[1] = 0.0f;
|
||||
hand->unk0d20.f[2] = RANDOMFRAC() * 2.5f * 0.0625f + 2.5f;
|
||||
spd0.f[0] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f;
|
||||
spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f;
|
||||
spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 184.0f - 0.03414231f;
|
||||
break;
|
||||
case 1:
|
||||
// 8b8
|
||||
hand->unk0d20.f[0] = -((RANDOMFRAC() - 0.5f) * 0.5333333f * 0.0625f + 3.0f * 0.5333333f);
|
||||
hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f;
|
||||
hand->unk0d20.f[2] = -(RANDOMFRAC() + 1.0f);
|
||||
spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 208.0f;
|
||||
spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f;
|
||||
spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 544.0f - 0.0115481345f;
|
||||
break;
|
||||
case 2:
|
||||
// aa4
|
||||
hand->unk0d20.f[0] = 0.0f;
|
||||
hand->unk0d20.f[1] = RANDOMFRAC() * 2.5f * 0.125f + 2.5f;
|
||||
hand->unk0d20.f[2] = (RANDOMFRAC() + 1.0f) * 0.25f;
|
||||
spd0.f[0] = (RANDOMFRAC() + 3.0f) * M_BADTAU / 368.0f;
|
||||
spd0.f[1] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f;
|
||||
spd0.f[2] = 2.0f * RANDOMFRAC() * M_BADTAU / 944.0f - 0.006654857f;
|
||||
break;
|
||||
}
|
||||
|
||||
// c28
|
||||
hand->unk0d10 = hand->unk0d14 - 200.0f;
|
||||
|
||||
mtx4LoadRotation(&spd0, &sp90);
|
||||
mtx4ToMtx3(&sp90, hand->unk0d50);
|
||||
|
||||
if (g_Vars.lvupdate240 > 0 && hand->unk0d0e_04) {
|
||||
sp84.x = (hand->posmtx.m[3][0] - hand->prevmtx.m[3][0]) / g_Vars.lvupdate240f;
|
||||
sp84.y = (hand->posmtx.m[3][1] - hand->prevmtx.m[3][1]) / g_Vars.lvupdate240f;
|
||||
sp84.z = (hand->posmtx.m[3][2] - hand->prevmtx.m[3][2]) / g_Vars.lvupdate240f;
|
||||
|
||||
mtx00017588(hand->posmtx.m, sp44.m);
|
||||
mtx4RotateVecInPlace(&sp44, &sp84);
|
||||
|
||||
hand->unk0d20.f[0] += sp84.x * 0.3f;
|
||||
hand->unk0d20.f[1] += sp84.y * 0.3f;
|
||||
hand->unk0d20.f[2] += sp84.z * 0.3f;
|
||||
}
|
||||
|
||||
hand->unk0d0e_00 = 2;
|
||||
break;
|
||||
case 2:
|
||||
// d28
|
||||
lvupdate = g_Vars.lvupdate240f;
|
||||
|
||||
if (g_Vars.currentplayer->isdead && lvupdate > 1.5f) {
|
||||
lvupdate = 1.5f;
|
||||
}
|
||||
|
||||
newval = hand->unk0d20.f[1] - lvupdate * 0.2777778f;
|
||||
|
||||
if (hand->unk0d18 < hand->unk0d10) {
|
||||
hand->unk0d0e_00 = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
sumval = hand->unk0d20.f[1] + newval;
|
||||
|
||||
hand->unk0d20.f[1] = newval;
|
||||
|
||||
hand->unk0d14 += lvupdate * hand->unk0d20.f[0];
|
||||
hand->unk0d18 += lvupdate * 0.5f * sumval;
|
||||
hand->unk0d1c += lvupdate * hand->unk0d20.f[2];
|
||||
|
||||
for (i = 0; i < g_Vars.lvupdate240; i++) {
|
||||
mtx00016110(hand->unk0d50, hand->unk0d2c);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bgun0f0a4e44(struct hand *hand, struct weapon *weapondef, struct modelfiledata *modeldef,
|
||||
struct weaponfunc *funcdef, s32 maxburst, u8 *allocation, s32 weaponnum,
|
||||
@@ -12345,6 +12349,7 @@ u32 var800702d4 = 0x00000000;
|
||||
u32 var800702d8 = 0x00000000;
|
||||
u32 var800702dc = 0x00000001;
|
||||
|
||||
#if MATCHING
|
||||
#if PAL
|
||||
GLOBAL_ASM(
|
||||
glabel bgunRender
|
||||
@@ -14860,261 +14865,262 @@ glabel var7f1aca90
|
||||
/* f0a5a84: 27bd0148 */ addiu $sp,$sp,0x148
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
// Mismatch: Goal uses different codegen for accessing vertices
|
||||
//void bgunRender(Gfx **gdlptr)
|
||||
//{
|
||||
// Gfx *gdl = *gdlptr;
|
||||
// struct modelrenderdata renderdata = {NULL, true, 3}; // 10c
|
||||
// struct player *player;
|
||||
// s32 i;
|
||||
//
|
||||
// static bool renderhand = true; // var800702dc
|
||||
//
|
||||
// player = g_Vars.currentplayer;
|
||||
//
|
||||
// if (player->visionmode == VISIONMODE_XRAY) {
|
||||
// for (i = 0; i < 2; i++) {
|
||||
// if (g_Vars.currentplayer->hands[i].firedrocket) {
|
||||
// g_Vars.currentplayer->hands[i].rocket = NULL;
|
||||
// }
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// gdl = mblurRender(gdl);
|
||||
// gdl = vi0000b280(gdl);
|
||||
// gdl = vi0000b1d0(gdl);
|
||||
//
|
||||
// gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(),
|
||||
// viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight());
|
||||
//
|
||||
// gdl = vi0000aca4(gdl, 1.5, 1000);
|
||||
//
|
||||
// if (g_Vars.currentplayer->teleportstate != TELEPORTSTATE_INACTIVE) {
|
||||
// f32 f2;
|
||||
//
|
||||
// if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
// f2 = player0f0bd358() * 1.3333334f;
|
||||
// } else {
|
||||
// f2 = player0f0bd358();
|
||||
// }
|
||||
//
|
||||
// gdl = vi0000b0e8(gdl, 60, f2);
|
||||
// }
|
||||
//
|
||||
// if (PLAYERCOUNT() == 1 && IS8MB()) {
|
||||
// gdl = lasersightRenderBeam(gdl);
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < 2; i++) {
|
||||
// struct hand *hand;
|
||||
// s32 j;
|
||||
// s32 alpha;
|
||||
// s32 weaponnum; // ec
|
||||
// struct modelnode *node; // e8
|
||||
// u32 colour; // e4
|
||||
//
|
||||
// hand = player->hands + i;
|
||||
//
|
||||
// weaponnum = bgunGetWeaponNum2(i);
|
||||
//
|
||||
// if (hand->visible) {
|
||||
// gdl = beamRender(gdl, &hand->beam, 0, 0);
|
||||
//
|
||||
// if (weaponHasFlag(hand->gset.weaponnum, WEAPONFLAG_00008000)) {
|
||||
// gSPNumLights(gdl++, 1);
|
||||
// gSPLight(gdl++, &var80070098, 1);
|
||||
// gSPLight(gdl++, &var80070090, 2);
|
||||
// gSPLookAt(gdl++, camGetLookAt());
|
||||
// }
|
||||
//
|
||||
// gSPPerspNormalize(gdl++, mtx00016dcc(0, 300));
|
||||
//
|
||||
// // There is support for guns having a TV screen on them
|
||||
// // but no guns have this model part so it's not used.
|
||||
// node = modelGetPart(hand->gunmodel.filedata, MODELPART_0010);
|
||||
//
|
||||
// if (node) {
|
||||
// union modelrwdata *rwdata = modelGetNodeRwData(&hand->gunmodel, modelGetPart(hand->gunmodel.filedata, MODELPART_0011));
|
||||
//
|
||||
// if (rwdata) {
|
||||
// rwdata->toggle.visible = true;
|
||||
// }
|
||||
//
|
||||
// gdl = tvscreenRender(&hand->gunmodel, node, &var8009cf88, gdl, 0, 1);
|
||||
// }
|
||||
//
|
||||
// renderdata.gdl = gdl;
|
||||
// renderdata.unk30 = 4;
|
||||
//
|
||||
// if (USINGDEVICE(DEVICE_NIGHTVISION) || USINGDEVICE(DEVICE_IRSCANNER)) {
|
||||
// // 67c
|
||||
// u8 *col = player->gunshadecol;
|
||||
// u32 shade;
|
||||
// s32 spb0[4];
|
||||
// s32 spa0[4];
|
||||
//
|
||||
// if (col[0] > col[1] && col[0] > col[2]) {
|
||||
// shade = col[0];
|
||||
// } else if (col[1] > col[2]) {
|
||||
// shade = col[1];
|
||||
// } else {
|
||||
// shade = col[2];
|
||||
// }
|
||||
//
|
||||
// renderdata.envcolour = (shade << 24 | shade << 16 | shade << 8) + col[3];
|
||||
//
|
||||
// if (USINGDEVICE(DEVICE_NIGHTVISION)) {
|
||||
// spb0[0] = var8009caef;
|
||||
// spb0[1] = var8009caef;
|
||||
// spb0[2] = var8009caef;
|
||||
// spb0[3] = var8009caf0;
|
||||
//
|
||||
// colour = (spb0[0] << 24 | spb0[1] << 16 | spb0[2] << 8) + spb0[3];
|
||||
// } else if (USINGDEVICE(DEVICE_IRSCANNER)) {
|
||||
// spa0[0] = 0xff;
|
||||
// spa0[1] = 0;
|
||||
// spa0[2] = 0;
|
||||
// spa0[3] = 0x80;
|
||||
//
|
||||
// colour = (spa0[0] << 24 | spa0[1] << 16 | spa0[2] << 8) + spa0[3];
|
||||
// }
|
||||
//
|
||||
// if (weaponnum == WEAPON_UNARMED) {
|
||||
// renderdata.envcolour = colour;
|
||||
// }
|
||||
// } else {
|
||||
// renderdata.envcolour = player->gunshadecol[0] << 24 | player->gunshadecol[1] << 16 | player->gunshadecol[2] << 8 | player->gunshadecol[3];
|
||||
// colour = renderdata.envcolour;
|
||||
//
|
||||
// // 838
|
||||
// if (hand->gset.weaponnum == WEAPON_MAULER) {
|
||||
// u32 weight = hand->matmot1 * 50.0f;
|
||||
// renderdata.envcolour = colourBlend(0xff00007f, renderdata.envcolour, weight);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Apply transparency based on player's cloak
|
||||
// alpha = chrGetCloakAlpha(player->prop->chr);
|
||||
//
|
||||
// if (alpha < 255) {
|
||||
// colour = (s32) (alpha * 0.74509805f) + 0x41;
|
||||
// renderdata.unk30 = 5;
|
||||
// renderdata.fogcolour = renderdata.envcolour;
|
||||
// renderdata.envcolour = colour;
|
||||
// }
|
||||
//
|
||||
// renderdata.zbufferenabled = true;
|
||||
//
|
||||
// mtx00016760();
|
||||
//
|
||||
// // Render rocket launcher's rocket if it's in Jo's hand or in the launcher
|
||||
// if (hand->rocket) {
|
||||
// struct model *rocketmodel = hand->rocket->base.model; // 98
|
||||
// bool sp94 = false;
|
||||
//
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// if (rocketmodel && rocketmodel->filedata) {
|
||||
// sp94 = true;
|
||||
//
|
||||
// modelRender(&renderdata, rocketmodel);
|
||||
//
|
||||
// func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices);
|
||||
//
|
||||
// if (hand->firedrocket) {
|
||||
// hand->rocket = NULL;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (sp94);
|
||||
//#else
|
||||
// modelRender(&renderdata, rocketmodel);
|
||||
//
|
||||
// func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices);
|
||||
//
|
||||
// if (hand->firedrocket) {
|
||||
// hand->rocket = NULL;
|
||||
// }
|
||||
//#endif
|
||||
// }
|
||||
//
|
||||
// if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) {
|
||||
// gSPClearGeometryMode(renderdata.gdl++, G_CULL_BOTH);
|
||||
//
|
||||
// if (i == HAND_RIGHT) {
|
||||
// renderdata.cullmode = CULLMODE_BACK;
|
||||
// } else {
|
||||
// renderdata.cullmode = CULLMODE_FRONT;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Slide the laser's liquid texture
|
||||
// if (PLAYERCOUNT() == 1) {
|
||||
// node = modelGetPart(hand->gunmodel.filedata, MODELPART_LASER_0041);
|
||||
//
|
||||
// // a5c
|
||||
// if (node) {
|
||||
// struct modelrodata_gundl *rodata;
|
||||
// rodata = &node->rodata->gundl;
|
||||
//
|
||||
// for (j = 0; j < rodata->numvertices; j++) {
|
||||
// // a7c
|
||||
// s32 stack[2];
|
||||
// s32 k;
|
||||
//
|
||||
// (rodata->vertices + j)->t -= g_Vars.lvupdate240 * PALUP(25);
|
||||
//
|
||||
// if ((rodata->vertices + j)->t < -0x6000) {
|
||||
// for (k = 0; k < rodata->numvertices; k++) {
|
||||
// (rodata->vertices + k)->t += 0x2000;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Render the gun
|
||||
// modelRender(&renderdata, &hand->gunmodel);
|
||||
//
|
||||
// // Render the hand
|
||||
// if (player->gunctrl.handmodeldef && renderhand) {
|
||||
// s32 prevcolour = renderdata.envcolour; // 7c
|
||||
//
|
||||
// hand->handmodel.matrices = hand->gunmodel.matrices;
|
||||
//
|
||||
// model0001cc20(&hand->handmodel);
|
||||
//
|
||||
// renderdata.envcolour = colour;
|
||||
// modelRender(&renderdata, &hand->handmodel);
|
||||
// renderdata.envcolour = prevcolour;
|
||||
// }
|
||||
//
|
||||
// // Clean up
|
||||
// gdl = renderdata.gdl;
|
||||
//
|
||||
// if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) {
|
||||
// gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
// }
|
||||
//
|
||||
// func0f0c33f0(hand->gunmodel.matrices, hand->gunmodel.filedata->nummatrices);
|
||||
// mtx00016784();
|
||||
//
|
||||
// gSPPerspNormalize(gdl++, viGetPerspScale());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// casingsRender(&gdl);
|
||||
// mblur0f176298();
|
||||
//
|
||||
// gdl = mblur0f1762ac(gdl);
|
||||
// gdl = vi0000b1d0(gdl);
|
||||
//
|
||||
// gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(),
|
||||
// viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight());
|
||||
//
|
||||
// *gdlptr = gdl;
|
||||
//}
|
||||
void bgunRender(Gfx **gdlptr)
|
||||
{
|
||||
Gfx *gdl = *gdlptr;
|
||||
struct modelrenderdata renderdata = {NULL, true, 3}; // 10c
|
||||
struct player *player;
|
||||
s32 i;
|
||||
|
||||
static bool renderhand = true; // var800702dc
|
||||
|
||||
player = g_Vars.currentplayer;
|
||||
|
||||
if (player->visionmode == VISIONMODE_XRAY) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (g_Vars.currentplayer->hands[i].firedrocket) {
|
||||
g_Vars.currentplayer->hands[i].rocket = NULL;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
gdl = mblurRender(gdl);
|
||||
gdl = vi0000b280(gdl);
|
||||
gdl = vi0000b1d0(gdl);
|
||||
|
||||
gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(),
|
||||
viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight());
|
||||
|
||||
gdl = vi0000aca4(gdl, 1.5, 1000);
|
||||
|
||||
if (g_Vars.currentplayer->teleportstate != TELEPORTSTATE_INACTIVE) {
|
||||
f32 f2;
|
||||
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
f2 = player0f0bd358() * 1.3333334f;
|
||||
} else {
|
||||
f2 = player0f0bd358();
|
||||
}
|
||||
|
||||
gdl = vi0000b0e8(gdl, 60, f2);
|
||||
}
|
||||
|
||||
if (PLAYERCOUNT() == 1 && IS8MB()) {
|
||||
gdl = lasersightRenderBeam(gdl);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
struct hand *hand;
|
||||
s32 j;
|
||||
s32 alpha;
|
||||
s32 weaponnum; // ec
|
||||
struct modelnode *node; // e8
|
||||
u32 colour; // e4
|
||||
|
||||
hand = player->hands + i;
|
||||
|
||||
weaponnum = bgunGetWeaponNum2(i);
|
||||
|
||||
if (hand->visible) {
|
||||
gdl = beamRender(gdl, &hand->beam, 0, 0);
|
||||
|
||||
if (weaponHasFlag(hand->gset.weaponnum, WEAPONFLAG_00008000)) {
|
||||
gSPNumLights(gdl++, 1);
|
||||
gSPLight(gdl++, &var80070098, 1);
|
||||
gSPLight(gdl++, &var80070090, 2);
|
||||
gSPLookAt(gdl++, camGetLookAt());
|
||||
}
|
||||
|
||||
gSPPerspNormalize(gdl++, mtx00016dcc(0, 300));
|
||||
|
||||
// There is support for guns having a TV screen on them
|
||||
// but no guns have this model part so it's not used.
|
||||
node = modelGetPart(hand->gunmodel.filedata, MODELPART_0010);
|
||||
|
||||
if (node) {
|
||||
union modelrwdata *rwdata = modelGetNodeRwData(&hand->gunmodel, modelGetPart(hand->gunmodel.filedata, MODELPART_0011));
|
||||
|
||||
if (rwdata) {
|
||||
rwdata->toggle.visible = true;
|
||||
}
|
||||
|
||||
gdl = tvscreenRender(&hand->gunmodel, node, &var8009cf88, gdl, 0, 1);
|
||||
}
|
||||
|
||||
renderdata.gdl = gdl;
|
||||
renderdata.unk30 = 4;
|
||||
|
||||
if (USINGDEVICE(DEVICE_NIGHTVISION) || USINGDEVICE(DEVICE_IRSCANNER)) {
|
||||
// 67c
|
||||
u8 *col = player->gunshadecol;
|
||||
u32 shade;
|
||||
s32 spb0[4];
|
||||
s32 spa0[4];
|
||||
|
||||
if (col[0] > col[1] && col[0] > col[2]) {
|
||||
shade = col[0];
|
||||
} else if (col[1] > col[2]) {
|
||||
shade = col[1];
|
||||
} else {
|
||||
shade = col[2];
|
||||
}
|
||||
|
||||
renderdata.envcolour = (shade << 24 | shade << 16 | shade << 8) + col[3];
|
||||
|
||||
if (USINGDEVICE(DEVICE_NIGHTVISION)) {
|
||||
spb0[0] = var8009caef;
|
||||
spb0[1] = var8009caef;
|
||||
spb0[2] = var8009caef;
|
||||
spb0[3] = var8009caf0;
|
||||
|
||||
colour = (spb0[0] << 24 | spb0[1] << 16 | spb0[2] << 8) + spb0[3];
|
||||
} else if (USINGDEVICE(DEVICE_IRSCANNER)) {
|
||||
spa0[0] = 0xff;
|
||||
spa0[1] = 0;
|
||||
spa0[2] = 0;
|
||||
spa0[3] = 0x80;
|
||||
|
||||
colour = (spa0[0] << 24 | spa0[1] << 16 | spa0[2] << 8) + spa0[3];
|
||||
}
|
||||
|
||||
if (weaponnum == WEAPON_UNARMED) {
|
||||
renderdata.envcolour = colour;
|
||||
}
|
||||
} else {
|
||||
renderdata.envcolour = player->gunshadecol[0] << 24 | player->gunshadecol[1] << 16 | player->gunshadecol[2] << 8 | player->gunshadecol[3];
|
||||
colour = renderdata.envcolour;
|
||||
|
||||
// 838
|
||||
if (hand->gset.weaponnum == WEAPON_MAULER) {
|
||||
u32 weight = hand->matmot1 * 50.0f;
|
||||
renderdata.envcolour = colourBlend(0xff00007f, renderdata.envcolour, weight);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply transparency based on player's cloak
|
||||
alpha = chrGetCloakAlpha(player->prop->chr);
|
||||
|
||||
if (alpha < 255) {
|
||||
colour = (s32) (alpha * 0.74509805f) + 0x41;
|
||||
renderdata.unk30 = 5;
|
||||
renderdata.fogcolour = renderdata.envcolour;
|
||||
renderdata.envcolour = colour;
|
||||
}
|
||||
|
||||
renderdata.zbufferenabled = true;
|
||||
|
||||
mtx00016760();
|
||||
|
||||
// Render rocket launcher's rocket if it's in Jo's hand or in the launcher
|
||||
if (hand->rocket) {
|
||||
struct model *rocketmodel = hand->rocket->base.model; // 98
|
||||
bool sp94 = false;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (rocketmodel && rocketmodel->filedata) {
|
||||
sp94 = true;
|
||||
|
||||
modelRender(&renderdata, rocketmodel);
|
||||
|
||||
func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices);
|
||||
|
||||
if (hand->firedrocket) {
|
||||
hand->rocket = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (sp94);
|
||||
#else
|
||||
modelRender(&renderdata, rocketmodel);
|
||||
|
||||
func0f0c33f0(rocketmodel->matrices, rocketmodel->filedata->nummatrices);
|
||||
|
||||
if (hand->firedrocket) {
|
||||
hand->rocket = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) {
|
||||
gSPClearGeometryMode(renderdata.gdl++, G_CULL_BOTH);
|
||||
|
||||
if (i == HAND_RIGHT) {
|
||||
renderdata.cullmode = CULLMODE_BACK;
|
||||
} else {
|
||||
renderdata.cullmode = CULLMODE_FRONT;
|
||||
}
|
||||
}
|
||||
|
||||
// Slide the laser's liquid texture
|
||||
if (PLAYERCOUNT() == 1) {
|
||||
node = modelGetPart(hand->gunmodel.filedata, MODELPART_LASER_0041);
|
||||
|
||||
// a5c
|
||||
if (node) {
|
||||
struct modelrodata_gundl *rodata;
|
||||
rodata = &node->rodata->gundl;
|
||||
|
||||
for (j = 0; j < rodata->numvertices; j++) {
|
||||
// a7c
|
||||
s32 stack[2];
|
||||
s32 k;
|
||||
|
||||
(rodata->vertices + j)->t -= g_Vars.lvupdate240 * PALUP(25);
|
||||
|
||||
if ((rodata->vertices + j)->t < -0x6000) {
|
||||
for (k = 0; k < rodata->numvertices; k++) {
|
||||
(rodata->vertices + k)->t += 0x2000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render the gun
|
||||
modelRender(&renderdata, &hand->gunmodel);
|
||||
|
||||
// Render the hand
|
||||
if (player->gunctrl.handmodeldef && renderhand) {
|
||||
s32 prevcolour = renderdata.envcolour; // 7c
|
||||
|
||||
hand->handmodel.matrices = hand->gunmodel.matrices;
|
||||
|
||||
model0001cc20(&hand->handmodel);
|
||||
|
||||
renderdata.envcolour = colour;
|
||||
modelRender(&renderdata, &hand->handmodel);
|
||||
renderdata.envcolour = prevcolour;
|
||||
}
|
||||
|
||||
// Clean up
|
||||
gdl = renderdata.gdl;
|
||||
|
||||
if (weaponHasFlag(weaponnum, WEAPONFLAG_DUALFLIP)) {
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
}
|
||||
|
||||
func0f0c33f0(hand->gunmodel.matrices, hand->gunmodel.filedata->nummatrices);
|
||||
mtx00016784();
|
||||
|
||||
gSPPerspNormalize(gdl++, viGetPerspScale());
|
||||
}
|
||||
}
|
||||
|
||||
casingsRender(&gdl);
|
||||
mblur0f176298();
|
||||
|
||||
gdl = mblur0f1762ac(gdl);
|
||||
gdl = vi0000b1d0(gdl);
|
||||
|
||||
gDPSetScissor(gdl++, G_SC_NON_INTERLACE, viGetViewLeft(), viGetViewTop(),
|
||||
viGetViewLeft() + viGetViewWidth(), viGetViewTop() + viGetViewHeight());
|
||||
|
||||
*gdlptr = gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Find and return an available audio handle out of a pool of four.
|
||||
|
||||
+318
-308
@@ -825,6 +825,7 @@ s32 func0f14ad38(s32 device)
|
||||
const char var7f1b6688[] = "Cam_ClearCameraLoadBuffer -> Camera=%d\n";
|
||||
const char var7f1b66b0[] = "Cam_StartTemp : Need %u bytes for temp cam images buffer\n";
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel func0f14ad58
|
||||
.late_rodata
|
||||
@@ -916,62 +917,63 @@ glabel var7f1b72e8
|
||||
/* f14ae98: 03e00008 */ jr $ra
|
||||
/* f14ae9c: e4500048 */ swc1 $f16,0x48($v0)
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: need to fiddle with the order of these
|
||||
//void func0f14ad58(s32 index)
|
||||
//{
|
||||
// struct var8007f8dc *thing = &var8007f8dc[index];
|
||||
//
|
||||
// thing->unk000 = 0;
|
||||
// thing->unk004 = 1.0f;
|
||||
// thing->unk008 = 1.0f;
|
||||
// thing->unk050 = 110.0f;
|
||||
// thing->unk00c = 0.1f;
|
||||
// thing->unk010 = 0.2f;
|
||||
// thing->unk054 = 30;
|
||||
// thing->unk058 = -1;
|
||||
// thing->unk068 = -1;
|
||||
// thing->unk06c = 0;
|
||||
// thing->unk070 = 0;
|
||||
// thing->unk074 = 0;
|
||||
// thing->unk084 = 0;
|
||||
// thing->unk024 = 1.0f;
|
||||
// thing->unk028 = 1.0f;
|
||||
// thing->unk03c = 1.0f;
|
||||
// thing->unk014 = 0.0f;
|
||||
// thing->unk018 = 0.0f;
|
||||
// thing->unk01c = 0.0f;
|
||||
// thing->unk020 = 0.0f;
|
||||
// thing->unk02c = 0.0f;
|
||||
// thing->unk030 = 0.0f;
|
||||
// thing->unk034 = 0.0f;
|
||||
// thing->unk038 = 0.0f;
|
||||
// thing->unk040 = 0.0f;
|
||||
// thing->unk044 = 30.0f;
|
||||
// thing->unk060 = 6;
|
||||
// thing->unk08c = 14;
|
||||
// thing->unk088 = 1;
|
||||
// thing->unk090 = 0;
|
||||
// thing->unk064 = 0;
|
||||
// thing->unk0f4 = 0;
|
||||
// thing->unk094 = 0;
|
||||
// thing->unk0f8 = 0;
|
||||
// thing->unk0fc = 3;
|
||||
// thing->unk100 = 3;
|
||||
// thing->unk0e0 = 0;
|
||||
// thing->unk0e4 = 0;
|
||||
// thing->unk0e8 = 0;
|
||||
// thing->unk0ec = 0;
|
||||
// thing->unk0f0 = 0;
|
||||
// thing->unk078 = 0;
|
||||
// thing->unk07c = 0;
|
||||
// thing->unk05c = var8007f940;
|
||||
// thing->unk048 = 1.0f;
|
||||
// thing->unk0d4_00 = false;
|
||||
// thing->unk0d4_01 = false;
|
||||
// thing->unk0d4_02 = false;
|
||||
// thing->unk0d4_04 = true;
|
||||
//}
|
||||
void func0f14ad58(s32 index)
|
||||
{
|
||||
struct var8007f8dc *thing = &var8007f8dc[index];
|
||||
|
||||
thing->unk000 = 0;
|
||||
thing->unk004 = 1.0f;
|
||||
thing->unk008 = 1.0f;
|
||||
thing->unk050 = 110.0f;
|
||||
thing->unk00c = 0.1f;
|
||||
thing->unk010 = 0.2f;
|
||||
thing->unk054 = 30;
|
||||
thing->unk058 = -1;
|
||||
thing->unk068 = -1;
|
||||
thing->unk06c = 0;
|
||||
thing->unk070 = 0;
|
||||
thing->unk074 = 0;
|
||||
thing->unk084 = 0;
|
||||
thing->unk024 = 1.0f;
|
||||
thing->unk028 = 1.0f;
|
||||
thing->unk03c = 1.0f;
|
||||
thing->unk014 = 0.0f;
|
||||
thing->unk018 = 0.0f;
|
||||
thing->unk01c = 0.0f;
|
||||
thing->unk020 = 0.0f;
|
||||
thing->unk02c = 0.0f;
|
||||
thing->unk030 = 0.0f;
|
||||
thing->unk034 = 0.0f;
|
||||
thing->unk038 = 0.0f;
|
||||
thing->unk040 = 0.0f;
|
||||
thing->unk044 = 30.0f;
|
||||
thing->unk060 = 6;
|
||||
thing->unk08c = 14;
|
||||
thing->unk088 = 1;
|
||||
thing->unk090 = 0;
|
||||
thing->unk064 = 0;
|
||||
thing->unk0f4 = 0;
|
||||
thing->unk094 = 0;
|
||||
thing->unk0f8 = 0;
|
||||
thing->unk0fc = 3;
|
||||
thing->unk100 = 3;
|
||||
thing->unk0e0 = 0;
|
||||
thing->unk0e4 = 0;
|
||||
thing->unk0e8 = 0;
|
||||
thing->unk0ec = 0;
|
||||
thing->unk0f0 = 0;
|
||||
thing->unk078 = 0;
|
||||
thing->unk07c = 0;
|
||||
thing->unk05c = var8007f904[30];
|
||||
thing->unk048 = 1.0f;
|
||||
thing->unk0d4_00 = false;
|
||||
thing->unk0d4_01 = false;
|
||||
thing->unk0d4_02 = false;
|
||||
thing->unk0d4_04 = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool func0f14aea0(s32 device)
|
||||
{
|
||||
@@ -1630,6 +1632,7 @@ void func0f14c4c0(s32 index)
|
||||
menuSetBanner(MENUBANNER_DOWNLOADINGIMAGE, false);
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel func0f14c50c
|
||||
/* f14c50c: 27bdffe0 */ addiu $sp,$sp,-32
|
||||
@@ -1792,68 +1795,69 @@ glabel func0f14c50c
|
||||
/* f14c754: 03e00008 */ jr $ra
|
||||
/* f14c758: 27bd0020 */ addiu $sp,$sp,0x20
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Goal loads var8007f8e0 into a2 then does nothing with it.
|
||||
// The below optimises it out.
|
||||
//void func0f14c50c(struct var8007f8e0 *dst, struct var8007f8e0 *src, u32 line, char *file)
|
||||
//{
|
||||
// struct var8007f8e0 *thing = var8007f8e0;
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
// s32 row = 0;
|
||||
//
|
||||
// for (i = 0; i < 22; i++);
|
||||
//
|
||||
// dst->unk3f4_00 = src->unk3f4_00;
|
||||
// dst->unk3f4_01 = src->unk3f4_01;
|
||||
// dst->unk3f4_02 = src->unk3f4_02;
|
||||
// dst->unk3f4_03 = src->unk3f4_03;
|
||||
// dst->colournum = src->colournum;
|
||||
// dst->stylenum = src->stylenum;
|
||||
// dst->unk3a4 = src->unk3a4;
|
||||
// dst->unk3b4 = src->unk3b4;
|
||||
// dst->unk3b8 = src->unk3b8;
|
||||
// dst->unk3bc = src->unk3bc;
|
||||
// dst->unk3c0 = src->unk3c0;
|
||||
// dst->unk3c4 = src->unk3c4;
|
||||
// dst->unk3c8 = src->unk3c8;
|
||||
// dst->unk3cc = src->unk3cc;
|
||||
// dst->unk3ec = src->unk3ec;
|
||||
// dst->unk3f0 = src->unk3f0;
|
||||
//
|
||||
// dst->fileguid.fileid = src->fileguid.fileid;
|
||||
// dst->fileguid.deviceserial = src->fileguid.deviceserial;
|
||||
//
|
||||
// for (i = 0; i != 7; i++) {
|
||||
// dst->unk3d0[i] = src->unk3d0[i];
|
||||
// }
|
||||
//
|
||||
// if (dst->unk01c) {
|
||||
// s32 i;
|
||||
//
|
||||
// for (i = 63; i != -1; i--) {
|
||||
// for (j = 0; j != 64; j++) {
|
||||
// s32 fudge = (i & 1) ? ((j & 4) ? -4 : 4) : 0;
|
||||
//
|
||||
// dst->unk01c[row * 64 + j] = src->unk004.textureptr[i * 64 + j + fudge];
|
||||
// }
|
||||
//
|
||||
// row++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// func0f14c75c(&dst->unk004, &src->unk004);
|
||||
//
|
||||
// if (dst->unk010.textureptr && src->unk010.textureptr) {
|
||||
// func0f14c75c(&dst->unk010, &src->unk010);
|
||||
// }
|
||||
//
|
||||
// if (src->unk3f4_04) {
|
||||
// for (i = 0; i < 1024; i++) {
|
||||
// dst->unk020[i] = src->unk020[i];
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void func0f14c50c(struct var8007f8e0 *dst, struct var8007f8e0 *src, u32 line, char *file)
|
||||
{
|
||||
struct var8007f8e0 *thing = var8007f8e0;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 row = 0;
|
||||
|
||||
for (i = 0; i < 22; i++);
|
||||
|
||||
dst->unk3f4_00 = src->unk3f4_00;
|
||||
dst->unk3f4_01 = src->unk3f4_01;
|
||||
dst->unk3f4_02 = src->unk3f4_02;
|
||||
dst->unk3f4_03 = src->unk3f4_03;
|
||||
dst->colournum = src->colournum;
|
||||
dst->stylenum = src->stylenum;
|
||||
dst->unk3a4 = src->unk3a4;
|
||||
dst->unk3b4 = src->unk3b4;
|
||||
dst->unk3b8 = src->unk3b8;
|
||||
dst->unk3bc = src->unk3bc;
|
||||
dst->unk3c0 = src->unk3c0;
|
||||
dst->unk3c4 = src->unk3c4;
|
||||
dst->unk3c8 = src->unk3c8;
|
||||
dst->unk3cc = src->unk3cc;
|
||||
dst->unk3ec = src->unk3ec;
|
||||
dst->unk3f0 = src->unk3f0;
|
||||
|
||||
dst->fileguid.fileid = src->fileguid.fileid;
|
||||
dst->fileguid.deviceserial = src->fileguid.deviceserial;
|
||||
|
||||
for (i = 0; i != 7; i++) {
|
||||
dst->unk3d0[i] = src->unk3d0[i];
|
||||
}
|
||||
|
||||
if (dst->unk01c) {
|
||||
s32 i;
|
||||
|
||||
for (i = 63; i != -1; i--) {
|
||||
for (j = 0; j != 64; j++) {
|
||||
s32 fudge = (i & 1) ? ((j & 4) ? -4 : 4) : 0;
|
||||
|
||||
dst->unk01c[row * 64 + j] = src->unk004.textureptr[i * 64 + j + fudge];
|
||||
}
|
||||
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
func0f14c75c(&dst->unk004, &src->unk004);
|
||||
|
||||
if (dst->unk010.textureptr && src->unk010.textureptr) {
|
||||
func0f14c75c(&dst->unk010, &src->unk010);
|
||||
}
|
||||
|
||||
if (src->unk3f4_04) {
|
||||
for (i = 0; i < 1024; i++) {
|
||||
dst->unk020[i] = src->unk020[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void func0f14c75c(struct textureconfig *arg0, struct textureconfig *arg1)
|
||||
{
|
||||
@@ -2112,6 +2116,7 @@ void func0f14d2c8(u8 *arg0, u8 *arg1)
|
||||
}
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel func0f14d4f0
|
||||
/* f14d4f0: 27bdff30 */ addiu $sp,$sp,-208
|
||||
@@ -2289,75 +2294,76 @@ u32 var8007fa50 = 0x3c5a0169;
|
||||
u32 var8007fa54 = 0x3cb3b752;
|
||||
u32 var8007fa58 = 0x3c5a0169;
|
||||
u32 var8007fa5c = 0x3b42938e;
|
||||
|
||||
#else
|
||||
// Mismatch: Different codegen. The function is generating a 64x64 thumbnail
|
||||
// from a 128x128 source, and there's lots of different ways that variables can
|
||||
// be used to do this.
|
||||
//void func0f14d4f0(u8 *arg0, u8 *arg1)
|
||||
//{
|
||||
// f32 *s1 = (f32 *) var800a45a0->unk474;
|
||||
// f32 *s0 = (f32 *) var800a45a0->unk478;
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
// s32 x;
|
||||
// s32 y;
|
||||
//
|
||||
// f32 sp50[] = {
|
||||
// 0.0029690000228584f,
|
||||
// 0.013306000269949f,
|
||||
// 0.021937999874353f,
|
||||
// 0.013306000269949f,
|
||||
// 0.0029690000228584f,
|
||||
// 0.013306000269949f,
|
||||
// 0.059634000062943f,
|
||||
// 0.098319999873638f,
|
||||
// 0.059634000062943f,
|
||||
// 0.013306000269949f,
|
||||
// 0.021937999874353f,
|
||||
// 0.098319999873638f,
|
||||
// 0.16210299730301f,
|
||||
// 0.098319999873638f,
|
||||
// 0.021937999874353f,
|
||||
// 0.013306000269949f,
|
||||
// 0.059634000062943f,
|
||||
// 0.098319999873638f,
|
||||
// 0.059634000062943f,
|
||||
// 0.013306000269949f,
|
||||
// 0.0029690000228584f,
|
||||
// 0.013306000269949f,
|
||||
// 0.021937999874353f,
|
||||
// 0.013306000269949f,
|
||||
// 0.0029690000228584f,
|
||||
// };
|
||||
//
|
||||
// for (i = 0; i < 128; i++) {
|
||||
// for (j = 0; j < 128; j++) {
|
||||
// s1[i * 128 + j] = arg0[i * 128 + j];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// func0f14d8d8(s1, s0, 128, sp50, 5);
|
||||
//
|
||||
// for (y = 0; y < 63; y++) {
|
||||
// for (x = 0; x < 63; x++) {
|
||||
// f32 value = (
|
||||
// s0[y * 2 * 128 + x * 2 + 0] +
|
||||
// s0[y * 2 * 128 + x * 2 + 1] +
|
||||
// s0[y * 2 * 128 + x * 2 + 128] +
|
||||
// s0[y * 2 * 128 + x * 2 + 129]) * 0.25f;
|
||||
//
|
||||
// if (value < 0.0f) {
|
||||
// value = 0.0f;
|
||||
// }
|
||||
//
|
||||
// if (value > 255.0f) {
|
||||
// value = 255.0f;
|
||||
// }
|
||||
//
|
||||
// arg1[y * 64 + x] = value;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void func0f14d4f0(u8 *arg0, u8 *arg1)
|
||||
{
|
||||
f32 *s1 = (f32 *) var800a45a0->unk474;
|
||||
f32 *s0 = (f32 *) var800a45a0->unk478;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
f32 sp50[] = {
|
||||
0.0029690000228584f,
|
||||
0.013306000269949f,
|
||||
0.021937999874353f,
|
||||
0.013306000269949f,
|
||||
0.0029690000228584f,
|
||||
0.013306000269949f,
|
||||
0.059634000062943f,
|
||||
0.098319999873638f,
|
||||
0.059634000062943f,
|
||||
0.013306000269949f,
|
||||
0.021937999874353f,
|
||||
0.098319999873638f,
|
||||
0.16210299730301f,
|
||||
0.098319999873638f,
|
||||
0.021937999874353f,
|
||||
0.013306000269949f,
|
||||
0.059634000062943f,
|
||||
0.098319999873638f,
|
||||
0.059634000062943f,
|
||||
0.013306000269949f,
|
||||
0.0029690000228584f,
|
||||
0.013306000269949f,
|
||||
0.021937999874353f,
|
||||
0.013306000269949f,
|
||||
0.0029690000228584f,
|
||||
};
|
||||
|
||||
for (i = 0; i < 128; i++) {
|
||||
for (j = 0; j < 128; j++) {
|
||||
s1[i * 128 + j] = arg0[i * 128 + j];
|
||||
}
|
||||
}
|
||||
|
||||
func0f14d8d8(s1, s0, 128, sp50, 5);
|
||||
|
||||
for (y = 0; y < 63; y++) {
|
||||
for (x = 0; x < 63; x++) {
|
||||
f32 value = (
|
||||
s0[y * 2 * 128 + x * 2 + 0] +
|
||||
s0[y * 2 * 128 + x * 2 + 1] +
|
||||
s0[y * 2 * 128 + x * 2 + 128] +
|
||||
s0[y * 2 * 128 + x * 2 + 129]) * 0.25f;
|
||||
|
||||
if (value < 0.0f) {
|
||||
value = 0.0f;
|
||||
}
|
||||
|
||||
if (value > 255.0f) {
|
||||
value = 255.0f;
|
||||
}
|
||||
|
||||
arg1[y * 64 + x] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void func0f14d714(u8 *arg0, u8 *arg1)
|
||||
{
|
||||
@@ -3250,6 +3256,7 @@ void func0f14f4e4(struct var8007f8e0 *arg0)
|
||||
}
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel func0f14f510
|
||||
.late_rodata
|
||||
@@ -3386,35 +3393,36 @@ glabel var7f1b7364
|
||||
/* f14f6f8: 03e00008 */ jr $ra
|
||||
/* f14f6fc: 27bd0060 */ addiu $sp,$sp,0x60
|
||||
);
|
||||
#else
|
||||
void func0f14f510(s32 arg0)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
//void func0f14f510(s32 arg0)
|
||||
//{
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
//
|
||||
// for (i = 0; i < 8; i++) {
|
||||
// s32 tmp = (i + 1) * arg0 + 1;
|
||||
//
|
||||
// for (j = 0; j < 8; j++) {
|
||||
// var800a45a0->unk06c[i * 8 + j] = tmp + j * arg0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// var800a45a0->unk010 = 0;
|
||||
// var800a45a0->unk00c = 0;
|
||||
//
|
||||
// for (i = 0; i < 8; i++) {
|
||||
// var800a45a0->unk17c[i] = 1 / sqrtf(8);
|
||||
// var800a45a0->unk27c[i * 8] = var800a45a0->unk17c[i];
|
||||
// }
|
||||
//
|
||||
// for (i = 1; i < 8; i++) {
|
||||
// for (j = 0; j < 8; j++) {
|
||||
// var800a45a0->unk17c[i * 8 + j] = sqrtf(0.25f) * cosf(((1 + j * 2) * M_PI * i) / 16.0f);
|
||||
// var800a45a0->unk27c[j * 8 + i] = var800a45a0->unk17c[i * 8 + j];
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
for (i = 0; i < 8; i++) {
|
||||
s32 tmp = (i + 1) * arg0 + 1;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
var800a45a0->unk06c[i][j] = tmp + j * arg0;
|
||||
}
|
||||
}
|
||||
|
||||
var800a45a0->unk010 = 0;
|
||||
var800a45a0->unk00c = 0;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
var800a45a0->unk17c[0][i] = 1 / sqrtf(8);
|
||||
var800a45a0->unk27c[i][0] = var800a45a0->unk17c[0][i];
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
var800a45a0->unk17c[i][j] = sqrtf(0.25f) * cosf(((1 + j * 2) * M_PI * i) / 16.0f);
|
||||
var800a45a0->unk27c[j][i] = var800a45a0->unk17c[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void func0f14f700(struct var8007f8e0 *arg0, u32 arg1, u32 arg2)
|
||||
{
|
||||
@@ -3807,6 +3815,7 @@ const char var7f1b727c[] = "\nCam_SaveEditSlotToParamPakItem -> Save failed\n";
|
||||
const char var7f1b72ac[] = "Camera Save Error Result: %d\n";
|
||||
const char var7f1b72cc[] = "Magic Guid set to %d\n";
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel pheadSaveFile
|
||||
/* f150468: 27bdeb08 */ addiu $sp,$sp,-5368
|
||||
@@ -4037,106 +4046,107 @@ glabel pheadSaveFile
|
||||
/* f1507ac: 03e00008 */ jr $ra
|
||||
/* f1507b0: 27bd14f8 */ addiu $sp,$sp,0x14f8
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Regalloc
|
||||
//s32 pheadSaveFile(s8 device, s32 fileid, u16 serial)
|
||||
//{
|
||||
// u32 stack[2];
|
||||
// struct camerafile file; // 1050
|
||||
// struct var8007f8e0 *thing = func0f14a06c(-1);
|
||||
// s32 ret;
|
||||
// s32 writtenfileid; // 1044
|
||||
// u8 sp44[0x1000];
|
||||
// s32 i;
|
||||
//
|
||||
// if (!thing->unk3f4_03) {
|
||||
// thing->unk036 = 1;
|
||||
// thing->unk024 = sp44;
|
||||
//
|
||||
// while (true) {
|
||||
// func0f150068(thing, thing->unk036);
|
||||
//
|
||||
// file.unk80 = thing->unk02c / 8;
|
||||
//
|
||||
// if ((u32)file.unk80 >= 1024) {
|
||||
// thing->unk036++;
|
||||
//
|
||||
// if (thing->unk036 >= 12) {
|
||||
// return -1;
|
||||
// }
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < (u32)file.unk80; i++) {
|
||||
// thing->unk020[i] = thing->unk024[i];
|
||||
// }
|
||||
//
|
||||
// for (i = file.unk80; i < 1024; i++) {
|
||||
// thing->unk020[i] = 0;
|
||||
// }
|
||||
//
|
||||
// thing->unk3f4_03 = true;
|
||||
// }
|
||||
//
|
||||
// file.unk8e_00 = thing->unk3f4_01;
|
||||
// file.unk8e_01 = thing->unk3f4_02;
|
||||
// file.unk8e_02 = thing->unk3a4;
|
||||
//
|
||||
// file.unk82 = thing->unk3bc;
|
||||
// file.unk84 = thing->unk3b8;
|
||||
// file.unk8c = thing->colournum;
|
||||
// file.unk8d = thing->stylenum;
|
||||
// file.unk86 = thing->unk3c0;
|
||||
// file.unk87 = thing->unk3c4;
|
||||
// file.unk88 = thing->unk3c8;
|
||||
// file.unk89 = thing->unk3cc;
|
||||
// file.unk8a = thing->unk3ec;
|
||||
// file.unk8b = thing->unk3f0;
|
||||
//
|
||||
// for (i = 0; i != ARRAYCOUNT(file.unk90); i++) {
|
||||
// file.unk90[i] = thing->unk3d0[i] * 1000.0f;
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < ARRAYCOUNT(file.unk00); i++) {
|
||||
// file.unk00[i] = thing->unk010.textureptr[i];
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < ARRAYCOUNT(file.unk9e); i++) {
|
||||
// file.unk9e[i] = thing->unk020[i];
|
||||
// }
|
||||
//
|
||||
// var80075bd0[3] = true;
|
||||
//
|
||||
// ret = pakSaveAtGuid(device, fileid, PAKFILETYPE_CAMERA, (u8 *)&file, &writtenfileid, NULL);
|
||||
//
|
||||
// if (ret == 0) {
|
||||
// s32 i;
|
||||
// for (i = 0; i < 18; i++) {
|
||||
// struct var8007f8e0 *thing2 = func0f14a06c(i);
|
||||
//
|
||||
// if (thing2->fileguid.fileid == thing->fileguid.fileid
|
||||
// && thing2->fileguid.deviceserial == thing->fileguid.deviceserial) {
|
||||
// thing2->fileguid.fileid = writtenfileid;
|
||||
// thing2->fileguid.deviceserial = serial;
|
||||
//
|
||||
// if (i >= 12) {
|
||||
// g_Vars.modifiedfiles |= MODFILE_GAME;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// thing->fileguid.fileid = writtenfileid;
|
||||
// thing->fileguid.deviceserial = serial;
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// g_FilemgrLastPakError = ret;
|
||||
//
|
||||
// return -1;
|
||||
//}
|
||||
s32 pheadSaveFile(s8 device, s32 fileid, u16 serial)
|
||||
{
|
||||
u32 stack[2];
|
||||
struct camerafile file; // 1050
|
||||
struct var8007f8e0 *thing = func0f14a06c(-1);
|
||||
s32 ret;
|
||||
s32 writtenfileid; // 1044
|
||||
u8 sp44[0x1000];
|
||||
s32 i;
|
||||
|
||||
if (!thing->unk3f4_03) {
|
||||
thing->unk036 = 1;
|
||||
thing->unk024 = sp44;
|
||||
|
||||
while (true) {
|
||||
func0f150068(thing, thing->unk036);
|
||||
|
||||
file.unk80 = thing->unk02c / 8;
|
||||
|
||||
if ((u32)file.unk80 >= 1024) {
|
||||
thing->unk036++;
|
||||
|
||||
if (thing->unk036 >= 12) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (u32)file.unk80; i++) {
|
||||
thing->unk020[i] = thing->unk024[i];
|
||||
}
|
||||
|
||||
for (i = file.unk80; i < 1024; i++) {
|
||||
thing->unk020[i] = 0;
|
||||
}
|
||||
|
||||
thing->unk3f4_03 = true;
|
||||
}
|
||||
|
||||
file.unk8e_00 = thing->unk3f4_01;
|
||||
file.unk8e_01 = thing->unk3f4_02;
|
||||
file.unk8e_02 = thing->unk3a4;
|
||||
|
||||
file.unk82 = thing->unk3bc;
|
||||
file.unk84 = thing->unk3b8;
|
||||
file.unk8c = thing->colournum;
|
||||
file.unk8d = thing->stylenum;
|
||||
file.unk86 = thing->unk3c0;
|
||||
file.unk87 = thing->unk3c4;
|
||||
file.unk88 = thing->unk3c8;
|
||||
file.unk89 = thing->unk3cc;
|
||||
file.unk8a = thing->unk3ec;
|
||||
file.unk8b = thing->unk3f0;
|
||||
|
||||
for (i = 0; i != ARRAYCOUNT(file.unk90); i++) {
|
||||
file.unk90[i] = thing->unk3d0[i] * 1000.0f;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(file.unk00); i++) {
|
||||
file.unk00[i] = thing->unk010.textureptr[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(file.unk9e); i++) {
|
||||
file.unk9e[i] = thing->unk020[i];
|
||||
}
|
||||
|
||||
var80075bd0[3] = true;
|
||||
|
||||
ret = pakSaveAtGuid(device, fileid, PAKFILETYPE_CAMERA, (u8 *)&file, &writtenfileid, NULL);
|
||||
|
||||
if (ret == 0) {
|
||||
s32 i;
|
||||
for (i = 0; i < 18; i++) {
|
||||
struct var8007f8e0 *thing2 = func0f14a06c(i);
|
||||
|
||||
if (thing2->fileguid.fileid == thing->fileguid.fileid
|
||||
&& thing2->fileguid.deviceserial == thing->fileguid.deviceserial) {
|
||||
thing2->fileguid.fileid = writtenfileid;
|
||||
thing2->fileguid.deviceserial = serial;
|
||||
|
||||
if (i >= 12) {
|
||||
g_Vars.modifiedfiles |= MODFILE_GAME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
thing->fileguid.fileid = writtenfileid;
|
||||
thing->fileguid.deviceserial = serial;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_FilemgrLastPakError = ret;
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void phGetGuid(s32 index, struct fileguid *guid)
|
||||
{
|
||||
|
||||
+48
-46
@@ -586,6 +586,7 @@ bool camIsPosInScreenBox(struct coord *pos, f32 arg1, struct var800a4640_00 *arg
|
||||
return true;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel camIsPosInFovAndVisibleRoom
|
||||
/* f0b6260: 27bdffb0 */ addiu $sp,$sp,-80
|
||||
@@ -681,50 +682,51 @@ glabel camIsPosInFovAndVisibleRoom
|
||||
/* f0b63a0: 03e00008 */ jr $ra
|
||||
/* f0b63a4: 27bd0050 */ addiu $sp,$sp,0x50
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Too much compiler-managed stack
|
||||
//bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2)
|
||||
//{
|
||||
// s8 hasdata = false;
|
||||
// s16 room;
|
||||
// s32 i;
|
||||
// struct var800a4640_00 *thisthing;
|
||||
// struct var800a4640_00 thing; // 34
|
||||
//
|
||||
// for (i = 0, room = rooms[0]; room != -1; i++, room = rooms[i]) {
|
||||
// if (g_Rooms[room].flags & ROOMFLAG_ONSCREEN) {
|
||||
// thisthing = func0f158140(room);
|
||||
//
|
||||
// if (hasdata == false) {
|
||||
// thing.box.xmin = thisthing->box.xmin;
|
||||
// thing.box.ymin = thisthing->box.ymin;
|
||||
// thing.box.xmax = thisthing->box.xmax;
|
||||
// thing.box.ymax = thisthing->box.ymax;
|
||||
// } else {
|
||||
// if (thisthing->box.xmin < thing.box.xmin) {
|
||||
// thing.box.xmin = thisthing->box.xmin;
|
||||
// }
|
||||
//
|
||||
// if (thisthing->box.ymin < thing.box.ymin) {
|
||||
// thing.box.ymin = thisthing->box.ymin;
|
||||
// }
|
||||
//
|
||||
// if (thisthing->box.xmax > thing.box.xmax) {
|
||||
// thing.box.xmax = thisthing->box.xmax;
|
||||
// }
|
||||
//
|
||||
// if (thisthing->box.ymax > thing.box.ymax) {
|
||||
// thing.box.ymax = thisthing->box.ymax;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// hasdata = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!hasdata) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return camIsPosInScreenBox(pos, arg2, &thing);
|
||||
//}
|
||||
bool camIsPosInFovAndVisibleRoom(s16 *rooms, struct coord *pos, f32 arg2)
|
||||
{
|
||||
s8 hasdata = false;
|
||||
s16 room;
|
||||
s32 i;
|
||||
struct var800a4640_00 *thisthing;
|
||||
struct var800a4640_00 thing; // 34
|
||||
|
||||
for (i = 0, room = rooms[0]; room != -1; i++, room = rooms[i]) {
|
||||
if (g_Rooms[room].flags & ROOMFLAG_ONSCREEN) {
|
||||
thisthing = func0f158140(room);
|
||||
|
||||
if (hasdata == false) {
|
||||
thing.box.xmin = thisthing->box.xmin;
|
||||
thing.box.ymin = thisthing->box.ymin;
|
||||
thing.box.xmax = thisthing->box.xmax;
|
||||
thing.box.ymax = thisthing->box.ymax;
|
||||
} else {
|
||||
if (thisthing->box.xmin < thing.box.xmin) {
|
||||
thing.box.xmin = thisthing->box.xmin;
|
||||
}
|
||||
|
||||
if (thisthing->box.ymin < thing.box.ymin) {
|
||||
thing.box.ymin = thisthing->box.ymin;
|
||||
}
|
||||
|
||||
if (thisthing->box.xmax > thing.box.xmax) {
|
||||
thing.box.xmax = thisthing->box.xmax;
|
||||
}
|
||||
|
||||
if (thisthing->box.ymax > thing.box.ymax) {
|
||||
thing.box.ymax = thisthing->box.ymax;
|
||||
}
|
||||
}
|
||||
|
||||
hasdata = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasdata) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return camIsPosInScreenBox(pos, arg2, &thing);
|
||||
}
|
||||
#endif
|
||||
|
||||
+274
-272
@@ -3670,6 +3670,7 @@ void chrEmitSparks(struct chrdata *chr, struct prop *prop, s32 hitpart, struct c
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel chr0f0260c4
|
||||
/* f0260c4: 27bdfed8 */ addiu $sp,$sp,-296
|
||||
@@ -4233,282 +4234,283 @@ glabel chr0f0260c4
|
||||
/* f0268b4: 03e00008 */ jr $ra
|
||||
/* f0268b8: 27bd0128 */ addiu $sp,$sp,0x128
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: The bottom two tmp calculations should multiply by s32 0xc using
|
||||
// shift operations, however doing this causes it to boot gdlptr out of s8 and
|
||||
// use s8 for s32 0xc. The below multiplies by 6 which is incorrect, but creates
|
||||
// a diff of only one instruction to show that this is the only issue.
|
||||
//void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struct coord *arg3)
|
||||
//{
|
||||
// struct modelnode *bestnode = NULL;
|
||||
// s32 mindist = 0x7fffffff;
|
||||
// s32 bestcoords[3];
|
||||
// struct modelnode *curnode;
|
||||
// Gfx *gdlptr;
|
||||
// Gfx *gdlptr2;
|
||||
// struct gfxvtx *vertices;
|
||||
// struct modelnode *posnode = NULL;
|
||||
// struct coord relpos;
|
||||
// struct coord spd4;
|
||||
// struct coord spc8;
|
||||
// s32 spbc[3];
|
||||
// s32 alpha = 20 + (random() % 50);
|
||||
// struct modelrodata_dl *rodata;
|
||||
// struct modelrwdata_dl *rwdata;
|
||||
// s32 spac = 0;
|
||||
// s32 op;
|
||||
// s32 nodetype;
|
||||
//
|
||||
// modelNodeGetModelRelativePosition(model, model0001a740(node), &relpos);
|
||||
//
|
||||
// spc8.f[0] = arg3->x - relpos.x;
|
||||
// spc8.f[1] = arg3->y - relpos.y;
|
||||
// spc8.f[2] = arg3->z - relpos.z;
|
||||
//
|
||||
// // This first pass over the node tree is deciding which modelnode to use.
|
||||
// curnode = node;
|
||||
//
|
||||
// while (curnode) {
|
||||
// s32 nodetype = curnode->type & 0xff;
|
||||
//
|
||||
// switch (nodetype) {
|
||||
// case MODELNODETYPE_DL:
|
||||
// rodata = &curnode->rodata->dl;
|
||||
// rwdata = modelGetNodeRwData(model, curnode);
|
||||
//
|
||||
// if (rwdata->gdl == NULL) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // By default, the model instance's displaylist points to the
|
||||
// // one in the model definition. If it hasn't been changed we'll
|
||||
// // use the space... after the model definition's colour table?
|
||||
// // Let's hope that's not being used by other instances...
|
||||
// if (rwdata->gdl == rodata->primary) {
|
||||
// gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff));
|
||||
// } else {
|
||||
// gdlptr = rwdata->gdl;
|
||||
// }
|
||||
//
|
||||
// if (rodata->secondary) {
|
||||
// gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff));
|
||||
// } else {
|
||||
// gdlptr2 = NULL;
|
||||
// }
|
||||
//
|
||||
// // Iterate the primary DL, and once the end is reached
|
||||
// // iterate the secondary DL if we have one.
|
||||
// while (true) {
|
||||
// op = *(s8 *)&gdlptr->words.w0;
|
||||
//
|
||||
// if (op == G_ENDDL) {
|
||||
// if (gdlptr2) {
|
||||
// // Switch to second DL
|
||||
// gdlptr = gdlptr2;
|
||||
// gdlptr2 = NULL;
|
||||
// } else {
|
||||
// // We're done
|
||||
// gdlptr = NULL;
|
||||
// break;
|
||||
// }
|
||||
// } else {
|
||||
// // Note: We should have found an MTX op before VTX.
|
||||
// if (op == G_VTX) {
|
||||
// u8 *ptr = (u8 *)&gdlptr->words.w0;
|
||||
// u32 word = gdlptr->words.w1 & 0xffffff;
|
||||
// s32 numverts;
|
||||
// s32 i;
|
||||
//
|
||||
// vertices = (struct gfxvtx *)((u32)rodata->vertices + word);
|
||||
// numverts = (u32)ptr[1] / 16 + 1;
|
||||
//
|
||||
// if (posnode) {
|
||||
// for (i = 0; i < numverts; i++) {
|
||||
// s32 x = spbc[0] - vertices[i].x;
|
||||
// s32 y = spbc[1] - vertices[i].y;
|
||||
// s32 z = spbc[2] - vertices[i].z;
|
||||
// s32 dist = x * x + y * y + z * z;
|
||||
//
|
||||
// if (dist < mindist) {
|
||||
// mindist = dist;
|
||||
// bestnode = curnode;
|
||||
// bestcoords[0] = vertices[i].x + (s32)spd4.f[0];
|
||||
// bestcoords[1] = vertices[i].y + (s32)spd4.f[1];
|
||||
// bestcoords[2] = vertices[i].z + (s32)spd4.f[2];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else if (op == G_MTX) {
|
||||
// u32 addr = gdlptr->words.w1 & 0xffffff;
|
||||
// posnode = model0001a634(model, addr / sizeof(Mtxf));
|
||||
// modelNodeGetModelRelativePosition(model, posnode, &spd4);
|
||||
//
|
||||
// spbc[0] = spd4.x + spc8.x;
|
||||
// spbc[1] = spd4.y + spc8.y;
|
||||
// spbc[2] = spd4.z + spc8.z;
|
||||
// }
|
||||
//
|
||||
// gdlptr++;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case MODELNODETYPE_DISTANCE:
|
||||
// model0001c784(model, curnode);
|
||||
// break;
|
||||
// case MODELNODETYPE_TOGGLE:
|
||||
// model0001c7d0(model, curnode);
|
||||
// break;
|
||||
// case MODELNODETYPE_HEADSPOT:
|
||||
// modelAttachHead(model, curnode);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (curnode->child && (curnode == node
|
||||
// || (nodetype != MODELNODETYPE_BBOX && nodetype != MODELNODETYPE_11))) {
|
||||
// curnode = curnode->child;
|
||||
// } else {
|
||||
// while (curnode) {
|
||||
// if (curnode == node) {
|
||||
// curnode = NULL;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (curnode->next) {
|
||||
// curnode = curnode->next;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// curnode = curnode->parent;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (bestnode == NULL) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Do a pass over the entire model's tree, looking for vertices that share
|
||||
// // the chosen vertex, and darken then.
|
||||
// curnode = model->filedata->rootnode;
|
||||
//
|
||||
// while (curnode) {
|
||||
// nodetype = curnode->type & 0xff;
|
||||
//
|
||||
// switch (nodetype) {
|
||||
// case MODELNODETYPE_DL:
|
||||
// rodata = &curnode->rodata->dl;
|
||||
// rwdata = modelGetNodeRwData(model, curnode);
|
||||
//
|
||||
// if (rwdata->gdl == NULL) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (rwdata->gdl == rodata->primary) {
|
||||
// gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff));
|
||||
// } else {
|
||||
// gdlptr = rwdata->gdl;
|
||||
// }
|
||||
//
|
||||
// if (rodata->secondary) {
|
||||
// gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff));
|
||||
// } else {
|
||||
// gdlptr2 = NULL;
|
||||
// }
|
||||
//
|
||||
// while (true) {
|
||||
// s32 op = *(s8 *)&gdlptr->words.w0;
|
||||
//
|
||||
// if (op == G_ENDDL) {
|
||||
// if (gdlptr2) {
|
||||
// // Switch to second DL
|
||||
// gdlptr = gdlptr2;
|
||||
// gdlptr2 = NULL;
|
||||
// } else {
|
||||
// // We're done
|
||||
// gdlptr = NULL;
|
||||
// break;
|
||||
// }
|
||||
// } else {
|
||||
// // Note: We should have found an MTX op before VTX.
|
||||
// if (op == G_VTX) {
|
||||
// u8 *ptr = (u8 *)&gdlptr->words.w0;
|
||||
// u32 word = gdlptr->words.w1 & 0xffffff;
|
||||
// struct gfxvtx *vertices = (struct gfxvtx *)((u32)rodata->vertices + word);
|
||||
// s32 numverts = (u32)ptr[1] / 16 + 1;
|
||||
// s32 i;
|
||||
//
|
||||
// if (posnode) {
|
||||
// for (i = 0; i < numverts; i++) {
|
||||
// s32 x = vertices[i].x + (s32)spd4.f[0];
|
||||
// s32 y = vertices[i].y + (s32)spd4.f[1];
|
||||
// s32 z = vertices[i].z + (s32)spd4.f[2];
|
||||
//
|
||||
// if (x == bestcoords[0] && y == bestcoords[1] && z == bestcoords[2]) {
|
||||
// u32 tmp = ALIGN8((u32)&rodata->vertices[(u32)rodata->numvertices]); // u32 0xc
|
||||
//
|
||||
// if ((u32)rwdata->colours == tmp) {
|
||||
// struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0);
|
||||
// s32 j;
|
||||
//
|
||||
// if (colours) {
|
||||
// for (j = 0; j < rodata->numcolours; j++) {
|
||||
// colours[j] = rwdata->colours[j];
|
||||
// }
|
||||
//
|
||||
// rwdata->colours = colours;
|
||||
//
|
||||
// tmp = ALIGN8((s32)&rodata->vertices[rodata->numvertices]); // s32 0xc
|
||||
// } else {
|
||||
// tmp = ALIGN8((s32)rodata->vertices + rodata->numvertices * 6); // s32 0xc
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ((u32)rwdata->colours != tmp) {
|
||||
// u32 offset = rwdata->vertices[word / 12u + i].colour >> 2; // u32 0xc (both divide and mult)
|
||||
// struct colour *colours = (struct colour *) ((u32)rwdata->colours + spac);
|
||||
//
|
||||
// colours[offset].a = alpha;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else if (op == G_MTX) {
|
||||
// u32 addr = gdlptr->words.w1 & 0xffffff;
|
||||
// posnode = model0001a634(model, addr / sizeof(Mtxf));
|
||||
// modelNodeGetModelRelativePosition(model, posnode, &spd4);
|
||||
// } else if (op == G_SETCOLOR) {
|
||||
// spac = gdlptr->words.w1 & 0xffffff;
|
||||
// }
|
||||
//
|
||||
// gdlptr++;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case MODELNODETYPE_DISTANCE:
|
||||
// model0001c784(model, curnode);
|
||||
// break;
|
||||
// case MODELNODETYPE_TOGGLE:
|
||||
// model0001c7d0(model, curnode);
|
||||
// break;
|
||||
// case MODELNODETYPE_HEADSPOT:
|
||||
// modelAttachHead(model, curnode);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (curnode->child) {
|
||||
// curnode = curnode->child;
|
||||
// } else {
|
||||
// while (curnode) {
|
||||
// if (curnode && curnode->next) {
|
||||
// curnode = curnode->next;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// curnode = curnode->parent;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void chr0f0260c4(struct model *model, s32 hitpart, struct modelnode *node, struct coord *arg3)
|
||||
{
|
||||
struct modelnode *bestnode = NULL;
|
||||
s32 mindist = 0x7fffffff;
|
||||
s32 bestcoords[3];
|
||||
struct modelnode *curnode;
|
||||
Gfx *gdlptr;
|
||||
Gfx *gdlptr2;
|
||||
struct gfxvtx *vertices;
|
||||
struct modelnode *posnode = NULL;
|
||||
struct coord relpos;
|
||||
struct coord spd4;
|
||||
struct coord spc8;
|
||||
s32 spbc[3];
|
||||
s32 alpha = 20 + (random() % 50);
|
||||
struct modelrodata_dl *rodata;
|
||||
struct modelrwdata_dl *rwdata;
|
||||
s32 spac = 0;
|
||||
s32 op;
|
||||
s32 nodetype;
|
||||
|
||||
modelNodeGetModelRelativePosition(model, model0001a740(node), &relpos);
|
||||
|
||||
spc8.f[0] = arg3->x - relpos.x;
|
||||
spc8.f[1] = arg3->y - relpos.y;
|
||||
spc8.f[2] = arg3->z - relpos.z;
|
||||
|
||||
// This first pass over the node tree is deciding which modelnode to use.
|
||||
curnode = node;
|
||||
|
||||
while (curnode) {
|
||||
s32 nodetype = curnode->type & 0xff;
|
||||
|
||||
switch (nodetype) {
|
||||
case MODELNODETYPE_DL:
|
||||
rodata = &curnode->rodata->dl;
|
||||
rwdata = modelGetNodeRwData(model, curnode);
|
||||
|
||||
if (rwdata->gdl == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
// By default, the model instance's displaylist points to the
|
||||
// one in the model definition. If it hasn't been changed we'll
|
||||
// use the space... after the model definition's colour table?
|
||||
// Let's hope that's not being used by other instances...
|
||||
if (rwdata->gdl == rodata->primary) {
|
||||
gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff));
|
||||
} else {
|
||||
gdlptr = rwdata->gdl;
|
||||
}
|
||||
|
||||
if (rodata->secondary) {
|
||||
gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff));
|
||||
} else {
|
||||
gdlptr2 = NULL;
|
||||
}
|
||||
|
||||
// Iterate the primary DL, and once the end is reached
|
||||
// iterate the secondary DL if we have one.
|
||||
while (true) {
|
||||
op = *(s8 *)&gdlptr->words.w0;
|
||||
|
||||
if (op == G_ENDDL) {
|
||||
if (gdlptr2) {
|
||||
// Switch to second DL
|
||||
gdlptr = gdlptr2;
|
||||
gdlptr2 = NULL;
|
||||
} else {
|
||||
// We're done
|
||||
gdlptr = NULL;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Note: We should have found an MTX op before VTX.
|
||||
if (op == G_VTX) {
|
||||
u8 *ptr = (u8 *)&gdlptr->words.w0;
|
||||
u32 word = gdlptr->words.w1 & 0xffffff;
|
||||
s32 numverts;
|
||||
s32 i;
|
||||
|
||||
vertices = (struct gfxvtx *)((u32)rodata->vertices + word);
|
||||
numverts = (u32)ptr[1] / 16 + 1;
|
||||
|
||||
if (posnode) {
|
||||
for (i = 0; i < numverts; i++) {
|
||||
s32 x = spbc[0] - vertices[i].x;
|
||||
s32 y = spbc[1] - vertices[i].y;
|
||||
s32 z = spbc[2] - vertices[i].z;
|
||||
s32 dist = x * x + y * y + z * z;
|
||||
|
||||
if (dist < mindist) {
|
||||
mindist = dist;
|
||||
bestnode = curnode;
|
||||
bestcoords[0] = vertices[i].x + (s32)spd4.f[0];
|
||||
bestcoords[1] = vertices[i].y + (s32)spd4.f[1];
|
||||
bestcoords[2] = vertices[i].z + (s32)spd4.f[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (op == G_MTX) {
|
||||
u32 addr = gdlptr->words.w1 & 0xffffff;
|
||||
posnode = model0001a634(model, addr / sizeof(Mtxf));
|
||||
modelNodeGetModelRelativePosition(model, posnode, &spd4);
|
||||
|
||||
spbc[0] = spd4.x + spc8.x;
|
||||
spbc[1] = spd4.y + spc8.y;
|
||||
spbc[2] = spd4.z + spc8.z;
|
||||
}
|
||||
|
||||
gdlptr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MODELNODETYPE_DISTANCE:
|
||||
model0001c784(model, curnode);
|
||||
break;
|
||||
case MODELNODETYPE_TOGGLE:
|
||||
model0001c7d0(model, curnode);
|
||||
break;
|
||||
case MODELNODETYPE_HEADSPOT:
|
||||
modelAttachHead(model, curnode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (curnode->child && (curnode == node
|
||||
|| (nodetype != MODELNODETYPE_BBOX && nodetype != MODELNODETYPE_11))) {
|
||||
curnode = curnode->child;
|
||||
} else {
|
||||
while (curnode) {
|
||||
if (curnode == node) {
|
||||
curnode = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (curnode->next) {
|
||||
curnode = curnode->next;
|
||||
break;
|
||||
}
|
||||
|
||||
curnode = curnode->parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestnode == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do a pass over the entire model's tree, looking for vertices that share
|
||||
// the chosen vertex, and darken then.
|
||||
curnode = model->filedata->rootnode;
|
||||
|
||||
while (curnode) {
|
||||
nodetype = curnode->type & 0xff;
|
||||
|
||||
switch (nodetype) {
|
||||
case MODELNODETYPE_DL:
|
||||
rodata = &curnode->rodata->dl;
|
||||
rwdata = modelGetNodeRwData(model, curnode);
|
||||
|
||||
if (rwdata->gdl == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (rwdata->gdl == rodata->primary) {
|
||||
gdlptr = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->primary & 0xffffff));
|
||||
} else {
|
||||
gdlptr = rwdata->gdl;
|
||||
}
|
||||
|
||||
if (rodata->secondary) {
|
||||
gdlptr2 = (Gfx *)((u32)rodata->colourtable + ((u32)rodata->secondary & 0xffffff));
|
||||
} else {
|
||||
gdlptr2 = NULL;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
s32 op = *(s8 *)&gdlptr->words.w0;
|
||||
|
||||
if (op == G_ENDDL) {
|
||||
if (gdlptr2) {
|
||||
// Switch to second DL
|
||||
gdlptr = gdlptr2;
|
||||
gdlptr2 = NULL;
|
||||
} else {
|
||||
// We're done
|
||||
gdlptr = NULL;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Note: We should have found an MTX op before VTX.
|
||||
if (op == G_VTX) {
|
||||
u8 *ptr = (u8 *)&gdlptr->words.w0;
|
||||
u32 word = gdlptr->words.w1 & 0xffffff;
|
||||
struct gfxvtx *vertices = (struct gfxvtx *)((u32)rodata->vertices + word);
|
||||
s32 numverts = (u32)ptr[1] / 16 + 1;
|
||||
s32 i;
|
||||
|
||||
if (posnode) {
|
||||
for (i = 0; i < numverts; i++) {
|
||||
s32 x = vertices[i].x + (s32)spd4.f[0];
|
||||
s32 y = vertices[i].y + (s32)spd4.f[1];
|
||||
s32 z = vertices[i].z + (s32)spd4.f[2];
|
||||
|
||||
if (x == bestcoords[0] && y == bestcoords[1] && z == bestcoords[2]) {
|
||||
u32 tmp = ALIGN8((u32)&rodata->vertices[(u32)rodata->numvertices]); // u32 0xc
|
||||
|
||||
if ((u32)rwdata->colours == tmp) {
|
||||
struct colour *colours = vtxstoreAllocate(rodata->numcolours, VTXSTORETYPE_CHRCOL, 0, 0);
|
||||
s32 j;
|
||||
|
||||
if (colours) {
|
||||
for (j = 0; j < rodata->numcolours; j++) {
|
||||
colours[j] = rwdata->colours[j];
|
||||
}
|
||||
|
||||
rwdata->colours = colours;
|
||||
|
||||
tmp = ALIGN8((s32)&rodata->vertices[rodata->numvertices]); // s32 0xc
|
||||
} else {
|
||||
tmp = ALIGN8((s32)rodata->vertices + rodata->numvertices * 6); // s32 0xc
|
||||
}
|
||||
}
|
||||
|
||||
if ((u32)rwdata->colours != tmp) {
|
||||
u32 offset = rwdata->vertices[word / 12u + i].colour >> 2; // u32 0xc (both divide and mult)
|
||||
struct colour *colours = (struct colour *) ((u32)rwdata->colours + spac);
|
||||
|
||||
colours[offset].a = alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (op == G_MTX) {
|
||||
u32 addr = gdlptr->words.w1 & 0xffffff;
|
||||
posnode = model0001a634(model, addr / sizeof(Mtxf));
|
||||
modelNodeGetModelRelativePosition(model, posnode, &spd4);
|
||||
} else if (op == G_SETCOLOR) {
|
||||
spac = gdlptr->words.w1 & 0xffffff;
|
||||
}
|
||||
|
||||
gdlptr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MODELNODETYPE_DISTANCE:
|
||||
model0001c784(model, curnode);
|
||||
break;
|
||||
case MODELNODETYPE_TOGGLE:
|
||||
model0001c7d0(model, curnode);
|
||||
break;
|
||||
case MODELNODETYPE_HEADSPOT:
|
||||
modelAttachHead(model, curnode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (curnode->child) {
|
||||
curnode = curnode->child;
|
||||
} else {
|
||||
while (curnode) {
|
||||
if (curnode && curnode->next) {
|
||||
curnode = curnode->next;
|
||||
break;
|
||||
}
|
||||
|
||||
curnode = curnode->parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Bruise a chr by darkening their vertices.
|
||||
|
||||
+694
-690
File diff suppressed because it is too large
Load Diff
+260
-258
@@ -6853,6 +6853,7 @@ s16 g_MaianQuipBank[][4] = {
|
||||
/**
|
||||
* @cmd 0130
|
||||
*/
|
||||
#if MATCHING
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel aiSayQuip
|
||||
@@ -9490,265 +9491,266 @@ glabel var7f1a9d64
|
||||
/* f05a010: 00000000 */ sll $zero,$zero,0x0
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
// regalloc difference near 64c
|
||||
//bool aiSayQuip(void)
|
||||
//{
|
||||
// u8 column; // 167
|
||||
// s16 audioid; // 164
|
||||
// u8 i; // 163
|
||||
// u8 *cmd = g_Vars.ailist + g_Vars.aioffset; // 156
|
||||
// s32 numnearbychrs; // 152
|
||||
// bool issomeonetalking; // 148
|
||||
// s32 probability; // 144
|
||||
// u32 stack; // 140 - not referenced
|
||||
// s16 *chrnums; // 136
|
||||
// s16 (*bank)[4]; // 132
|
||||
// char *text; // 128
|
||||
// struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); // 124
|
||||
// u32 prevplayernum = g_Vars.currentplayernum; // 120
|
||||
// s32 distance; // 116 - not referenced
|
||||
// s32 row = cmd[3]; // 112
|
||||
// u32 playernum; // 108 - not referenced
|
||||
// u8 headshotted = g_Vars.chrdata->hidden2 & CHRH2FLAG_HEADSHOTTED; // 107
|
||||
// struct chrdata *loopchr; // 100
|
||||
//
|
||||
// // Choose bank
|
||||
// // 2c0
|
||||
// if (CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) {
|
||||
// bank = g_SkedarQuipBank;
|
||||
//
|
||||
// if (row > 5) {
|
||||
// row = 0;
|
||||
// }
|
||||
// // 2e0
|
||||
// } else if (g_Vars.chrdata->headnum == HEAD_MAIAN_S) {
|
||||
// bank = g_MaianQuipBank;
|
||||
//
|
||||
// if (row > 2) {
|
||||
// row = random() & 1;
|
||||
// }
|
||||
// // 324
|
||||
// } else if (cmd[7] == 0) {
|
||||
// if (g_Vars.chrdata->voicebox > 3) {
|
||||
// g_Vars.chrdata->voicebox = 3;
|
||||
// }
|
||||
//
|
||||
// bank = &g_GuardQuipBank[g_Vars.chrdata->voicebox * 41];
|
||||
// } else {
|
||||
// // 37c
|
||||
// bank = g_SpecialQuipBank;
|
||||
// }
|
||||
//
|
||||
// // 37c
|
||||
// if (!row && !cmd[4] && !cmd[6]) {
|
||||
// g_Vars.chrdata->soundtimer = 0;
|
||||
// g_Vars.aioffset += 10;
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // 3bc
|
||||
// chrnums = teamGetChrIds(g_Vars.chrdata->team);
|
||||
// numnearbychrs = 0;
|
||||
// issomeonetalking = false;
|
||||
// probability = cmd[4];
|
||||
//
|
||||
// // Make it impossible for Elvis and Jon to use anything but special phrases
|
||||
// // 3f0
|
||||
// if ((g_Vars.chrdata->headnum == HEAD_ELVIS
|
||||
// || g_Vars.chrdata->headnum == HEAD_THEKING
|
||||
// || g_Vars.chrdata->headnum == HEAD_ELVIS_GOGS
|
||||
// || g_Vars.chrdata->headnum == HEAD_JONATHAN) &&
|
||||
// bank != g_SpecialQuipBank) {
|
||||
// probability = 0;
|
||||
// }
|
||||
//
|
||||
// // If the person talking is a player, and they've just died,
|
||||
// // try using the other coop player.
|
||||
// // 420
|
||||
// if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) {
|
||||
// // 444
|
||||
// playernum = playermgrGetPlayerNumByProp(chr->prop);
|
||||
//
|
||||
// if (g_Vars.coopplayernum >= 0 && g_Vars.players[playernum]->isdead) {
|
||||
// // 470
|
||||
// if (playernum == g_Vars.bondplayernum) {
|
||||
// playernum = g_Vars.coopplayernum;
|
||||
// } else {
|
||||
// playernum = g_Vars.bondplayernum;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// setCurrentPlayerNum(playernum);
|
||||
// }
|
||||
//
|
||||
// // If soundgap permits talking at this time and probability passes
|
||||
// // 494
|
||||
// if ((g_Vars.chrdata->soundgap == 0 || g_Vars.chrdata->soundgap * 60 < g_Vars.chrdata->soundtimer)
|
||||
// && probability > (u8)random()) {
|
||||
// // Try and find a chr in the same squadron who is currently talking
|
||||
// // 4dc
|
||||
// while (*chrnums != -2) {
|
||||
// loopchr = chrFindByLiteralId(*chrnums);
|
||||
//
|
||||
// if (loopchr && loopchr->model
|
||||
// && !chrIsDead(loopchr)
|
||||
// && loopchr->actiontype != ACT_DEAD
|
||||
// && g_Vars.chrdata->squadron == loopchr->squadron
|
||||
// && loopchr->alertness >= 100
|
||||
// && g_Vars.chrdata->chrnum != loopchr->chrnum
|
||||
// && chrGetDistanceToChr(g_Vars.chrdata, loopchr->chrnum) < 7000) {
|
||||
// // 584
|
||||
// numnearbychrs++;
|
||||
//
|
||||
// // 594
|
||||
// if (loopchr->soundtimer < 60 && cmd[6] != 0 && cmd[6] != 255) {
|
||||
// issomeonetalking = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// chrnums++;
|
||||
// }
|
||||
//
|
||||
// // 5dc
|
||||
// if (!issomeonetalking &&
|
||||
// ((numnearbychrs == 0 && (cmd[6] == 0 || cmd[6] == 255)) ||
|
||||
// (numnearbychrs > 0 && cmd[6] > 0))) {
|
||||
// column = random() % 3;
|
||||
//
|
||||
// // 64c
|
||||
// if ((cmd[7] & 0x80) == 0) {
|
||||
// audioid = bank[row][1 + column];
|
||||
// } else {
|
||||
// audioid = bank[row][1 + g_Vars.chrdata->tude];
|
||||
// }
|
||||
//
|
||||
// // 6a0
|
||||
// if (audioWasNotPlayedRecently(audioid) || CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) {
|
||||
// // 6d4
|
||||
// audioMarkAsRecentlyPlayed(audioid);
|
||||
//
|
||||
// // 6e8
|
||||
// // Replace gurgle with "why me"
|
||||
// if (audioid == 0x34e && !headshotted) {
|
||||
// audioid = 0x34d;
|
||||
// }
|
||||
//
|
||||
// // 700
|
||||
// g_Vars.chrdata->soundtimer = 0;
|
||||
// g_Vars.chrdata->soundgap = cmd[5];
|
||||
// g_Vars.chrdata->propsoundcount++;
|
||||
//
|
||||
// // 72c
|
||||
// if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) {
|
||||
// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// // 7a8
|
||||
// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
// } else {
|
||||
// // Audio is "Stop moving", "Stop dodging" or "Stand still"
|
||||
// distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata);
|
||||
//
|
||||
// if (ABS(distance) > 50) {
|
||||
// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// // 840
|
||||
// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Consider putting text on screen
|
||||
// // Note: if cmd[8] is 0 then it means no text, so the value
|
||||
// // needs to be be decremented by one so it's 0-indexed.
|
||||
// // 850
|
||||
// if (cmd[8] && (cmd[7] & 0x80) == 0) {
|
||||
// if (column > 2) {
|
||||
// column = 2;
|
||||
// }
|
||||
//
|
||||
// text = langGet(g_QuipTexts[cmd[8] - 1][1 + column]);
|
||||
//
|
||||
// if (!sndIsFiltered(audioid)) {
|
||||
// // 8ac
|
||||
// hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]);
|
||||
// }
|
||||
// } else if (cmd[8]) {
|
||||
// text = langGet(g_QuipTexts[cmd[8] - 1][1 + g_Vars.chrdata->tude]);
|
||||
//
|
||||
// if (!sndIsFiltered(audioid)) {
|
||||
// // 904
|
||||
// hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// // Audio was played recently - try and find a different one
|
||||
// audioid = 0;
|
||||
//
|
||||
// // 92c
|
||||
// for (i = 1; i < 4; i++) {
|
||||
// if (audioWasNotPlayedRecently(g_GuardQuipBank[row][i])
|
||||
// && audioWasNotPlayedRecently(bank[row][i])) {
|
||||
// audioid = bank[row][i];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 99c
|
||||
// if (audioid) {
|
||||
// audioMarkAsRecentlyPlayed(audioid);
|
||||
//
|
||||
// // Replace gurgle with "why me"
|
||||
// if (audioid == 0x34e && !headshotted) {
|
||||
// audioid = 0x34d;
|
||||
// }
|
||||
//
|
||||
// g_Vars.chrdata->soundtimer = 0;
|
||||
// g_Vars.chrdata->soundgap = cmd[5];
|
||||
// g_Vars.chrdata->propsoundcount++;
|
||||
//
|
||||
// // 9fc
|
||||
// if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) {
|
||||
// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// // a80
|
||||
// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
// } else {
|
||||
// // Audio is "Stop moving", "Stop dodging" or "Stand still"
|
||||
// // a90
|
||||
// distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata);
|
||||
//
|
||||
// if (ABS(distance) > 50) {
|
||||
// func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// // b28
|
||||
// propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
// -1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // b44
|
||||
// if (cmd[8]) {
|
||||
// text = langGet(g_QuipTexts[cmd[8] - 1][i]);
|
||||
//
|
||||
// if (!sndIsFiltered(audioid)) {
|
||||
// // b78
|
||||
// hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// g_Vars.chrdata->soundtimer = 0;
|
||||
// g_Vars.chrdata->soundgap = cmd[5];
|
||||
// chrUnsetFlags(g_Vars.chrdata, CHRFLAG1_TALKINGTODISGUISE, BANK_1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// setCurrentPlayerNum(prevplayernum);
|
||||
//
|
||||
// g_Vars.aioffset += 10;
|
||||
//
|
||||
// return false;
|
||||
//}
|
||||
bool aiSayQuip(void)
|
||||
{
|
||||
u8 column; // 167
|
||||
s16 audioid; // 164
|
||||
u8 i; // 163
|
||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset; // 156
|
||||
s32 numnearbychrs; // 152
|
||||
bool issomeonetalking; // 148
|
||||
s32 probability; // 144
|
||||
u32 stack; // 140 - not referenced
|
||||
s16 *chrnums; // 136
|
||||
s16 (*bank)[4]; // 132
|
||||
char *text; // 128
|
||||
struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); // 124
|
||||
u32 prevplayernum = g_Vars.currentplayernum; // 120
|
||||
s32 distance; // 116 - not referenced
|
||||
s32 row = cmd[3]; // 112
|
||||
u32 playernum; // 108 - not referenced
|
||||
u8 headshotted = g_Vars.chrdata->hidden2 & CHRH2FLAG_HEADSHOTTED; // 107
|
||||
struct chrdata *loopchr; // 100
|
||||
|
||||
// Choose bank
|
||||
// 2c0
|
||||
if (CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) {
|
||||
bank = g_SkedarQuipBank;
|
||||
|
||||
if (row > 5) {
|
||||
row = 0;
|
||||
}
|
||||
// 2e0
|
||||
} else if (g_Vars.chrdata->headnum == HEAD_MAIAN_S) {
|
||||
bank = g_MaianQuipBank;
|
||||
|
||||
if (row > 2) {
|
||||
row = random() & 1;
|
||||
}
|
||||
// 324
|
||||
} else if (cmd[7] == 0) {
|
||||
if (g_Vars.chrdata->voicebox > 3) {
|
||||
g_Vars.chrdata->voicebox = 3;
|
||||
}
|
||||
|
||||
bank = &g_GuardQuipBank[g_Vars.chrdata->voicebox * 41];
|
||||
} else {
|
||||
// 37c
|
||||
bank = g_SpecialQuipBank;
|
||||
}
|
||||
|
||||
// 37c
|
||||
if (!row && !cmd[4] && !cmd[6]) {
|
||||
g_Vars.chrdata->soundtimer = 0;
|
||||
g_Vars.aioffset += 10;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3bc
|
||||
chrnums = teamGetChrIds(g_Vars.chrdata->team);
|
||||
numnearbychrs = 0;
|
||||
issomeonetalking = false;
|
||||
probability = cmd[4];
|
||||
|
||||
// Make it impossible for Elvis and Jon to use anything but special phrases
|
||||
// 3f0
|
||||
if ((g_Vars.chrdata->headnum == HEAD_ELVIS
|
||||
|| g_Vars.chrdata->headnum == HEAD_THEKING
|
||||
|| g_Vars.chrdata->headnum == HEAD_ELVIS_GOGS
|
||||
|| g_Vars.chrdata->headnum == HEAD_JONATHAN) &&
|
||||
bank != g_SpecialQuipBank) {
|
||||
probability = 0;
|
||||
}
|
||||
|
||||
// If the person talking is a player, and they've just died,
|
||||
// try using the other coop player.
|
||||
// 420
|
||||
if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) {
|
||||
// 444
|
||||
playernum = playermgrGetPlayerNumByProp(chr->prop);
|
||||
|
||||
if (g_Vars.coopplayernum >= 0 && g_Vars.players[playernum]->isdead) {
|
||||
// 470
|
||||
if (playernum == g_Vars.bondplayernum) {
|
||||
playernum = g_Vars.coopplayernum;
|
||||
} else {
|
||||
playernum = g_Vars.bondplayernum;
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentPlayerNum(playernum);
|
||||
}
|
||||
|
||||
// If soundgap permits talking at this time and probability passes
|
||||
// 494
|
||||
if ((g_Vars.chrdata->soundgap == 0 || g_Vars.chrdata->soundgap * 60 < g_Vars.chrdata->soundtimer)
|
||||
&& probability > (u8)random()) {
|
||||
// Try and find a chr in the same squadron who is currently talking
|
||||
// 4dc
|
||||
while (*chrnums != -2) {
|
||||
loopchr = chrFindByLiteralId(*chrnums);
|
||||
|
||||
if (loopchr && loopchr->model
|
||||
&& !chrIsDead(loopchr)
|
||||
&& loopchr->actiontype != ACT_DEAD
|
||||
&& g_Vars.chrdata->squadron == loopchr->squadron
|
||||
&& loopchr->alertness >= 100
|
||||
&& g_Vars.chrdata->chrnum != loopchr->chrnum
|
||||
&& chrGetDistanceToChr(g_Vars.chrdata, loopchr->chrnum) < 7000) {
|
||||
// 584
|
||||
numnearbychrs++;
|
||||
|
||||
// 594
|
||||
if (loopchr->soundtimer < 60 && cmd[6] != 0 && cmd[6] != 255) {
|
||||
issomeonetalking = true;
|
||||
}
|
||||
}
|
||||
|
||||
chrnums++;
|
||||
}
|
||||
|
||||
// 5dc
|
||||
if (!issomeonetalking &&
|
||||
((numnearbychrs == 0 && (cmd[6] == 0 || cmd[6] == 255)) ||
|
||||
(numnearbychrs > 0 && cmd[6] > 0))) {
|
||||
column = random() % 3;
|
||||
|
||||
// 64c
|
||||
if ((cmd[7] & 0x80) == 0) {
|
||||
audioid = bank[row][1 + column];
|
||||
} else {
|
||||
audioid = bank[row][1 + g_Vars.chrdata->tude];
|
||||
}
|
||||
|
||||
// 6a0
|
||||
if (audioWasNotPlayedRecently(audioid) || CHRRACE(g_Vars.chrdata) == RACE_SKEDAR) {
|
||||
// 6d4
|
||||
audioMarkAsRecentlyPlayed(audioid);
|
||||
|
||||
// 6e8
|
||||
// Replace gurgle with "why me"
|
||||
if (audioid == 0x34e && !headshotted) {
|
||||
audioid = 0x34d;
|
||||
}
|
||||
|
||||
// 700
|
||||
g_Vars.chrdata->soundtimer = 0;
|
||||
g_Vars.chrdata->soundgap = cmd[5];
|
||||
g_Vars.chrdata->propsoundcount++;
|
||||
|
||||
// 72c
|
||||
if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) {
|
||||
func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// 7a8
|
||||
propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
-1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
} else {
|
||||
// Audio is "Stop moving", "Stop dodging" or "Stand still"
|
||||
distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata);
|
||||
|
||||
if (ABS(distance) > 50) {
|
||||
func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// 840
|
||||
propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
-1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// Consider putting text on screen
|
||||
// Note: if cmd[8] is 0 then it means no text, so the value
|
||||
// needs to be be decremented by one so it's 0-indexed.
|
||||
// 850
|
||||
if (cmd[8] && (cmd[7] & 0x80) == 0) {
|
||||
if (column > 2) {
|
||||
column = 2;
|
||||
}
|
||||
|
||||
text = langGet(g_QuipTexts[cmd[8] - 1][1 + column]);
|
||||
|
||||
if (!sndIsFiltered(audioid)) {
|
||||
// 8ac
|
||||
hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]);
|
||||
}
|
||||
} else if (cmd[8]) {
|
||||
text = langGet(g_QuipTexts[cmd[8] - 1][1 + g_Vars.chrdata->tude]);
|
||||
|
||||
if (!sndIsFiltered(audioid)) {
|
||||
// 904
|
||||
hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Audio was played recently - try and find a different one
|
||||
audioid = 0;
|
||||
|
||||
// 92c
|
||||
for (i = 1; i < 4; i++) {
|
||||
if (audioWasNotPlayedRecently(g_GuardQuipBank[row][i])
|
||||
&& audioWasNotPlayedRecently(bank[row][i])) {
|
||||
audioid = bank[row][i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 99c
|
||||
if (audioid) {
|
||||
audioMarkAsRecentlyPlayed(audioid);
|
||||
|
||||
// Replace gurgle with "why me"
|
||||
if (audioid == 0x34e && !headshotted) {
|
||||
audioid = 0x34d;
|
||||
}
|
||||
|
||||
g_Vars.chrdata->soundtimer = 0;
|
||||
g_Vars.chrdata->soundgap = cmd[5];
|
||||
g_Vars.chrdata->propsoundcount++;
|
||||
|
||||
// 9fc
|
||||
if (audioid != 0x3f7 && audioid != 0x331 && audioid != 0x3a1) {
|
||||
func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// a80
|
||||
propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
-1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
} else {
|
||||
// Audio is "Stop moving", "Stop dodging" or "Stand still"
|
||||
// a90
|
||||
distance = chrGetDistanceLostToTargetInLastSecond(g_Vars.chrdata);
|
||||
|
||||
if (ABS(distance) > 50) {
|
||||
func0f0926bc(g_Vars.chrdata->prop, 9, 0xffff);
|
||||
// b28
|
||||
propsnd0f0939f8(0, g_Vars.chrdata->prop, audioid, -1,
|
||||
-1, 8, 0, 9, 0, -1, 0, -1, -1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// b44
|
||||
if (cmd[8]) {
|
||||
text = langGet(g_QuipTexts[cmd[8] - 1][i]);
|
||||
|
||||
if (!sndIsFiltered(audioid)) {
|
||||
// b78
|
||||
hudmsgCreateWithColour(text, HUDMSGTYPE_INGAMESUBTITLE, cmd[9]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g_Vars.chrdata->soundtimer = 0;
|
||||
g_Vars.chrdata->soundgap = cmd[5];
|
||||
chrUnsetFlags(g_Vars.chrdata, CHRFLAG1_TALKINGTODISGUISE, BANK_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentPlayerNum(prevplayernum);
|
||||
|
||||
g_Vars.aioffset += 10;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void propDecrementSoundCount(struct prop *prop)
|
||||
{
|
||||
|
||||
+117
-115
@@ -950,6 +950,7 @@ void roomSetLighting(s32 roomnum, s32 operation, u8 arg2, u8 arg3, u8 arg4)
|
||||
}
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
GLOBAL_ASM(
|
||||
glabel lightTickBroken
|
||||
@@ -1592,122 +1593,123 @@ glabel lightTickBroken
|
||||
|
||||
const char var7f1a7bb4[] = "dlights.c";
|
||||
const char var7f1a7bc0[] = "dlights.c";
|
||||
|
||||
#else
|
||||
// Mismatch: Documented below
|
||||
//bool lightTickBroken(s32 roomnum, s32 lightnum)
|
||||
//{
|
||||
// struct light *light = (struct light *)(g_BgLightsFileData + ((g_Rooms[roomnum].lightindex + lightnum) * 0x22));
|
||||
// struct coord spc8;
|
||||
// struct coord spbc;
|
||||
// struct coord spb0;
|
||||
// struct coord spa4;
|
||||
// struct coord sp98;
|
||||
// struct coord sp8c;
|
||||
// struct coord sp80;
|
||||
// struct coord centre; // 74
|
||||
// f32 rand1; // 70
|
||||
// f32 rand2; // 6c
|
||||
// s32 sparktype; // 68
|
||||
//
|
||||
// if (!light->unk05_00) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (light->sparking) {
|
||||
// if ((random() % 8) == 0) {
|
||||
// light->sparking = false;
|
||||
// } else if ((random() % 2) == 0) {
|
||||
// rand1 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1
|
||||
// rand2 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1
|
||||
// sparktype = -1;
|
||||
//
|
||||
// spc8.x = light->bbox[1].x - light->bbox[0].x;
|
||||
// spc8.y = light->bbox[1].y - light->bbox[0].y;
|
||||
// spc8.z = light->bbox[1].z - light->bbox[0].z;
|
||||
//
|
||||
// spc8.x = rand1 * spc8.x;
|
||||
// spc8.y = rand1 * spc8.y;
|
||||
// spc8.z = rand1 * spc8.z;
|
||||
//
|
||||
// spbc.x = light->bbox[2].x - light->bbox[0].x;
|
||||
// spbc.y = light->bbox[2].y - light->bbox[0].y;
|
||||
// spbc.z = light->bbox[2].z - light->bbox[0].z;
|
||||
//
|
||||
// spbc.x = rand2 * spbc.x;
|
||||
// spbc.y = rand2 * spbc.y;
|
||||
// spbc.z = rand2 * spbc.z;
|
||||
//
|
||||
// // @bug? These all use x
|
||||
// sp98.x = light->bbox[0].x + spc8.x + spbc.x;
|
||||
// sp98.y = light->bbox[0].x + spc8.y + spbc.y;
|
||||
// sp98.z = light->bbox[0].x + spc8.z + spbc.z;
|
||||
//
|
||||
// sp8c.x = light->unk07;
|
||||
// sp8c.y = light->unk08;
|
||||
// sp8c.z = light->unk09;
|
||||
//
|
||||
// sp80.x = -sp8c.f[0];
|
||||
// sp80.y = -sp8c.f[1];
|
||||
// sp80.z = -sp8c.f[2];
|
||||
//
|
||||
// func0f177164(&sp98, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1546 : 1570, "dlights.c");
|
||||
//
|
||||
// spa4.x += sp80.x;
|
||||
// spa4.y += sp80.y;
|
||||
// spa4.z += sp80.z;
|
||||
//
|
||||
// func0f177164(&spa4, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1548 : 1572, "dlights.c");
|
||||
//
|
||||
// // Mismatch: Goal loads roomnum * 0x14 into sp58 here but doesn't
|
||||
// // use it until after lightGetBboxCentre. The below statement does
|
||||
// // the same but also emits the load and store instructions.
|
||||
// g_BgRooms[roomnum].unk00 += 0;
|
||||
//
|
||||
// switch (random() % 4) {
|
||||
// case 0:
|
||||
// sparktype = SPARKTYPE_LIGHT1;
|
||||
// break;
|
||||
// case 1:
|
||||
// sparktype = SPARKTYPE_LIGHT2;
|
||||
// break;
|
||||
// case 2:
|
||||
// sparktype = SPARKTYPE_LIGHT3;
|
||||
// break;
|
||||
// case 3:
|
||||
// sparktype = SPARKTYPE_LIGHT4;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// lightGetBboxCentre(roomnum, lightnum, ¢re);
|
||||
//
|
||||
// centre.x += g_BgRooms[roomnum].pos.x;
|
||||
// centre.y += g_BgRooms[roomnum].pos.y;
|
||||
// centre.z += g_BgRooms[roomnum].pos.z;
|
||||
//
|
||||
// sparksCreate(roomnum, NULL, ¢re, &spa4, &sp8c, sparktype);
|
||||
//
|
||||
// if ((random() % 4) == 0) {
|
||||
// s16 smokerooms[2]; // 64
|
||||
// smokerooms[0] = roomnum;
|
||||
// smokerooms[1] = -1;
|
||||
//
|
||||
// smokeCreateSimple(¢re, smokerooms, SMOKETYPE_BULLETIMPACT);
|
||||
// }
|
||||
//
|
||||
// roomAdjustLighting(roomnum, 0x40, 0x50);
|
||||
// propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0x400, 0, 0x10, ¢re, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f);
|
||||
// return true;
|
||||
// }
|
||||
// } else {
|
||||
// u32 stack;
|
||||
//
|
||||
// if ((random() % 80) == 0) {
|
||||
// light->sparking = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
//}
|
||||
bool lightTickBroken(s32 roomnum, s32 lightnum)
|
||||
{
|
||||
struct light *light = (struct light *)(g_BgLightsFileData + ((g_Rooms[roomnum].lightindex + lightnum) * 0x22));
|
||||
struct coord spc8;
|
||||
struct coord spbc;
|
||||
struct coord spb0;
|
||||
struct coord spa4;
|
||||
struct coord sp98;
|
||||
struct coord sp8c;
|
||||
struct coord sp80;
|
||||
struct coord centre; // 74
|
||||
f32 rand1; // 70
|
||||
f32 rand2; // 6c
|
||||
s32 sparktype; // 68
|
||||
|
||||
if (!light->unk05_00) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (light->sparking) {
|
||||
if ((random() % 8) == 0) {
|
||||
light->sparking = false;
|
||||
} else if ((random() % 2) == 0) {
|
||||
rand1 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1
|
||||
rand2 = 2.0f * RANDOMFRAC() - 1.0f; // range -1 to 1
|
||||
sparktype = -1;
|
||||
|
||||
spc8.x = light->bbox[1].x - light->bbox[0].x;
|
||||
spc8.y = light->bbox[1].y - light->bbox[0].y;
|
||||
spc8.z = light->bbox[1].z - light->bbox[0].z;
|
||||
|
||||
spc8.x = rand1 * spc8.x;
|
||||
spc8.y = rand1 * spc8.y;
|
||||
spc8.z = rand1 * spc8.z;
|
||||
|
||||
spbc.x = light->bbox[2].x - light->bbox[0].x;
|
||||
spbc.y = light->bbox[2].y - light->bbox[0].y;
|
||||
spbc.z = light->bbox[2].z - light->bbox[0].z;
|
||||
|
||||
spbc.x = rand2 * spbc.x;
|
||||
spbc.y = rand2 * spbc.y;
|
||||
spbc.z = rand2 * spbc.z;
|
||||
|
||||
// @bug? These all use x
|
||||
sp98.x = light->bbox[0].x + spc8.x + spbc.x;
|
||||
sp98.y = light->bbox[0].x + spc8.y + spbc.y;
|
||||
sp98.z = light->bbox[0].x + spc8.z + spbc.z;
|
||||
|
||||
sp8c.x = light->unk07;
|
||||
sp8c.y = light->unk08;
|
||||
sp8c.z = light->unk09;
|
||||
|
||||
sp80.x = -sp8c.f[0];
|
||||
sp80.y = -sp8c.f[1];
|
||||
sp80.z = -sp8c.f[2];
|
||||
|
||||
func0f177164(&sp98, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1546 : 1570, "dlights.c");
|
||||
|
||||
spa4.x += sp80.x;
|
||||
spa4.y += sp80.y;
|
||||
spa4.z += sp80.z;
|
||||
|
||||
func0f177164(&spa4, &spa4, VERSION >= VERSION_NTSC_1_0 ? 1548 : 1572, "dlights.c");
|
||||
|
||||
// Mismatch: Goal loads roomnum * 0x14 into sp58 here but doesn't
|
||||
// use it until after lightGetBboxCentre. The below statement does
|
||||
// the same but also emits the load and store instructions.
|
||||
g_BgRooms[roomnum].unk00 += 0;
|
||||
|
||||
switch (random() % 4) {
|
||||
case 0:
|
||||
sparktype = SPARKTYPE_LIGHT1;
|
||||
break;
|
||||
case 1:
|
||||
sparktype = SPARKTYPE_LIGHT2;
|
||||
break;
|
||||
case 2:
|
||||
sparktype = SPARKTYPE_LIGHT3;
|
||||
break;
|
||||
case 3:
|
||||
sparktype = SPARKTYPE_LIGHT4;
|
||||
break;
|
||||
}
|
||||
|
||||
lightGetBboxCentre(roomnum, lightnum, ¢re);
|
||||
|
||||
centre.x += g_BgRooms[roomnum].pos.x;
|
||||
centre.y += g_BgRooms[roomnum].pos.y;
|
||||
centre.z += g_BgRooms[roomnum].pos.z;
|
||||
|
||||
sparksCreate(roomnum, NULL, ¢re, &spa4, &sp8c, sparktype);
|
||||
|
||||
if ((random() % 4) == 0) {
|
||||
s16 smokerooms[2]; // 64
|
||||
smokerooms[0] = roomnum;
|
||||
smokerooms[1] = -1;
|
||||
|
||||
smokeCreateSimple(¢re, smokerooms, SMOKETYPE_BULLETIMPACT);
|
||||
}
|
||||
|
||||
roomAdjustLighting(roomnum, 0x40, 0x50);
|
||||
propsnd0f0939f8(NULL, NULL, propsndGetRandomSparkSound(), -1, -1, 0x400, 0, 0x10, ¢re, -1.0f, 0, roomnum, -1.0f, -1.0f, -1.0f);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
u32 stack;
|
||||
|
||||
if ((random() % 80) == 0) {
|
||||
light->sparking = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char var7f1a7bcc[] = "L2 - g_bfGlobalLightRebuild = %d";
|
||||
const char var7f1a7bf0[] = "Acoustic Shadowing is %s";
|
||||
|
||||
+2045
-2043
File diff suppressed because it is too large
Load Diff
+92
-91
@@ -2911,6 +2911,7 @@ Gfx *func0f1574d0jf(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel textMeasure
|
||||
@@ -3534,99 +3535,99 @@ glabel textMeasure
|
||||
/* f15751c: 27bd0018 */ addiu $sp,$sp,0x18
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
// Mismatch: Goal moves textheight to s0 then uses a0 for text[i] and/or
|
||||
// thischar.
|
||||
//void textMeasure(s32 *textheight, s32 *textwidth, char *text, struct fontchar *font1, struct font *font2, s32 lineheight)
|
||||
//{
|
||||
// s32 thischar;
|
||||
// s32 prevchar;
|
||||
// s32 longest;
|
||||
// s32 i;
|
||||
// s32 tmp;
|
||||
//
|
||||
// *textheight = 0;
|
||||
// prevchar = 'H'; // Just a default - presumably chosen for its flat right edge
|
||||
// longest = 0;
|
||||
// *textwidth = 0;
|
||||
//
|
||||
// // 324
|
||||
// if (lineheight == 0) {
|
||||
// lineheight = font1['['].baseline + font1['['].height;
|
||||
// }
|
||||
//
|
||||
// // 344
|
||||
// // Force minimum height for non-English languages
|
||||
// if (g_Jpn && lineheight < 14) {
|
||||
// lineheight = 14;
|
||||
// }
|
||||
//
|
||||
// // 358
|
||||
// if (text) {
|
||||
// thischar = text[0];
|
||||
//
|
||||
// for (i = 0; text[i] != '\0'; ) {
|
||||
// // 388
|
||||
// if (thischar == ' ') {
|
||||
// // Space
|
||||
// if (text[i + 1] != '\n') {
|
||||
// *textwidth += 5;
|
||||
// }
|
||||
//
|
||||
// prevchar = 'H';
|
||||
// i++;
|
||||
// } else /*3b4*/ if (thischar == '\n') {
|
||||
// // Line break
|
||||
// if (*textwidth > longest) {
|
||||
// longest = *textwidth;
|
||||
// }
|
||||
//
|
||||
// *textwidth = 0;
|
||||
// *textheight += lineheight;
|
||||
// i++;
|
||||
// } else /*3e8*/ {
|
||||
// if (thischar < 0x80) {
|
||||
// // Normal single-byte character
|
||||
// u8 character = thischar;
|
||||
// s32 b = font1[character - 0x21].unk04;
|
||||
// s32 a = font1[prevchar - 0x21].unk04;
|
||||
//
|
||||
// tmp = font2->unk000[b + a * 13] + var8007fac4 - 1;
|
||||
// tmp = font1[character - 0x21].width + tmp;
|
||||
//
|
||||
// *textwidth = *textwidth - tmp;
|
||||
//
|
||||
// prevchar = text[i];
|
||||
// i++;
|
||||
// } else /*460*/ if (thischar < 0xc0) {
|
||||
// // Multi-byte character
|
||||
// tmp = font2->unk000[0] + var8007fac4 - 1;
|
||||
// *textwidth = *textwidth - tmp + 11;
|
||||
// i += 2;
|
||||
// } else {
|
||||
// // Multi-byte character
|
||||
// // 494
|
||||
// tmp = font2->unk000[0] + var8007fac4 - 1;
|
||||
// *textwidth = *textwidth - tmp + 15;
|
||||
// i += 2;
|
||||
// }
|
||||
//
|
||||
// if (textheight);
|
||||
// }
|
||||
//
|
||||
// thischar = text[i];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (g_ScaleX == 1) {
|
||||
// *textwidth *= var8007fad0;
|
||||
// }
|
||||
//
|
||||
// // @bug? Shouldn't this go before the scale check?
|
||||
// if (*textwidth < longest) {
|
||||
// *textwidth = longest;
|
||||
// }
|
||||
//}
|
||||
void textMeasure(s32 *textheight, s32 *textwidth, char *text, struct fontchar *font1, struct font *font2, s32 lineheight)
|
||||
{
|
||||
s32 thischar;
|
||||
s32 prevchar;
|
||||
s32 longest;
|
||||
s32 i;
|
||||
s32 tmp;
|
||||
|
||||
*textheight = 0;
|
||||
prevchar = 'H'; // Just a default - presumably chosen for its flat right edge
|
||||
longest = 0;
|
||||
*textwidth = 0;
|
||||
|
||||
// 324
|
||||
if (lineheight == 0) {
|
||||
lineheight = font1['['].baseline + font1['['].height;
|
||||
}
|
||||
|
||||
// 344
|
||||
// Force minimum height for non-English languages
|
||||
if (g_Jpn && lineheight < 14) {
|
||||
lineheight = 14;
|
||||
}
|
||||
|
||||
// 358
|
||||
if (text) {
|
||||
thischar = text[0];
|
||||
|
||||
for (i = 0; text[i] != '\0'; ) {
|
||||
// 388
|
||||
if (thischar == ' ') {
|
||||
// Space
|
||||
if (text[i + 1] != '\n') {
|
||||
*textwidth += 5;
|
||||
}
|
||||
|
||||
prevchar = 'H';
|
||||
i++;
|
||||
} else /*3b4*/ if (thischar == '\n') {
|
||||
// Line break
|
||||
if (*textwidth > longest) {
|
||||
longest = *textwidth;
|
||||
}
|
||||
|
||||
*textwidth = 0;
|
||||
*textheight += lineheight;
|
||||
i++;
|
||||
} else /*3e8*/ {
|
||||
if (thischar < 0x80) {
|
||||
// Normal single-byte character
|
||||
u8 character = thischar;
|
||||
s32 b = font1[character - 0x21].unk04;
|
||||
s32 a = font1[prevchar - 0x21].unk04;
|
||||
|
||||
tmp = font2->unk000[b + a * 13] + var8007fac4 - 1;
|
||||
|
||||
*textwidth = *textwidth + font1[character - 0x21].width - tmp;
|
||||
|
||||
prevchar = text[i];
|
||||
i++;
|
||||
} else /*460*/ if (thischar < 0xc0) {
|
||||
// Multi-byte character
|
||||
tmp = font2->unk000[0] + var8007fac4 - 1;
|
||||
*textwidth = *textwidth - tmp + 11;
|
||||
i += 2;
|
||||
} else {
|
||||
// Multi-byte character
|
||||
// 494
|
||||
tmp = font2->unk000[0] + var8007fac4 - 1;
|
||||
*textwidth = *textwidth - tmp + 15;
|
||||
i += 2;
|
||||
}
|
||||
|
||||
if (textheight);
|
||||
}
|
||||
|
||||
thischar = text[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ScaleX == 1) {
|
||||
*textwidth *= var8007fad0;
|
||||
}
|
||||
|
||||
// @bug? Shouldn't this go before the scale check?
|
||||
if (*textwidth < longest) {
|
||||
*textwidth = longest;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if VERSION == VERSION_JPN_FINAL
|
||||
bool func0f157768jf(s32 arg0, s32 arg1)
|
||||
|
||||
+305
-303
@@ -301,6 +301,7 @@ u32 var80070518 = 0x00000000;
|
||||
u32 var8007051c = 0x00000000;
|
||||
u32 var80070520 = 0x00000000;
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel beamRender
|
||||
.late_rodata
|
||||
@@ -1427,313 +1428,314 @@ glabel var7f1accf4
|
||||
/* f0adbb4: 03e00008 */ jr $ra
|
||||
/* f0adbb8: 27bd0190 */ addiu $sp,$sp,0x190
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Regalloc and some swapped loads and stores
|
||||
// - After gfxAllocateMatrix, goal skips f0 and uses f12
|
||||
// - Goal reuses f2 in neg.s instruction for cam0f0b4e68's a1
|
||||
// - Calculation of spcc near sp100 is reordered
|
||||
//Gfx *beamRender(Gfx *gdl, struct beam *beam, bool arg2, u8 arg3)
|
||||
//{
|
||||
// u32 stack;
|
||||
// Mtxf *sp188;
|
||||
// Mtxf sp148;
|
||||
//
|
||||
// if (arg3 < 5 && beam->age >= 0) {
|
||||
// struct colour *colours = gfxAllocateColours(1); // 144
|
||||
// struct coord sp138;
|
||||
// struct coord *campos = &g_Vars.currentplayer->cam_pos; // 134
|
||||
// f32 sp130;
|
||||
// f32 sp12c = beam->mindist;
|
||||
// struct gfxvtx *vertices;
|
||||
// f32 sp124 = beam->dist;
|
||||
// struct coord sp118;
|
||||
// struct coord sp10c;
|
||||
// struct coord sp100 = {0, 0, 0};
|
||||
// struct coord spf4 = {0, 0, 0};
|
||||
// f32 spf0 = 1.4142f;
|
||||
// struct textureconfig *texconfig = &g_TexBeamConfigs[arg3]; // ec
|
||||
// s32 i;
|
||||
// Mtxf *worldtoscreenmtx = camGetWorldToScreenMtxf(); // e4
|
||||
// s32 j;
|
||||
// u32 stack1;
|
||||
// s32 spd8;
|
||||
// struct coord spcc;
|
||||
// u32 stack2;
|
||||
// f32 spc0[2];
|
||||
// f32 spb8[2];
|
||||
// f32 f14;
|
||||
// f32 f16;
|
||||
// f32 f18;
|
||||
// f32 spa8;
|
||||
// f32 spa4;
|
||||
//
|
||||
// switch (beam->weaponnum) {
|
||||
// case WEAPON_CYCLONE:
|
||||
// texconfig = &g_TexBeamConfigs[1];
|
||||
// break;
|
||||
// case WEAPON_TRANQUILIZER:
|
||||
// texconfig = &g_TexBeamConfigs[3];
|
||||
// break;
|
||||
// case WEAPON_MAULER:
|
||||
// case WEAPON_PHOENIX:
|
||||
// case WEAPON_CALLISTO:
|
||||
// case WEAPON_REAPER:
|
||||
// case WEAPON_FARSIGHT:
|
||||
// texconfig = &g_TexBeamConfigs[4];
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (beam->weaponnum == -1 || beam->weaponnum == WEAPON_CYCLONE) {
|
||||
// colours[0].word = 0xffffff7f;
|
||||
// } else {
|
||||
// colours[0].word = 0xffffffff;
|
||||
// }
|
||||
//
|
||||
// if (beam->weaponnum == WEAPON_LASER) {
|
||||
// // Laser primary
|
||||
// sp130 = 50.0f;
|
||||
// texconfig = &g_TexLaserConfigs[0];
|
||||
// } else if (beam->weaponnum == -2) {
|
||||
// // Laser secondary
|
||||
// sp130 = 10.0f;
|
||||
// texconfig = &g_TexLaserConfigs[0];
|
||||
//
|
||||
// colours[0].a = 150 + (random() % 50);
|
||||
//
|
||||
// if ((random() % 5) == 0) {
|
||||
// colours[0].r = colours[0].g = 255 - (random() % 100);
|
||||
// }
|
||||
// } else {
|
||||
// sp130 = 30.0f;
|
||||
// }
|
||||
//
|
||||
// if (beam->weaponnum <= -3) {
|
||||
// // Mauler
|
||||
// sp130 = sp130 * ((beam->weaponnum + 3) * 2.0f + 1.0f);
|
||||
// texconfig = &g_TexBeamConfigs[4];
|
||||
// }
|
||||
//
|
||||
// sp138.f[0] = beam->from.f[0];
|
||||
// sp138.f[1] = beam->from.f[1];
|
||||
// sp138.f[2] = beam->from.f[2];
|
||||
//
|
||||
// if (sp124 > 0.0f) {
|
||||
// sp138.f[0] += sp124 * beam->dir.f[0];
|
||||
// sp138.f[1] += sp124 * beam->dir.f[1];
|
||||
// sp138.f[2] += sp124 * beam->dir.f[2];
|
||||
// } else {
|
||||
// sp12c += sp124;
|
||||
// sp124 = 0.0f;
|
||||
// }
|
||||
//
|
||||
// if (sp124 + sp12c > beam->maxdist) {
|
||||
// sp12c = beam->maxdist - sp124;
|
||||
// }
|
||||
//
|
||||
// sp10c.f[0] = (beam->dir.f[1] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2]))) - (beam->dir.f[2] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1])));
|
||||
// sp10c.f[1] = (beam->dir.f[2] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0]))) - (beam->dir.f[0] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2])));
|
||||
// sp10c.f[2] = (beam->dir.f[0] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1]))) - (beam->dir.f[1] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0])));
|
||||
//
|
||||
// if (sp10c.f[0] != 0.0f || sp10c.f[1] != 0.0f || sp10c.f[2] != 0.0f) {
|
||||
// guNormalize(&sp10c.f[0], &sp10c.f[1], &sp10c.f[2]);
|
||||
//
|
||||
// sp10c.f[0] *= sp130;
|
||||
// sp10c.f[1] *= sp130;
|
||||
// sp10c.f[2] *= sp130;
|
||||
// } else {
|
||||
// sp10c.f[0] = 0.0f;
|
||||
// sp10c.f[1] = sp130;
|
||||
// sp10c.f[2] = 0.0f;
|
||||
// }
|
||||
//
|
||||
// sp118.f[0] = beam->dir.f[1] * sp10c.f[2] - beam->dir.f[2] * sp10c.f[1];
|
||||
// sp118.f[1] = beam->dir.f[2] * sp10c.f[0] - beam->dir.f[0] * sp10c.f[2];
|
||||
// sp118.f[2] = beam->dir.f[0] * sp10c.f[1] - beam->dir.f[1] * sp10c.f[0];
|
||||
//
|
||||
// guNormalize(&sp118.f[0], &sp118.f[1], &sp118.f[2]);
|
||||
//
|
||||
// sp118.f[0] *= sp130;
|
||||
// sp118.f[1] *= sp130;
|
||||
// sp118.f[2] *= sp130;
|
||||
//
|
||||
// if (beam->weaponnum == WEAPON_LASER) {
|
||||
// vertices = gfxAllocateVertices(8);
|
||||
// } else {
|
||||
// vertices = gfxAllocateVertices(4);
|
||||
// }
|
||||
//
|
||||
// sp188 = gfxAllocateMatrix();
|
||||
//
|
||||
// if (sp12c > 0.0f
|
||||
// && sp138.f[0] > -32000.0f && sp138.f[0] < 32000.0f
|
||||
// && sp138.f[1] > -32000.0f && sp138.f[1] < 32000.0f
|
||||
// && sp138.f[2] > -32000.0f && sp138.f[2] < 32000.0f) {
|
||||
// spd8 = true;
|
||||
// mtx4LoadTranslation(&sp138, &sp148);
|
||||
// mtx00015f04(0.1f, &sp148);
|
||||
// mtx00015be0(worldtoscreenmtx, &sp148);
|
||||
//
|
||||
// for (i = 0; i < 4; i++) {
|
||||
// for (j = 0; j < 4; j++) {
|
||||
// if (sp148.m[i][j] < -32000.0f || sp148.m[i][j] > 32000.0f) {
|
||||
// spd8 = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (spd8) {
|
||||
// mtx00016054(&sp148, sp188);
|
||||
//
|
||||
// if (beam->weaponnum);
|
||||
//
|
||||
// if (beam->weaponnum == -2 && PLAYERCOUNT() == 1) {
|
||||
// spcc.f[0] = sp138.f[0] + beam->dir.f[0] * sp12c;
|
||||
// spcc.f[1] = sp138.f[1] + beam->dir.f[1] * sp12c;
|
||||
// spcc.f[2] = sp138.f[2] + beam->dir.f[2] * sp12c;
|
||||
//
|
||||
// mtx4TransformVecInPlace(worldtoscreenmtx, &spcc);
|
||||
//
|
||||
// spb8[0] = spb8[1] = sp130 / 10.0f;
|
||||
//
|
||||
// cam0f0b4e68(spb8, -spcc.f[2], spc0);
|
||||
//
|
||||
// if (spc0[0] < 2.0f) {
|
||||
// spcc.f[0] *= spc0[0] * 0.5f;
|
||||
// spcc.f[1] *= spc0[0] * 0.5f;
|
||||
// spcc.f[2] *= spc0[0] * 0.5f;
|
||||
// }
|
||||
//
|
||||
// mtx4TransformVecInPlace(camGetProjectionMtxF(), &spcc);
|
||||
//
|
||||
// spcc.f[0] -= sp138.f[0];
|
||||
// spcc.f[1] -= sp138.f[1];
|
||||
// spcc.f[2] -= sp138.f[2];
|
||||
//
|
||||
// if (1);
|
||||
//
|
||||
// sp100.f[0] = spcc.f[0] * 10.0f;
|
||||
// sp100.f[1] = spcc.f[1] * 10.0f;
|
||||
// sp100.f[2] = spcc.f[2] * 10.0f;
|
||||
// } else {
|
||||
// sp100.f[0] = beam->dir.f[0] * (sp12c * 10.0f);
|
||||
// sp100.f[1] = beam->dir.f[1] * (sp12c * 10.0f);
|
||||
// sp100.f[2] = beam->dir.f[2] * (sp12c * 10.0f);
|
||||
// }
|
||||
//
|
||||
// if (sp100.f[0] > -30000.0f && sp100.f[0] < 30000.0f
|
||||
// && sp100.f[1] > -30000.0f && sp100.f[1] < 30000.0f
|
||||
// && sp100.f[2] > -30000.0f && sp100.f[2] < 30000.0f) {
|
||||
// vertices[0].x = sp10c.f[0];
|
||||
// vertices[0].y = sp10c.f[1];
|
||||
// vertices[0].z = sp10c.f[2];
|
||||
// vertices[0].s = texconfig->width * 32;
|
||||
// vertices[0].t = 0;
|
||||
// vertices[0].colour = 0;
|
||||
//
|
||||
// vertices[1].x = -sp10c.f[0];
|
||||
// vertices[1].y = -sp10c.f[1];
|
||||
// vertices[1].z = -sp10c.f[2];
|
||||
// vertices[1].s = 0;
|
||||
// vertices[1].t = 0;
|
||||
// vertices[1].colour = 0;
|
||||
//
|
||||
// vertices[2].x = sp100.f[0] + sp10c.f[0] * 0.9f;
|
||||
// vertices[2].y = sp100.f[1] + sp10c.f[1] * 0.9f;
|
||||
// vertices[2].z = sp100.f[2] + sp10c.f[2] * 0.9f;
|
||||
// vertices[2].s = texconfig->width * 32;
|
||||
// vertices[2].t = texconfig->height * 32;
|
||||
// vertices[2].colour = 0;
|
||||
//
|
||||
// vertices[3].x = sp100.f[0] - sp10c.f[0] * 0.9f;
|
||||
// vertices[3].y = sp100.f[1] - sp10c.f[1] * 0.9f;
|
||||
// vertices[3].z = sp100.f[2] - sp10c.f[2] * 0.9f;
|
||||
// vertices[3].s = 0;
|
||||
// vertices[3].t = texconfig->height * 32;
|
||||
// vertices[3].colour = 0;
|
||||
//
|
||||
// if (beam->weaponnum == WEAPON_LASER) {
|
||||
// f14 = campos->f[0] - sp138.f[0];
|
||||
// f16 = campos->f[1] - sp138.f[1];
|
||||
// f18 = campos->f[2] - sp138.f[2];
|
||||
//
|
||||
// spa8 = f14 * f14 + f16 * f16 + f18 * f18;
|
||||
//
|
||||
// f14 = campos->f[0] - (sp138.f[0] + beam->dir.f[0] * sp12c);
|
||||
// f16 = campos->f[1] - (sp138.f[1] + beam->dir.f[1] * sp12c);
|
||||
// f18 = campos->f[2] - (sp138.f[2] + beam->dir.f[2] * sp12c);
|
||||
//
|
||||
// spa4 = f14 * f14 + f16 * f16 + f18 * f18;
|
||||
//
|
||||
// if (spa4 < spa8) {
|
||||
// spf4.f[0] = sp100.f[0];
|
||||
// spf4.f[1] = sp100.f[1];
|
||||
// spf4.f[2] = sp100.f[2];
|
||||
// spf0 *= 0.9f;
|
||||
// }
|
||||
//
|
||||
// vertices[4].x = spf4.f[0] + sp118.f[0] * spf0;
|
||||
// vertices[4].y = spf4.f[1] + sp118.f[1] * spf0;
|
||||
// vertices[4].z = spf4.f[2] + sp118.f[2] * spf0;
|
||||
// vertices[4].s = g_TexGroup03Configs[0].width * 32;
|
||||
// vertices[4].t = g_TexGroup03Configs[0].height * 32;
|
||||
// vertices[4].colour = 0;
|
||||
//
|
||||
// vertices[5].x = spf4.f[0] - sp118.f[0] * spf0;
|
||||
// vertices[5].y = spf4.f[1] - sp118.f[1] * spf0;
|
||||
// vertices[5].z = spf4.f[2] - sp118.f[2] * spf0;
|
||||
// vertices[5].s = 0;
|
||||
// vertices[5].t = 0;
|
||||
// vertices[5].colour = 0;
|
||||
//
|
||||
// vertices[6].x = spf4.f[0] + sp10c.f[0] * spf0;
|
||||
// vertices[6].y = spf4.f[1] + sp10c.f[1] * spf0;
|
||||
// vertices[6].z = spf4.f[2] + sp10c.f[2] * spf0;
|
||||
// vertices[6].s = 0;
|
||||
// vertices[6].t = g_TexGroup03Configs[0].height * 32;
|
||||
// vertices[6].colour = 0;
|
||||
//
|
||||
// vertices[7].x = spf4.f[0] - sp10c.f[0] * spf0;
|
||||
// vertices[7].y = spf4.f[1] - sp10c.f[1] * spf0;
|
||||
// vertices[7].z = spf4.f[2] - sp10c.f[2] * spf0;
|
||||
// vertices[7].s = g_TexGroup03Configs[0].width * 32;
|
||||
// vertices[7].t = 0;
|
||||
// vertices[7].colour = 0;
|
||||
// }
|
||||
//
|
||||
// gSPClearGeometryMode(gdl++, G_CULL_BACK);
|
||||
// gSPMatrix(gdl++, osVirtualToPhysical(sp188), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetColorDither(gdl++, G_CD_DISABLE);
|
||||
// gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
// gDPSetTextureConvert(gdl++, G_TC_FILT);
|
||||
// gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA);
|
||||
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
//
|
||||
// if (beam->weaponnum == WEAPON_LASER) {
|
||||
// texSelect(&gdl, &g_TexGroup03Configs[0], 4, arg2, 2, true, NULL);
|
||||
//
|
||||
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8);
|
||||
// gDPTri2(gdl++, 4, 5, 6, 4, 5, 7);
|
||||
//
|
||||
// texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL);
|
||||
//
|
||||
// gDPTri2(gdl++, 0, 2, 3, 0, 3, 1);
|
||||
// } else {
|
||||
// texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL);
|
||||
//
|
||||
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4);
|
||||
// gDPTri2(gdl++, 0, 2, 3, 0, 3, 1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *beamRender(Gfx *gdl, struct beam *beam, bool arg2, u8 arg3)
|
||||
{
|
||||
u32 stack;
|
||||
Mtxf *sp188;
|
||||
Mtxf sp148;
|
||||
|
||||
if (arg3 < 5 && beam->age >= 0) {
|
||||
struct colour *colours = gfxAllocateColours(1); // 144
|
||||
struct coord sp138;
|
||||
struct coord *campos = &g_Vars.currentplayer->cam_pos; // 134
|
||||
f32 sp130;
|
||||
f32 sp12c = beam->mindist;
|
||||
struct gfxvtx *vertices;
|
||||
f32 sp124 = beam->dist;
|
||||
struct coord sp118;
|
||||
struct coord sp10c;
|
||||
struct coord sp100 = {0, 0, 0};
|
||||
struct coord spf4 = {0, 0, 0};
|
||||
f32 spf0 = 1.4142f;
|
||||
struct textureconfig *texconfig = &g_TexBeamConfigs[arg3]; // ec
|
||||
s32 i;
|
||||
Mtxf *worldtoscreenmtx = camGetWorldToScreenMtxf(); // e4
|
||||
s32 j;
|
||||
u32 stack1;
|
||||
s32 spd8;
|
||||
struct coord spcc;
|
||||
u32 stack2;
|
||||
f32 spc0[2];
|
||||
f32 spb8[2];
|
||||
f32 f14;
|
||||
f32 f16;
|
||||
f32 f18;
|
||||
f32 spa8;
|
||||
f32 spa4;
|
||||
|
||||
switch (beam->weaponnum) {
|
||||
case WEAPON_CYCLONE:
|
||||
texconfig = &g_TexBeamConfigs[1];
|
||||
break;
|
||||
case WEAPON_TRANQUILIZER:
|
||||
texconfig = &g_TexBeamConfigs[3];
|
||||
break;
|
||||
case WEAPON_MAULER:
|
||||
case WEAPON_PHOENIX:
|
||||
case WEAPON_CALLISTO:
|
||||
case WEAPON_REAPER:
|
||||
case WEAPON_FARSIGHT:
|
||||
texconfig = &g_TexBeamConfigs[4];
|
||||
break;
|
||||
}
|
||||
|
||||
if (beam->weaponnum == -1 || beam->weaponnum == WEAPON_CYCLONE) {
|
||||
colours[0].word = 0xffffff7f;
|
||||
} else {
|
||||
colours[0].word = 0xffffffff;
|
||||
}
|
||||
|
||||
if (beam->weaponnum == WEAPON_LASER) {
|
||||
// Laser primary
|
||||
sp130 = 50.0f;
|
||||
texconfig = &g_TexLaserConfigs[0];
|
||||
} else if (beam->weaponnum == -2) {
|
||||
// Laser secondary
|
||||
sp130 = 10.0f;
|
||||
texconfig = &g_TexLaserConfigs[0];
|
||||
|
||||
colours[0].a = 150 + (random() % 50);
|
||||
|
||||
if ((random() % 5) == 0) {
|
||||
colours[0].r = colours[0].g = 255 - (random() % 100);
|
||||
}
|
||||
} else {
|
||||
sp130 = 30.0f;
|
||||
}
|
||||
|
||||
if (beam->weaponnum <= -3) {
|
||||
// Mauler
|
||||
sp130 = sp130 * ((beam->weaponnum + 3) * 2.0f + 1.0f);
|
||||
texconfig = &g_TexBeamConfigs[4];
|
||||
}
|
||||
|
||||
sp138.f[0] = beam->from.f[0];
|
||||
sp138.f[1] = beam->from.f[1];
|
||||
sp138.f[2] = beam->from.f[2];
|
||||
|
||||
if (sp124 > 0.0f) {
|
||||
sp138.f[0] += sp124 * beam->dir.f[0];
|
||||
sp138.f[1] += sp124 * beam->dir.f[1];
|
||||
sp138.f[2] += sp124 * beam->dir.f[2];
|
||||
} else {
|
||||
sp12c += sp124;
|
||||
sp124 = 0.0f;
|
||||
}
|
||||
|
||||
if (sp124 + sp12c > beam->maxdist) {
|
||||
sp12c = beam->maxdist - sp124;
|
||||
}
|
||||
|
||||
sp10c.f[0] = (beam->dir.f[1] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2]))) - (beam->dir.f[2] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1])));
|
||||
sp10c.f[1] = (beam->dir.f[2] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0]))) - (beam->dir.f[0] * (campos->f[2] - (sp138.f[2] + sp12c * beam->dir.f[2])));
|
||||
sp10c.f[2] = (beam->dir.f[0] * (campos->f[1] - (sp138.f[1] + sp12c * beam->dir.f[1]))) - (beam->dir.f[1] * (campos->f[0] - (sp138.f[0] + sp12c * beam->dir.f[0])));
|
||||
|
||||
if (sp10c.f[0] != 0.0f || sp10c.f[1] != 0.0f || sp10c.f[2] != 0.0f) {
|
||||
guNormalize(&sp10c.f[0], &sp10c.f[1], &sp10c.f[2]);
|
||||
|
||||
sp10c.f[0] *= sp130;
|
||||
sp10c.f[1] *= sp130;
|
||||
sp10c.f[2] *= sp130;
|
||||
} else {
|
||||
sp10c.f[0] = 0.0f;
|
||||
sp10c.f[1] = sp130;
|
||||
sp10c.f[2] = 0.0f;
|
||||
}
|
||||
|
||||
sp118.f[0] = beam->dir.f[1] * sp10c.f[2] - beam->dir.f[2] * sp10c.f[1];
|
||||
sp118.f[1] = beam->dir.f[2] * sp10c.f[0] - beam->dir.f[0] * sp10c.f[2];
|
||||
sp118.f[2] = beam->dir.f[0] * sp10c.f[1] - beam->dir.f[1] * sp10c.f[0];
|
||||
|
||||
guNormalize(&sp118.f[0], &sp118.f[1], &sp118.f[2]);
|
||||
|
||||
sp118.f[0] *= sp130;
|
||||
sp118.f[1] *= sp130;
|
||||
sp118.f[2] *= sp130;
|
||||
|
||||
if (beam->weaponnum == WEAPON_LASER) {
|
||||
vertices = gfxAllocateVertices(8);
|
||||
} else {
|
||||
vertices = gfxAllocateVertices(4);
|
||||
}
|
||||
|
||||
sp188 = gfxAllocateMatrix();
|
||||
|
||||
if (sp12c > 0.0f
|
||||
&& sp138.f[0] > -32000.0f && sp138.f[0] < 32000.0f
|
||||
&& sp138.f[1] > -32000.0f && sp138.f[1] < 32000.0f
|
||||
&& sp138.f[2] > -32000.0f && sp138.f[2] < 32000.0f) {
|
||||
spd8 = true;
|
||||
mtx4LoadTranslation(&sp138, &sp148);
|
||||
mtx00015f04(0.1f, &sp148);
|
||||
mtx00015be0(worldtoscreenmtx, &sp148);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (sp148.m[i][j] < -32000.0f || sp148.m[i][j] > 32000.0f) {
|
||||
spd8 = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spd8) {
|
||||
mtx00016054(&sp148, sp188);
|
||||
|
||||
if (beam->weaponnum);
|
||||
|
||||
if (beam->weaponnum == -2 && PLAYERCOUNT() == 1) {
|
||||
spcc.f[0] = sp138.f[0] + beam->dir.f[0] * sp12c;
|
||||
spcc.f[1] = sp138.f[1] + beam->dir.f[1] * sp12c;
|
||||
spcc.f[2] = sp138.f[2] + beam->dir.f[2] * sp12c;
|
||||
|
||||
mtx4TransformVecInPlace(worldtoscreenmtx, &spcc);
|
||||
|
||||
spb8[0] = spb8[1] = sp130 / 10.0f;
|
||||
|
||||
cam0f0b4e68(spb8, -spcc.f[2], spc0);
|
||||
|
||||
if (spc0[0] < 2.0f) {
|
||||
spcc.f[0] *= spc0[0] * 0.5f;
|
||||
spcc.f[1] *= spc0[0] * 0.5f;
|
||||
spcc.f[2] *= spc0[0] * 0.5f;
|
||||
}
|
||||
|
||||
mtx4TransformVecInPlace(camGetProjectionMtxF(), &spcc);
|
||||
|
||||
spcc.f[0] -= sp138.f[0];
|
||||
spcc.f[1] -= sp138.f[1];
|
||||
spcc.f[2] -= sp138.f[2];
|
||||
|
||||
if (1);
|
||||
|
||||
sp100.f[0] = spcc.f[0] * 10.0f;
|
||||
sp100.f[1] = spcc.f[1] * 10.0f;
|
||||
sp100.f[2] = spcc.f[2] * 10.0f;
|
||||
} else {
|
||||
sp100.f[0] = beam->dir.f[0] * (sp12c * 10.0f);
|
||||
sp100.f[1] = beam->dir.f[1] * (sp12c * 10.0f);
|
||||
sp100.f[2] = beam->dir.f[2] * (sp12c * 10.0f);
|
||||
}
|
||||
|
||||
if (sp100.f[0] > -30000.0f && sp100.f[0] < 30000.0f
|
||||
&& sp100.f[1] > -30000.0f && sp100.f[1] < 30000.0f
|
||||
&& sp100.f[2] > -30000.0f && sp100.f[2] < 30000.0f) {
|
||||
vertices[0].x = sp10c.f[0];
|
||||
vertices[0].y = sp10c.f[1];
|
||||
vertices[0].z = sp10c.f[2];
|
||||
vertices[0].s = texconfig->width * 32;
|
||||
vertices[0].t = 0;
|
||||
vertices[0].colour = 0;
|
||||
|
||||
vertices[1].x = -sp10c.f[0];
|
||||
vertices[1].y = -sp10c.f[1];
|
||||
vertices[1].z = -sp10c.f[2];
|
||||
vertices[1].s = 0;
|
||||
vertices[1].t = 0;
|
||||
vertices[1].colour = 0;
|
||||
|
||||
vertices[2].x = sp100.f[0] + sp10c.f[0] * 0.9f;
|
||||
vertices[2].y = sp100.f[1] + sp10c.f[1] * 0.9f;
|
||||
vertices[2].z = sp100.f[2] + sp10c.f[2] * 0.9f;
|
||||
vertices[2].s = texconfig->width * 32;
|
||||
vertices[2].t = texconfig->height * 32;
|
||||
vertices[2].colour = 0;
|
||||
|
||||
vertices[3].x = sp100.f[0] - sp10c.f[0] * 0.9f;
|
||||
vertices[3].y = sp100.f[1] - sp10c.f[1] * 0.9f;
|
||||
vertices[3].z = sp100.f[2] - sp10c.f[2] * 0.9f;
|
||||
vertices[3].s = 0;
|
||||
vertices[3].t = texconfig->height * 32;
|
||||
vertices[3].colour = 0;
|
||||
|
||||
if (beam->weaponnum == WEAPON_LASER) {
|
||||
f14 = campos->f[0] - sp138.f[0];
|
||||
f16 = campos->f[1] - sp138.f[1];
|
||||
f18 = campos->f[2] - sp138.f[2];
|
||||
|
||||
spa8 = f14 * f14 + f16 * f16 + f18 * f18;
|
||||
|
||||
f14 = campos->f[0] - (sp138.f[0] + beam->dir.f[0] * sp12c);
|
||||
f16 = campos->f[1] - (sp138.f[1] + beam->dir.f[1] * sp12c);
|
||||
f18 = campos->f[2] - (sp138.f[2] + beam->dir.f[2] * sp12c);
|
||||
|
||||
spa4 = f14 * f14 + f16 * f16 + f18 * f18;
|
||||
|
||||
if (spa4 < spa8) {
|
||||
spf4.f[0] = sp100.f[0];
|
||||
spf4.f[1] = sp100.f[1];
|
||||
spf4.f[2] = sp100.f[2];
|
||||
spf0 *= 0.9f;
|
||||
}
|
||||
|
||||
vertices[4].x = spf4.f[0] + sp118.f[0] * spf0;
|
||||
vertices[4].y = spf4.f[1] + sp118.f[1] * spf0;
|
||||
vertices[4].z = spf4.f[2] + sp118.f[2] * spf0;
|
||||
vertices[4].s = g_TexGroup03Configs[0].width * 32;
|
||||
vertices[4].t = g_TexGroup03Configs[0].height * 32;
|
||||
vertices[4].colour = 0;
|
||||
|
||||
vertices[5].x = spf4.f[0] - sp118.f[0] * spf0;
|
||||
vertices[5].y = spf4.f[1] - sp118.f[1] * spf0;
|
||||
vertices[5].z = spf4.f[2] - sp118.f[2] * spf0;
|
||||
vertices[5].s = 0;
|
||||
vertices[5].t = 0;
|
||||
vertices[5].colour = 0;
|
||||
|
||||
vertices[6].x = spf4.f[0] + sp10c.f[0] * spf0;
|
||||
vertices[6].y = spf4.f[1] + sp10c.f[1] * spf0;
|
||||
vertices[6].z = spf4.f[2] + sp10c.f[2] * spf0;
|
||||
vertices[6].s = 0;
|
||||
vertices[6].t = g_TexGroup03Configs[0].height * 32;
|
||||
vertices[6].colour = 0;
|
||||
|
||||
vertices[7].x = spf4.f[0] - sp10c.f[0] * spf0;
|
||||
vertices[7].y = spf4.f[1] - sp10c.f[1] * spf0;
|
||||
vertices[7].z = spf4.f[2] - sp10c.f[2] * spf0;
|
||||
vertices[7].s = g_TexGroup03Configs[0].width * 32;
|
||||
vertices[7].t = 0;
|
||||
vertices[7].colour = 0;
|
||||
}
|
||||
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BACK);
|
||||
gSPMatrix(gdl++, osVirtualToPhysical(sp188), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetColorDither(gdl++, G_CD_DISABLE);
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
gDPSetTextureConvert(gdl++, G_TC_FILT);
|
||||
gDPSetCombineMode(gdl++, G_CC_BLENDIA, G_CC_BLENDIA);
|
||||
gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
|
||||
if (beam->weaponnum == WEAPON_LASER) {
|
||||
texSelect(&gdl, &g_TexGroup03Configs[0], 4, arg2, 2, true, NULL);
|
||||
|
||||
gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8);
|
||||
gDPTri2(gdl++, 4, 5, 6, 4, 5, 7);
|
||||
|
||||
texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL);
|
||||
|
||||
gDPTri2(gdl++, 0, 2, 3, 0, 3, 1);
|
||||
} else {
|
||||
texSelect(&gdl, texconfig, 4, arg2, 2, true, NULL);
|
||||
|
||||
gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4);
|
||||
gDPTri2(gdl++, 0, 2, 3, 0, 3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
void beamTick(struct beam *beam)
|
||||
{
|
||||
|
||||
+461
-450
@@ -20,6 +20,7 @@
|
||||
|
||||
#define NUM_SUCCESS_PARTICLES 280
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel menugfxCreateBlur
|
||||
@@ -517,6 +518,7 @@ const u32 var7f1adf00[] = {0x63636363};
|
||||
const u32 var7f1adf04[] = {0x00000000};
|
||||
u32 var80071180 = 1;
|
||||
|
||||
#else
|
||||
#define BLURIMG_WIDTH 40
|
||||
#define BLURIMG_HEIGHT 30
|
||||
#define SAMPLE_WIDTH 8
|
||||
@@ -539,113 +541,114 @@ u32 var80071180 = 1;
|
||||
* It's a simple fade between the source framebuffer and the blurred image.
|
||||
* Only one blurred image is made.
|
||||
*/
|
||||
//void menugfxCreateBlur(void)
|
||||
//{
|
||||
//#if VERSION >= VERSION_PAL_FINAL
|
||||
// // Mismatch: Different codegen
|
||||
// u8 *fb = viGetFrontBuffer();
|
||||
// s32 fbwidthinbytes = viGetWidth() * 2;
|
||||
// f32 scale = viGetWidth() / 320.0f;
|
||||
// s32 dsty;
|
||||
// s32 dstx;
|
||||
// s32 srcx;
|
||||
// s32 srcy;
|
||||
//
|
||||
// static u32 var80071180 = 1;
|
||||
//
|
||||
// g_ScaleX = 1;
|
||||
//
|
||||
// if (var80071180 == 1) {
|
||||
// fb = viGetFrontBuffer();
|
||||
// }
|
||||
//
|
||||
// mainOverrideVariable("cccc", &var80071180);
|
||||
//
|
||||
// for (dsty = 0; dsty < 30; dsty++) {
|
||||
// for (dstx = 0; dstx < 40; dstx++) {
|
||||
// s32 dstindex = dsty * 80 + dstx * 2;
|
||||
// u32 r = 0;
|
||||
// u32 g = 0;
|
||||
// u32 b = 0;
|
||||
//
|
||||
// for (srcx = 0; srcx < 8; srcx++) {
|
||||
// for (srcy = 0; srcy < 8; srcy++) {
|
||||
// s32 e = (f32)dstx * 2 * 4 * 2 * scale;
|
||||
// s32 c = (dsty * fbwidthinbytes * 8);
|
||||
// s32 block = (e + c) & ~1;
|
||||
// s32 a = (f32)srcx * 2 * scale;
|
||||
// s32 d = (srcy * fbwidthinbytes);
|
||||
// s32 index = (a + block + d) & ~1;
|
||||
//
|
||||
// u32 colour = fb[index] << 8 | fb[index + 1];
|
||||
//
|
||||
// r += colour >> 11 & 0x1f;
|
||||
// g += colour >> 6 & 0x1f;
|
||||
// b += colour >> 1 & 0x1f;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// r /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
// g /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
// b /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
//
|
||||
// g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2);
|
||||
// g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// g_ScaleX = 1;
|
||||
//#else
|
||||
// // Mismatch: The below stores 0x280 (end value for dstx loop) in s8,
|
||||
// // and doesn't store samplestartindex in s2.
|
||||
// u8 *fb = viGetFrontBuffer();
|
||||
// s32 fbwidthinbytes = PXTOBYTES(viGetWidth());
|
||||
// s32 dsty;
|
||||
// s32 dstx;
|
||||
// s32 srcx;
|
||||
// s32 srcy;
|
||||
//
|
||||
// static u32 var80071180 = 1;
|
||||
//
|
||||
// g_ScaleX = (g_ViRes == VIRES_HI) ? 2 : 1;
|
||||
//
|
||||
// if (var80071180 == 1) {
|
||||
// fb = viGetFrontBuffer();
|
||||
// }
|
||||
//
|
||||
// mainOverrideVariable("cccc", &var80071180);
|
||||
//
|
||||
// for (dsty = 0; dsty < BLURIMG_HEIGHT; dsty++) {
|
||||
// for (dstx = 0; dstx < BLURIMG_WIDTH; dstx++) {
|
||||
// s32 dstindex = PXTOBYTES(dsty * BLURIMG_WIDTH) + PXTOBYTES(dstx);
|
||||
// u32 r = 0;
|
||||
// u32 g = 0;
|
||||
// u32 b = 0;
|
||||
// s32 samplestartindex = PXTOBYTES(dstx * SAMPLE_WIDTH) * g_ScaleX + dsty * fbwidthinbytes * SAMPLE_HEIGHT;
|
||||
//
|
||||
// for (srcx = 0; srcx < SAMPLE_WIDTH; srcx++) {
|
||||
// for (srcy = 0; srcy < SAMPLE_HEIGHT; srcy++) {
|
||||
// s32 offset = PXTOBYTES(srcx) * g_ScaleX + srcy * fbwidthinbytes;
|
||||
// s32 colour = fb[samplestartindex + offset] << 8 | fb[samplestartindex + offset + 1];
|
||||
//
|
||||
// r += colour >> 11 & 0x1f;
|
||||
// g += colour >> 6 & 0x1f;
|
||||
// b += colour >> 1 & 0x1f;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// r /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
// g /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
// b /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
//
|
||||
// g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2);
|
||||
// g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// g_ScaleX = 1;
|
||||
//#endif
|
||||
//}
|
||||
void menugfxCreateBlur(void)
|
||||
{
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
// Mismatch: Different codegen
|
||||
u8 *fb = (u8 *) viGetFrontBuffer();
|
||||
s32 fbwidthinbytes = viGetWidth() * 2;
|
||||
f32 scale = viGetWidth() / 320.0f;
|
||||
s32 dsty;
|
||||
s32 dstx;
|
||||
s32 srcx;
|
||||
s32 srcy;
|
||||
|
||||
static u32 var80071180 = 1;
|
||||
|
||||
g_ScaleX = 1;
|
||||
|
||||
if (var80071180 == 1) {
|
||||
fb = (u8 *) viGetFrontBuffer();
|
||||
}
|
||||
|
||||
mainOverrideVariable("cccc", &var80071180);
|
||||
|
||||
for (dsty = 0; dsty < 30; dsty++) {
|
||||
for (dstx = 0; dstx < 40; dstx++) {
|
||||
s32 dstindex = dsty * 80 + dstx * 2;
|
||||
u32 r = 0;
|
||||
u32 g = 0;
|
||||
u32 b = 0;
|
||||
|
||||
for (srcx = 0; srcx < 8; srcx++) {
|
||||
for (srcy = 0; srcy < 8; srcy++) {
|
||||
s32 e = (f32)dstx * 2 * 4 * 2 * scale;
|
||||
s32 c = (dsty * fbwidthinbytes * 8);
|
||||
s32 block = (e + c) & ~1;
|
||||
s32 a = (f32)srcx * 2 * scale;
|
||||
s32 d = (srcy * fbwidthinbytes);
|
||||
s32 index = (a + block + d) & ~1;
|
||||
|
||||
u32 colour = fb[index] << 8 | fb[index + 1];
|
||||
|
||||
r += colour >> 11 & 0x1f;
|
||||
g += colour >> 6 & 0x1f;
|
||||
b += colour >> 1 & 0x1f;
|
||||
}
|
||||
}
|
||||
|
||||
r /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
g /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
b /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
|
||||
g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2);
|
||||
g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1);
|
||||
}
|
||||
}
|
||||
|
||||
g_ScaleX = 1;
|
||||
#else
|
||||
// Mismatch: The below stores 0x280 (end value for dstx loop) in s8,
|
||||
// and doesn't store samplestartindex in s2.
|
||||
u8 *fb = (u8 *) viGetFrontBuffer();
|
||||
s32 fbwidthinbytes = PXTOBYTES(viGetWidth());
|
||||
s32 dsty;
|
||||
s32 dstx;
|
||||
s32 srcx;
|
||||
s32 srcy;
|
||||
|
||||
static u32 var80071180 = 1;
|
||||
|
||||
g_ScaleX = (g_ViRes == VIRES_HI) ? 2 : 1;
|
||||
|
||||
if (var80071180 == 1) {
|
||||
fb = (u8 *) viGetFrontBuffer();
|
||||
}
|
||||
|
||||
mainOverrideVariable("cccc", &var80071180);
|
||||
|
||||
for (dsty = 0; dsty < BLURIMG_HEIGHT; dsty++) {
|
||||
for (dstx = 0; dstx < BLURIMG_WIDTH; dstx++) {
|
||||
s32 dstindex = PXTOBYTES(dsty * BLURIMG_WIDTH) + PXTOBYTES(dstx);
|
||||
u32 r = 0;
|
||||
u32 g = 0;
|
||||
u32 b = 0;
|
||||
s32 samplestartindex = PXTOBYTES(dstx * SAMPLE_WIDTH) * g_ScaleX + dsty * fbwidthinbytes * SAMPLE_HEIGHT;
|
||||
|
||||
for (srcx = 0; srcx < SAMPLE_WIDTH; srcx++) {
|
||||
for (srcy = 0; srcy < SAMPLE_HEIGHT; srcy++) {
|
||||
s32 offset = PXTOBYTES(srcx) * g_ScaleX + srcy * fbwidthinbytes;
|
||||
s32 colour = fb[samplestartindex + offset] << 8 | fb[samplestartindex + offset + 1];
|
||||
|
||||
r += colour >> 11 & 0x1f;
|
||||
g += colour >> 6 & 0x1f;
|
||||
b += colour >> 1 & 0x1f;
|
||||
}
|
||||
}
|
||||
|
||||
r /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
g /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
b /= SAMPLE_WIDTH * SAMPLE_HEIGHT;
|
||||
|
||||
g_BlurBuffer[dstindex + 0] = (r << 3) | (g >> 2);
|
||||
g_BlurBuffer[dstindex + 1] = (g << 6) | ((b & 0x1f) << 1);
|
||||
}
|
||||
}
|
||||
|
||||
g_ScaleX = 1;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3)
|
||||
{
|
||||
@@ -803,6 +806,7 @@ Gfx *menugfxRenderDialogBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, str
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel menugfxRenderBgGreenHaze
|
||||
.late_rodata
|
||||
@@ -1261,7 +1265,7 @@ glabel var7f1adf18
|
||||
/* f0e1660: 03e00008 */ jr $ra
|
||||
/* f0e1664: 27bd0118 */ addiu $sp,$sp,0x118
|
||||
);
|
||||
|
||||
#else
|
||||
/**
|
||||
* This unused function renders an experimental menu background.
|
||||
*
|
||||
@@ -1269,126 +1273,127 @@ glabel var7f1adf18
|
||||
* Both layers spin slowly in opposite directions.
|
||||
*/
|
||||
// Mismatch: Regalloc, and a different approach is taken for the i == 1 checks.
|
||||
//Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2)
|
||||
//{
|
||||
// u32 *colours;
|
||||
// struct gfxvtx *vertices;
|
||||
// u32 alphas[2]; // 104
|
||||
// s32 i;
|
||||
// s16 t5;
|
||||
// s16 s0;
|
||||
// s16 s2;
|
||||
// s16 s3;
|
||||
// f32 f20;
|
||||
// f32 f22;
|
||||
// f32 f24;
|
||||
// f32 f26;
|
||||
// f32 f0;
|
||||
// f32 f2;
|
||||
// u32 stack[2];
|
||||
// struct gfxvtx *iter;
|
||||
//
|
||||
// colours = gfxAllocateColours(4);
|
||||
// vertices = gfxAllocateVertices(8);
|
||||
//
|
||||
// gDPPipeSync(gdl++);
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI);
|
||||
// gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
//
|
||||
// texSelect(&gdl, &g_TexGeneralConfigs[6], 2, 0, 2, 1, NULL);
|
||||
//
|
||||
// gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
//
|
||||
// vertices[4].x = vertices[0].x = x1 * 10;
|
||||
// vertices[4].y = vertices[0].y = y1 * 10;
|
||||
// vertices[4].z = vertices[0].z = -10;
|
||||
// vertices[5].x = vertices[1].x = x2 * 10;
|
||||
// vertices[5].y = vertices[1].y = y1 * 10;
|
||||
// vertices[5].z = vertices[1].z = -10;
|
||||
// vertices[6].x = vertices[2].x = x2 * 10;
|
||||
// vertices[6].y = vertices[2].y = y2 * 10;
|
||||
// vertices[6].z = vertices[2].z = -10;
|
||||
// vertices[7].x = vertices[3].x = x1 * 10;
|
||||
// vertices[7].y = vertices[3].y = y2 * 10;
|
||||
// vertices[7].z = vertices[3].z = -10;
|
||||
//
|
||||
// for (i = 0; i < 2; i++) {
|
||||
// f0 = var80061630;
|
||||
// f26 = M_BADTAU * var80061630;
|
||||
//
|
||||
// if (i == 1) {
|
||||
// f26 = -f26;
|
||||
// }
|
||||
//
|
||||
// if (i == 1) {
|
||||
// f0 += 0.5f;
|
||||
// }
|
||||
//
|
||||
// if (f0 > 1.0f) {
|
||||
// f0 -= 1.0f;
|
||||
// }
|
||||
//
|
||||
// f2 = 1.0f - f0;
|
||||
//
|
||||
// if (f0 < 0.2f) {
|
||||
// alphas[i] = f0 / 0.2f * 127.0f;
|
||||
// } else if (f0 > 0.9f) {
|
||||
// alphas[i] = f2 / 0.1f * 127.0f;
|
||||
// } else {
|
||||
// alphas[i] = 0x7f;
|
||||
// }
|
||||
//
|
||||
// f20 = (f2 + 0.1f) * 15.0f;
|
||||
// f22 = (x2 - x1) / 2 * f20;
|
||||
// f24 = (y2 - y1) / 2 * f20;
|
||||
//
|
||||
// s2 = sinf(f26) * f22;
|
||||
// s3 = cosf(f26) * f24;
|
||||
// s0 = cosf(f26) * f22;
|
||||
// t5 = -sinf(f26) * f24;
|
||||
//
|
||||
// if (1);
|
||||
//
|
||||
// iter = &vertices[i * 4];
|
||||
//
|
||||
// iter[0].unk08 = i * 256 - s2 - s0;
|
||||
// iter[0].unk0a = i * 256 - s3 - t5;
|
||||
// iter[1].unk08 = i * 256 + s2 - s0;
|
||||
// iter[1].unk0a = i * 256 + s3 - t5;
|
||||
// iter[2].unk08 = i * 256 + s2 + s0;
|
||||
// iter[2].unk0a = i * 256 + s3 + t5;
|
||||
// iter[3].unk08 = i * 256 - s2 + s0;
|
||||
// iter[3].unk0a = i * 256 - s3 + t5;
|
||||
// }
|
||||
//
|
||||
// vertices[0].colour = 0;
|
||||
// vertices[1].colour = 0;
|
||||
// vertices[2].colour = 4;
|
||||
// vertices[3].colour = 4;
|
||||
// vertices[4].colour = 12;
|
||||
// vertices[5].colour = 12;
|
||||
// vertices[6].colour = 8;
|
||||
// vertices[7].colour = 8;
|
||||
//
|
||||
// colours[0] = 0x00af0000 | alphas[0];
|
||||
// colours[1] = 0xffff0000 | alphas[0];
|
||||
// colours[2] = 0x00af0000 | alphas[1];
|
||||
// colours[3] = 0xffff0000 | alphas[1];
|
||||
//
|
||||
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4);
|
||||
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8);
|
||||
//
|
||||
// if (var80061630 > 0.5f) {
|
||||
// gDPTri4(gdl++, 4, 5, 6, 6, 7, 4, 0, 1, 2, 2, 3, 0);
|
||||
// } else {
|
||||
// gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4);
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *menugfxRenderBgGreenHaze(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2)
|
||||
{
|
||||
u32 *colours;
|
||||
struct gfxvtx *vertices;
|
||||
u32 alphas[2]; // 104
|
||||
s32 i;
|
||||
s16 t5;
|
||||
s16 s0;
|
||||
s16 s2;
|
||||
s16 s3;
|
||||
f32 f20;
|
||||
f32 f22;
|
||||
f32 f24;
|
||||
f32 f26;
|
||||
f32 f0;
|
||||
f32 f2;
|
||||
u32 stack[2];
|
||||
struct gfxvtx *iter;
|
||||
|
||||
colours = gfxAllocateColours(4);
|
||||
vertices = gfxAllocateVertices(8);
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI);
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
|
||||
texSelect(&gdl, &g_TexGeneralConfigs[6], 2, 0, 2, 1, NULL);
|
||||
|
||||
gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
|
||||
vertices[4].x = vertices[0].x = x1 * 10;
|
||||
vertices[4].y = vertices[0].y = y1 * 10;
|
||||
vertices[4].z = vertices[0].z = -10;
|
||||
vertices[5].x = vertices[1].x = x2 * 10;
|
||||
vertices[5].y = vertices[1].y = y1 * 10;
|
||||
vertices[5].z = vertices[1].z = -10;
|
||||
vertices[6].x = vertices[2].x = x2 * 10;
|
||||
vertices[6].y = vertices[2].y = y2 * 10;
|
||||
vertices[6].z = vertices[2].z = -10;
|
||||
vertices[7].x = vertices[3].x = x1 * 10;
|
||||
vertices[7].y = vertices[3].y = y2 * 10;
|
||||
vertices[7].z = vertices[3].z = -10;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
f0 = var80061630;
|
||||
f26 = M_BADTAU * var80061630;
|
||||
|
||||
if (i == 1) {
|
||||
f26 = -f26;
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
f0 += 0.5f;
|
||||
}
|
||||
|
||||
if (f0 > 1.0f) {
|
||||
f0 -= 1.0f;
|
||||
}
|
||||
|
||||
f2 = 1.0f - f0;
|
||||
|
||||
if (f0 < 0.2f) {
|
||||
alphas[i] = f0 / 0.2f * 127.0f;
|
||||
} else if (f0 > 0.9f) {
|
||||
alphas[i] = f2 / 0.1f * 127.0f;
|
||||
} else {
|
||||
alphas[i] = 0x7f;
|
||||
}
|
||||
|
||||
f20 = (f2 + 0.1f) * 15.0f;
|
||||
f22 = (x2 - x1) / 2 * f20;
|
||||
f24 = (y2 - y1) / 2 * f20;
|
||||
|
||||
s2 = sinf(f26) * f22;
|
||||
s3 = cosf(f26) * f24;
|
||||
s0 = cosf(f26) * f22;
|
||||
t5 = -sinf(f26) * f24;
|
||||
|
||||
if (1);
|
||||
|
||||
iter = &vertices[i * 4];
|
||||
|
||||
iter[0].s = i * 256 - s2 - s0;
|
||||
iter[0].t = i * 256 - s3 - t5;
|
||||
iter[1].s = i * 256 + s2 - s0;
|
||||
iter[1].t = i * 256 + s3 - t5;
|
||||
iter[2].s = i * 256 + s2 + s0;
|
||||
iter[2].t = i * 256 + s3 + t5;
|
||||
iter[3].s = i * 256 - s2 + s0;
|
||||
iter[3].t = i * 256 - s3 + t5;
|
||||
}
|
||||
|
||||
vertices[0].colour = 0;
|
||||
vertices[1].colour = 0;
|
||||
vertices[2].colour = 4;
|
||||
vertices[3].colour = 4;
|
||||
vertices[4].colour = 12;
|
||||
vertices[5].colour = 12;
|
||||
vertices[6].colour = 8;
|
||||
vertices[7].colour = 8;
|
||||
|
||||
colours[0] = 0x00af0000 | alphas[0];
|
||||
colours[1] = 0xffff0000 | alphas[0];
|
||||
colours[2] = 0x00af0000 | alphas[1];
|
||||
colours[3] = 0xffff0000 | alphas[1];
|
||||
|
||||
gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 4);
|
||||
gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8);
|
||||
|
||||
if (var80061630 > 0.5f) {
|
||||
gDPTri4(gdl++, 4, 5, 6, 6, 7, 4, 0, 1, 2, 2, 3, 0);
|
||||
} else {
|
||||
gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4);
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *menugfxDrawDropdownBackground(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2)
|
||||
{
|
||||
@@ -1803,6 +1808,7 @@ glabel menugfxDrawListGroupHeader
|
||||
);
|
||||
#endif
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel menugfxRenderGradient
|
||||
/* f0e1ce8: 27bdffa0 */ addiu $sp,$sp,-96
|
||||
@@ -1985,79 +1991,80 @@ glabel menugfxRenderGradient
|
||||
/* f0e1fa4: 03e00008 */ jr $ra
|
||||
/* f0e1fa8: 27bd0060 */ addiu $sp,$sp,0x60
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Goal has the if statement with empty contents
|
||||
//Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colourstart, u32 colourmid, u32 colourend)
|
||||
//{
|
||||
// u32 *colours = gfxAllocateColours(3);
|
||||
// struct gfxvtx *vertices = gfxAllocateVertices(6);
|
||||
// s32 ymid;
|
||||
//
|
||||
// gDPPipeSync(gdl++);
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI);
|
||||
// gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
//
|
||||
// texSelect(&gdl, NULL, 2, 0, 2, 1, NULL);
|
||||
//
|
||||
// gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
//
|
||||
// ymid = (y1 + y2) / 2;
|
||||
//
|
||||
// if (x2 - x1 < ymid * 2) {
|
||||
// ymid <<= 0;
|
||||
// }
|
||||
//
|
||||
// // 0 = top left
|
||||
// // 1 = top right
|
||||
// // 2 = bottom right
|
||||
// // 3 = bottom left
|
||||
// // 4 = mid left
|
||||
// // 5 = mid right
|
||||
//
|
||||
// vertices[0].z = -10;
|
||||
// vertices[1].z = -10;
|
||||
// vertices[2].z = -10;
|
||||
// vertices[3].z = -10;
|
||||
// vertices[4].z = -10;
|
||||
// vertices[5].z = -10;
|
||||
//
|
||||
// vertices[0].x = x1 * 10;
|
||||
// vertices[0].y = y1 * 10;
|
||||
// vertices[0].colour = 0;
|
||||
//
|
||||
// vertices[1].x = x2 * 10;
|
||||
// vertices[1].y = y1 * 10;
|
||||
// vertices[1].colour = 0;
|
||||
//
|
||||
// vertices[2].x = x2 * 10;
|
||||
// vertices[2].y = y2 * 10;
|
||||
// vertices[2].colour = 4;
|
||||
//
|
||||
// vertices[3].x = x1 * 10;
|
||||
// vertices[3].y = y2 * 10;
|
||||
// vertices[3].colour = 4;
|
||||
//
|
||||
// vertices[4].x = x1 * 10;
|
||||
// vertices[4].y = ymid * 10;
|
||||
// vertices[4].colour = 8;
|
||||
//
|
||||
// vertices[5].x = x2 * 10;
|
||||
// vertices[5].y = ymid * 10;
|
||||
// vertices[5].colour = 8;
|
||||
//
|
||||
// colours[0] = colourstart;
|
||||
// colours[2] = colourmid;
|
||||
// colours[1] = colourend;
|
||||
//
|
||||
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3);
|
||||
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6);
|
||||
// gDPTri4(gdl++, 0, 1, 5, 5, 4, 0, 2, 3, 4, 4, 5, 2);
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *menugfxRenderGradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colourstart, u32 colourmid, u32 colourend)
|
||||
{
|
||||
u32 *colours = gfxAllocateColours(3);
|
||||
struct gfxvtx *vertices = gfxAllocateVertices(6);
|
||||
s32 ymid;
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEI, G_CC_MODULATEI);
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
|
||||
texSelect(&gdl, NULL, 2, 0, 2, 1, NULL);
|
||||
|
||||
gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
|
||||
ymid = (y1 + y2) / 2;
|
||||
|
||||
if (x2 - x1 < ymid * 2) {
|
||||
ymid <<= 0;
|
||||
}
|
||||
|
||||
// 0 = top left
|
||||
// 1 = top right
|
||||
// 2 = bottom right
|
||||
// 3 = bottom left
|
||||
// 4 = mid left
|
||||
// 5 = mid right
|
||||
|
||||
vertices[0].z = -10;
|
||||
vertices[1].z = -10;
|
||||
vertices[2].z = -10;
|
||||
vertices[3].z = -10;
|
||||
vertices[4].z = -10;
|
||||
vertices[5].z = -10;
|
||||
|
||||
vertices[0].x = x1 * 10;
|
||||
vertices[0].y = y1 * 10;
|
||||
vertices[0].colour = 0;
|
||||
|
||||
vertices[1].x = x2 * 10;
|
||||
vertices[1].y = y1 * 10;
|
||||
vertices[1].colour = 0;
|
||||
|
||||
vertices[2].x = x2 * 10;
|
||||
vertices[2].y = y2 * 10;
|
||||
vertices[2].colour = 4;
|
||||
|
||||
vertices[3].x = x1 * 10;
|
||||
vertices[3].y = y2 * 10;
|
||||
vertices[3].colour = 4;
|
||||
|
||||
vertices[4].x = x1 * 10;
|
||||
vertices[4].y = ymid * 10;
|
||||
vertices[4].colour = 8;
|
||||
|
||||
vertices[5].x = x2 * 10;
|
||||
vertices[5].y = ymid * 10;
|
||||
vertices[5].colour = 8;
|
||||
|
||||
colours[0] = colourstart;
|
||||
colours[2] = colourmid;
|
||||
colours[1] = colourend;
|
||||
|
||||
gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 3);
|
||||
gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 6);
|
||||
gDPTri4(gdl++, 0, 1, 5, 5, 4, 0, 2, 3, 4, 4, 5, 2);
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *menugfxRenderSlider(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 markerx, u32 colour)
|
||||
{
|
||||
@@ -2222,6 +2229,7 @@ Gfx *menugfxDrawLine(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel menugfxDrawTessellatedRect
|
||||
/* f0e2744: 27bdff68 */ addiu $sp,$sp,-152
|
||||
@@ -2456,87 +2464,88 @@ glabel menugfxDrawTessellatedRect
|
||||
/* f0e2a9c: 03e00008 */ jr $ra
|
||||
/* f0e2aa0: 27bd0098 */ addiu $sp,$sp,0x98
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Uses callee-save registers differently
|
||||
//Gfx *menugfxDrawTessellatedRect(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colour2)
|
||||
//{
|
||||
// if (textHasDiagonalBlend()) {
|
||||
// if (y2 - y1 > x2 - x1) {
|
||||
// // Portrait
|
||||
// s32 numfullparts; // 94
|
||||
// u32 nextcolour;
|
||||
// u32 thiscolour; // 8c
|
||||
// s32 i;
|
||||
// s32 nexty;
|
||||
// s32 thisy; // 80
|
||||
// u32 stack[2];
|
||||
//
|
||||
// numfullparts = (y2 - y1) / 15;
|
||||
// thiscolour = text0f153e94(x1, y1, colour1);
|
||||
// thisy = y1;
|
||||
//
|
||||
// for (i = 0; i < numfullparts; i++) {
|
||||
// nexty = y1 + i * 15;
|
||||
//
|
||||
// if (y2 - nexty < 3) {
|
||||
// nexty = y2;
|
||||
// nextcolour = text0f153e94(x2, y2, colour2);
|
||||
// } else {
|
||||
// nextcolour = colourBlend(colour2, colour1, (nexty - y1) * 255 / (y2 - y1));
|
||||
// // @bug? Should y1 be x1?
|
||||
// nextcolour = text0f153e94(y1, thisy, nextcolour);
|
||||
// }
|
||||
//
|
||||
// gdl = menugfxDrawTri2(gdl, x1, thisy, x2, nexty, thiscolour, nextcolour, false);
|
||||
//
|
||||
// thisy = nexty;
|
||||
// thiscolour = nextcolour;
|
||||
// }
|
||||
//
|
||||
// nextcolour = text0f153e94(x2, y2, colour2);
|
||||
// gdl = menugfxDrawTri2(gdl, x1, thisy, x2, y2, thiscolour, nextcolour, false);
|
||||
// } else {
|
||||
// // Landscape
|
||||
// // 8f4
|
||||
// s32 numfullparts; // 74
|
||||
// u32 nextcolour;
|
||||
// u32 thiscolour; // 6c
|
||||
// s32 i;
|
||||
// s32 nextx;
|
||||
// s32 thisx; // 60
|
||||
// u32 stack[1];
|
||||
//
|
||||
// numfullparts = (x2 - x1) / 15;
|
||||
// thiscolour = text0f153e94(x1, y1, colour1);
|
||||
// thisx = x1;
|
||||
//
|
||||
// for (i = 0; i < numfullparts; i++) {
|
||||
// nextx = x1 + i * 15;
|
||||
//
|
||||
// if (x2 - nextx < 3) {
|
||||
// nextx = x2;
|
||||
// nextcolour = text0f153e94(x2, y2, colour2);
|
||||
// } else {
|
||||
// nextcolour = colourBlend(colour2, colour1, (nextx - x1) * 255 / (x2 - x1));
|
||||
// nextcolour = text0f153e94(thisx, y1, nextcolour);
|
||||
// }
|
||||
//
|
||||
// gdl = menugfxDrawTri2(gdl, thisx, y1, nextx, y2, thiscolour, nextcolour, false);
|
||||
//
|
||||
// thisx = nextx;
|
||||
// thiscolour = nextcolour;
|
||||
// }
|
||||
//
|
||||
// nextcolour = text0f153e94(x2, y2, colour2);
|
||||
// gdl = menugfxDrawTri2(gdl, thisx, y1, x2, y2, thiscolour, nextcolour, false);
|
||||
// }
|
||||
// } else {
|
||||
// // a40
|
||||
// gdl = menugfxDrawTri2(gdl, x1, y1, x2, y2, colour1, colour2, false);
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *menugfxDrawTessellatedRect(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour1, u32 colour2)
|
||||
{
|
||||
if (textHasDiagonalBlend()) {
|
||||
if (y2 - y1 > x2 - x1) {
|
||||
// Portrait
|
||||
s32 numfullparts; // 94
|
||||
u32 nextcolour;
|
||||
u32 thiscolour; // 8c
|
||||
s32 i;
|
||||
s32 nexty;
|
||||
s32 thisy; // 80
|
||||
u32 stack[2];
|
||||
|
||||
numfullparts = (y2 - y1) / 15;
|
||||
thiscolour = text0f153e94(x1, y1, colour1);
|
||||
thisy = y1;
|
||||
|
||||
for (i = 0; i < numfullparts; i++) {
|
||||
nexty = y1 + i * 15;
|
||||
|
||||
if (y2 - nexty < 3) {
|
||||
nexty = y2;
|
||||
nextcolour = text0f153e94(x2, y2, colour2);
|
||||
} else {
|
||||
nextcolour = colourBlend(colour2, colour1, (nexty - y1) * 255 / (y2 - y1));
|
||||
// @bug? Should y1 be x1?
|
||||
nextcolour = text0f153e94(y1, thisy, nextcolour);
|
||||
}
|
||||
|
||||
gdl = menugfxDrawTri2(gdl, x1, thisy, x2, nexty, thiscolour, nextcolour, false);
|
||||
|
||||
thisy = nexty;
|
||||
thiscolour = nextcolour;
|
||||
}
|
||||
|
||||
nextcolour = text0f153e94(x2, y2, colour2);
|
||||
gdl = menugfxDrawTri2(gdl, x1, thisy, x2, y2, thiscolour, nextcolour, false);
|
||||
} else {
|
||||
// Landscape
|
||||
// 8f4
|
||||
s32 numfullparts; // 74
|
||||
u32 nextcolour;
|
||||
u32 thiscolour; // 6c
|
||||
s32 i;
|
||||
s32 nextx;
|
||||
s32 thisx; // 60
|
||||
u32 stack[1];
|
||||
|
||||
numfullparts = (x2 - x1) / 15;
|
||||
thiscolour = text0f153e94(x1, y1, colour1);
|
||||
thisx = x1;
|
||||
|
||||
for (i = 0; i < numfullparts; i++) {
|
||||
nextx = x1 + i * 15;
|
||||
|
||||
if (x2 - nextx < 3) {
|
||||
nextx = x2;
|
||||
nextcolour = text0f153e94(x2, y2, colour2);
|
||||
} else {
|
||||
nextcolour = colourBlend(colour2, colour1, (nextx - x1) * 255 / (x2 - x1));
|
||||
nextcolour = text0f153e94(thisx, y1, nextcolour);
|
||||
}
|
||||
|
||||
gdl = menugfxDrawTri2(gdl, thisx, y1, nextx, y2, thiscolour, nextcolour, false);
|
||||
|
||||
thisx = nextx;
|
||||
thiscolour = nextcolour;
|
||||
}
|
||||
|
||||
nextcolour = text0f153e94(x2, y2, colour2);
|
||||
gdl = menugfxDrawTri2(gdl, thisx, y1, x2, y2, thiscolour, nextcolour, false);
|
||||
}
|
||||
} else {
|
||||
// a40
|
||||
gdl = menugfxDrawTri2(gdl, x1, y1, x2, y2, colour1, colour2, false);
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Consider rendering a shimmer effect along a line, based on timing.
|
||||
@@ -2977,6 +2986,7 @@ Gfx *menugfxRenderBgFailure(Gfx *gdl)
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel menugfxRenderBgCone
|
||||
.late_rodata
|
||||
@@ -3253,77 +3263,78 @@ glabel var7f1adf4c
|
||||
/* f0e4584: 03e00008 */ jr $ra
|
||||
/* f0e4588: 27bd00a0 */ addiu $sp,$sp,0xa0
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Float regalloc
|
||||
//Gfx *menugfxRenderBgCone(Gfx *gdl)
|
||||
//{
|
||||
// f32 sp9c;
|
||||
// u32 stack[2];
|
||||
// f32 angle;
|
||||
// s32 x1;
|
||||
// s32 y1;
|
||||
// s32 x2;
|
||||
// s32 y2;
|
||||
// u32 s0;
|
||||
// f32 sp78;
|
||||
// s32 colour;
|
||||
// s32 i;
|
||||
//
|
||||
// angle = M_BADTAU * var80061630;
|
||||
// sp9c = angle * 2.0f;
|
||||
// s0 = (u32)(func0f006b08(1) * 255.0f) << 16;
|
||||
//
|
||||
// gdl = func0f0d4a3c(gdl, 0);
|
||||
//
|
||||
// colour = s0 | 0xff00007f;
|
||||
//
|
||||
// var8009de90 = -100000;
|
||||
// var8009de94 = 100000;
|
||||
//
|
||||
// for (i = 0; i < 8; i++) {
|
||||
// angle = sp9c + i * 2.0f * M_PI * 0.125f;
|
||||
//
|
||||
// x1 = 600.0f * sinf(angle);
|
||||
// y1 = 600.0f * cosf(angle);
|
||||
// x2 = 600.0f * sinf(angle + 0.78539818525314f);
|
||||
// y2 = 600.0f * cosf(angle + 0.78539818525314f);
|
||||
//
|
||||
// x1 += 160;
|
||||
// x2 += 160;
|
||||
// y1 += 120;
|
||||
// y2 += 120;
|
||||
//
|
||||
// gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_08);
|
||||
// }
|
||||
//
|
||||
// s0 = (u32)(255.0f - func0f006b54(1) * 255.0f) << 16;
|
||||
//
|
||||
// if (M_BADTAU * var80061630);
|
||||
// angle = M_BADTAU * var80061630;
|
||||
// sp78 = -angle;
|
||||
//
|
||||
// colour = s0 | 0xff00007f;
|
||||
//
|
||||
// for (i = 0; i < 8; i++) {
|
||||
// angle = sp78 + 2.0f * i * M_PI * 0.125f;
|
||||
//
|
||||
// x1 = 600.0f * sinf(angle);
|
||||
// y1 = 600.0f * cosf(angle);
|
||||
// x2 = 600.0f * sinf(angle + 0.78539818525314f);
|
||||
// y2 = 600.0f * cosf(angle + 0.78539818525314f);
|
||||
//
|
||||
// x1 += 160;
|
||||
// x2 += 160;
|
||||
// y1 += 120;
|
||||
// y2 += 120;
|
||||
//
|
||||
// gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_09);
|
||||
// }
|
||||
//
|
||||
// gdl = func0f0d4c80(gdl);
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *menugfxRenderBgCone(Gfx *gdl)
|
||||
{
|
||||
f32 sp9c;
|
||||
u32 stack[2];
|
||||
f32 angle;
|
||||
s32 x1;
|
||||
s32 y1;
|
||||
s32 x2;
|
||||
s32 y2;
|
||||
u32 s0;
|
||||
f32 sp78;
|
||||
s32 colour;
|
||||
s32 i;
|
||||
|
||||
angle = M_BADTAU * var80061630;
|
||||
sp9c = angle * 2.0f;
|
||||
s0 = (u32)(func0f006b08(1) * 255.0f) << 16;
|
||||
|
||||
gdl = func0f0d4a3c(gdl, 0);
|
||||
|
||||
colour = s0 | 0xff00007f;
|
||||
|
||||
var8009de90 = -100000;
|
||||
var8009de94 = 100000;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
angle = sp9c + i * 2.0f * M_PI * 0.125f;
|
||||
|
||||
x1 = 600.0f * sinf(angle);
|
||||
y1 = 600.0f * cosf(angle);
|
||||
x2 = 600.0f * sinf(angle + 0.78539818525314f);
|
||||
y2 = 600.0f * cosf(angle + 0.78539818525314f);
|
||||
|
||||
x1 += 160;
|
||||
x2 += 160;
|
||||
y1 += 120;
|
||||
y2 += 120;
|
||||
|
||||
gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_08);
|
||||
}
|
||||
|
||||
s0 = (u32)(255.0f - func0f006b54(1) * 255.0f) << 16;
|
||||
|
||||
if (M_BADTAU * var80061630);
|
||||
angle = M_BADTAU * var80061630;
|
||||
sp78 = -angle;
|
||||
|
||||
colour = s0 | 0xff00007f;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
angle = sp78 + 2.0f * i * M_PI * 0.125f;
|
||||
|
||||
x1 = 600.0f * sinf(angle);
|
||||
y1 = 600.0f * cosf(angle);
|
||||
x2 = 600.0f * sinf(angle + 0.78539818525314f);
|
||||
y2 = 600.0f * cosf(angle + 0.78539818525314f);
|
||||
|
||||
x1 += 160;
|
||||
x2 += 160;
|
||||
y1 += 120;
|
||||
y2 += 120;
|
||||
|
||||
gdl = menugfxDrawPlane(gdl, x1, y1, x2, y2, colour, colour, MENUPLANE_09);
|
||||
}
|
||||
|
||||
gdl = func0f0d4c80(gdl);
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Fill the framebuffer with a transparent green overlay.
|
||||
|
||||
+165
-163
@@ -1594,6 +1594,7 @@ Gfx *menuitemSeparatorRender(Gfx *gdl, struct menurendercontext *context)
|
||||
|
||||
u32 var800711e8 = 0x00000000;
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel menuitemObjectivesRenderOne
|
||||
@@ -4187,172 +4188,173 @@ glabel menuitemObjectivesRenderOne
|
||||
const char var7f1adfa0[] = "brcol";
|
||||
const char var7f1adfa8[] = "%d: ";
|
||||
const char var7f1adfb0[] = "%s";
|
||||
|
||||
#else
|
||||
// Mismatch: Stack usage is different. Target appears to use compiler-managed
|
||||
// stack from 0x44 and below, which means the vars from 0x48 to 0x6c are real
|
||||
// variables, and many are optimised out.
|
||||
//Gfx *menuitemObjectivesRenderOne(Gfx *gdl, struct menudialog *dialog, s32 index, s32 position, s16 objx, s16 objy, s16 width, s16 height, bool withstatus, s32 arg9)
|
||||
//{
|
||||
// u32 sp12c;
|
||||
// s32 x; // 128
|
||||
// s32 y; // 124
|
||||
// char *sp120;
|
||||
// char buffer[80]; // d0
|
||||
// char *spcc;
|
||||
// u32 spc8;
|
||||
// s32 textwidth; // c4
|
||||
// s32 textheight; // c0
|
||||
// s32 spbc;
|
||||
// s32 tmp;
|
||||
// s32 spb4;
|
||||
// s32 spb0;
|
||||
// s32 spac;
|
||||
// s32 spa8;
|
||||
// u32 stack3[2];
|
||||
// s32 sp9c;
|
||||
// s32 sp98;
|
||||
// u32 s0;
|
||||
// s32 stack[4];
|
||||
// s32 sp80;
|
||||
// s32 sp7c;
|
||||
// s32 sp78;
|
||||
// s32 sp74;
|
||||
// s32 stack2;
|
||||
// s32 sp6c;
|
||||
// s32 sp58;
|
||||
// s32 sp54;
|
||||
//
|
||||
// spbc = 0;
|
||||
//
|
||||
// if (arg9) {
|
||||
// spbc = PAL ? 16 : 12;
|
||||
// }
|
||||
//
|
||||
// mainOverrideVariable("brcol", &var800711e8);
|
||||
// sp120 = langGet(g_Briefing.objectivenames[index]);
|
||||
// y = objy;
|
||||
// sp12c = MIXCOLOUR(dialog, unfocused);
|
||||
//
|
||||
// if (dialog->dimmed) {
|
||||
// sp12c = (colourBlend(sp12c, 0, 0x2c) & 0xffffff00) | (sp12c & 0xff);
|
||||
// }
|
||||
//
|
||||
// textSetWaveColours(g_MenuColourPalettes3[dialog->type].unfocused, g_MenuColourPalettes2[dialog->type].unfocused);
|
||||
// buffer[0] = '\0';
|
||||
//
|
||||
// // Render objective number
|
||||
// gdl = text0f153628(gdl);
|
||||
// sprintf(buffer, "%d: ", position);
|
||||
// textMeasure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0);
|
||||
// x = objx - textwidth + 25;
|
||||
// gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0);
|
||||
//
|
||||
// x = objx + 25;
|
||||
//
|
||||
// if (arg9) {
|
||||
// textWrap(85, sp120, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs);
|
||||
// gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, sp12c, width, height, 0, 0);
|
||||
// } else {
|
||||
// sprintf(buffer, "%s", sp120);
|
||||
// gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0);
|
||||
// }
|
||||
//
|
||||
// if (withstatus) {
|
||||
// switch (objectiveCheck(index)) {
|
||||
// case OBJECTIVE_INCOMPLETE:
|
||||
// spcc = langGet(L_OPTIONS_001); // "Incomplete"
|
||||
// spc8 = 0xffff00ff;
|
||||
// break;
|
||||
// case OBJECTIVE_COMPLETE:
|
||||
// spcc = langGet(L_OPTIONS_000); // "Complete"
|
||||
// spc8 = 0x00ff00ff;
|
||||
// break;
|
||||
// case OBJECTIVE_FAILED:
|
||||
// spcc = langGet(L_OPTIONS_002); // "Failed"
|
||||
// spc8 = 0xff4040ff;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (dialog != g_Menus[g_MpPlayerNum].curdialog) {
|
||||
// spc8 = g_MenuColourPalettes[0].unfocused;
|
||||
// }
|
||||
//
|
||||
// textMeasure(&textheight, &textwidth, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0);
|
||||
//
|
||||
// if (var800711e8 != 0) {
|
||||
// spc8 = var800711e8;
|
||||
// }
|
||||
//
|
||||
// x = objx + width - textwidth - 10;
|
||||
// y = objy + spbc + 9;
|
||||
//
|
||||
// gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8, width, height, 0, 0);
|
||||
//
|
||||
// x = objx + width - textwidth - 10;
|
||||
// y = objy + spbc + 9;
|
||||
//
|
||||
// gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8 & 0xffffff7f, width, height, 0, 0);
|
||||
//
|
||||
// x = objx + width - textwidth - 13;
|
||||
// y = objy + 9;
|
||||
//
|
||||
// gdl = text0f153780(gdl);
|
||||
//
|
||||
// spb4 = objx + 22;
|
||||
// spb0 = objy - 2;
|
||||
// spac = objy + 8;
|
||||
// spa8 = y + spbc + 2;
|
||||
// tmp = (objx * 3 + objx + 66) / 4;
|
||||
// sp9c = x;
|
||||
// sp98 = tmp + 19 + (sp9c - tmp - 24) * (position - 1) / 5;
|
||||
//
|
||||
// sp58 = (objx * 3 + objx + 66) / 4 - 1;
|
||||
// sp54 = (objx * 3 + objx + 66) / 4 + 14;
|
||||
//
|
||||
// gdl = menugfx0f0e2498(gdl);
|
||||
//
|
||||
// // Blue lines
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, objx, spb0, spb4, spb0 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, spb4, spb0, spb4 + 1, spac, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, objx, spac, sp58, spac + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, spac, spb4 + 1, spac + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58, spac, sp58 + 1, spa8 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spac, sp58 + 3, spa8, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spa8, sp54, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58, spa8 + 2, sp54, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8, sp98, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8 + 2, sp98, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
//
|
||||
// // Coloured lines
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp98, spa8, sp98 + 1, spa8 + 3, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp98 + 1, spa8 + 1, sp9c - 4, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp9c - 4, spa8 + 1, sp9c, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, spc8 & 0xffffff00 | 0xcf);
|
||||
// } else {
|
||||
// // Render lines without status
|
||||
// sp80 = objx + 22;
|
||||
// sp7c = objy - 2;
|
||||
// sp78 = objy + 8;
|
||||
// sp74 = y + 1;
|
||||
//
|
||||
// textMeasure(&textheight, &textwidth, sp120, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0);
|
||||
//
|
||||
// sp6c = objx + textwidth + 25;
|
||||
// sp58 = (objx * 3 + objx + 66) / 4 - 1;
|
||||
//
|
||||
// gdl = text0f153780(gdl);
|
||||
// gdl = menugfx0f0e2498(gdl);
|
||||
//
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, objx, sp7c, sp80, sp7c + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp80, sp7c, sp80 + 1, sp78, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, objx, sp78, sp58, sp78 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, sp78, sp80 + 1, sp78 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58, sp78, sp58 + 1, sp74 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp78, sp58 + 3, sp74, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp74, sp6c, sp74 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *menuitemObjectivesRenderOne(Gfx *gdl, struct menudialog *dialog, s32 index, s32 position, s16 objx, s16 objy, s16 width, s16 height, bool withstatus, s32 arg9)
|
||||
{
|
||||
u32 sp12c;
|
||||
s32 x; // 128
|
||||
s32 y; // 124
|
||||
char *sp120;
|
||||
char buffer[80]; // d0
|
||||
char *spcc;
|
||||
u32 spc8;
|
||||
s32 textwidth; // c4
|
||||
s32 textheight; // c0
|
||||
s32 spbc;
|
||||
s32 tmp;
|
||||
s32 spb4;
|
||||
s32 spb0;
|
||||
s32 spac;
|
||||
s32 spa8;
|
||||
u32 stack3[2];
|
||||
s32 sp9c;
|
||||
s32 sp98;
|
||||
u32 s0;
|
||||
s32 stack[4];
|
||||
s32 sp80;
|
||||
s32 sp7c;
|
||||
s32 sp78;
|
||||
s32 sp74;
|
||||
s32 stack2;
|
||||
s32 sp6c;
|
||||
s32 sp58;
|
||||
s32 sp54;
|
||||
|
||||
spbc = 0;
|
||||
|
||||
if (arg9) {
|
||||
spbc = PAL ? 16 : 12;
|
||||
}
|
||||
|
||||
mainOverrideVariable("brcol", &var800711e8);
|
||||
sp120 = langGet(g_Briefing.objectivenames[index]);
|
||||
y = objy;
|
||||
sp12c = MIXCOLOUR(dialog, unfocused);
|
||||
|
||||
if (dialog->dimmed) {
|
||||
sp12c = (colourBlend(sp12c, 0, 0x2c) & 0xffffff00) | (sp12c & 0xff);
|
||||
}
|
||||
|
||||
textSetWaveColours(g_MenuColourPalettes3[dialog->type].unfocused, g_MenuColourPalettes2[dialog->type].unfocused);
|
||||
buffer[0] = '\0';
|
||||
|
||||
// Render objective number
|
||||
gdl = text0f153628(gdl);
|
||||
sprintf(buffer, "%d: ", position);
|
||||
textMeasure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0);
|
||||
x = objx - textwidth + 25;
|
||||
gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0);
|
||||
|
||||
x = objx + 25;
|
||||
|
||||
if (arg9) {
|
||||
textWrap(85, sp120, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs);
|
||||
gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, sp12c, width, height, 0, 0);
|
||||
} else {
|
||||
sprintf(buffer, "%s", sp120);
|
||||
gdl = textRenderProjected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0);
|
||||
}
|
||||
|
||||
if (withstatus) {
|
||||
switch (objectiveCheck(index)) {
|
||||
case OBJECTIVE_INCOMPLETE:
|
||||
spcc = langGet(L_OPTIONS_001); // "Incomplete"
|
||||
spc8 = 0xffff00ff;
|
||||
break;
|
||||
case OBJECTIVE_COMPLETE:
|
||||
spcc = langGet(L_OPTIONS_000); // "Complete"
|
||||
spc8 = 0x00ff00ff;
|
||||
break;
|
||||
case OBJECTIVE_FAILED:
|
||||
spcc = langGet(L_OPTIONS_002); // "Failed"
|
||||
spc8 = 0xff4040ff;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dialog != g_Menus[g_MpPlayerNum].curdialog) {
|
||||
spc8 = g_MenuColourPalettes[0].unfocused;
|
||||
}
|
||||
|
||||
textMeasure(&textheight, &textwidth, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0);
|
||||
|
||||
if (var800711e8 != 0) {
|
||||
spc8 = var800711e8;
|
||||
}
|
||||
|
||||
x = objx + width - textwidth - 10;
|
||||
y = objy + spbc + 9;
|
||||
|
||||
gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8, width, height, 0, 0);
|
||||
|
||||
x = objx + width - textwidth - 10;
|
||||
y = objy + spbc + 9;
|
||||
|
||||
gdl = textRenderProjected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8 & 0xffffff7f, width, height, 0, 0);
|
||||
|
||||
x = objx + width - textwidth - 13;
|
||||
y = objy + 9;
|
||||
|
||||
gdl = text0f153780(gdl);
|
||||
|
||||
spb4 = objx + 22;
|
||||
spb0 = objy - 2;
|
||||
spac = objy + 8;
|
||||
spa8 = y + spbc + 2;
|
||||
tmp = (objx * 3 + objx + 66) / 4;
|
||||
sp9c = x;
|
||||
sp98 = tmp + 19 + (sp9c - tmp - 24) * (position - 1) / 5;
|
||||
|
||||
sp58 = (objx * 3 + objx + 66) / 4 - 1;
|
||||
sp54 = (objx * 3 + objx + 66) / 4 + 14;
|
||||
|
||||
gdl = menugfx0f0e2498(gdl);
|
||||
|
||||
// Blue lines
|
||||
gdl = menugfxDrawTessellatedRect(gdl, objx, spb0, spb4, spb0 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, spb4, spb0, spb4 + 1, spac, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, objx, spac, sp58, spac + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, spac, spb4 + 1, spac + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58, spac, sp58 + 1, spa8 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spac, sp58 + 3, spa8, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, spa8, sp54, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58, spa8 + 2, sp54, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8, sp98, spa8 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp54, spa8 + 2, sp98, spa8 + 3, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
|
||||
// Coloured lines
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp98, spa8, sp98 + 1, spa8 + 3, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp98 + 1, spa8 + 1, sp9c - 4, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, (spc8 & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp9c - 4, spa8 + 1, sp9c, spa8 + 2, (spc8 & 0xffffff00) | 0x3f, spc8 & 0xffffff00 | 0xcf);
|
||||
} else {
|
||||
// Render lines without status
|
||||
sp80 = objx + 22;
|
||||
sp7c = objy - 2;
|
||||
sp78 = objy + 8;
|
||||
sp74 = y + 1;
|
||||
|
||||
textMeasure(&textheight, &textwidth, sp120, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0);
|
||||
|
||||
sp6c = objx + textwidth + 25;
|
||||
sp58 = (objx * 3 + objx + 66) / 4 - 1;
|
||||
|
||||
gdl = text0f153780(gdl);
|
||||
gdl = menugfx0f0e2498(gdl);
|
||||
|
||||
gdl = menugfxDrawTessellatedRect(gdl, objx, sp7c, sp80, sp7c + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp80, sp7c, sp80 + 1, sp78, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, objx, sp78, sp58, sp78 + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58 + 3, sp78, sp80 + 1, sp78 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58, sp78, sp58 + 1, sp74 + 2, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp78, sp58 + 3, sp74, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
gdl = menugfxDrawTessellatedRect(gdl, sp58 + 2, sp74, sp6c, sp74 + 1, (sp12c & 0xffffff00) | 0x3f, (sp12c & 0xffffff00) | 0x3f);
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *menuitemObjectivesRender(Gfx *gdl, struct menurendercontext *context)
|
||||
{
|
||||
|
||||
+419
-413
@@ -423,6 +423,7 @@ void func0f0099a4(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if PAL
|
||||
GLOBAL_ASM(
|
||||
glabel nbombInflictDamage
|
||||
@@ -1095,96 +1096,97 @@ glabel var7f1a7f20
|
||||
/* f0099d4: 27bd0320 */ addiu $sp,$sp,0x320
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
// Mismatch: different usage of callee-save registers relating to room loop
|
||||
//void nbombInflictDamage(struct nbomb *nbomb)
|
||||
//{
|
||||
// s32 index = 0;
|
||||
// u32 stack;
|
||||
// s16 propnums[256]; // 100
|
||||
// struct coord bbmin; // f4
|
||||
// struct coord bbmax; // e8
|
||||
// s16 roomnums[54]; // 7c
|
||||
// s16 *propnumptr;
|
||||
// s32 i;
|
||||
// u8 sp70[4];
|
||||
// u32 stack2;
|
||||
//
|
||||
// sp70[0] = WEAPON_NBOMB;
|
||||
// sp70[3] = 0;
|
||||
//
|
||||
// if (g_Vars.lvupdate240 <= 0 || nbomb->age240 > 350) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (g_Rooms);
|
||||
//
|
||||
// // Find rooms which intersect the nbomb dome's bbox
|
||||
// bbmin.x = nbomb->pos.f[0] - nbomb->radius;
|
||||
// bbmin.y = nbomb->pos.f[1] - nbomb->radius;
|
||||
// bbmin.z = nbomb->pos.f[2] - nbomb->radius;
|
||||
//
|
||||
// bbmax.x = nbomb->pos.f[0] + nbomb->radius;
|
||||
// bbmax.y = nbomb->pos.f[1] + nbomb->radius;
|
||||
// bbmax.z = nbomb->pos.f[2] + nbomb->radius;
|
||||
//
|
||||
// if (g_Vars.roomcount);
|
||||
// if (g_Vars.roomcount);
|
||||
//
|
||||
// for (i = 1; i < g_Vars.roomcount; i++) {
|
||||
// if (!(bbmax.f[0] < g_Rooms[i].bbmin[0]
|
||||
// || bbmin.f[0] > g_Rooms[i].bbmax[0]
|
||||
// || bbmax.f[1] < g_Rooms[i].bbmin[1]
|
||||
// || bbmin.f[1] > g_Rooms[i].bbmax[1]
|
||||
// || bbmax.f[2] < g_Rooms[i].bbmin[2]
|
||||
// || bbmin.f[2] > g_Rooms[i].bbmax[2])
|
||||
// && index < 52) {
|
||||
// roomnums[index] = i;
|
||||
// index++;
|
||||
// roomAdjustLighting(i, -38, -180);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// roomnums[index] = -1;
|
||||
//
|
||||
// // Iterate props in the affected rooms and damage any chrs
|
||||
// roomGetProps(roomnums, propnums, 256);
|
||||
//
|
||||
// propnumptr = propnums;
|
||||
//
|
||||
// while (*propnumptr >= 0) {
|
||||
// struct prop *prop = &g_Vars.props[*propnumptr];
|
||||
//
|
||||
// if (prop->timetoregen == 0) {
|
||||
// if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
|
||||
// f32 xdiff = prop->pos.f[0] - nbomb->pos.f[0];
|
||||
// f32 ydiff = prop->pos.f[1] - nbomb->pos.f[1];
|
||||
// f32 zdiff = prop->pos.f[2] - nbomb->pos.f[2];
|
||||
//
|
||||
// f32 dist = sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
|
||||
//
|
||||
// if (dist < nbomb->radius) {
|
||||
// struct chrdata *chr = prop->chr;
|
||||
//
|
||||
// if (chr) {
|
||||
// struct coord vector = {0, 0, 0};
|
||||
// f32 damage = 0.0099999997764826f * g_Vars.lvupdate240freal;
|
||||
//
|
||||
// chrDamageByMisc(chr, damage, &vector, sp70, nbomb->prop);
|
||||
//
|
||||
// chr->chrflags |= CHRCFLAG_TRIGGERSHOTLIST;
|
||||
//
|
||||
// if (chr->hidden & CHRHFLAG_CLOAKED) {
|
||||
// chrUncloak(chr, true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// propnumptr++;
|
||||
// }
|
||||
//}
|
||||
void nbombInflictDamage(struct nbomb *nbomb)
|
||||
{
|
||||
s32 index = 0;
|
||||
u32 stack;
|
||||
s16 propnums[256]; // 100
|
||||
struct coord bbmin; // f4
|
||||
struct coord bbmax; // e8
|
||||
s16 roomnums[54]; // 7c
|
||||
s16 *propnumptr;
|
||||
s32 i;
|
||||
struct gset gset; // 70
|
||||
u32 stack2;
|
||||
|
||||
gset.weaponnum = WEAPON_NBOMB;
|
||||
gset.weaponfunc = FUNC_PRIMARY;
|
||||
|
||||
if (g_Vars.lvupdate240 <= 0 || nbomb->age240 > 350) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Rooms);
|
||||
|
||||
// Find rooms which intersect the nbomb dome's bbox
|
||||
bbmin.x = nbomb->pos.f[0] - nbomb->radius;
|
||||
bbmin.y = nbomb->pos.f[1] - nbomb->radius;
|
||||
bbmin.z = nbomb->pos.f[2] - nbomb->radius;
|
||||
|
||||
bbmax.x = nbomb->pos.f[0] + nbomb->radius;
|
||||
bbmax.y = nbomb->pos.f[1] + nbomb->radius;
|
||||
bbmax.z = nbomb->pos.f[2] + nbomb->radius;
|
||||
|
||||
if (g_Vars.roomcount);
|
||||
if (g_Vars.roomcount);
|
||||
|
||||
for (i = 1; i < g_Vars.roomcount; i++) {
|
||||
if (!(bbmax.f[0] < g_Rooms[i].bbmin[0]
|
||||
|| bbmin.f[0] > g_Rooms[i].bbmax[0]
|
||||
|| bbmax.f[1] < g_Rooms[i].bbmin[1]
|
||||
|| bbmin.f[1] > g_Rooms[i].bbmax[1]
|
||||
|| bbmax.f[2] < g_Rooms[i].bbmin[2]
|
||||
|| bbmin.f[2] > g_Rooms[i].bbmax[2])
|
||||
&& index < 52) {
|
||||
roomnums[index] = i;
|
||||
index++;
|
||||
roomAdjustLighting(i, -38, -180);
|
||||
}
|
||||
}
|
||||
|
||||
roomnums[index] = -1;
|
||||
|
||||
// Iterate props in the affected rooms and damage any chrs
|
||||
roomGetProps(roomnums, propnums, 256);
|
||||
|
||||
propnumptr = propnums;
|
||||
|
||||
while (*propnumptr >= 0) {
|
||||
struct prop *prop = &g_Vars.props[*propnumptr];
|
||||
|
||||
if (prop->timetoregen == 0) {
|
||||
if (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER) {
|
||||
f32 xdiff = prop->pos.f[0] - nbomb->pos.f[0];
|
||||
f32 ydiff = prop->pos.f[1] - nbomb->pos.f[1];
|
||||
f32 zdiff = prop->pos.f[2] - nbomb->pos.f[2];
|
||||
|
||||
f32 dist = sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
|
||||
|
||||
if (dist < nbomb->radius) {
|
||||
struct chrdata *chr = prop->chr;
|
||||
|
||||
if (chr) {
|
||||
struct coord vector = {0, 0, 0};
|
||||
f32 damage = 0.0099999997764826f * g_Vars.lvupdate240freal;
|
||||
|
||||
chrDamageByMisc(chr, damage, &vector, &gset, nbomb->ownerprop);
|
||||
|
||||
chr->chrflags |= CHRCFLAG_TRIGGERSHOTLIST;
|
||||
|
||||
if (chr->hidden & CHRHFLAG_CLOAKED) {
|
||||
chrUncloak(chr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
propnumptr++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
u32 var800616e8 = 0x00000000;
|
||||
u32 var800616ec = 0x00000000;
|
||||
@@ -1451,6 +1453,7 @@ f32 gasGetDoorFrac(s32 tagnum)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if PAL
|
||||
GLOBAL_ASM(
|
||||
glabel nbombRenderOverlay
|
||||
@@ -2074,134 +2077,136 @@ glabel nbombRenderOverlay
|
||||
/* f00a93c: 27bd0080 */ addiu $sp,$sp,0x80
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
/**
|
||||
* Checks if the player is inside an nbomb storm, and if so renders the black
|
||||
* storm texture directly over the screen.
|
||||
*/
|
||||
// Mismatch: Goal has an extra move in the calculation of sp5e
|
||||
//Gfx *nbombRenderOverlay(Gfx *gdl)
|
||||
//{
|
||||
// u32 stack;
|
||||
// struct coord campos; // 70
|
||||
// struct gfxvtx *vertices;
|
||||
// u32 maxalpha;
|
||||
// bool inside;
|
||||
// s32 i;
|
||||
// s16 sp5e;
|
||||
// s16 s2;
|
||||
// u32 stack2[2];
|
||||
// bool sp50 = false;
|
||||
// s32 b;
|
||||
// u32 *colours; // 48
|
||||
// s32 a;
|
||||
// s16 viewleft; // 42
|
||||
// s16 viewtop; // 40
|
||||
// s16 viewright; // 3e
|
||||
// s16 viewbottom; // 3c
|
||||
//
|
||||
// campos.x = g_Vars.currentplayer->cam_pos.x;
|
||||
// campos.y = g_Vars.currentplayer->cam_pos.y;
|
||||
// campos.z = g_Vars.currentplayer->cam_pos.z;
|
||||
//
|
||||
// inside = false;
|
||||
// maxalpha = 0;
|
||||
//
|
||||
// for (i = 0; i < ARRAYCOUNT(g_Nbombs); i++) {
|
||||
// if (g_Nbombs[i].age240 >= 0 && g_Nbombs[i].age240 <= TICKS(350)) {
|
||||
// f32 xdiff = campos.f[0] - g_Nbombs[i].pos.f[0];
|
||||
// f32 ydiff = campos.f[1] - g_Nbombs[i].pos.f[1];
|
||||
// f32 zdiff = campos.f[2] - g_Nbombs[i].pos.f[2];
|
||||
//
|
||||
// if (sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff) < g_Nbombs[i].radius) {
|
||||
// u32 alpha = nbombCalculateAlpha(&g_Nbombs[i]);
|
||||
//
|
||||
// inside = true;
|
||||
//
|
||||
// if (alpha > maxalpha) {
|
||||
// maxalpha = alpha;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (inside) {
|
||||
// colours = gfxAllocateColours(1);
|
||||
// vertices = gfxAllocateVertices(4);
|
||||
//
|
||||
// viewleft = viGetViewLeft() * 10;
|
||||
// viewtop = viGetViewTop() * 10;
|
||||
// viewright = (s16)(viGetViewLeft() + viGetViewWidth()) * 10;
|
||||
// viewbottom = (s16)(viGetViewTop() + viGetViewHeight()) * 10;
|
||||
//
|
||||
// sp50 = true;
|
||||
//
|
||||
// s2 = (s32) (8.0f * var80061630 * 128.0f * 32.0f) % 2048;
|
||||
// sp5e = ((s32)(campos.f[1] * 8.0f) % 2048) + (s32)(2.0f * var80061630 * 128.0f * 32.0f);
|
||||
//
|
||||
// if (1);
|
||||
// if (1);
|
||||
//
|
||||
// gdl = func0f0d479c(gdl);
|
||||
//
|
||||
// if (1);
|
||||
//
|
||||
// texSelect(&gdl, &g_TexGeneralConfigs[10], 2, 1, 2, true, NULL);
|
||||
//
|
||||
// gDPPipeSync(gdl++);
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
// gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
// gDPSetColorDither(gdl++, G_CD_DISABLE);
|
||||
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
// gDPSetRenderMode(gdl++, G_RM_ZB_XLU_SURF, G_RM_ZB_XLU_SURF2);
|
||||
// gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
//
|
||||
// vertices[0].x = viewleft;
|
||||
// vertices[0].y = viewtop;
|
||||
// vertices[0].z = -10;
|
||||
//
|
||||
// vertices[1].x = viewright;
|
||||
// vertices[1].y = viewtop;
|
||||
// vertices[1].z = -10;
|
||||
//
|
||||
// vertices[2].x = viewright;
|
||||
// vertices[2].y = viewbottom;
|
||||
// vertices[2].z = -10;
|
||||
//
|
||||
// vertices[3].x = viewleft;
|
||||
// vertices[3].y = viewbottom;
|
||||
// vertices[3].z = -10;
|
||||
//
|
||||
// vertices[0].s = s2;
|
||||
// vertices[0].t = sp5e;
|
||||
// vertices[1].s = s2 + 160;
|
||||
// vertices[1].t = sp5e;
|
||||
// vertices[2].s = s2 + 160;
|
||||
// vertices[2].t = sp5e + 960;
|
||||
// vertices[3].s = s2;
|
||||
// vertices[3].t = sp5e + 960;
|
||||
//
|
||||
// vertices[0].colour = 0;
|
||||
// vertices[1].colour = 0;
|
||||
// vertices[2].colour = 0;
|
||||
// vertices[3].colour = 0;
|
||||
//
|
||||
// colours[0] = maxalpha;
|
||||
//
|
||||
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4);
|
||||
// gDPTri2(gdl++, 0, 1, 2, 2, 3, 0);
|
||||
// }
|
||||
//
|
||||
// if (sp50) {
|
||||
// gdl = func0f0d49c8(gdl);
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *nbombRenderOverlay(Gfx *gdl)
|
||||
{
|
||||
u32 stack;
|
||||
struct coord campos; // 70
|
||||
struct gfxvtx *vertices;
|
||||
u32 maxalpha;
|
||||
bool inside;
|
||||
s32 i;
|
||||
s16 sp5e;
|
||||
s16 s2;
|
||||
u32 stack2[2];
|
||||
bool sp50 = false;
|
||||
s32 b;
|
||||
u32 *colours; // 48
|
||||
s32 a;
|
||||
s16 viewleft; // 42
|
||||
s16 viewtop; // 40
|
||||
s16 viewright; // 3e
|
||||
s16 viewbottom; // 3c
|
||||
|
||||
campos.x = g_Vars.currentplayer->cam_pos.x;
|
||||
campos.y = g_Vars.currentplayer->cam_pos.y;
|
||||
campos.z = g_Vars.currentplayer->cam_pos.z;
|
||||
|
||||
inside = false;
|
||||
maxalpha = 0;
|
||||
|
||||
for (i = 0; i < ARRAYCOUNT(g_Nbombs); i++) {
|
||||
if (g_Nbombs[i].age240 >= 0 && g_Nbombs[i].age240 <= TICKS(350)) {
|
||||
f32 xdiff = campos.f[0] - g_Nbombs[i].pos.f[0];
|
||||
f32 ydiff = campos.f[1] - g_Nbombs[i].pos.f[1];
|
||||
f32 zdiff = campos.f[2] - g_Nbombs[i].pos.f[2];
|
||||
|
||||
if (sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff) < g_Nbombs[i].radius) {
|
||||
u32 alpha = nbombCalculateAlpha(&g_Nbombs[i]);
|
||||
|
||||
inside = true;
|
||||
|
||||
if (alpha > maxalpha) {
|
||||
maxalpha = alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inside) {
|
||||
colours = gfxAllocateColours(1);
|
||||
vertices = gfxAllocateVertices(4);
|
||||
|
||||
viewleft = viGetViewLeft() * 10;
|
||||
viewtop = viGetViewTop() * 10;
|
||||
viewright = (s16)(viGetViewLeft() + viGetViewWidth()) * 10;
|
||||
viewbottom = (s16)(viGetViewTop() + viGetViewHeight()) * 10;
|
||||
|
||||
sp50 = true;
|
||||
|
||||
s2 = (s32) (8.0f * var80061630 * 128.0f * 32.0f) % 2048;
|
||||
sp5e = ((s32)(campos.f[1] * 8.0f) % 2048) + (s32)(2.0f * var80061630 * 128.0f * 32.0f);
|
||||
|
||||
if (1);
|
||||
if (1);
|
||||
|
||||
gdl = func0f0d479c(gdl);
|
||||
|
||||
if (1);
|
||||
|
||||
texSelect(&gdl, &g_TexGeneralConfigs[10], 2, 1, 2, true, NULL);
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
gDPSetColorDither(gdl++, G_CD_DISABLE);
|
||||
gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
gDPSetRenderMode(gdl++, G_RM_ZB_XLU_SURF, G_RM_ZB_XLU_SURF2);
|
||||
gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
|
||||
vertices[0].x = viewleft;
|
||||
vertices[0].y = viewtop;
|
||||
vertices[0].z = -10;
|
||||
|
||||
vertices[1].x = viewright;
|
||||
vertices[1].y = viewtop;
|
||||
vertices[1].z = -10;
|
||||
|
||||
vertices[2].x = viewright;
|
||||
vertices[2].y = viewbottom;
|
||||
vertices[2].z = -10;
|
||||
|
||||
vertices[3].x = viewleft;
|
||||
vertices[3].y = viewbottom;
|
||||
vertices[3].z = -10;
|
||||
|
||||
vertices[0].s = s2;
|
||||
vertices[0].t = sp5e;
|
||||
vertices[1].s = s2 + 160;
|
||||
vertices[1].t = sp5e;
|
||||
vertices[2].s = s2 + 160;
|
||||
vertices[2].t = sp5e + 960;
|
||||
vertices[3].s = s2;
|
||||
vertices[3].t = sp5e + 960;
|
||||
|
||||
vertices[0].colour = 0;
|
||||
vertices[1].colour = 0;
|
||||
vertices[2].colour = 0;
|
||||
vertices[3].colour = 0;
|
||||
|
||||
colours[0] = maxalpha;
|
||||
|
||||
gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 4);
|
||||
gDPTri2(gdl++, 0, 1, 2, 2, 3, 0);
|
||||
}
|
||||
|
||||
if (sp50) {
|
||||
gdl = func0f0d49c8(gdl);
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel gasRender
|
||||
.late_rodata
|
||||
@@ -2775,206 +2780,207 @@ const u32 var7f1a7ea0[] = {0x0000009a};
|
||||
const u32 var7f1a7ea4[] = {0x00000091};
|
||||
const u32 var7f1a7ea8[] = {0x0000008f};
|
||||
const u32 var7f1a7eac[] = {0x00000090};
|
||||
|
||||
#else
|
||||
// Mismatch: Float calculations
|
||||
//Gfx *gasRender(Gfx *gdl)
|
||||
//{
|
||||
// bool show = false;
|
||||
// f32 alphafrac = 1.0f; // 108
|
||||
// struct coord campos; // fc
|
||||
// s16 spfa; // fa
|
||||
// u32 alpha;
|
||||
// s32 i;
|
||||
// bool drawn = false; // ec
|
||||
// const u32 gasrooms[] = { 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x91, 0x8f, 0x90 }; // bc
|
||||
// f32 intensityfrac; // b8
|
||||
// u32 stack;
|
||||
// f32 frac1; // b0
|
||||
// f32 frac2;
|
||||
//
|
||||
// f32 distance;
|
||||
// u32 *colours; // a4
|
||||
// struct gfxvtx *vertices;
|
||||
// s16 viewleft; // 9e
|
||||
// s16 viewtop; // 9c
|
||||
// s16 viewright; // 9a
|
||||
// s16 viewbottom; // 98
|
||||
// f32 fVar19;
|
||||
// f32 camposx; // 8c
|
||||
// f32 camposz; // 88
|
||||
// f32 sp78; // 78
|
||||
// s16 sp76; // 76
|
||||
// s16 sp72; // 72
|
||||
// s16 sVar15;
|
||||
// s32 uVar21;
|
||||
// f32 sp38; // 38
|
||||
//
|
||||
// if (g_Vars.stagenum == STAGE_ESCAPE) {
|
||||
// intensityfrac = 1.0f;
|
||||
//
|
||||
// campos.x = g_Vars.currentplayer->cam_pos.x;
|
||||
// campos.y = g_Vars.currentplayer->cam_pos.y;
|
||||
// campos.z = g_Vars.currentplayer->cam_pos.z;
|
||||
//
|
||||
// for (i = 0; i < 12; i++) {
|
||||
// if (roomContainsCoord(&campos, gasrooms[i])) {
|
||||
// show = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!show) {
|
||||
// // Outside of the gas rooms list - check distance to abitrary point
|
||||
// distance = sqrtf(
|
||||
// (campos.f[0] - -1473.0f) * (campos.f[0] - -1473.0f) +
|
||||
// (campos.f[1] - -308.0f) * (campos.f[1] - -308.0f) +
|
||||
// (campos.f[2] - -13660.0f) * (campos.f[2] - -13660.0f));
|
||||
//
|
||||
// if (distance < 1328.0f) {
|
||||
// show = true;
|
||||
// alphafrac = 1.0f - distance / 1328.0f;
|
||||
// intensityfrac = gasGetDoorFrac(0x32);
|
||||
// }
|
||||
// } else {
|
||||
// if (roomContainsCoord(&campos, 0x91)) {
|
||||
// // In the small room between the first two doors
|
||||
// frac1 = gasGetDoorFrac(0x30);
|
||||
// frac2 = gasGetDoorFrac(0x31);
|
||||
//
|
||||
// if (frac2 > frac1) {
|
||||
// intensityfrac = frac2;
|
||||
// } else {
|
||||
// intensityfrac = frac1;
|
||||
// }
|
||||
//
|
||||
// intensityfrac += 0.2f;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// alphafrac *= intensityfrac;
|
||||
//
|
||||
// if (show && g_Vars.tickmode == TICKMODE_CUTSCENE) {
|
||||
// if (g_CutsceneCurAnimFrame60 < 2180) {
|
||||
// show = false;
|
||||
// } else {
|
||||
// if (g_CutsceneCurAnimFrame60 < 2600) {
|
||||
// alphafrac *= (g_CutsceneCurAnimFrame60 - 2180) / 420.0f;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (show) {
|
||||
// f32 lookx;
|
||||
// f32 lookz;
|
||||
// f32 tmp;
|
||||
// f32 tmp2;
|
||||
// s32 tmp3;
|
||||
// colours = gfxAllocateColours(1);
|
||||
// vertices = gfxAllocateVertices(8);
|
||||
// viewleft = viGetViewLeft() * 10;
|
||||
// viewtop = viGetViewTop() * 10;
|
||||
// viewright = (viGetViewLeft() + viGetViewWidth()) * 10;
|
||||
// viewbottom = (viGetViewTop() + viGetViewHeight()) * 10;
|
||||
//
|
||||
// lookx = g_Vars.currentplayer->cam_look.x;
|
||||
// lookz = g_Vars.currentplayer->cam_look.z;
|
||||
// camposx = g_Vars.currentplayer->cam_pos.f[0];
|
||||
// camposz = g_Vars.currentplayer->cam_pos.f[2];
|
||||
//
|
||||
// sp78 = atan2f(-lookx, lookz) / M_BADTAU;
|
||||
// sp38 = (func0f006b08(4) - 0.5f) / 6.0f;
|
||||
//
|
||||
// fVar19 = (camposx + camposz) / 3000.0f;
|
||||
// fVar19 -= (s32)fVar19;
|
||||
// tmp = sp38 + sp78 + fVar19 * 1.5f;
|
||||
//
|
||||
// sp76 = (s32)((2.0f * tmp) * 128.0f * 32.0f) % 0x800;
|
||||
//
|
||||
// tmp2 = (func0f006b54(4) - 0.5f) / -9.0f;
|
||||
// drawn = true;
|
||||
// fVar19 = tmp2 + sp78 + sp38;
|
||||
//
|
||||
// sVar15 = (s32)((2.0f * fVar19) * 128.0f * 32.0f) % 0x800;
|
||||
//
|
||||
// tmp3 = (s32)(campos.y * 8.0f) % 0x800;
|
||||
//
|
||||
// spfa = tmp3 + (s32)((2.0f * var80061630) * 128.0f * 32.0f);
|
||||
// sp72 = tmp3 + (s32)((2.0f * var80061630) * 64.0f * 32.0f);
|
||||
//
|
||||
// gdl = func0f0d479c(gdl);
|
||||
//
|
||||
// texSelect(&gdl, &g_TexGeneralConfigs[6], 4, 1, 2, 1, NULL);
|
||||
//
|
||||
// gDPPipeSync(gdl++);
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
// gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
// gDPSetColorDither(gdl++, G_CD_DISABLE);
|
||||
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
// gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
|
||||
// gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
//
|
||||
// vertices[0].x = viewleft;
|
||||
// vertices[0].y = viewtop;
|
||||
// vertices[0].z = -10;
|
||||
// vertices[1].z = -10;
|
||||
// vertices[2].z = -10;
|
||||
// vertices[3].z = -10;
|
||||
// vertices[4].z = -10;
|
||||
// vertices[5].z = -10;
|
||||
// vertices[6].z = -10;
|
||||
// vertices[7].z = -10;
|
||||
// vertices[0].s = sVar15;
|
||||
// vertices[0].t = sp72;
|
||||
// vertices[1].y = viewtop;
|
||||
// vertices[4].y = viewtop;
|
||||
// vertices[5].y = viewtop;
|
||||
// vertices[3].x = viewleft;
|
||||
// vertices[4].x = viewleft;
|
||||
// vertices[7].x = viewleft;
|
||||
// vertices[2].y = viewbottom;
|
||||
// vertices[3].y = viewbottom;
|
||||
// vertices[6].y = viewbottom;
|
||||
// vertices[7].y = viewbottom;
|
||||
// vertices[1].x = viewright;
|
||||
// vertices[2].x = viewright;
|
||||
// vertices[5].x = viewright;
|
||||
// vertices[6].x = viewright;
|
||||
// vertices[1].s = sVar15 + 960;
|
||||
// vertices[2].s = sVar15 + 960;
|
||||
// vertices[2].t = sp72 + 640;
|
||||
// vertices[3].s = sVar15;
|
||||
// vertices[3].t = sp72 + 640;
|
||||
// vertices[0].colour = 0;
|
||||
// vertices[1].colour = 0;
|
||||
// vertices[2].colour = 0;
|
||||
// vertices[3].colour = 0;
|
||||
// vertices[1].t = sp72;
|
||||
// vertices[4].t = spfa;
|
||||
// vertices[4].s = sp76;
|
||||
// vertices[5].s = sp76 + 640;
|
||||
// vertices[6].s = sp76 + 640;
|
||||
// vertices[6].t = spfa + 480;
|
||||
// vertices[7].t = spfa + 480;
|
||||
// vertices[4].colour = 0;
|
||||
// vertices[5].colour = 0;
|
||||
// vertices[6].colour = 0;
|
||||
// vertices[7].colour = 0;
|
||||
// vertices[5].t = spfa;
|
||||
// vertices[7].s = sp76;
|
||||
//
|
||||
// colours[0] = 0x3faf1100 | (u32)(alphafrac * 127.0f);
|
||||
//
|
||||
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
// gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8);
|
||||
//
|
||||
// gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (drawn) {
|
||||
// gdl = func0f0d49c8(gdl);
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *gasRender(Gfx *gdl)
|
||||
{
|
||||
bool show = false;
|
||||
f32 alphafrac = 1.0f; // 108
|
||||
struct coord campos; // fc
|
||||
s16 spfa; // fa
|
||||
u32 alpha;
|
||||
s32 i;
|
||||
bool drawn = false; // ec
|
||||
const u32 gasrooms[] = { 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x91, 0x8f, 0x90 }; // bc
|
||||
f32 intensityfrac; // b8
|
||||
u32 stack;
|
||||
f32 frac1; // b0
|
||||
f32 frac2;
|
||||
|
||||
f32 distance;
|
||||
u32 *colours; // a4
|
||||
struct gfxvtx *vertices;
|
||||
s16 viewleft; // 9e
|
||||
s16 viewtop; // 9c
|
||||
s16 viewright; // 9a
|
||||
s16 viewbottom; // 98
|
||||
f32 fVar19;
|
||||
f32 camposx; // 8c
|
||||
f32 camposz; // 88
|
||||
f32 sp78; // 78
|
||||
s16 sp76; // 76
|
||||
s16 sp72; // 72
|
||||
s16 sVar15;
|
||||
s32 uVar21;
|
||||
f32 sp38; // 38
|
||||
|
||||
if (g_Vars.stagenum == STAGE_ESCAPE) {
|
||||
intensityfrac = 1.0f;
|
||||
|
||||
campos.x = g_Vars.currentplayer->cam_pos.x;
|
||||
campos.y = g_Vars.currentplayer->cam_pos.y;
|
||||
campos.z = g_Vars.currentplayer->cam_pos.z;
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (roomContainsCoord(&campos, gasrooms[i])) {
|
||||
show = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!show) {
|
||||
// Outside of the gas rooms list - check distance to abitrary point
|
||||
distance = sqrtf(
|
||||
(campos.f[0] - -1473.0f) * (campos.f[0] - -1473.0f) +
|
||||
(campos.f[1] - -308.0f) * (campos.f[1] - -308.0f) +
|
||||
(campos.f[2] - -13660.0f) * (campos.f[2] - -13660.0f));
|
||||
|
||||
if (distance < 1328.0f) {
|
||||
show = true;
|
||||
alphafrac = 1.0f - distance / 1328.0f;
|
||||
intensityfrac = gasGetDoorFrac(0x32);
|
||||
}
|
||||
} else {
|
||||
if (roomContainsCoord(&campos, 0x91)) {
|
||||
// In the small room between the first two doors
|
||||
frac1 = gasGetDoorFrac(0x30);
|
||||
frac2 = gasGetDoorFrac(0x31);
|
||||
|
||||
if (frac2 > frac1) {
|
||||
intensityfrac = frac2;
|
||||
} else {
|
||||
intensityfrac = frac1;
|
||||
}
|
||||
|
||||
intensityfrac += 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
alphafrac *= intensityfrac;
|
||||
|
||||
if (show && g_Vars.tickmode == TICKMODE_CUTSCENE) {
|
||||
if (g_CutsceneCurAnimFrame60 < 2180) {
|
||||
show = false;
|
||||
} else {
|
||||
if (g_CutsceneCurAnimFrame60 < 2600) {
|
||||
alphafrac *= (g_CutsceneCurAnimFrame60 - 2180) / 420.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (show) {
|
||||
f32 lookx;
|
||||
f32 lookz;
|
||||
f32 tmp;
|
||||
f32 tmp2;
|
||||
s32 tmp3;
|
||||
colours = gfxAllocateColours(1);
|
||||
vertices = gfxAllocateVertices(8);
|
||||
viewleft = viGetViewLeft() * 10;
|
||||
viewtop = viGetViewTop() * 10;
|
||||
viewright = (viGetViewLeft() + viGetViewWidth()) * 10;
|
||||
viewbottom = (viGetViewTop() + viGetViewHeight()) * 10;
|
||||
|
||||
lookx = g_Vars.currentplayer->cam_look.x;
|
||||
lookz = g_Vars.currentplayer->cam_look.z;
|
||||
camposx = g_Vars.currentplayer->cam_pos.f[0];
|
||||
camposz = g_Vars.currentplayer->cam_pos.f[2];
|
||||
|
||||
sp78 = atan2f(-lookx, lookz) / M_BADTAU;
|
||||
sp38 = (func0f006b08(4) - 0.5f) / 6.0f;
|
||||
|
||||
fVar19 = (camposx + camposz) / 3000.0f;
|
||||
fVar19 -= (s32)fVar19;
|
||||
tmp = sp38 + sp78 + fVar19 * 1.5f;
|
||||
|
||||
sp76 = (s32)((2.0f * tmp) * 128.0f * 32.0f) % 0x800;
|
||||
|
||||
tmp2 = (func0f006b54(4) - 0.5f) / -9.0f;
|
||||
drawn = true;
|
||||
fVar19 = tmp2 + sp78 + sp38;
|
||||
|
||||
sVar15 = (s32)((2.0f * fVar19) * 128.0f * 32.0f) % 0x800;
|
||||
|
||||
tmp3 = (s32)(campos.y * 8.0f) % 0x800;
|
||||
|
||||
spfa = tmp3 + (s32)((2.0f * var80061630) * 128.0f * 32.0f);
|
||||
sp72 = tmp3 + (s32)((2.0f * var80061630) * 64.0f * 32.0f);
|
||||
|
||||
gdl = func0f0d479c(gdl);
|
||||
|
||||
texSelect(&gdl, &g_TexGeneralConfigs[6], 4, 1, 2, 1, NULL);
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetCombineMode(gdl++, G_CC_MODULATEIA, G_CC_MODULATEIA);
|
||||
gSPClearGeometryMode(gdl++, G_CULL_BOTH);
|
||||
gDPSetColorDither(gdl++, G_CD_DISABLE);
|
||||
gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
|
||||
gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
|
||||
vertices[0].x = viewleft;
|
||||
vertices[0].y = viewtop;
|
||||
vertices[0].z = -10;
|
||||
vertices[1].z = -10;
|
||||
vertices[2].z = -10;
|
||||
vertices[3].z = -10;
|
||||
vertices[4].z = -10;
|
||||
vertices[5].z = -10;
|
||||
vertices[6].z = -10;
|
||||
vertices[7].z = -10;
|
||||
vertices[0].s = sVar15;
|
||||
vertices[0].t = sp72;
|
||||
vertices[1].y = viewtop;
|
||||
vertices[4].y = viewtop;
|
||||
vertices[5].y = viewtop;
|
||||
vertices[3].x = viewleft;
|
||||
vertices[4].x = viewleft;
|
||||
vertices[7].x = viewleft;
|
||||
vertices[2].y = viewbottom;
|
||||
vertices[3].y = viewbottom;
|
||||
vertices[6].y = viewbottom;
|
||||
vertices[7].y = viewbottom;
|
||||
vertices[1].x = viewright;
|
||||
vertices[2].x = viewright;
|
||||
vertices[5].x = viewright;
|
||||
vertices[6].x = viewright;
|
||||
vertices[1].s = sVar15 + 960;
|
||||
vertices[2].s = sVar15 + 960;
|
||||
vertices[2].t = sp72 + 640;
|
||||
vertices[3].s = sVar15;
|
||||
vertices[3].t = sp72 + 640;
|
||||
vertices[0].colour = 0;
|
||||
vertices[1].colour = 0;
|
||||
vertices[2].colour = 0;
|
||||
vertices[3].colour = 0;
|
||||
vertices[1].t = sp72;
|
||||
vertices[4].t = spfa;
|
||||
vertices[4].s = sp76;
|
||||
vertices[5].s = sp76 + 640;
|
||||
vertices[6].s = sp76 + 640;
|
||||
vertices[6].t = spfa + 480;
|
||||
vertices[7].t = spfa + 480;
|
||||
vertices[4].colour = 0;
|
||||
vertices[5].colour = 0;
|
||||
vertices[6].colour = 0;
|
||||
vertices[7].colour = 0;
|
||||
vertices[5].t = spfa;
|
||||
vertices[7].s = sp76;
|
||||
|
||||
colours[0] = 0x3faf1100 | (u32)(alphafrac * 127.0f);
|
||||
|
||||
gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
gDPSetVerticeArray(gdl++, osVirtualToPhysical(vertices), 8);
|
||||
|
||||
gDPTri4(gdl++, 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (drawn) {
|
||||
gdl = func0f0d49c8(gdl);
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
+43
-41
@@ -5432,6 +5432,7 @@ bool pak0f11d7c4(s8 device)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel pakConvertFromGbcImage
|
||||
/* f11d8b4: 27bdffe0 */ addiu $sp,$sp,-32
|
||||
@@ -5509,7 +5510,7 @@ glabel pakConvertFromGbcImage
|
||||
/* f11d9bc: 03e00008 */ jr $ra
|
||||
/* f11d9c0: 27bd0020 */ addiu $sp,$sp,0x20
|
||||
);
|
||||
|
||||
#else
|
||||
/**
|
||||
* Convert camera pixel data from the Game Boy Camera's format and write it to
|
||||
* a 128x128 byte array.
|
||||
@@ -5518,46 +5519,47 @@ glabel pakConvertFromGbcImage
|
||||
* linear; the two bits for each pixel are in neighbouring bytes using the same
|
||||
* bit index. It also appears that the GBC format is column major.
|
||||
*/
|
||||
//void pakConvertFromGbcImage(u8 *src, u8 *dst)
|
||||
//{
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
// s32 byte;
|
||||
// s32 bit;
|
||||
// s32 a0;
|
||||
// s32 a3;
|
||||
// s32 t2;
|
||||
// u8 *s2;
|
||||
//
|
||||
// for (i = 0; i < 16; i++) {
|
||||
// a0 = (i * 16) << 4;
|
||||
//
|
||||
// for (j = 0; j < 16; j++) {
|
||||
// s2 = &src[a0];
|
||||
//
|
||||
// for (byte = 0; byte < 8; byte++) {
|
||||
// t2 = (i * 8 + byte) << 7;
|
||||
// a3 = j * 8;
|
||||
//
|
||||
// for (bit = 0; bit < 8; bit++) {
|
||||
// dst[t2 + a3] = 0;
|
||||
//
|
||||
// if ((s2[byte * 2 + 0] & (0x80 >> bit)) == 0) {
|
||||
// dst[t2 + a3] += 0x40;
|
||||
// }
|
||||
//
|
||||
// if ((s2[byte * 2 + 1] & (0x80 >> bit)) == 0) {
|
||||
// dst[t2 + a3] += 0x80;
|
||||
// }
|
||||
//
|
||||
// a3++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// a0 += 16;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void pakConvertFromGbcImage(u8 *src, u8 *dst)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 byte;
|
||||
s32 bit;
|
||||
s32 a0;
|
||||
s32 a3;
|
||||
s32 t2;
|
||||
u8 *s2;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
a0 = (i * 16) << 4;
|
||||
|
||||
for (j = 0; j < 16; j++) {
|
||||
s2 = &src[a0];
|
||||
|
||||
for (byte = 0; byte < 8; byte++) {
|
||||
t2 = (i * 8 + byte) << 7;
|
||||
a3 = j * 8;
|
||||
|
||||
for (bit = 0; bit < 8; bit++) {
|
||||
dst[t2 + a3] = 0;
|
||||
|
||||
if ((s2[byte * 2 + 0] & (0x80 >> bit)) == 0) {
|
||||
dst[t2 + a3] += 0x40;
|
||||
}
|
||||
|
||||
if ((s2[byte * 2 + 1] & (0x80 >> bit)) == 0) {
|
||||
dst[t2 + a3] += 0x80;
|
||||
}
|
||||
|
||||
a3++;
|
||||
}
|
||||
}
|
||||
|
||||
a0 += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Perform operations on a 128 x 128 image.
|
||||
|
||||
+62
-60
@@ -701,6 +701,7 @@ void playermgrSetAspectRatio(f32 aspect)
|
||||
g_Vars.currentplayer->aspect = aspect;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
GLOBAL_ASM(
|
||||
glabel playermgrGetModelOfWeapon
|
||||
@@ -1184,67 +1185,68 @@ glabel var7f1b522c
|
||||
/* f128cec: 00601025 */ or $v0,$v1,$zero
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
s32 playermgrGetModelOfWeapon(s32 weapon)
|
||||
{
|
||||
switch (weapon) {
|
||||
case WEAPON_NONE:
|
||||
case WEAPON_UNARMED: return -1;
|
||||
case WEAPON_FALCON2: return MODEL_CHRFALCON2;
|
||||
case WEAPON_MAGSEC4: return MODEL_CHRLEEGUN1;
|
||||
case WEAPON_MAULER: return MODEL_CHRMAULER;
|
||||
case WEAPON_DY357MAGNUM: return MODEL_CHRDY357;
|
||||
case WEAPON_DY357LX: return MODEL_CHRDY357TRENT;
|
||||
case WEAPON_PHOENIX: return MODEL_CHRMAIANPISTOL;
|
||||
case WEAPON_FALCON2_SILENCER: return MODEL_CHRFALCON2SIL;
|
||||
case WEAPON_FALCON2_SCOPE: return MODEL_CHRFALCON2SCOPE;
|
||||
case WEAPON_CMP150: return MODEL_CHRCMP150;
|
||||
case WEAPON_AR34: return MODEL_CHRAR34;
|
||||
case WEAPON_DRAGON: return MODEL_CHRDRAGON;
|
||||
case WEAPON_SUPERDRAGON: return MODEL_CHRSUPERDRAGON;
|
||||
case WEAPON_K7AVENGER: return MODEL_CHRAVENGER;
|
||||
case WEAPON_CYCLONE: return MODEL_CHRCYCLONE;
|
||||
case WEAPON_CALLISTO: return MODEL_CHRMAIANSMG;
|
||||
case WEAPON_RCP120: return MODEL_CHRRCP120;
|
||||
case WEAPON_LAPTOPGUN: return MODEL_CHRPCGUN;
|
||||
case WEAPON_SHOTGUN: return MODEL_CHRSHOTGUN;
|
||||
case WEAPON_REAPER: return MODEL_CHRSKMINIGUN;
|
||||
case WEAPON_ROCKETLAUNCHER: return MODEL_CHRDYROCKET;
|
||||
case WEAPON_DEVASTATOR: return MODEL_CHRDEVASTATOR;
|
||||
case WEAPON_SLAYER: return MODEL_CHRSKROCKET;
|
||||
case WEAPON_FARSIGHT: return MODEL_CHRZ2020;
|
||||
case WEAPON_SNIPERRIFLE: return MODEL_CHRSNIPERRIFLE;
|
||||
case WEAPON_CROSSBOW: return MODEL_CHRCROSSBOW;
|
||||
case WEAPON_LASER: return MODEL_CHRLASER;
|
||||
case WEAPON_COMBATKNIFE: return MODEL_CHRKNIFE;
|
||||
case WEAPON_TRANQUILIZER: return MODEL_CHRDRUGGUN;
|
||||
case WEAPON_PSYCHOSISGUN: return MODEL_CHRDRUGGUN;
|
||||
case WEAPON_NBOMB: return MODEL_CHRNBOMB;
|
||||
case WEAPON_GRENADE: return MODEL_CHRGRENADE;
|
||||
case WEAPON_REMOTEMINE: return MODEL_CHRREMOTEMINE;
|
||||
case WEAPON_PROXIMITYMINE: return MODEL_CHRPROXIMITYMINE;
|
||||
case WEAPON_TIMEDMINE: return MODEL_CHRTIMEDMINE;
|
||||
case WEAPON_BRIEFCASE2: return MODEL_CHRBRIEFCASE;
|
||||
case WEAPON_CLOAKINGDEVICE: return MODEL_CHRCLOAKER;
|
||||
case WEAPON_PP9I: return MODEL_CHRWPPK;
|
||||
case WEAPON_CC13: return MODEL_CHRTT33;
|
||||
case WEAPON_KL01313: return MODEL_CHRSKORPION;
|
||||
case WEAPON_KF7SPECIAL: return MODEL_CHRKALASH;
|
||||
case WEAPON_ZZT: return MODEL_CHRUZI;
|
||||
case WEAPON_DMC: return MODEL_CHRMP5K;
|
||||
case WEAPON_AR53: return MODEL_CHRM16;
|
||||
case WEAPON_RCP45: return MODEL_CHRFNP90;
|
||||
case WEAPON_COMBATBOOST: return -1;
|
||||
case WEAPON_HAMMER: return MODEL_CHRLUMPHAMMER;
|
||||
case WEAPON_SCREWDRIVER: return MODEL_CHRSONICSCREWER;
|
||||
}
|
||||
|
||||
//s32 playermgrGetModelOfWeapon(s32 weapon)
|
||||
//{
|
||||
// switch (weapon) {
|
||||
// case WEAPON_NONE:
|
||||
// case WEAPON_UNARMED: return -1;
|
||||
// case WEAPON_FALCON2: return MODEL_CHRFALCON2;
|
||||
// case WEAPON_MAGSEC4: return MODEL_CHRLEEGUN1;
|
||||
// case WEAPON_MAULER: return MODEL_CHRMAULER;
|
||||
// case WEAPON_DY357MAGNUM: return MODEL_CHRDY357;
|
||||
// case WEAPON_DY357LX: return MODEL_CHRDY357TRENT;
|
||||
// case WEAPON_PHOENIX: return MODEL_CHRMAIANPISTOL;
|
||||
// case WEAPON_FALCON2_SILENCER: return MODEL_CHRFALCON2SIL;
|
||||
// case WEAPON_FALCON2_SCOPE: return MODEL_CHRFALCON2SCOPE;
|
||||
// case WEAPON_CMP150: return MODEL_CHRCMP150;
|
||||
// case WEAPON_AR34: return MODEL_CHRAR34;
|
||||
// case WEAPON_DRAGON: return MODEL_CHRDRAGON;
|
||||
// case WEAPON_SUPERDRAGON: return MODEL_CHRSUPERDRAGON;
|
||||
// case WEAPON_K7AVENGER: return MODEL_CHRAVENGER;
|
||||
// case WEAPON_CYCLONE: return MODEL_CHRCYCLONE;
|
||||
// case WEAPON_CALLISTO: return MODEL_CHRMAIANSMG;
|
||||
// case WEAPON_RCP120: return MODEL_CHRRCP120;
|
||||
// case WEAPON_LAPTOPGUN: return MODEL_CHRPCGUN;
|
||||
// case WEAPON_SHOTGUN: return MODEL_CHRSHOTGUN;
|
||||
// case WEAPON_REAPER: return MODEL_CHRSKMINIGUN;
|
||||
// case WEAPON_ROCKETLAUNCHER: return MODEL_CHRDYROCKET;
|
||||
// case WEAPON_DEVASTATOR: return MODEL_CHRDEVASTATOR;
|
||||
// case WEAPON_SLAYER: return MODEL_CHRSKROCKET;
|
||||
// case WEAPON_FARSIGHT: return MODEL_CHRZ2020;
|
||||
// case WEAPON_SNIPERRIFLE: return MODEL_CHRSNIPERRIFLE;
|
||||
// case WEAPON_CROSSBOW: return MODEL_CHRCROSSBOW;
|
||||
// case WEAPON_LASER: return MODEL_CHRLASER;
|
||||
// case WEAPON_COMBATKNIFE: return MODEL_CHRKNIFE;
|
||||
// case WEAPON_TRANQUILIZER: return MODEL_CHRDRUGGUN;
|
||||
// case WEAPON_PSYCHOSISGUN: return MODEL_CHRDRUGGUN;
|
||||
// case WEAPON_NBOMB: return MODEL_CHRNBOMB;
|
||||
// case WEAPON_GRENADE: return MODEL_CHRGRENADE;
|
||||
// case WEAPON_REMOTEMINE: return MODEL_CHRREMOTEMINE;
|
||||
// case WEAPON_PROXIMITYMINE: return MODEL_CHRPROXIMITYMINE;
|
||||
// case WEAPON_TIMEDMINE: return MODEL_CHRTIMEDMINE;
|
||||
// case WEAPON_BRIEFCASE2: return MODEL_CHRBRIEFCASE;
|
||||
// case WEAPON_CLOAKINGDEVICE: return MODEL_CHRCLOAKER;
|
||||
// case WEAPON_PP9I: return MODEL_CHRWPPK;
|
||||
// case WEAPON_CC13: return MODEL_CHRTT33;
|
||||
// case WEAPON_KL01313: return MODEL_CHRSKORPION;
|
||||
// case WEAPON_KF7SPECIAL: return MODEL_CHRKALASH;
|
||||
// case WEAPON_ZZT: return MODEL_CHRUZI;
|
||||
// case WEAPON_DMC: return MODEL_CHRMP5K;
|
||||
// case WEAPON_AR53: return MODEL_CHRM16;
|
||||
// case WEAPON_RCP45: return MODEL_CHRFNP90;
|
||||
// case WEAPON_COMBATBOOST: return -1;
|
||||
// case WEAPON_HAMMER: return MODEL_CHRLUMPHAMMER;
|
||||
// case WEAPON_SCREWDRIVER: return MODEL_CHRSONICSCREWER;
|
||||
// }
|
||||
//
|
||||
// if (weapon <= WEAPON_PSYCHOSISGUN) {
|
||||
// return MODEL_CHRSNIPERRIFLE;
|
||||
// }
|
||||
//
|
||||
// return -1;
|
||||
//}
|
||||
if (weapon <= WEAPON_PSYCHOSISGUN) {
|
||||
return MODEL_CHRSNIPERRIFLE;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void playermgrDeleteWeapon(s32 hand)
|
||||
{
|
||||
|
||||
+296
-294
@@ -14058,6 +14058,7 @@ void tvscreenSetTexture(struct tvscreen *screen, s32 texturenum)
|
||||
screen->tconfig = (struct textureconfig *)texturenum;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel tvscreenRender
|
||||
.late_rodata
|
||||
@@ -15049,302 +15050,303 @@ glabel var7f1aa824
|
||||
/* f0809bc: 03e00008 */ jr $ra
|
||||
/* f0809c0: 27bd00b8 */ addiu $sp,$sp,0xb8
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Several issues, but main one is the float variables near the cosf
|
||||
// and sinf calls. Appears to be functionally identical.
|
||||
//Gfx *tvscreenRender(struct model *model, struct modelnode *node, struct tvscreen *screen, Gfx *gdl, s32 arg4, s32 arg5)
|
||||
//{
|
||||
// struct textureconfig *tconfig;
|
||||
//
|
||||
// if (node && (node->type & 0xff) == MODELNODETYPE_DL) {
|
||||
// struct gfxvtx *vertices = gfxAllocateVertices(4); // b4
|
||||
// u8 *colours = gfxAllocateColours(1); // b0
|
||||
// Gfx *savedgdl = gdl++; // ac
|
||||
// union modelrodata *rodata = node->rodata; // a8
|
||||
// union modelrwdata *rwdata = modelGetNodeRwData(model, node); // a4
|
||||
// bool yielding = false;
|
||||
//
|
||||
// while (!yielding) {
|
||||
// u32 *cmd = &screen->cmdlist[screen->offset];
|
||||
//
|
||||
// switch (cmd[0]) {
|
||||
// case TVCMD_STOPSCROLL: // f07fce4
|
||||
// screen->xmidinc = 0;
|
||||
// screen->ymidinc = 0;
|
||||
// screen->offset++;
|
||||
// break;
|
||||
// case TVCMD_SCROLLRELX: // f07fcf8
|
||||
// screen->xmidfrac = 0;
|
||||
// screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
// screen->xmidold = screen->xmid;
|
||||
// screen->xmidnew = screen->xmid + (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_SCROLLRELY: // f07fd68
|
||||
// screen->ymidfrac = 0;
|
||||
// screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
// screen->ymidold = screen->ymid;
|
||||
// screen->ymidnew = screen->ymid + (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_SCROLLABSX: // f07fdd8
|
||||
// screen->xmidfrac = 0;
|
||||
// screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
// screen->xmidold = screen->xmid;
|
||||
// screen->xmidnew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_SCROLLABSY: // f07fe44
|
||||
// screen->ymidfrac = 0;
|
||||
// screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
// screen->ymidold = screen->ymid;
|
||||
// screen->ymidnew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_SCALEABSX: // f07feb0
|
||||
// screen->xscalefrac = 0;
|
||||
// screen->xscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
// screen->xscaleold = screen->xscale;
|
||||
// screen->xscalenew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_SCALEABSY: // f07ff1c
|
||||
// screen->yscalefrac = 0;
|
||||
// screen->yscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
// screen->yscaleold = screen->yscale;
|
||||
// screen->yscalenew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_SETTEXTURE: // f07ff88
|
||||
// tvscreenSetTexture(screen, cmd[1]);
|
||||
// screen->offset += 2;
|
||||
// break;
|
||||
// case TVCMD_PAUSE: // f07ffb4
|
||||
// if (screen->pause60 >= 0) {
|
||||
// screen->pause60 -= g_Vars.lvupdate240_60;
|
||||
//
|
||||
// if (screen->pause60 >= 0) {
|
||||
// yielding = true;
|
||||
// } else {
|
||||
// screen->offset += 2;
|
||||
// }
|
||||
// } else {
|
||||
// yielding = true;
|
||||
// screen->pause60 = cmd[1];
|
||||
// }
|
||||
// break;
|
||||
// case TVCMD_SETCMDLIST: // f080000
|
||||
// tvscreenSetCmdlist(screen, (u32 *) cmd[1]);
|
||||
// break;
|
||||
// case TVCMD_RANDSETCMDLIST: // f080020
|
||||
// if ((random() >> 16) < cmd[2]) {
|
||||
// tvscreenSetCmdlist(screen, (u32 *) cmd[1]);
|
||||
// } else {
|
||||
// screen->offset += 3;
|
||||
// }
|
||||
// break;
|
||||
// case TVCMD_RESTART: // f080074
|
||||
// screen->offset = 0;
|
||||
// break;
|
||||
// case TVCMD_YIELD: // f08007c
|
||||
// yielding = true;
|
||||
// break;
|
||||
// case TVCMD_SETCOLOUR: // f080084
|
||||
// screen->colfrac = 0;
|
||||
// screen->colinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
//
|
||||
// screen->redold = screen->red;
|
||||
// screen->rednew = (cmd[1] >> 24);
|
||||
//
|
||||
// screen->greenold = screen->green;
|
||||
// screen->greennew = (cmd[1] >> 16);
|
||||
//
|
||||
// screen->blueold = screen->blue;
|
||||
// screen->bluenew = (cmd[1] >> 8);
|
||||
//
|
||||
// screen->alphaold = screen->alpha;
|
||||
// screen->alphanew = cmd[1];
|
||||
//
|
||||
// screen->offset += 3;
|
||||
// break;
|
||||
// case TVCMD_ROTATEABS: // f08011c
|
||||
// screen->rot = (s32)cmd[1] * (M_BADTAU / 65536.0f);
|
||||
// screen->offset += 2;
|
||||
// break;
|
||||
// case TVCMD_ROTATEREL: // f080140
|
||||
// screen->rot += g_Vars.lvupdate240f * (s32)cmd[1] * (M_BADTAU / 65536.0f);
|
||||
//
|
||||
// if (screen->rot >= M_BADTAU) {
|
||||
// screen->rot -= M_BADTAU;
|
||||
// }
|
||||
//
|
||||
// if (screen->rot < 0) {
|
||||
// screen->rot += M_BADTAU;
|
||||
// }
|
||||
//
|
||||
// screen->offset += 2;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Increment X scale
|
||||
// if (screen->xscaleinc > 0) {
|
||||
// screen->xscalefrac += screen->xscaleinc * g_Vars.lvupdate240f;
|
||||
//
|
||||
// if (screen->xscalefrac < 1.0f) {
|
||||
// screen->xscale = screen->xscaleold + (screen->xscalenew - screen->xscaleold) * screen->xscalefrac;
|
||||
// } else {
|
||||
// screen->xscalefrac = 1.0f;
|
||||
// screen->xscaleinc = 0;
|
||||
// screen->xscale = screen->xscalenew;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Increment Y scale
|
||||
// if (screen->yscaleinc > 0) {
|
||||
// screen->yscalefrac += screen->yscaleinc * g_Vars.lvupdate240f;
|
||||
//
|
||||
// if (screen->yscalefrac < 1.0f) {
|
||||
// screen->yscale = screen->yscaleold + (screen->yscalenew - screen->yscaleold) * screen->yscalefrac;
|
||||
// } else {
|
||||
// screen->yscalefrac = 1.0f;
|
||||
// screen->yscaleinc = 0;
|
||||
// screen->yscale = screen->yscalenew;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Increment X scroll
|
||||
// if (screen->xmidinc > 0) {
|
||||
// screen->xmidfrac += screen->xmidinc * g_Vars.lvupdate240f;
|
||||
//
|
||||
// if (screen->xmidfrac < 1.0f) {
|
||||
// screen->xmid = screen->xmidold + (screen->xmidnew - screen->xmidold) * screen->xmidfrac;
|
||||
// } else {
|
||||
// screen->xmidfrac = 1.0f;
|
||||
// screen->xmidinc = 0;
|
||||
// screen->xmid = screen->xmidnew;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Increment Y scroll
|
||||
// if (screen->ymidinc > 0) {
|
||||
// screen->ymidfrac += screen->ymidinc * g_Vars.lvupdate240f;
|
||||
//
|
||||
// if (screen->ymidfrac < 1.0f) {
|
||||
// screen->ymid = screen->ymidold + (screen->ymidnew - screen->ymidold) * screen->ymidfrac;
|
||||
// } else {
|
||||
// screen->ymidfrac = 1.0f;
|
||||
// screen->ymidinc = 0;
|
||||
// screen->ymid = screen->ymidnew;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Increment colour change
|
||||
// // 370
|
||||
// if (screen->colinc > 0) {
|
||||
// screen->colfrac += screen->colinc * g_Vars.lvupdate240f;
|
||||
//
|
||||
// // 398
|
||||
// if (screen->colfrac < 1.0f) {
|
||||
// s32 r;
|
||||
// s32 g;
|
||||
// s32 b;
|
||||
// s32 a;
|
||||
// r = screen->colfrac * (screen->rednew - screen->redold);
|
||||
// g = screen->colfrac * (screen->greennew - screen->greenold);
|
||||
// screen->red = r + screen->redold;
|
||||
// screen->green = g + screen->greenold;
|
||||
// b = screen->colfrac * (screen->bluenew - screen->blueold);
|
||||
// a = screen->colfrac * (screen->alphanew - screen->alphaold);
|
||||
// screen->blue = b + screen->blueold;
|
||||
// screen->alpha = a + screen->alphaold;
|
||||
// } else {
|
||||
// screen->colfrac = 1.0f;
|
||||
// screen->colinc = 0;
|
||||
// screen->red = screen->rednew;
|
||||
// screen->green = screen->greennew;
|
||||
// screen->blue = screen->bluenew;
|
||||
// screen->alpha = screen->alphanew;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Set up everything for rendering
|
||||
// rwdata->dl.vertices = vertices;
|
||||
// rwdata->dl.unk08 = (u32 *) colours;
|
||||
// rwdata->dl.gdl = gdl;
|
||||
//
|
||||
// vertices[0] = rodata->dl.vertices[0];
|
||||
// vertices[1] = rodata->dl.vertices[1];
|
||||
// vertices[2] = rodata->dl.vertices[2];
|
||||
// vertices[3] = rodata->dl.vertices[3];
|
||||
//
|
||||
// if ((u32)screen->tconfig < 100) {
|
||||
// tconfig = &g_TexScreenConfigs[(u32)screen->tconfig];
|
||||
// } else {
|
||||
// tconfig = screen->tconfig;
|
||||
// }
|
||||
//
|
||||
// if (tconfig != NULL) {
|
||||
// f32 f20 = screen->xscale * 0.5f;
|
||||
// f32 f24 = screen->yscale * 0.5f;
|
||||
// f32 f14 = f20;
|
||||
// f32 f16 = f24;
|
||||
//
|
||||
// if (screen->rot != 0) {
|
||||
// f32 f22 = cosf(screen->rot) * 1.4141999483109f;
|
||||
// f32 f2 = sinf(screen->rot) * 1.4141999483109f;
|
||||
//
|
||||
// f20 *= f22;
|
||||
// f24 *= f2;
|
||||
// f14 *= f2;
|
||||
// f16 *= f22;
|
||||
// }
|
||||
//
|
||||
// vertices[0].s = tconfig->width * (screen->xmid + f20) * 32;
|
||||
// vertices[0].t = tconfig->height * (screen->ymid + f24) * 32;
|
||||
// vertices[1].s = tconfig->width * (screen->xmid - f14) * 32;
|
||||
// vertices[1].t = tconfig->height * (screen->ymid + f16) * 32;
|
||||
// vertices[2].s = tconfig->width * (screen->xmid - f20) * 32;
|
||||
// vertices[2].t = tconfig->height * (screen->ymid - f24) * 32;
|
||||
// vertices[3].s = tconfig->width * (screen->xmid + f14) * 32;
|
||||
// vertices[3].t = tconfig->height * (screen->ymid - f16) * 32;
|
||||
// }
|
||||
//
|
||||
// if (tconfig);
|
||||
//
|
||||
// colours[0] = screen->red;
|
||||
// colours[1] = screen->green;
|
||||
// colours[2] = screen->blue;
|
||||
// colours[3] = screen->alpha;
|
||||
//
|
||||
// vertices[0].colour = 0;
|
||||
// vertices[1].colour = 0;
|
||||
// vertices[2].colour = 0;
|
||||
// vertices[3].colour = 0;
|
||||
//
|
||||
// if (screen->alpha < 255) {
|
||||
// arg5 = 2;
|
||||
// }
|
||||
//
|
||||
// // Render the image
|
||||
// gSPSetGeometryMode(gdl++, G_CULL_BACK);
|
||||
//
|
||||
// texSelect(&gdl, tconfig, arg5, arg4, 2, 1, NULL);
|
||||
//
|
||||
// gSPMatrix(gdl++, osVirtualToPhysical(model->matrices), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
//
|
||||
// gMoveWd(gdl++, 1, 6, osVirtualToPhysical(vertices));
|
||||
// gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
// gDPSetVerticeArray(gdl++, 0x04000000, 4);
|
||||
//
|
||||
// gDPTri2(gdl++, 0, 1, 2, 0, 2, 3);
|
||||
// gSPEndDisplayList(gdl++);
|
||||
//
|
||||
// gSPBranchList(savedgdl++, gdl);
|
||||
// }
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *tvscreenRender(struct model *model, struct modelnode *node, struct tvscreen *screen, Gfx *gdl, s32 arg4, s32 arg5)
|
||||
{
|
||||
struct textureconfig *tconfig;
|
||||
|
||||
if (node && (node->type & 0xff) == MODELNODETYPE_DL) {
|
||||
struct gfxvtx *vertices = gfxAllocateVertices(4); // b4
|
||||
u8 *colours = gfxAllocateColours(1); // b0
|
||||
Gfx *savedgdl = gdl++; // ac
|
||||
union modelrodata *rodata = node->rodata; // a8
|
||||
union modelrwdata *rwdata = modelGetNodeRwData(model, node); // a4
|
||||
bool yielding = false;
|
||||
|
||||
while (!yielding) {
|
||||
u32 *cmd = &screen->cmdlist[screen->offset];
|
||||
|
||||
switch (cmd[0]) {
|
||||
case TVCMD_STOPSCROLL: // f07fce4
|
||||
screen->xmidinc = 0;
|
||||
screen->ymidinc = 0;
|
||||
screen->offset++;
|
||||
break;
|
||||
case TVCMD_SCROLLRELX: // f07fcf8
|
||||
screen->xmidfrac = 0;
|
||||
screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
screen->xmidold = screen->xmid;
|
||||
screen->xmidnew = screen->xmid + (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_SCROLLRELY: // f07fd68
|
||||
screen->ymidfrac = 0;
|
||||
screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
screen->ymidold = screen->ymid;
|
||||
screen->ymidnew = screen->ymid + (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_SCROLLABSX: // f07fdd8
|
||||
screen->xmidfrac = 0;
|
||||
screen->xmidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
screen->xmidold = screen->xmid;
|
||||
screen->xmidnew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_SCROLLABSY: // f07fe44
|
||||
screen->ymidfrac = 0;
|
||||
screen->ymidinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
screen->ymidold = screen->ymid;
|
||||
screen->ymidnew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_SCALEABSX: // f07feb0
|
||||
screen->xscalefrac = 0;
|
||||
screen->xscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
screen->xscaleold = screen->xscale;
|
||||
screen->xscalenew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_SCALEABSY: // f07ff1c
|
||||
screen->yscalefrac = 0;
|
||||
screen->yscaleinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
screen->yscaleold = screen->yscale;
|
||||
screen->yscalenew = (s32)cmd[1] * (1.0f / 1024.0f);
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_SETTEXTURE: // f07ff88
|
||||
tvscreenSetTexture(screen, cmd[1]);
|
||||
screen->offset += 2;
|
||||
break;
|
||||
case TVCMD_PAUSE: // f07ffb4
|
||||
if (screen->pause60 >= 0) {
|
||||
screen->pause60 -= g_Vars.lvupdate240_60;
|
||||
|
||||
if (screen->pause60 >= 0) {
|
||||
yielding = true;
|
||||
} else {
|
||||
screen->offset += 2;
|
||||
}
|
||||
} else {
|
||||
yielding = true;
|
||||
screen->pause60 = cmd[1];
|
||||
}
|
||||
break;
|
||||
case TVCMD_SETCMDLIST: // f080000
|
||||
tvscreenSetCmdlist(screen, (u32 *) cmd[1]);
|
||||
break;
|
||||
case TVCMD_RANDSETCMDLIST: // f080020
|
||||
if ((random() >> 16) < cmd[2]) {
|
||||
tvscreenSetCmdlist(screen, (u32 *) cmd[1]);
|
||||
} else {
|
||||
screen->offset += 3;
|
||||
}
|
||||
break;
|
||||
case TVCMD_RESTART: // f080074
|
||||
screen->offset = 0;
|
||||
break;
|
||||
case TVCMD_YIELD: // f08007c
|
||||
yielding = true;
|
||||
break;
|
||||
case TVCMD_SETCOLOUR: // f080084
|
||||
screen->colfrac = 0;
|
||||
screen->colinc = cmd[2] == 0 ? 1.0f : 1.0f / cmd[2];
|
||||
|
||||
screen->redold = screen->red;
|
||||
screen->rednew = (cmd[1] >> 24);
|
||||
|
||||
screen->greenold = screen->green;
|
||||
screen->greennew = (cmd[1] >> 16);
|
||||
|
||||
screen->blueold = screen->blue;
|
||||
screen->bluenew = (cmd[1] >> 8);
|
||||
|
||||
screen->alphaold = screen->alpha;
|
||||
screen->alphanew = cmd[1];
|
||||
|
||||
screen->offset += 3;
|
||||
break;
|
||||
case TVCMD_ROTATEABS: // f08011c
|
||||
screen->rot = (s32)cmd[1] * (M_BADTAU / 65536.0f);
|
||||
screen->offset += 2;
|
||||
break;
|
||||
case TVCMD_ROTATEREL: // f080140
|
||||
screen->rot += g_Vars.lvupdate240f * (s32)cmd[1] * (M_BADTAU / 65536.0f);
|
||||
|
||||
if (screen->rot >= M_BADTAU) {
|
||||
screen->rot -= M_BADTAU;
|
||||
}
|
||||
|
||||
if (screen->rot < 0) {
|
||||
screen->rot += M_BADTAU;
|
||||
}
|
||||
|
||||
screen->offset += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment X scale
|
||||
if (screen->xscaleinc > 0) {
|
||||
screen->xscalefrac += screen->xscaleinc * g_Vars.lvupdate240f;
|
||||
|
||||
if (screen->xscalefrac < 1.0f) {
|
||||
screen->xscale = screen->xscaleold + (screen->xscalenew - screen->xscaleold) * screen->xscalefrac;
|
||||
} else {
|
||||
screen->xscalefrac = 1.0f;
|
||||
screen->xscaleinc = 0;
|
||||
screen->xscale = screen->xscalenew;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment Y scale
|
||||
if (screen->yscaleinc > 0) {
|
||||
screen->yscalefrac += screen->yscaleinc * g_Vars.lvupdate240f;
|
||||
|
||||
if (screen->yscalefrac < 1.0f) {
|
||||
screen->yscale = screen->yscaleold + (screen->yscalenew - screen->yscaleold) * screen->yscalefrac;
|
||||
} else {
|
||||
screen->yscalefrac = 1.0f;
|
||||
screen->yscaleinc = 0;
|
||||
screen->yscale = screen->yscalenew;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment X scroll
|
||||
if (screen->xmidinc > 0) {
|
||||
screen->xmidfrac += screen->xmidinc * g_Vars.lvupdate240f;
|
||||
|
||||
if (screen->xmidfrac < 1.0f) {
|
||||
screen->xmid = screen->xmidold + (screen->xmidnew - screen->xmidold) * screen->xmidfrac;
|
||||
} else {
|
||||
screen->xmidfrac = 1.0f;
|
||||
screen->xmidinc = 0;
|
||||
screen->xmid = screen->xmidnew;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment Y scroll
|
||||
if (screen->ymidinc > 0) {
|
||||
screen->ymidfrac += screen->ymidinc * g_Vars.lvupdate240f;
|
||||
|
||||
if (screen->ymidfrac < 1.0f) {
|
||||
screen->ymid = screen->ymidold + (screen->ymidnew - screen->ymidold) * screen->ymidfrac;
|
||||
} else {
|
||||
screen->ymidfrac = 1.0f;
|
||||
screen->ymidinc = 0;
|
||||
screen->ymid = screen->ymidnew;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment colour change
|
||||
// 370
|
||||
if (screen->colinc > 0) {
|
||||
screen->colfrac += screen->colinc * g_Vars.lvupdate240f;
|
||||
|
||||
// 398
|
||||
if (screen->colfrac < 1.0f) {
|
||||
s32 r;
|
||||
s32 g;
|
||||
s32 b;
|
||||
s32 a;
|
||||
r = screen->colfrac * (screen->rednew - screen->redold);
|
||||
g = screen->colfrac * (screen->greennew - screen->greenold);
|
||||
screen->red = r + screen->redold;
|
||||
screen->green = g + screen->greenold;
|
||||
b = screen->colfrac * (screen->bluenew - screen->blueold);
|
||||
a = screen->colfrac * (screen->alphanew - screen->alphaold);
|
||||
screen->blue = b + screen->blueold;
|
||||
screen->alpha = a + screen->alphaold;
|
||||
} else {
|
||||
screen->colfrac = 1.0f;
|
||||
screen->colinc = 0;
|
||||
screen->red = screen->rednew;
|
||||
screen->green = screen->greennew;
|
||||
screen->blue = screen->bluenew;
|
||||
screen->alpha = screen->alphanew;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up everything for rendering
|
||||
rwdata->dl.vertices = vertices;
|
||||
rwdata->dl.colours = (struct colour *) colours;
|
||||
rwdata->dl.gdl = gdl;
|
||||
|
||||
vertices[0] = rodata->dl.vertices[0];
|
||||
vertices[1] = rodata->dl.vertices[1];
|
||||
vertices[2] = rodata->dl.vertices[2];
|
||||
vertices[3] = rodata->dl.vertices[3];
|
||||
|
||||
if ((u32)screen->tconfig < 100) {
|
||||
tconfig = &g_TexScreenConfigs[(u32)screen->tconfig];
|
||||
} else {
|
||||
tconfig = screen->tconfig;
|
||||
}
|
||||
|
||||
if (tconfig != NULL) {
|
||||
f32 f20 = screen->xscale * 0.5f;
|
||||
f32 f24 = screen->yscale * 0.5f;
|
||||
f32 f14 = f20;
|
||||
f32 f16 = f24;
|
||||
|
||||
if (screen->rot != 0) {
|
||||
f32 f22 = cosf(screen->rot) * 1.4141999483109f;
|
||||
f32 f2 = sinf(screen->rot) * 1.4141999483109f;
|
||||
|
||||
f20 *= f22;
|
||||
f24 *= f2;
|
||||
f14 *= f2;
|
||||
f16 *= f22;
|
||||
}
|
||||
|
||||
vertices[0].s = tconfig->width * (screen->xmid + f20) * 32;
|
||||
vertices[0].t = tconfig->height * (screen->ymid + f24) * 32;
|
||||
vertices[1].s = tconfig->width * (screen->xmid - f14) * 32;
|
||||
vertices[1].t = tconfig->height * (screen->ymid + f16) * 32;
|
||||
vertices[2].s = tconfig->width * (screen->xmid - f20) * 32;
|
||||
vertices[2].t = tconfig->height * (screen->ymid - f24) * 32;
|
||||
vertices[3].s = tconfig->width * (screen->xmid + f14) * 32;
|
||||
vertices[3].t = tconfig->height * (screen->ymid - f16) * 32;
|
||||
}
|
||||
|
||||
if (tconfig);
|
||||
|
||||
colours[0] = screen->red;
|
||||
colours[1] = screen->green;
|
||||
colours[2] = screen->blue;
|
||||
colours[3] = screen->alpha;
|
||||
|
||||
vertices[0].colour = 0;
|
||||
vertices[1].colour = 0;
|
||||
vertices[2].colour = 0;
|
||||
vertices[3].colour = 0;
|
||||
|
||||
if (screen->alpha < 255) {
|
||||
arg5 = 2;
|
||||
}
|
||||
|
||||
// Render the image
|
||||
gSPSetGeometryMode(gdl++, G_CULL_BACK);
|
||||
|
||||
texSelect(&gdl, tconfig, arg5, arg4, 2, 1, NULL);
|
||||
|
||||
gSPMatrix(gdl++, osVirtualToPhysical(model->matrices), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gMoveWd(gdl++, 1, 6, osVirtualToPhysical(vertices));
|
||||
gDPSetColorArray(gdl++, osVirtualToPhysical(colours), 1);
|
||||
gDPSetVerticeArray(gdl++, 0x04000000, 4);
|
||||
|
||||
gDPTri2(gdl++, 0, 1, 2, 0, 2, 3);
|
||||
gSPEndDisplayList(gdl++);
|
||||
|
||||
gSPBranchList(savedgdl++, gdl);
|
||||
}
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
void objRenderProp(struct prop *prop, struct modelrenderdata *renderdata, bool xlupass)
|
||||
{
|
||||
|
||||
+284
-282
@@ -239,6 +239,7 @@ s32 propsndGetSubtitleOpacity(s32 channelnum)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION >= VERSION_JPN_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel propsndTickChannel
|
||||
@@ -3423,289 +3424,290 @@ glabel var7f1ab740
|
||||
/* f091a38: 00000000 */ sll $zero,$zero,0x0
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
// Mismatch: Some reordered instructions
|
||||
//void propsndTickChannel(s32 channelnum)
|
||||
//{
|
||||
// struct audiochannel *channel = &g_AudioChannels[channelnum];
|
||||
//
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// if ((channel->flags2 & AUDIOCHANNELFLAG2_0080) == 0
|
||||
// && channel->unk28 != 11
|
||||
// && ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED)
|
||||
// || (channel->flags & AUDIOCHANNELFLAG_0002)
|
||||
// || (channel->flags & AUDIOCHANNELFLAG_1000)
|
||||
// || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3())))
|
||||
//#else
|
||||
// if ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED)
|
||||
// || (channel->flags & AUDIOCHANNELFLAG_0002)
|
||||
// || (channel->flags & AUDIOCHANNELFLAG_1000)
|
||||
// || ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3()))
|
||||
//#endif
|
||||
// {
|
||||
// struct coord *pos = NULL; // 50
|
||||
// s16 *rooms = NULL; // 4c
|
||||
// s32 sp48;
|
||||
// s32 sp44;
|
||||
// s32 sp40;
|
||||
// f32 sp3c;
|
||||
//
|
||||
// if (channel->prop) {
|
||||
// pos = &channel->prop->pos;
|
||||
// rooms = channel->prop->rooms;
|
||||
// } else if (channel->rooms[0] != -1) {
|
||||
// rooms = channel->rooms;
|
||||
// }
|
||||
//
|
||||
// if (channel->posptr != NULL) {
|
||||
// pos = channel->posptr;
|
||||
// }
|
||||
//
|
||||
// if (1);
|
||||
//
|
||||
// if (g_Vars.langfilteron && (channel->flags2 & AUDIOCHANNELFLAG2_OFFENSIVE)) {
|
||||
// channel->unk04 = 0;
|
||||
// } else if (channel->flags2 & AUDIOCHANNELFLAG2_0010) {
|
||||
// if ((channel->flags & AUDIOCHANNELFLAG_1000) == 0) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// channel->unk04 = channel->unk10;
|
||||
// } else {
|
||||
// if (pos && rooms) {
|
||||
// s16 *tmprooms;
|
||||
//
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_8000) {
|
||||
// tmprooms = NULL;
|
||||
// } else {
|
||||
// tmprooms = rooms;
|
||||
// }
|
||||
//
|
||||
// var8006ae50 = channel->unk2c;
|
||||
//
|
||||
// channel->unk04 = propsnd0f0946b0(pos, channel->unk34, channel->unk38, channel->unk3c,
|
||||
// tmprooms, channel->soundnum26, channel->unk10, &channel->unk4c);
|
||||
// }
|
||||
//
|
||||
// if ((channel->flags & AUDIOCHANNELFLAG_0020) == 0) {
|
||||
// channel->unk0a = propsnd0f094d78(pos, channel->unk34, channel->unk38, channel->unk3c,
|
||||
// channel->unk4c, channel->flags & AUDIOCHANNELFLAG_0800, &channel->audiohandle);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (rooms != NULL && rooms[0] != -1) {
|
||||
// channel->unk0c = 0;
|
||||
// channel->unk1a = 1;
|
||||
// } else {
|
||||
// channel->unk0c = 0;
|
||||
// channel->unk1a = 1;
|
||||
// }
|
||||
//
|
||||
// if (channel->audiohandle != NULL && channel->unk44 > 0.0f) {
|
||||
// if (channel->unk48 < 0.0f) {
|
||||
// sp3c = channel->unk44;
|
||||
// } else if (channel->unk20 > 0.0f) {
|
||||
// sp3c = channel->unk48 + (channel->unk44 - channel->unk48) * g_Vars.lvupdate240 / channel->unk20;
|
||||
// } else {
|
||||
// sp3c = channel->unk44;
|
||||
// }
|
||||
// } else {
|
||||
// sp3c = -1.0f;
|
||||
// }
|
||||
//
|
||||
// sp44 = channel->unk0a;
|
||||
// sp48 = channel->unk06;
|
||||
// sp40 = channel->unk0c;
|
||||
//
|
||||
// if (channel->unk06 == -1) {
|
||||
// sp48 = channel->unk04;
|
||||
// } else if (channel->unk1c >= 0) {
|
||||
// if (channel->unk1c > g_Vars.lvupdate240_60) {
|
||||
// sp48 = channel->unk06 + (channel->unk04 - channel->unk06) * g_Vars.lvupdate240_60 / channel->unk1c;
|
||||
// }
|
||||
//
|
||||
// channel->unk1c -= g_Vars.lvupdate240_60;
|
||||
// } else if (channel->unk18 && channel->unk06 != channel->unk04) {
|
||||
// f32 f12 = channel->unk04 - channel->unk06;
|
||||
//#if VERSION >= VERSION_PAL_BETA
|
||||
// f32 f14 = g_Vars.lvupdate240freal * (1.0f / 6000.0f) * channel->unk18;
|
||||
//#else
|
||||
// f32 f14 = g_Vars.lvupdate240_60 * (1.0f / 6000.0f) * channel->unk18;
|
||||
//#endif
|
||||
//
|
||||
// if (ABS(f12) > 1.0f) {
|
||||
// if (f14 > 1.0f) {
|
||||
// f14 = 1.0f;
|
||||
// }
|
||||
//
|
||||
// if (ABS(f14 * f12) > 1.0f) {
|
||||
// sp48 = channel->unk06 + (s32) (f14 * f12);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// sp48 = channel->unk04;
|
||||
// }
|
||||
//
|
||||
// if (lvIsPaused()
|
||||
// || (mpIsPaused() && (channel->flags2 & AUDIOCHANNELFLAG2_0002))
|
||||
// || (mpIsPaused() && PLAYERCOUNT() == 1)) {
|
||||
// channel->unk06 = -1;
|
||||
// sp48 = 0;
|
||||
// }
|
||||
//
|
||||
// if (sp48 != channel->unk06) {
|
||||
// channel->unk06 = sp48;
|
||||
// } else {
|
||||
// sp48 = -1;
|
||||
// }
|
||||
//
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// if (channel->unk0a != channel->unk08) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_1000) {
|
||||
// channel->unk08 = channel->unk0a;
|
||||
// sp44 = channel->unk08;
|
||||
// } else {
|
||||
// s32 diff = channel->unk0a - channel->unk08;
|
||||
// s32 lvupdate = g_Vars.lvupdate240 * 512 / 240;
|
||||
// s32 dir = diff < 0 ? -1 : 1;
|
||||
// s32 absdiff = ABS(diff);
|
||||
// s32 amount = absdiff < lvupdate ? absdiff : lvupdate;
|
||||
//
|
||||
// channel->unk08 += amount * dir;
|
||||
// sp44 = channel->unk08;
|
||||
// }
|
||||
//
|
||||
// channel->flags |= AUDIOCHANNELFLAG_4000;
|
||||
// } else {
|
||||
// sp44 = -1;
|
||||
// }
|
||||
//#else
|
||||
// if (sp44 != channel->unk08) {
|
||||
// channel->flags |= AUDIOCHANNELFLAG_4000;
|
||||
// channel->unk08 = sp44;
|
||||
// } else {
|
||||
// sp44 = -1;
|
||||
// }
|
||||
//#endif
|
||||
//
|
||||
// if (sp40 != channel->unk0e) {
|
||||
// channel->unk0e = sp40;
|
||||
// } else {
|
||||
// sp40 = -1;
|
||||
// }
|
||||
//
|
||||
// if (sp3c > 0.0f && ABS(sp3c - channel->unk48) > 0.01f) {
|
||||
// channel->unk48 = sp3c;
|
||||
// } else {
|
||||
// sp3c = -1.0f;
|
||||
// }
|
||||
//
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_0002) {
|
||||
// if (channel->unk06 > 0) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_2000) {
|
||||
// channel->flags &= ~AUDIOCHANNELFLAG_2000;
|
||||
// channel->flags |= AUDIOCHANNELFLAG_1000;
|
||||
// }
|
||||
// } else {
|
||||
// if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) {
|
||||
// if (channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) {
|
||||
// audioStop(channel->audiohandle);
|
||||
//#if VERSION < VERSION_NTSC_1_0
|
||||
// channel->audiohandle = NULL;
|
||||
//#endif
|
||||
// }
|
||||
//
|
||||
// channel->flags |= AUDIOCHANNELFLAG_2000;
|
||||
// }
|
||||
//
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
//#endif
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_1000) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
// sndStartMp3(channel->soundnum26, sp48, sp44, (channel->flags2 & AUDIOCHANNELFLAG2_0001) ? 1 : 0);
|
||||
// } else {
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_0400) {
|
||||
// if (sp48) {
|
||||
// snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
// channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
// }
|
||||
// } else {
|
||||
// if (sp48) {
|
||||
// snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
// channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
// }
|
||||
// }
|
||||
//#else
|
||||
// snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
// channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
//#endif
|
||||
// }
|
||||
//
|
||||
// channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
// } else {
|
||||
// sndAdjust(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
// channel->soundnum26, sp3c, channel->unk1a, sp40, channel->flags & AUDIOCHANNELFLAG_4000);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// if (channel->unk28 != 11) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
// if (!sndIsPlayingMp3()) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
// propDecrementSoundCount(channel->prop);
|
||||
// }
|
||||
//
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) {
|
||||
// hudmsgsHideByChannel(channelnum);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
// } else if (channel->audiohandle == NULL) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
// propDecrementSoundCount(channel->prop);
|
||||
// }
|
||||
//
|
||||
// channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
// }
|
||||
// }
|
||||
//#else
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
// if (!sndIsPlayingMp3()) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
// propDecrementSoundCount(channel->prop);
|
||||
// }
|
||||
//
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) {
|
||||
// hudmsgsHideByChannel(channelnum);
|
||||
// }
|
||||
// }
|
||||
// } else if (channel->audiohandle == NULL) {
|
||||
// if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
// propDecrementSoundCount(channel->prop);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
//#endif
|
||||
// }
|
||||
//
|
||||
// if (var8006ae44 && (channel->flags2 & AUDIOCHANNELFLAG2_0004)) {
|
||||
// propsndPrintChannel(channel);
|
||||
// }
|
||||
//
|
||||
//#if VERSION >= VERSION_NTSC_1_0
|
||||
// channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
//#endif
|
||||
// channel->flags &= ~AUDIOCHANNELFLAG_4000;
|
||||
//}
|
||||
void propsndTickChannel(s32 channelnum)
|
||||
{
|
||||
struct audiochannel *channel = &g_AudioChannels[channelnum];
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if ((channel->flags2 & AUDIOCHANNELFLAG2_0080) == 0
|
||||
&& channel->unk28 != 11
|
||||
&& ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_0002)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_1000)
|
||||
|| ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3())))
|
||||
#else
|
||||
if ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_0002)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_1000)
|
||||
|| ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3()))
|
||||
#endif
|
||||
{
|
||||
struct coord *pos = NULL; // 50
|
||||
s16 *rooms = NULL; // 4c
|
||||
s32 sp48;
|
||||
s32 sp44;
|
||||
s32 sp40;
|
||||
f32 sp3c;
|
||||
|
||||
if (channel->prop) {
|
||||
pos = &channel->prop->pos;
|
||||
rooms = channel->prop->rooms;
|
||||
} else if (channel->rooms[0] != -1) {
|
||||
rooms = channel->rooms;
|
||||
}
|
||||
|
||||
if (channel->posptr != NULL) {
|
||||
pos = channel->posptr;
|
||||
}
|
||||
|
||||
if (1);
|
||||
|
||||
if (g_Vars.langfilteron && (channel->flags2 & AUDIOCHANNELFLAG2_OFFENSIVE)) {
|
||||
channel->unk04 = 0;
|
||||
} else if (channel->flags2 & AUDIOCHANNELFLAG2_0010) {
|
||||
if ((channel->flags & AUDIOCHANNELFLAG_1000) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
channel->unk04 = channel->unk10;
|
||||
} else {
|
||||
if (pos && rooms) {
|
||||
s16 *tmprooms;
|
||||
|
||||
if (channel->flags & AUDIOCHANNELFLAG_8000) {
|
||||
tmprooms = NULL;
|
||||
} else {
|
||||
tmprooms = rooms;
|
||||
}
|
||||
|
||||
var8006ae50 = channel->unk2c;
|
||||
|
||||
channel->unk04 = propsnd0f0946b0(pos, channel->unk34, channel->unk38, channel->unk3c,
|
||||
tmprooms, channel->soundnum26, channel->unk10, &channel->unk4c);
|
||||
}
|
||||
|
||||
if ((channel->flags & AUDIOCHANNELFLAG_0020) == 0) {
|
||||
channel->unk0a = propsnd0f094d78(pos, channel->unk34, channel->unk38, channel->unk3c,
|
||||
channel->unk4c, channel->flags & AUDIOCHANNELFLAG_0800, channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (rooms != NULL && rooms[0] != -1) {
|
||||
channel->unk0c = 0;
|
||||
channel->unk1a = 1;
|
||||
} else {
|
||||
channel->unk0c = 0;
|
||||
channel->unk1a = 1;
|
||||
}
|
||||
|
||||
if (channel->audiohandle != NULL && channel->unk44 > 0.0f) {
|
||||
if (channel->unk48 < 0.0f) {
|
||||
sp3c = channel->unk44;
|
||||
} else if (channel->unk20 > 0.0f) {
|
||||
sp3c = channel->unk48 + (channel->unk44 - channel->unk48) * g_Vars.lvupdate240 / channel->unk20;
|
||||
} else {
|
||||
sp3c = channel->unk44;
|
||||
}
|
||||
} else {
|
||||
sp3c = -1.0f;
|
||||
}
|
||||
|
||||
sp44 = channel->unk0a;
|
||||
sp48 = channel->unk06;
|
||||
sp40 = channel->unk0c;
|
||||
|
||||
if (channel->unk06 == -1) {
|
||||
sp48 = channel->unk04;
|
||||
} else if (channel->unk1c >= 0) {
|
||||
if (channel->unk1c > g_Vars.lvupdate240_60) {
|
||||
sp48 = channel->unk06 + (channel->unk04 - channel->unk06) * g_Vars.lvupdate240_60 / channel->unk1c;
|
||||
}
|
||||
|
||||
channel->unk1c -= g_Vars.lvupdate240_60;
|
||||
} else if (channel->unk18 && channel->unk06 != channel->unk04) {
|
||||
f32 f12 = channel->unk04 - channel->unk06;
|
||||
#if VERSION >= VERSION_PAL_BETA
|
||||
f32 f14 = g_Vars.lvupdate240freal * (1.0f / 6000.0f) * channel->unk18;
|
||||
#else
|
||||
f32 f14 = g_Vars.lvupdate240_60 * (1.0f / 6000.0f) * channel->unk18;
|
||||
#endif
|
||||
|
||||
if (ABS(f12) > 1.0f) {
|
||||
if (f14 > 1.0f) {
|
||||
f14 = 1.0f;
|
||||
}
|
||||
|
||||
if (ABS(f14 * f12) > 1.0f) {
|
||||
sp48 = channel->unk06 + (s32) (f14 * f12);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sp48 = channel->unk04;
|
||||
}
|
||||
|
||||
if (lvIsPaused()
|
||||
|| (mpIsPaused() && (channel->flags2 & AUDIOCHANNELFLAG2_0002))
|
||||
|| (mpIsPaused() && PLAYERCOUNT() == 1)) {
|
||||
channel->unk06 = -1;
|
||||
sp48 = 0;
|
||||
}
|
||||
|
||||
if (sp48 != channel->unk06) {
|
||||
channel->unk06 = sp48;
|
||||
} else {
|
||||
sp48 = -1;
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (channel->unk0a != channel->unk08) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_1000) {
|
||||
channel->unk08 = channel->unk0a;
|
||||
sp44 = channel->unk08;
|
||||
} else {
|
||||
s32 diff = channel->unk0a - channel->unk08;
|
||||
s32 lvupdate = g_Vars.lvupdate240 * 512 / 240;
|
||||
s32 dir = diff < 0 ? -1 : 1;
|
||||
s32 absdiff = ABS(diff);
|
||||
s32 amount = absdiff < lvupdate ? absdiff : lvupdate;
|
||||
|
||||
channel->unk08 += amount * dir;
|
||||
sp44 = channel->unk08;
|
||||
}
|
||||
|
||||
channel->flags |= AUDIOCHANNELFLAG_4000;
|
||||
} else {
|
||||
sp44 = -1;
|
||||
}
|
||||
#else
|
||||
if (sp44 != channel->unk08) {
|
||||
channel->flags |= AUDIOCHANNELFLAG_4000;
|
||||
channel->unk08 = sp44;
|
||||
} else {
|
||||
sp44 = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sp40 != channel->unk0e) {
|
||||
channel->unk0e = sp40;
|
||||
} else {
|
||||
sp40 = -1;
|
||||
}
|
||||
|
||||
if (sp3c > 0.0f && ABS(sp3c - channel->unk48) > 0.01f) {
|
||||
channel->unk48 = sp3c;
|
||||
} else {
|
||||
sp3c = -1.0f;
|
||||
}
|
||||
|
||||
if (channel->flags & AUDIOCHANNELFLAG_0002) {
|
||||
if (channel->unk06 > 0) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_2000) {
|
||||
channel->flags &= ~AUDIOCHANNELFLAG_2000;
|
||||
channel->flags |= AUDIOCHANNELFLAG_1000;
|
||||
}
|
||||
} else {
|
||||
if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) {
|
||||
if (channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED) {
|
||||
audioStop(channel->audiohandle);
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
channel->audiohandle = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
channel->flags |= AUDIOCHANNELFLAG_2000;
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_1000) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
sndStartMp3(channel->soundnum26, sp48, sp44, (channel->flags2 & AUDIOCHANNELFLAG2_0001) ? 1 : 0);
|
||||
} else {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (channel->flags & AUDIOCHANNELFLAG_0400) {
|
||||
if (sp48) {
|
||||
snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
}
|
||||
} else {
|
||||
if (sp48) {
|
||||
snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
} else {
|
||||
sndAdjust(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, channel->flags & AUDIOCHANNELFLAG_4000);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (channel->unk28 != 11) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
if (!sndIsPlayingMp3()) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) {
|
||||
hudmsgsHideByChannel(channelnum);
|
||||
}
|
||||
}
|
||||
|
||||
channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
} else if (channel->audiohandle == NULL) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
|
||||
channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
if (!sndIsPlayingMp3()) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) {
|
||||
hudmsgsHideByChannel(channelnum);
|
||||
}
|
||||
}
|
||||
} else if (channel->audiohandle == NULL) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
}
|
||||
|
||||
channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (var8006ae44 && (channel->flags2 & AUDIOCHANNELFLAG2_0004)) {
|
||||
propsndPrintChannel(channel);
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
#endif
|
||||
channel->flags &= ~AUDIOCHANNELFLAG_4000;
|
||||
}
|
||||
#endif
|
||||
|
||||
void propsndTick(void)
|
||||
{
|
||||
|
||||
+147
-145
@@ -1147,6 +1147,7 @@ Gfx *sightDrawSkedar(Gfx *gdl, bool sighton)
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel sightDrawZoom
|
||||
.late_rodata
|
||||
@@ -3251,152 +3252,153 @@ glabel var7f1ade54
|
||||
/* f0dc168: 03e00008 */ jr $ra
|
||||
/* f0dc16c: 00000000 */ nop
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Goal loads 1.0f into $at earlier
|
||||
//Gfx *sightDrawZoom(Gfx *gdl, bool sighton)
|
||||
//{
|
||||
// s32 viewleft; // fc
|
||||
// s32 viewtop; // f8
|
||||
// s32 halfwidth; // f4
|
||||
// s32 halfheight; // f0
|
||||
// s32 viewright;
|
||||
// s32 viewbottom; // e8
|
||||
// f32 maxfovy;
|
||||
// s32 availableabove; // e0
|
||||
// s32 availablebelow; // dc
|
||||
// s32 availableleft;
|
||||
// s32 availableright;
|
||||
// f32 zoominfovy;
|
||||
// f32 frac; // cc
|
||||
//
|
||||
// f32 boxright; // 50
|
||||
// f32 boxtop; // 4c
|
||||
// f32 boxbottom; // 48
|
||||
// f32 boxleft;
|
||||
//
|
||||
// s32 outerwidth;
|
||||
// s32 outerheight; // b4
|
||||
// s32 weaponnum; // b0
|
||||
// u8 showzoomrange; // af
|
||||
//
|
||||
// s32 innerwidth;
|
||||
// s32 innerheight;
|
||||
//
|
||||
// viewleft = viGetViewLeft() / g_ScaleX;
|
||||
// viewtop = viGetViewTop();
|
||||
// halfwidth = (viGetViewWidth() / g_ScaleX) >> 1;
|
||||
// halfheight = viGetViewHeight() >> 1;
|
||||
// viewright = viewleft + halfwidth * 2 - 1;
|
||||
// viewbottom = viewtop + halfheight * 2 - 1;
|
||||
//
|
||||
// availableleft = halfwidth - 48;
|
||||
// availableright = halfwidth - 49;
|
||||
// availableabove = halfheight - 10;
|
||||
// availablebelow = halfheight - 10;
|
||||
// frac = 1.0f;
|
||||
// weaponnum = g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum;
|
||||
// outerwidth = (halfwidth >> 1) - 60;
|
||||
// outerheight = (halfheight >> 1) - 22;
|
||||
//
|
||||
// showzoomrange = optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex)
|
||||
// && optionsGetSightOnScreen(g_Vars.currentplayerstats->mpindex);
|
||||
//
|
||||
// maxfovy = currentPlayerGetGunZoomFov();
|
||||
// zoominfovy = g_Vars.currentplayer->zoominfovy;
|
||||
//
|
||||
// if (maxfovy == 0.0f || maxfovy == 60.0f) {
|
||||
// if (weaponnum != WEAPON_SNIPERRIFLE) {
|
||||
// showzoomrange = false;
|
||||
// }
|
||||
// } else {
|
||||
// frac = maxfovy / zoominfovy;
|
||||
// }
|
||||
//
|
||||
// if (showzoomrange) {
|
||||
// gdl = text0f153628(gdl);
|
||||
// gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
//
|
||||
// if (frac < 0.2f) {
|
||||
// outerwidth *= 0.2f;
|
||||
// outerheight *= 0.2f;
|
||||
// } else {
|
||||
// outerwidth *= frac;
|
||||
// outerheight *= frac;
|
||||
// }
|
||||
//
|
||||
// if (PLAYERCOUNT() >= 2) {
|
||||
// outerheight *= 2;
|
||||
// }
|
||||
//
|
||||
// if (outerwidth < 5) {
|
||||
// outerwidth = 5;
|
||||
// }
|
||||
//
|
||||
// if (outerheight < 5) {
|
||||
// outerheight = 5;
|
||||
// }
|
||||
//
|
||||
// // a600
|
||||
// boxtop = viewtop + (halfheight - availableabove * frac);
|
||||
// boxleft = viewleft + (halfwidth - availableleft * frac);
|
||||
// boxright = viewright - (halfwidth - availableright * frac);
|
||||
// boxbottom = viewbottom - (halfheight - availablebelow * frac);
|
||||
//
|
||||
// // Goal loads 1.0f into $at around here
|
||||
// // (The +1s in the GBI macros are floats)
|
||||
//
|
||||
// if (outerwidth > boxright - boxleft) {
|
||||
// outerwidth = boxright - boxleft;
|
||||
// }
|
||||
//
|
||||
// if (outerheight > boxbottom - boxtop) {
|
||||
// outerheight = boxbottom - boxtop;
|
||||
// }
|
||||
//
|
||||
// // a72c
|
||||
// // Top left outer
|
||||
// gDPFillRectangleScaled(gdl++, boxleft + 1, boxtop, boxleft + outerwidth - 1 + 1, boxtop + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + outerheight - 1 + 1);
|
||||
//
|
||||
// // Top right outer
|
||||
// gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxtop, boxright - 1 + 1, boxtop + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + outerheight - 1 + 1);
|
||||
//
|
||||
// // Bottom left outer
|
||||
// gDPFillRectangleScaled(gdl++, boxleft + 1, boxbottom, boxleft + outerwidth - 1 + 1, boxbottom + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxleft, boxbottom - outerheight + 1, boxleft + 1, boxbottom + 1);
|
||||
//
|
||||
// // Bottom right outer
|
||||
// gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxbottom, boxright - 1 + 1, boxbottom + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxright, boxbottom - outerheight + 1, boxright + 1, boxbottom + 1);
|
||||
//
|
||||
// innerwidth = outerwidth >> 1;
|
||||
// innerheight = outerheight >> 1;
|
||||
//
|
||||
// // Top left inner
|
||||
// gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + innerwidth + 1, boxtop + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + innerheight + 1);
|
||||
//
|
||||
// // Top right inner
|
||||
// gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxtop, boxright + 1, boxtop + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + innerheight + 1);
|
||||
//
|
||||
// // Bottom left inner
|
||||
// gDPFillRectangleScaled(gdl++, boxleft, boxbottom, boxleft + innerwidth + 1, boxbottom + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxleft, boxbottom - innerheight, boxleft + 1, boxbottom + 1);
|
||||
//
|
||||
// // Bottom right inner
|
||||
// gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxbottom, boxright + 1, boxbottom + 1);
|
||||
// gDPFillRectangleScaled(gdl++, boxright, boxbottom - innerheight, boxright + 1, boxbottom + 1);
|
||||
//
|
||||
// gdl = text0f153838(gdl);
|
||||
// gdl = text0f153780(gdl);
|
||||
// }
|
||||
//
|
||||
// gdl = sightDrawDefault(gdl, sighton);
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *sightDrawZoom(Gfx *gdl, bool sighton)
|
||||
{
|
||||
s32 viewleft; // fc
|
||||
s32 viewtop; // f8
|
||||
s32 halfwidth; // f4
|
||||
s32 halfheight; // f0
|
||||
s32 viewright;
|
||||
s32 viewbottom; // e8
|
||||
f32 maxfovy;
|
||||
s32 availableabove; // e0
|
||||
s32 availablebelow; // dc
|
||||
s32 availableleft;
|
||||
s32 availableright;
|
||||
f32 zoominfovy;
|
||||
f32 frac; // cc
|
||||
|
||||
f32 boxright; // 50
|
||||
f32 boxtop; // 4c
|
||||
f32 boxbottom; // 48
|
||||
f32 boxleft;
|
||||
|
||||
s32 outerwidth;
|
||||
s32 outerheight; // b4
|
||||
s32 weaponnum; // b0
|
||||
u8 showzoomrange; // af
|
||||
|
||||
s32 innerwidth;
|
||||
s32 innerheight;
|
||||
|
||||
viewleft = viGetViewLeft() / g_ScaleX;
|
||||
viewtop = viGetViewTop();
|
||||
halfwidth = (viGetViewWidth() / g_ScaleX) >> 1;
|
||||
halfheight = viGetViewHeight() >> 1;
|
||||
viewright = viewleft + halfwidth * 2 - 1;
|
||||
viewbottom = viewtop + halfheight * 2 - 1;
|
||||
|
||||
availableleft = halfwidth - 48;
|
||||
availableright = halfwidth - 49;
|
||||
availableabove = halfheight - 10;
|
||||
availablebelow = halfheight - 10;
|
||||
frac = 1.0f;
|
||||
weaponnum = g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum;
|
||||
outerwidth = (halfwidth >> 1) - 60;
|
||||
outerheight = (halfheight >> 1) - 22;
|
||||
|
||||
showzoomrange = optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex)
|
||||
&& optionsGetSightOnScreen(g_Vars.currentplayerstats->mpindex);
|
||||
|
||||
maxfovy = currentPlayerGetGunZoomFov();
|
||||
zoominfovy = g_Vars.currentplayer->zoominfovy;
|
||||
|
||||
if (maxfovy == 0.0f || maxfovy == 60.0f) {
|
||||
if (weaponnum != WEAPON_SNIPERRIFLE) {
|
||||
showzoomrange = false;
|
||||
}
|
||||
} else {
|
||||
frac = maxfovy / zoominfovy;
|
||||
}
|
||||
|
||||
if (showzoomrange) {
|
||||
gdl = text0f153628(gdl);
|
||||
gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
|
||||
if (frac < 0.2f) {
|
||||
outerwidth *= 0.2f;
|
||||
outerheight *= 0.2f;
|
||||
} else {
|
||||
outerwidth *= frac;
|
||||
outerheight *= frac;
|
||||
}
|
||||
|
||||
if (PLAYERCOUNT() >= 2) {
|
||||
outerheight *= 2;
|
||||
}
|
||||
|
||||
if (outerwidth < 5) {
|
||||
outerwidth = 5;
|
||||
}
|
||||
|
||||
if (outerheight < 5) {
|
||||
outerheight = 5;
|
||||
}
|
||||
|
||||
// a600
|
||||
boxtop = viewtop + (halfheight - availableabove * frac);
|
||||
boxleft = viewleft + (halfwidth - availableleft * frac);
|
||||
boxright = viewright - (halfwidth - availableright * frac);
|
||||
boxbottom = viewbottom - (halfheight - availablebelow * frac);
|
||||
|
||||
// Goal loads 1.0f into $at around here
|
||||
// (The +1s in the GBI macros are floats)
|
||||
|
||||
if (outerwidth > boxright - boxleft) {
|
||||
outerwidth = boxright - boxleft;
|
||||
}
|
||||
|
||||
if (outerheight > boxbottom - boxtop) {
|
||||
outerheight = boxbottom - boxtop;
|
||||
}
|
||||
|
||||
// a72c
|
||||
// Top left outer
|
||||
gDPFillRectangleScaled(gdl++, boxleft + 1, boxtop, boxleft + outerwidth - 1 + 1, boxtop + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + outerheight - 1 + 1);
|
||||
|
||||
// Top right outer
|
||||
gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxtop, boxright - 1 + 1, boxtop + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + outerheight - 1 + 1);
|
||||
|
||||
// Bottom left outer
|
||||
gDPFillRectangleScaled(gdl++, boxleft + 1, boxbottom, boxleft + outerwidth - 1 + 1, boxbottom + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxleft, boxbottom - outerheight + 1, boxleft + 1, boxbottom + 1);
|
||||
|
||||
// Bottom right outer
|
||||
gDPFillRectangleScaled(gdl++, boxright - outerwidth + 2, boxbottom, boxright - 1 + 1, boxbottom + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxright, boxbottom - outerheight + 1, boxright + 1, boxbottom + 1);
|
||||
|
||||
innerwidth = outerwidth >> 1;
|
||||
innerheight = outerheight >> 1;
|
||||
|
||||
// Top left inner
|
||||
gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + innerwidth + 1, boxtop + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxleft, boxtop, boxleft + 1, boxtop + innerheight + 1);
|
||||
|
||||
// Top right inner
|
||||
gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxtop, boxright + 1, boxtop + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxright, boxtop, boxright + 1, boxtop + innerheight + 1);
|
||||
|
||||
// Bottom left inner
|
||||
gDPFillRectangleScaled(gdl++, boxleft, boxbottom, boxleft + innerwidth + 1, boxbottom + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxleft, boxbottom - innerheight, boxleft + 1, boxbottom + 1);
|
||||
|
||||
// Bottom right inner
|
||||
gDPFillRectangleScaled(gdl++, boxright - innerwidth, boxbottom, boxright + 1, boxbottom + 1);
|
||||
gDPFillRectangleScaled(gdl++, boxright, boxbottom - innerheight, boxright + 1, boxbottom + 1);
|
||||
|
||||
gdl = text0f153838(gdl);
|
||||
gdl = text0f153780(gdl);
|
||||
}
|
||||
|
||||
gdl = sightDrawDefault(gdl, sighton);
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *sightDrawMaian(Gfx *gdl, bool sighton)
|
||||
{
|
||||
|
||||
+145
-143
@@ -2606,6 +2606,7 @@ Gfx *skyRenderSuns(Gfx *gdl, bool xray)
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
GLOBAL_ASM(
|
||||
glabel sky0f126384
|
||||
@@ -4350,152 +4351,153 @@ glabel var7f1b511c
|
||||
/* f126c38: 27bd0190 */ addiu $sp,$sp,0x190
|
||||
);
|
||||
#endif
|
||||
|
||||
#else
|
||||
/**
|
||||
* Render a sun and its artifacts.
|
||||
*/
|
||||
//Gfx *sky0f126384(Gfx *gdl, f32 x, f32 y, f32 arg3, f32 size, s32 arg5, f32 arg6)
|
||||
//{
|
||||
// f32 fa;
|
||||
// f32 fb;
|
||||
// f32 fc;
|
||||
// f32 sp17c[2];
|
||||
// f32 sp174[2];
|
||||
// s32 sp15c[] = { 16, 32, 12, 32, 24, 64 }; // diameters?
|
||||
// s32 sp144[] = { 60, 80, 225, 275, 470, 570 }; // distances from the sun?
|
||||
//
|
||||
// u32 colours[] = { // 12c
|
||||
// 0xff99ffff, // pinkish/purple
|
||||
// 0x9999ffff, // blue
|
||||
// 0x99ffffff, // very light blue
|
||||
// 0x99ff99ff, // green
|
||||
// 0xffff99ff, // yellow
|
||||
// 0xff9999ff, // red
|
||||
// };
|
||||
//
|
||||
// f32 sp128;
|
||||
// f32 sp124;
|
||||
// s32 scale;
|
||||
// s32 i;
|
||||
// f32 f2;
|
||||
// f32 f12;
|
||||
// f32 f20;
|
||||
// f32 f0;
|
||||
//
|
||||
// scale = 1;
|
||||
//
|
||||
// if (g_ViRes == VIRES_HI) {
|
||||
// scale = 2;
|
||||
// }
|
||||
//
|
||||
// sp128 = (x - viGetViewWidth() * 0.5f) * 0.01f;
|
||||
// sp124 = (y - viGetViewHeight() * 0.5f) * 0.01f;
|
||||
//
|
||||
// // Render the sun
|
||||
// texSelect(&gdl, &g_TexLightGlareConfigs[6], 4, 0, 2, 1, NULL);
|
||||
//
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetColorDither(gdl++, G_CD_BAYER);
|
||||
// gDPSetAlphaDither(gdl++, G_AD_PATTERN);
|
||||
// gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
// gDPSetTexturePersp(gdl++, G_TP_NONE);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
// gDPSetTextureConvert(gdl++, G_TC_FILT);
|
||||
// gDPSetTextureLUT(gdl++, G_TT_NONE);
|
||||
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
// gDPSetCombineLERP(gdl++,
|
||||
// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0,
|
||||
// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0);
|
||||
//
|
||||
// fa = (size * (0.5f + 0.5f * arg3) * (60.0f / viGetFovY()));
|
||||
//
|
||||
// gDPSetEnvColor(gdl++, 0xff, 0xff, 0xff, (s32)(arg6 * arg3 * 255.0f));
|
||||
//
|
||||
// sp17c[0] = x;
|
||||
// sp17c[1] = y;
|
||||
// sp174[1] = fa;
|
||||
// sp174[0] = fa * scale;
|
||||
//
|
||||
// func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[6].width, g_TexLightGlareConfigs[6].height, 0, 1, 1, 1, 0, 1);
|
||||
//
|
||||
// // Render the artifacts
|
||||
// texSelect(&gdl, &g_TexLightGlareConfigs[1], 4, 0, 2, 1, NULL);
|
||||
//
|
||||
// gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
// gDPSetColorDither(gdl++, G_CD_BAYER);
|
||||
// gDPSetAlphaDither(gdl++, G_AD_PATTERN);
|
||||
// gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
// gDPSetTexturePersp(gdl++, G_TP_NONE);
|
||||
// gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
// gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
// gDPSetTextureConvert(gdl++, G_TC_FILT);
|
||||
// gDPSetTextureLUT(gdl++, G_TT_NONE);
|
||||
// gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
// gDPSetCombineLERP(gdl++,
|
||||
// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0,
|
||||
// 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0);
|
||||
//
|
||||
// for (i = 0; i < 6; i++) {
|
||||
// // 90c
|
||||
// if (arg5 < 90) {
|
||||
// if (arg5 < 30) {
|
||||
// f2 = arg5 * 0.033333335071802f;
|
||||
// } else {
|
||||
// f2 = 1.0f;
|
||||
// }
|
||||
// } else {
|
||||
// f2 = (180.0f - (arg5 - 90)) * 0.0055555556900799f * 0.5f;
|
||||
//
|
||||
// if (f2 < 0.0f) {
|
||||
// f2 = 0.0f;
|
||||
// }
|
||||
//
|
||||
// f2 += 0.5f;
|
||||
// }
|
||||
//
|
||||
// // 974
|
||||
// fb = x - sp144[i] * sp128;
|
||||
// fc = y - sp144[i] * sp124;
|
||||
// fa = sp15c[i] * 0.5f;
|
||||
//
|
||||
// gDPSetEnvColor(gdl++, colours[i] >> 24, (colours[i] >> 16) & 0xff, (colours[i] >> 8) & 0xff, (s32)((colours[i] & 0xff) * (arg6 * f2)));
|
||||
//
|
||||
// sp17c[0] = fb;
|
||||
// sp17c[1] = fc;
|
||||
//
|
||||
// sp174[1] = fa;
|
||||
// sp174[0] = fa * scale;
|
||||
//
|
||||
// func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[1].width, g_TexLightGlareConfigs[1].height, 0, 0, 0, 0, 0, 1);
|
||||
// }
|
||||
//
|
||||
// f20 = viGetViewWidth() * .5f - x;
|
||||
// f0 = viGetViewHeight() * .5f - y;
|
||||
//
|
||||
// f12 = (40.0f - sqrtf(f20 * f20 + f0 * f0)) * 0.0125f;
|
||||
//
|
||||
// if (f12 < 0.0f) {
|
||||
// f12 = 0.0f;
|
||||
// }
|
||||
//
|
||||
// f12 += 0.1f;
|
||||
//
|
||||
// if (arg5 <= g_Vars.lvupdate240) {
|
||||
// f12 = 0.0f;
|
||||
// }
|
||||
//
|
||||
// if (f12 > 0.0f) {
|
||||
// sky0f127334(arg6 * f12 * 255.0f, arg6 * f12 * 255.0f, arg6 * f12 * 255.0f);
|
||||
// }
|
||||
//
|
||||
// gDPSetColorDither(gdl++, G_CD_BAYER);
|
||||
// gDPSetAlphaDither(gdl++, G_AD_PATTERN | G_CD_DISABLE);
|
||||
// gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
// gDPSetTextureLOD(gdl++, G_TL_LOD);
|
||||
//
|
||||
// return gdl;
|
||||
//}
|
||||
Gfx *sky0f126384(Gfx *gdl, f32 x, f32 y, f32 arg3, f32 size, s32 arg5, f32 arg6)
|
||||
{
|
||||
f32 fa;
|
||||
f32 fb;
|
||||
f32 fc;
|
||||
f32 sp17c[2];
|
||||
f32 sp174[2];
|
||||
s32 sp15c[] = { 16, 32, 12, 32, 24, 64 }; // diameters?
|
||||
s32 sp144[] = { 60, 80, 225, 275, 470, 570 }; // distances from the sun?
|
||||
|
||||
u32 colours[] = { // 12c
|
||||
0xff99ffff, // pinkish/purple
|
||||
0x9999ffff, // blue
|
||||
0x99ffffff, // very light blue
|
||||
0x99ff99ff, // green
|
||||
0xffff99ff, // yellow
|
||||
0xff9999ff, // red
|
||||
};
|
||||
|
||||
f32 sp128;
|
||||
f32 sp124;
|
||||
s32 scale;
|
||||
s32 i;
|
||||
f32 f2;
|
||||
f32 f12;
|
||||
f32 f20;
|
||||
f32 f0;
|
||||
|
||||
scale = 1;
|
||||
|
||||
if (g_ViRes == VIRES_HI) {
|
||||
scale = 2;
|
||||
}
|
||||
|
||||
sp128 = (x - viGetViewWidth() * 0.5f) * 0.01f;
|
||||
sp124 = (y - viGetViewHeight() * 0.5f) * 0.01f;
|
||||
|
||||
// Render the sun
|
||||
texSelect(&gdl, &g_TexLightGlareConfigs[6], 4, 0, 2, 1, NULL);
|
||||
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetColorDither(gdl++, G_CD_BAYER);
|
||||
gDPSetAlphaDither(gdl++, G_AD_PATTERN);
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
gDPSetTexturePersp(gdl++, G_TP_NONE);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
gDPSetTextureConvert(gdl++, G_TC_FILT);
|
||||
gDPSetTextureLUT(gdl++, G_TT_NONE);
|
||||
gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
gDPSetCombineLERP(gdl++,
|
||||
0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0,
|
||||
0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0);
|
||||
|
||||
fa = (size * (0.5f + 0.5f * arg3) * (60.0f / viGetFovY()));
|
||||
|
||||
gDPSetEnvColor(gdl++, 0xff, 0xff, 0xff, (s32)(arg6 * arg3 * 255.0f));
|
||||
|
||||
sp17c[0] = x;
|
||||
sp17c[1] = y;
|
||||
sp174[1] = fa;
|
||||
sp174[0] = fa * scale;
|
||||
|
||||
func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[6].width, g_TexLightGlareConfigs[6].height, 0, 1, 1, 1, 0, 1);
|
||||
|
||||
// Render the artifacts
|
||||
texSelect(&gdl, &g_TexLightGlareConfigs[1], 4, 0, 2, 1, NULL);
|
||||
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
gDPSetColorDither(gdl++, G_CD_BAYER);
|
||||
gDPSetAlphaDither(gdl++, G_AD_PATTERN);
|
||||
gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
gDPSetTexturePersp(gdl++, G_TP_NONE);
|
||||
gDPSetAlphaCompare(gdl++, G_AC_NONE);
|
||||
gDPSetTextureLOD(gdl++, G_TL_TILE);
|
||||
gDPSetTextureConvert(gdl++, G_TC_FILT);
|
||||
gDPSetTextureLUT(gdl++, G_TT_NONE);
|
||||
gDPSetTextureFilter(gdl++, G_TF_BILERP);
|
||||
gDPSetCombineLERP(gdl++,
|
||||
0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0,
|
||||
0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
// 90c
|
||||
if (arg5 < 90) {
|
||||
if (arg5 < 30) {
|
||||
f2 = arg5 * 0.033333335071802f;
|
||||
} else {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
} else {
|
||||
f2 = (180.0f - (arg5 - 90)) * 0.0055555556900799f * 0.5f;
|
||||
|
||||
if (f2 < 0.0f) {
|
||||
f2 = 0.0f;
|
||||
}
|
||||
|
||||
f2 += 0.5f;
|
||||
}
|
||||
|
||||
// 974
|
||||
fb = x - sp144[i] * sp128;
|
||||
fc = y - sp144[i] * sp124;
|
||||
fa = sp15c[i] * 0.5f;
|
||||
|
||||
gDPSetEnvColor(gdl++, colours[i] >> 24, (colours[i] >> 16) & 0xff, (colours[i] >> 8) & 0xff, (s32)((colours[i] & 0xff) * (arg6 * f2)));
|
||||
|
||||
sp17c[0] = fb;
|
||||
sp17c[1] = fc;
|
||||
|
||||
sp174[1] = fa;
|
||||
sp174[0] = fa * scale;
|
||||
|
||||
func0f0b2150(&gdl, sp17c, sp174, g_TexLightGlareConfigs[1].width, g_TexLightGlareConfigs[1].height, 0, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
f20 = viGetViewWidth() * .5f - x;
|
||||
f0 = viGetViewHeight() * .5f - y;
|
||||
|
||||
f12 = (40.0f - sqrtf(f20 * f20 + f0 * f0)) * 0.0125f;
|
||||
|
||||
if (f12 < 0.0f) {
|
||||
f12 = 0.0f;
|
||||
}
|
||||
|
||||
f12 += 0.1f;
|
||||
|
||||
if (arg5 <= g_Vars.lvupdate240) {
|
||||
f12 = 0.0f;
|
||||
}
|
||||
|
||||
if (f12 > 0.0f) {
|
||||
sky0f127334(arg6 * f12 * 255.0f, arg6 * f12 * 255.0f, arg6 * f12 * 255.0f);
|
||||
}
|
||||
|
||||
gDPSetColorDither(gdl++, G_CD_BAYER);
|
||||
gDPSetAlphaDither(gdl++, G_AD_PATTERN | G_CD_DISABLE);
|
||||
gDPSetTexturePersp(gdl++, G_TP_PERSP);
|
||||
gDPSetTextureLOD(gdl++, G_TL_LOD);
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Render a sun and its artifacts if on screen.
|
||||
|
||||
+81
-79
@@ -6,6 +6,7 @@
|
||||
|
||||
const u32 var7f1a8680[] = {0xb8d1b717};
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel sparksTick
|
||||
/* f01e050: 27bdffe0 */ addiu $sp,$sp,-32
|
||||
@@ -148,83 +149,84 @@ glabel sparksTick
|
||||
/* f01e244: 03e00008 */ jr $ra
|
||||
/* f01e248: 27bd0020 */ addiu $sp,$sp,0x20
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch due to regalloc near group->startindex
|
||||
//void sparksTick(void)
|
||||
//{
|
||||
// struct sparkgroup *group;
|
||||
// struct sparktype *type;
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
// s32 k;
|
||||
//
|
||||
// // 074
|
||||
// if (g_SparksAreActive) {
|
||||
// g_SparksAreActive = false;
|
||||
// group = &g_SparkGroups[0];
|
||||
//
|
||||
// // Iterate spark groups
|
||||
// for (i = 0; i != 10; i++) {
|
||||
// type = &g_SparkTypes[group->type];
|
||||
//
|
||||
// // 0e8
|
||||
// if (group->age >= type->maxage) {
|
||||
// group->age = 0;
|
||||
// } else /*0f8*/ if (group->age) {
|
||||
// // 10c
|
||||
// if (g_SparksAreActive == false) {
|
||||
// g_SparksAreActive = true;
|
||||
// }
|
||||
//
|
||||
// // 118
|
||||
// // Iterate the lvupdate multiplier
|
||||
// for (j = 0; j < g_Vars.lvupdate240_60; j++) {
|
||||
// // 120
|
||||
// struct spark *spark = &g_Sparks[group->startindex];
|
||||
// struct spark *next = &g_Sparks[group->startindex];
|
||||
// group->age++;
|
||||
//
|
||||
// // 144
|
||||
// // Iterate sparks in this group
|
||||
// for (k = 0; k < group->numsparks; k++) {
|
||||
// // 14c
|
||||
// // Update this spark if active
|
||||
// if (spark->ttl) {
|
||||
// spark->speed.x -= spark->speed.x * type->decel;
|
||||
// spark->speed.y = (spark->speed.y - spark->speed.y * type->decel) - type->weight;
|
||||
// spark->speed.z -= spark->speed.z * type->decel;
|
||||
//
|
||||
// if (spark->speed.y == 0) {
|
||||
// spark->speed.y = -0.0001f;
|
||||
// }
|
||||
//
|
||||
// spark->pos.x += spark->speed.x;
|
||||
// spark->pos.y += spark->speed.y;
|
||||
// spark->pos.z += spark->speed.z;
|
||||
//
|
||||
// spark->ttl--;
|
||||
// }
|
||||
//
|
||||
// // 1f4
|
||||
// // If reached the end of the array, jump back to start
|
||||
// if (++next == &g_Sparks[100]) {
|
||||
// // @dangerous: `next` is not reset here, so this
|
||||
// // condition will only pass once per group.
|
||||
// // If a group contains more than 100 sparks, it
|
||||
// // could cause spark to overflow the array and write
|
||||
// // over whatever's after it.
|
||||
// spark = &g_Sparks[0];
|
||||
// } else {
|
||||
// spark++;
|
||||
// }
|
||||
//
|
||||
// // 208
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 224
|
||||
// group++;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void sparksTick(void)
|
||||
{
|
||||
struct sparkgroup *group;
|
||||
struct sparktype *type;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 k;
|
||||
|
||||
// 074
|
||||
if (g_SparksAreActive) {
|
||||
g_SparksAreActive = false;
|
||||
group = &g_SparkGroups[0];
|
||||
|
||||
// Iterate spark groups
|
||||
for (i = 0; i != 10; i++) {
|
||||
type = &g_SparkTypes[group->type];
|
||||
|
||||
// 0e8
|
||||
if (group->age >= type->maxage) {
|
||||
group->age = 0;
|
||||
} else /*0f8*/ if (group->age) {
|
||||
// 10c
|
||||
if (g_SparksAreActive == false) {
|
||||
g_SparksAreActive = true;
|
||||
}
|
||||
|
||||
// 118
|
||||
// Iterate the lvupdate multiplier
|
||||
for (j = 0; j < g_Vars.lvupdate240_60; j++) {
|
||||
// 120
|
||||
struct spark *spark = &g_Sparks[group->startindex];
|
||||
struct spark *next = &g_Sparks[group->startindex];
|
||||
group->age++;
|
||||
|
||||
// 144
|
||||
// Iterate sparks in this group
|
||||
for (k = 0; k < group->numsparks; k++) {
|
||||
// 14c
|
||||
// Update this spark if active
|
||||
if (spark->ttl) {
|
||||
spark->speed.x -= spark->speed.x * type->decel;
|
||||
spark->speed.y = (spark->speed.y - spark->speed.y * type->decel) - type->weight;
|
||||
spark->speed.z -= spark->speed.z * type->decel;
|
||||
|
||||
if (spark->speed.y == 0) {
|
||||
spark->speed.y = -0.0001f;
|
||||
}
|
||||
|
||||
spark->pos.x += spark->speed.x;
|
||||
spark->pos.y += spark->speed.y;
|
||||
spark->pos.z += spark->speed.z;
|
||||
|
||||
spark->ttl--;
|
||||
}
|
||||
|
||||
// 1f4
|
||||
// If reached the end of the array, jump back to start
|
||||
if (++next == &g_Sparks[100]) {
|
||||
// @dangerous: `next` is not reset here, so this
|
||||
// condition will only pass once per group.
|
||||
// If a group contains more than 100 sparks, it
|
||||
// could cause spark to overflow the array and write
|
||||
// over whatever's after it.
|
||||
spark = &g_Sparks[0];
|
||||
} else {
|
||||
spark++;
|
||||
}
|
||||
|
||||
// 208
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 224
|
||||
group++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+117
-115
@@ -92,6 +92,7 @@ void starInsert(s32 index, struct coord *arg1)
|
||||
}
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel starsReset
|
||||
/* f1360e8: 27bdff18 */ addiu $sp,$sp,-232
|
||||
@@ -631,123 +632,124 @@ glabel starsReset
|
||||
/* f136874: 03e00008 */ jr $ra
|
||||
/* f136878: 27bd00e8 */ addiu $sp,$sp,0xe8
|
||||
);
|
||||
|
||||
#else
|
||||
#define ABS2(value) ((value) < 0 ? -(value) : (value))
|
||||
|
||||
//void starsReset(void)
|
||||
//{
|
||||
// struct coord spd4;
|
||||
// struct coord spc8;
|
||||
// f32 spbc[2];
|
||||
// s32 spb0;
|
||||
// f32 f12;
|
||||
// f32 f0;
|
||||
// f32 f2;
|
||||
// s32 v0;
|
||||
// s32 v1;
|
||||
// s32 i;
|
||||
// s32 tmp;
|
||||
//
|
||||
// g_StarPositions = NULL;
|
||||
//
|
||||
// if (PLAYERCOUNT() < 2) {
|
||||
// g_StarsBelowHorizon = false;
|
||||
// g_StarGridSize = 3;
|
||||
//
|
||||
// if (g_Vars.stagenum == STAGE_TEST_OLD) {
|
||||
// g_StarsBelowHorizon = true;
|
||||
// g_StarCount = 1600;
|
||||
// } else if (g_Vars.stagenum == STAGE_DEFECTION || g_Vars.stagenum == STAGE_EXTRACTION) {
|
||||
// g_StarCount = 200;
|
||||
// g_StarGridSize = 2;
|
||||
// } else if (g_Vars.stagenum == STAGE_ATTACKSHIP) {
|
||||
// g_StarsBelowHorizon = true;
|
||||
// g_StarCount = 1200;
|
||||
// } else {
|
||||
// g_StarCount = 200;
|
||||
// g_StarGridSize = 2;
|
||||
// }
|
||||
//
|
||||
// tmp = g_StarGridSize + 1;
|
||||
// g_StarPositions = mempAlloc(ALIGN64(g_StarCount * 3 + tmp * 72 * tmp + g_StarGridSize * 6 * g_StarGridSize * 4 + 4), MEMPOOL_STAGE);
|
||||
//
|
||||
// if (g_StarPositions != NULL) {
|
||||
// s32 tmp;
|
||||
// g_StarPosIndexes = (s32 *)(g_StarPositions + g_StarCount * 3);
|
||||
//
|
||||
// for (i = 0; i < (g_StarGridSize * 6 * g_StarGridSize + 1); i++) {
|
||||
// g_StarPosIndexes[i] = 0;
|
||||
// }
|
||||
//
|
||||
// g_StarData3 = (f32 *)((u32)g_StarPosIndexes + (g_StarGridSize * 6 * g_StarGridSize + 1) * sizeof(f32));
|
||||
//
|
||||
// stars0f135c70();
|
||||
//
|
||||
// for (i = 0; i < g_StarCount; i++) {
|
||||
// spd4.f[0] = 2.0f * RANDOMFRAC() - 1.0f;
|
||||
//
|
||||
// if (g_StarsBelowHorizon) {
|
||||
// spd4.f[1] = 2.0f * RANDOMFRAC() - 1.0f;
|
||||
// } else {
|
||||
// spd4.f[1] = RANDOMFRAC();
|
||||
// }
|
||||
//
|
||||
// spd4.f[2] = 2.0f * RANDOMFRAC() - 1.0f;
|
||||
//
|
||||
// guNormalize(&spd4.f[0], &spd4.f[1], &spd4.f[2]);
|
||||
//
|
||||
// if (ABS2(spd4.f[1]) < ABS2(spd4.f[0])) {
|
||||
// f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[0]) ? ABS2(spd4.f[0]) : ABS2(spd4.f[2]);
|
||||
// } else {
|
||||
// f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[1]) ? ABS2(spd4.f[1]) : ABS2(spd4.f[2]);
|
||||
// }
|
||||
//
|
||||
// // 5e0
|
||||
// tmp = g_StarGridSize * g_StarGridSize;
|
||||
//
|
||||
// spc8.f[0] = spd4.f[0] / f0;
|
||||
// spc8.f[1] = spd4.f[1] / f0;
|
||||
// spc8.f[2] = spd4.f[2] / f0;
|
||||
//
|
||||
// if (spc8.f[0] == 1.0f || spc8.f[0] == -1.0f) {
|
||||
// spb0 = spc8.f[0] == -1.0f ? 0 : 1;
|
||||
// spbc[0] = spc8.f[2];
|
||||
// spbc[1] = spc8.f[1];
|
||||
// f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
// f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
// } else if (spc8.f[1] == 1.0f || spc8.f[1] == -1.0f) {
|
||||
// spb0 = spc8.f[1] == -1.0f ? 2 : 3;
|
||||
// spbc[0] = spc8.f[0];
|
||||
// spbc[1] = spc8.f[2];
|
||||
// f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
// f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
// } else if (spc8.f[2] == 1.0f || spc8.f[2] == -1.0f) {
|
||||
// spb0 = spc8.f[2] == -1.0f ? 4 : 5;
|
||||
// spbc[0] = spc8.f[1];
|
||||
// spbc[1] = spc8.f[0];
|
||||
// f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
// f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
// } else{
|
||||
// f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
// f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
// }
|
||||
//
|
||||
// v0 = f2 * g_StarGridSize;
|
||||
// v1 = f12 * g_StarGridSize;
|
||||
//
|
||||
// if (v0 == g_StarGridSize) {
|
||||
// v0--;
|
||||
// }
|
||||
//
|
||||
// if (v1 == g_StarGridSize) {
|
||||
// v1--;
|
||||
// }
|
||||
//
|
||||
// starInsert(spb0 * tmp + (g_StarGridSize * v1) + v0, spd4.f);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void starsReset(void)
|
||||
{
|
||||
struct coord spd4;
|
||||
struct coord spc8;
|
||||
f32 spbc[2];
|
||||
s32 spb0;
|
||||
f32 f12;
|
||||
f32 f0;
|
||||
f32 f2;
|
||||
s32 v0;
|
||||
s32 v1;
|
||||
s32 i;
|
||||
s32 tmp;
|
||||
|
||||
g_StarPositions = NULL;
|
||||
|
||||
if (PLAYERCOUNT() < 2) {
|
||||
g_StarsBelowHorizon = false;
|
||||
g_StarGridSize = 3;
|
||||
|
||||
if (g_Vars.stagenum == STAGE_TEST_OLD) {
|
||||
g_StarsBelowHorizon = true;
|
||||
g_StarCount = 1600;
|
||||
} else if (g_Vars.stagenum == STAGE_DEFECTION || g_Vars.stagenum == STAGE_EXTRACTION) {
|
||||
g_StarCount = 200;
|
||||
g_StarGridSize = 2;
|
||||
} else if (g_Vars.stagenum == STAGE_ATTACKSHIP) {
|
||||
g_StarsBelowHorizon = true;
|
||||
g_StarCount = 1200;
|
||||
} else {
|
||||
g_StarCount = 200;
|
||||
g_StarGridSize = 2;
|
||||
}
|
||||
|
||||
tmp = g_StarGridSize + 1;
|
||||
g_StarPositions = mempAlloc(ALIGN64(g_StarCount * 3 + tmp * 72 * tmp + g_StarGridSize * 6 * g_StarGridSize * 4 + 4), MEMPOOL_STAGE);
|
||||
|
||||
if (g_StarPositions != NULL) {
|
||||
s32 tmp;
|
||||
g_StarPosIndexes = (s32 *)(g_StarPositions + g_StarCount * 3);
|
||||
|
||||
for (i = 0; i < (g_StarGridSize * 6 * g_StarGridSize + 1); i++) {
|
||||
g_StarPosIndexes[i] = 0;
|
||||
}
|
||||
|
||||
g_StarData3 = (f32 *)((u32)g_StarPosIndexes + (g_StarGridSize * 6 * g_StarGridSize + 1) * sizeof(f32));
|
||||
|
||||
stars0f135c70();
|
||||
|
||||
for (i = 0; i < g_StarCount; i++) {
|
||||
spd4.f[0] = 2.0f * RANDOMFRAC() - 1.0f;
|
||||
|
||||
if (g_StarsBelowHorizon) {
|
||||
spd4.f[1] = 2.0f * RANDOMFRAC() - 1.0f;
|
||||
} else {
|
||||
spd4.f[1] = RANDOMFRAC();
|
||||
}
|
||||
|
||||
spd4.f[2] = 2.0f * RANDOMFRAC() - 1.0f;
|
||||
|
||||
guNormalize(&spd4.f[0], &spd4.f[1], &spd4.f[2]);
|
||||
|
||||
if (ABS2(spd4.f[1]) < ABS2(spd4.f[0])) {
|
||||
f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[0]) ? ABS2(spd4.f[0]) : ABS2(spd4.f[2]);
|
||||
} else {
|
||||
f0 = ABS2(spd4.f[2]) < ABS2(spd4.f[1]) ? ABS2(spd4.f[1]) : ABS2(spd4.f[2]);
|
||||
}
|
||||
|
||||
// 5e0
|
||||
tmp = g_StarGridSize * g_StarGridSize;
|
||||
|
||||
spc8.f[0] = spd4.f[0] / f0;
|
||||
spc8.f[1] = spd4.f[1] / f0;
|
||||
spc8.f[2] = spd4.f[2] / f0;
|
||||
|
||||
if (spc8.f[0] == 1.0f || spc8.f[0] == -1.0f) {
|
||||
spb0 = spc8.f[0] == -1.0f ? 0 : 1;
|
||||
spbc[0] = spc8.f[2];
|
||||
spbc[1] = spc8.f[1];
|
||||
f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
} else if (spc8.f[1] == 1.0f || spc8.f[1] == -1.0f) {
|
||||
spb0 = spc8.f[1] == -1.0f ? 2 : 3;
|
||||
spbc[0] = spc8.f[0];
|
||||
spbc[1] = spc8.f[2];
|
||||
f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
} else if (spc8.f[2] == 1.0f || spc8.f[2] == -1.0f) {
|
||||
spb0 = spc8.f[2] == -1.0f ? 4 : 5;
|
||||
spbc[0] = spc8.f[1];
|
||||
spbc[1] = spc8.f[0];
|
||||
f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
} else{
|
||||
f12 = (spbc[0] + 1.0f) / 2.0f;
|
||||
f2 = (spbc[1] + 1.0f) / 2.0f;
|
||||
}
|
||||
|
||||
v0 = f2 * g_StarGridSize;
|
||||
v1 = f12 * g_StarGridSize;
|
||||
|
||||
if (v0 == g_StarGridSize) {
|
||||
v0--;
|
||||
}
|
||||
|
||||
if (v1 == g_StarGridSize) {
|
||||
v1--;
|
||||
}
|
||||
|
||||
starInsert(spb0 * tmp + (g_StarGridSize * v1) + v0, &spd4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *starsRender(Gfx *gdl)
|
||||
{
|
||||
|
||||
+341
-339
@@ -777,6 +777,7 @@ Gfx *tex0f17563c(Gfx *gdl, struct tex *tex, s32 arg2, s32 arg3, s32 arg4)
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel tex0f1756c0
|
||||
.late_rodata
|
||||
@@ -1386,346 +1387,347 @@ glabel jtbl_var7f1b7c70
|
||||
/* f175eec: 03e00008 */ jr $ra
|
||||
/* f175ef0: 27bd0138 */ addiu $sp,$sp,0x138
|
||||
);
|
||||
|
||||
#else
|
||||
// Mismatch: Extra move instruction in last half of G_VTX case
|
||||
//s32 tex0f1756c0(Gfx *arg0, s32 arg1, Gfx *arg2, struct texpool *arg3, u32 arg4)
|
||||
//{
|
||||
// struct tex *v0;
|
||||
// struct tex *v0_2;
|
||||
// Gfx *sp12c;
|
||||
// s32 sp128;
|
||||
// u32 tmp1;
|
||||
// u32 tmp2;
|
||||
// u32 tmp3;
|
||||
// u32 tmp4;
|
||||
// u32 tmp5;
|
||||
// u32 tmp6;
|
||||
// bool flag;
|
||||
// s32 j;
|
||||
// bool sp104;
|
||||
// u8 animated;
|
||||
// Gfx *s5;
|
||||
// Gfx *s6;
|
||||
// u32 spf4;
|
||||
// s32 texturenum;
|
||||
// s32 texturenum2;
|
||||
// bool spe8;
|
||||
// s32 spe4;
|
||||
// s32 spe0;
|
||||
// struct gfxvtx *spA0[16];
|
||||
// u8 sp90[16];
|
||||
//
|
||||
// s32 i;
|
||||
//
|
||||
// sp12c = NULL;
|
||||
// sp104 = true;
|
||||
// animated = false;
|
||||
// spe8 = false;
|
||||
// spe4 = false;
|
||||
// var800844d0 = false;
|
||||
// spf4 = 0;
|
||||
// s5 = arg0;
|
||||
// s6 = arg2;
|
||||
//
|
||||
// sp128 = arg1 >> 3;
|
||||
//
|
||||
// tex0f173a08();
|
||||
//
|
||||
// spe0 = dyntexHasRoom();
|
||||
//
|
||||
// if (spe0) {
|
||||
// for (j = 0; j < 16; j++) {
|
||||
// sp90[j] = 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (arg3 == NULL) {
|
||||
// arg3 = &g_TexSharedPool;
|
||||
// }
|
||||
//
|
||||
// while (sp128 > 0) {
|
||||
// switch (s5->texture.cmd) {
|
||||
// case 0xc0: // Repurposed?
|
||||
// spe4 = true;
|
||||
//
|
||||
// if (animated) {
|
||||
// spe8 = true;
|
||||
// }
|
||||
//
|
||||
// texturenum = s5->words.w1 & 0xfff;
|
||||
// flag = s5->words.w0 & 0x200;
|
||||
//
|
||||
// texLoadFromTextureNum(texturenum, arg3);
|
||||
//
|
||||
// v0 = texFindInPool(texturenum, arg3);
|
||||
//
|
||||
// if (v0 != NULL) {
|
||||
// spf4 = v0->unk0c_03;
|
||||
// } else {
|
||||
// spf4 = 0;
|
||||
// }
|
||||
//
|
||||
// if (v0 != NULL) {
|
||||
// s6 = tex0f1742e4(s6, sp12c, v0, sp104);
|
||||
// sp104 = false;
|
||||
// animated = false;
|
||||
//
|
||||
// switch (s5->unkc0.subcmd) {
|
||||
// case 0:
|
||||
// tmp6 = (s5->words.w1 >> 24) & 0xff;
|
||||
// tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
// tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
// tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
// tmp4 = (s5->words.w0 >> 14) & 0xf;
|
||||
// tmp5 = (s5->words.w0 >> 10) & 0xf;
|
||||
//
|
||||
// s6 = tex0f175490(s6, v0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, flag);
|
||||
// break;
|
||||
// case 1:
|
||||
// texturenum2 = (s5->words.w1 >> 12) & 0xfff;
|
||||
// texLoadFromTextureNum(texturenum2, arg3);
|
||||
// v0_2 = texFindInPool(texturenum2, arg3);
|
||||
//
|
||||
// if (v0_2 != NULL) {
|
||||
// tmp6 = (s5->words.w1 >> 24) & 0xff;
|
||||
// tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
// tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
// tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
// tmp4 = (s5->words.w0 >> 14) & 0xf;
|
||||
// tmp5 = (s5->words.w0 >> 10) & 0xf;
|
||||
//
|
||||
// s6 = tex0f175308(s6, v0, tmp1, tmp2, tmp3, v0_2, tmp4, tmp5, tmp6, flag);
|
||||
// }
|
||||
// break;
|
||||
// case 2:
|
||||
// tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
// tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
// tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
//
|
||||
// s6 = tex0f1751e4(s6, v0, tmp1, tmp2, tmp3, flag);
|
||||
// break;
|
||||
// case 3:
|
||||
// tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
// tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
// tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
//
|
||||
// s6 = tex0f17563c(s6, v0, tmp1, tmp2, tmp3);
|
||||
// break;
|
||||
// case 4:
|
||||
// tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
// tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
// tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
//
|
||||
// s6 = tex0f1755dc(s6, v0, tmp1, tmp2, tmp3);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (spe0 != 0) {
|
||||
// // Deep Sea - green river under floor
|
||||
// if (texturenum == TEXTURE_06CB) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_RIVER);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // Deep Sea - juice that flows inside SA megaweapon
|
||||
// // Attack Ship - juice that flows inside engine power node
|
||||
// if (texturenum == TEXTURE_0A6A) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_POWERJUICE);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // Deep Sea - white rings around SA megaweapon node
|
||||
// // Attack Ship - white rings around engine power node
|
||||
// if (texturenum == TEXTURE_0A69) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_POWERRING);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // Deep Sea - teleport
|
||||
// if (texturenum == TEXTURE_06E2) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_TELEPORTAL);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // 01c7 - Air Base - distant water
|
||||
// // 01c7 - Investigation - puddle behind glass near shield
|
||||
// // 0dae - Chicago - canal
|
||||
// // 0dae - Villa - shallow water
|
||||
// // 0dae - Sewers (MP)
|
||||
// if (texturenum == TEXTURE_01C7 || texturenum == TEXTURE_0DAE) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_RIVER);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // Air Force One - Monitor
|
||||
// if (texturenum == TEXTURE_029B) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_MONITOR);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // Villa - deep water
|
||||
// // Complex - water
|
||||
// if (texturenum == TEXTURE_090F) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_OCEAN);
|
||||
// animated = true;
|
||||
// }
|
||||
//
|
||||
// // Attack Ship - triangular arrows
|
||||
// if (texturenum == TEXTURE_0A42) {
|
||||
// dyntexSetCurrentType(DYNTEXTYPE_ARROWS);
|
||||
// animated = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// s5++;
|
||||
// break;
|
||||
// case G_VTX:
|
||||
// {
|
||||
// s32 start;
|
||||
// s32 count;
|
||||
// u32 offset;
|
||||
// struct gfxvtx *vtx;
|
||||
//
|
||||
// if (spe0) {
|
||||
// start = s5->bytes[1] & 0xf;
|
||||
// count = ((u32)s5->bytes[1] >> 4) + 1;
|
||||
// vtx = (struct gfxvtx *)(s5->dma.addr & 0x00ffffff);
|
||||
//
|
||||
// for (i = start; i < start + count; i++) {
|
||||
// if (animated && sp90[i]) {
|
||||
// dyntexAddVertex(spA0[i]);
|
||||
// sp90[i] = 0;
|
||||
// }
|
||||
//
|
||||
// spA0[i] = vtx;
|
||||
// vtx++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (spf4 && arg4) {
|
||||
// // b7c
|
||||
// u32 offset;
|
||||
// struct gfxvtx *vtx;
|
||||
// s32 i;
|
||||
//
|
||||
// count = (s5->dma.par >> 4) + 1;
|
||||
// offset = s5->dma.addr & 0x00ffffff;
|
||||
// i = 0;
|
||||
// offset = (arg4 + offset);
|
||||
// vtx = (struct gfxvtx *) offset;
|
||||
//
|
||||
// for (; i < count; i++) {
|
||||
// vtx[i].unk08 >>= 1;
|
||||
// vtx[i].unk0a >>= 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// *s6 = *s5;
|
||||
// s6++;
|
||||
// s5++;
|
||||
// break;
|
||||
// case G_RDPPIPESYNC:
|
||||
// var800844d0 = true;
|
||||
// *s6 = *s5;
|
||||
// s6++;
|
||||
// s5++;
|
||||
// break;
|
||||
// case (u8)G_TRI4:
|
||||
// case (u8)G_TRI1:
|
||||
// if (animated) {
|
||||
// if (s5->texture.cmd == (u8)G_TRI1) {
|
||||
// sp90[s5->tri.tri.v[0] / 10] = 1;
|
||||
// sp90[s5->tri.tri.v[1] / 10] = 1;
|
||||
// sp90[s5->tri.tri.v[2] / 10] = 1;
|
||||
// } else {
|
||||
// // c68
|
||||
// if (s5->tri4.x1 != s5->tri4.y1 || s5->tri4.z1 != s5->tri4.y1) {
|
||||
// sp90[s5->tri4.x1] = 1;
|
||||
// sp90[s5->tri4.y1] = 1;
|
||||
// sp90[s5->tri4.z1] = 1;
|
||||
// }
|
||||
//
|
||||
// // cbc
|
||||
// if (s5->tri4.x2 != s5->tri4.y2 || s5->tri4.z2 != s5->tri4.y2) {
|
||||
// sp90[s5->tri4.x2] = 1;
|
||||
// sp90[s5->tri4.y2] = 1;
|
||||
// sp90[s5->tri4.z2] = 1;
|
||||
// }
|
||||
//
|
||||
// // d0c
|
||||
// if (s5->tri4.x3 != s5->tri4.y3 || s5->tri4.z3 != s5->tri4.y3) {
|
||||
// sp90[s5->tri4.x3] = 1;
|
||||
// sp90[s5->tri4.y3] = 1;
|
||||
// sp90[s5->tri4.z3] = 1;
|
||||
// }
|
||||
//
|
||||
// // d58
|
||||
// if (s5->tri4.x4 != s5->tri4.y4 || s5->tri4.z4 != s5->tri4.y4) {
|
||||
// sp90[s5->tri4.x4] = 1;
|
||||
// sp90[s5->tri4.y4] = 1;
|
||||
// sp90[s5->tri4.z4] = 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// sp104 = true;
|
||||
// var800844d0 = false;
|
||||
//
|
||||
// *s6 = *s5;
|
||||
// s6++;
|
||||
// s5++;
|
||||
// break;
|
||||
// case (u8)G_TEXTURE:
|
||||
// spe4 = true;
|
||||
//
|
||||
// if (animated) {
|
||||
// spe8 = true;
|
||||
// }
|
||||
//
|
||||
// animated = false;
|
||||
// sp104 = false;
|
||||
//
|
||||
// sp12c = s6;
|
||||
// *s6 = *s5;
|
||||
// s6++;
|
||||
// s5++;
|
||||
// break;
|
||||
// case (u8)G_SETOTHERMODE_H:
|
||||
// *s6 = *s5;
|
||||
// s6++;
|
||||
// s5++;
|
||||
// break;
|
||||
// default:
|
||||
// *s6 = *s5;
|
||||
// s6++;
|
||||
// s5++;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// sp128--;
|
||||
//
|
||||
// if (spe4 || sp128 <= 0) {
|
||||
// spe4 = false;
|
||||
//
|
||||
// if (spe8 || animated) {
|
||||
// s32 i;
|
||||
//
|
||||
// spe8 = false;
|
||||
//
|
||||
// for (i = 0; i < 16; i++) {
|
||||
// if (sp90[i]) {
|
||||
// dyntexAddVertex(spA0[i]);
|
||||
// sp90[i] = 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return (u32)s6 - (u32)arg2;
|
||||
//}
|
||||
s32 tex0f1756c0(Gfx *arg0, s32 arg1, Gfx *arg2, struct texpool *arg3, u32 arg4)
|
||||
{
|
||||
struct tex *v0;
|
||||
struct tex *v0_2;
|
||||
Gfx *sp12c;
|
||||
s32 sp128;
|
||||
u32 tmp1;
|
||||
u32 tmp2;
|
||||
u32 tmp3;
|
||||
u32 tmp4;
|
||||
u32 tmp5;
|
||||
u32 tmp6;
|
||||
bool flag;
|
||||
s32 j;
|
||||
bool sp104;
|
||||
u8 animated;
|
||||
Gfx *s5;
|
||||
Gfx *s6;
|
||||
u32 spf4;
|
||||
s32 texturenum;
|
||||
s32 texturenum2;
|
||||
bool spe8;
|
||||
s32 spe4;
|
||||
s32 spe0;
|
||||
struct gfxvtx *spA0[16];
|
||||
u8 sp90[16];
|
||||
|
||||
s32 i;
|
||||
|
||||
sp12c = NULL;
|
||||
sp104 = true;
|
||||
animated = false;
|
||||
spe8 = false;
|
||||
spe4 = false;
|
||||
var800844d0 = false;
|
||||
spf4 = 0;
|
||||
s5 = arg0;
|
||||
s6 = arg2;
|
||||
|
||||
sp128 = arg1 >> 3;
|
||||
|
||||
tex0f173a08();
|
||||
|
||||
spe0 = dyntexHasRoom();
|
||||
|
||||
if (spe0) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
sp90[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg3 == NULL) {
|
||||
arg3 = &g_TexSharedPool;
|
||||
}
|
||||
|
||||
while (sp128 > 0) {
|
||||
switch (s5->texture.cmd) {
|
||||
case 0xc0: // Repurposed?
|
||||
spe4 = true;
|
||||
|
||||
if (animated) {
|
||||
spe8 = true;
|
||||
}
|
||||
|
||||
texturenum = s5->words.w1 & 0xfff;
|
||||
flag = s5->words.w0 & 0x200;
|
||||
|
||||
texLoadFromTextureNum(texturenum, arg3);
|
||||
|
||||
v0 = texFindInPool(texturenum, arg3);
|
||||
|
||||
if (v0 != NULL) {
|
||||
spf4 = v0->unk0c_03;
|
||||
} else {
|
||||
spf4 = 0;
|
||||
}
|
||||
|
||||
if (v0 != NULL) {
|
||||
s6 = tex0f1742e4(s6, sp12c, v0, sp104);
|
||||
sp104 = false;
|
||||
animated = false;
|
||||
|
||||
switch (s5->unkc0.subcmd) {
|
||||
case 0:
|
||||
tmp6 = (s5->words.w1 >> 24) & 0xff;
|
||||
tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
tmp4 = (s5->words.w0 >> 14) & 0xf;
|
||||
tmp5 = (s5->words.w0 >> 10) & 0xf;
|
||||
|
||||
s6 = tex0f175490(s6, v0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, flag);
|
||||
break;
|
||||
case 1:
|
||||
texturenum2 = (s5->words.w1 >> 12) & 0xfff;
|
||||
texLoadFromTextureNum(texturenum2, arg3);
|
||||
v0_2 = texFindInPool(texturenum2, arg3);
|
||||
|
||||
if (v0_2 != NULL) {
|
||||
tmp6 = (s5->words.w1 >> 24) & 0xff;
|
||||
tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
tmp4 = (s5->words.w0 >> 14) & 0xf;
|
||||
tmp5 = (s5->words.w0 >> 10) & 0xf;
|
||||
|
||||
s6 = tex0f175308(s6, v0, tmp1, tmp2, tmp3, v0_2, tmp4, tmp5, tmp6, flag);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
|
||||
s6 = tex0f1751e4(s6, v0, tmp1, tmp2, tmp3, flag);
|
||||
break;
|
||||
case 3:
|
||||
tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
|
||||
s6 = tex0f17563c(s6, v0, tmp1, tmp2, tmp3);
|
||||
break;
|
||||
case 4:
|
||||
tmp1 = (s5->words.w0 >> 22) & 3;
|
||||
tmp2 = (s5->words.w0 >> 20) & 3;
|
||||
tmp3 = (s5->words.w0 >> 18) & 3;
|
||||
|
||||
s6 = tex0f1755dc(s6, v0, tmp1, tmp2, tmp3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (spe0 != 0) {
|
||||
// Deep Sea - green river under floor
|
||||
if (texturenum == TEXTURE_06CB) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_RIVER);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// Deep Sea - juice that flows inside SA megaweapon
|
||||
// Attack Ship - juice that flows inside engine power node
|
||||
if (texturenum == TEXTURE_0A6A) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_POWERJUICE);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// Deep Sea - white rings around SA megaweapon node
|
||||
// Attack Ship - white rings around engine power node
|
||||
if (texturenum == TEXTURE_0A69) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_POWERRING);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// Deep Sea - teleport
|
||||
if (texturenum == TEXTURE_06E2) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_TELEPORTAL);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// 01c7 - Air Base - distant water
|
||||
// 01c7 - Investigation - puddle behind glass near shield
|
||||
// 0dae - Chicago - canal
|
||||
// 0dae - Villa - shallow water
|
||||
// 0dae - Sewers (MP)
|
||||
if (texturenum == TEXTURE_01C7 || texturenum == TEXTURE_0DAE) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_RIVER);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// Air Force One - Monitor
|
||||
if (texturenum == TEXTURE_029B) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_MONITOR);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// Villa - deep water
|
||||
// Complex - water
|
||||
if (texturenum == TEXTURE_090F) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_OCEAN);
|
||||
animated = true;
|
||||
}
|
||||
|
||||
// Attack Ship - triangular arrows
|
||||
if (texturenum == TEXTURE_0A42) {
|
||||
dyntexSetCurrentType(DYNTEXTYPE_ARROWS);
|
||||
animated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s5++;
|
||||
break;
|
||||
case G_VTX:
|
||||
{
|
||||
s32 start;
|
||||
s32 count;
|
||||
u32 offset;
|
||||
struct gfxvtx *vtx;
|
||||
|
||||
if (spe0) {
|
||||
start = s5->bytes[1] & 0xf;
|
||||
count = ((u32)s5->bytes[1] >> 4) + 1;
|
||||
vtx = (struct gfxvtx *)(s5->dma.addr & 0x00ffffff);
|
||||
|
||||
for (i = start; i < start + count; i++) {
|
||||
if (animated && sp90[i]) {
|
||||
dyntexAddVertex(spA0[i]);
|
||||
sp90[i] = 0;
|
||||
}
|
||||
|
||||
spA0[i] = vtx;
|
||||
vtx++;
|
||||
}
|
||||
}
|
||||
|
||||
if (spf4 && arg4) {
|
||||
// b7c
|
||||
u32 offset;
|
||||
struct gfxvtx *vtx;
|
||||
s32 i;
|
||||
|
||||
count = (s5->dma.par >> 4) + 1;
|
||||
offset = s5->dma.addr & 0x00ffffff;
|
||||
i = 0;
|
||||
offset = (arg4 + offset);
|
||||
vtx = (struct gfxvtx *) offset;
|
||||
|
||||
for (; i < count; i++) {
|
||||
vtx[i].s >>= 1;
|
||||
vtx[i].t >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*s6 = *s5;
|
||||
s6++;
|
||||
s5++;
|
||||
break;
|
||||
case G_RDPPIPESYNC:
|
||||
var800844d0 = true;
|
||||
*s6 = *s5;
|
||||
s6++;
|
||||
s5++;
|
||||
break;
|
||||
case (u8)G_TRI4:
|
||||
case (u8)G_TRI1:
|
||||
if (animated) {
|
||||
if (s5->texture.cmd == (u8)G_TRI1) {
|
||||
sp90[s5->tri.tri.v[0] / 10] = 1;
|
||||
sp90[s5->tri.tri.v[1] / 10] = 1;
|
||||
sp90[s5->tri.tri.v[2] / 10] = 1;
|
||||
} else {
|
||||
// c68
|
||||
if (s5->tri4.x1 != s5->tri4.y1 || s5->tri4.z1 != s5->tri4.y1) {
|
||||
sp90[s5->tri4.x1] = 1;
|
||||
sp90[s5->tri4.y1] = 1;
|
||||
sp90[s5->tri4.z1] = 1;
|
||||
}
|
||||
|
||||
// cbc
|
||||
if (s5->tri4.x2 != s5->tri4.y2 || s5->tri4.z2 != s5->tri4.y2) {
|
||||
sp90[s5->tri4.x2] = 1;
|
||||
sp90[s5->tri4.y2] = 1;
|
||||
sp90[s5->tri4.z2] = 1;
|
||||
}
|
||||
|
||||
// d0c
|
||||
if (s5->tri4.x3 != s5->tri4.y3 || s5->tri4.z3 != s5->tri4.y3) {
|
||||
sp90[s5->tri4.x3] = 1;
|
||||
sp90[s5->tri4.y3] = 1;
|
||||
sp90[s5->tri4.z3] = 1;
|
||||
}
|
||||
|
||||
// d58
|
||||
if (s5->tri4.x4 != s5->tri4.y4 || s5->tri4.z4 != s5->tri4.y4) {
|
||||
sp90[s5->tri4.x4] = 1;
|
||||
sp90[s5->tri4.y4] = 1;
|
||||
sp90[s5->tri4.z4] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sp104 = true;
|
||||
var800844d0 = false;
|
||||
|
||||
*s6 = *s5;
|
||||
s6++;
|
||||
s5++;
|
||||
break;
|
||||
case (u8)G_TEXTURE:
|
||||
spe4 = true;
|
||||
|
||||
if (animated) {
|
||||
spe8 = true;
|
||||
}
|
||||
|
||||
animated = false;
|
||||
sp104 = false;
|
||||
|
||||
sp12c = s6;
|
||||
*s6 = *s5;
|
||||
s6++;
|
||||
s5++;
|
||||
break;
|
||||
case (u8)G_SETOTHERMODE_H:
|
||||
*s6 = *s5;
|
||||
s6++;
|
||||
s5++;
|
||||
break;
|
||||
default:
|
||||
*s6 = *s5;
|
||||
s6++;
|
||||
s5++;
|
||||
break;
|
||||
}
|
||||
|
||||
sp128--;
|
||||
|
||||
if (spe4 || sp128 <= 0) {
|
||||
spe4 = false;
|
||||
|
||||
if (spe8 || animated) {
|
||||
s32 i;
|
||||
|
||||
spe8 = false;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (sp90[i]) {
|
||||
dyntexAddVertex(spA0[i]);
|
||||
sp90[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (u32)s6 - (u32)arg2;
|
||||
}
|
||||
#endif
|
||||
|
||||
void tex0f175ef4(Gfx *arg0, Gfx *arg1, s32 arg2)
|
||||
{
|
||||
|
||||
+599
-595
File diff suppressed because it is too large
Load Diff
+196
-194
@@ -412,6 +412,7 @@ void wallhitReapOne(void)
|
||||
if (1);
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel wallhitsTick
|
||||
.late_rodata
|
||||
@@ -1027,205 +1028,206 @@ glabel var7f1b5d18
|
||||
/* f13f3ec: 03e00008 */ jr $ra
|
||||
/* f13f3f0: 27bd0130 */ addiu $sp,$sp,0x130
|
||||
);
|
||||
|
||||
const char var7f1b5a54[] = "wallhit";
|
||||
|
||||
s32 var8007f834 = 0;
|
||||
#else
|
||||
|
||||
// Mismatch: float regalloc for midx, midy and midz
|
||||
//void wallhitsTick(void)
|
||||
//{
|
||||
// f32 sp12c;
|
||||
// f32 fov;
|
||||
// s32 numallocated;
|
||||
// s32 i;
|
||||
// s32 j;
|
||||
// u32 stack[3];
|
||||
// f32 midx;
|
||||
// f32 midy;
|
||||
// f32 midz;
|
||||
// f32 f22;
|
||||
// f32 f24;
|
||||
// struct wallhit *wallhit;
|
||||
// struct coord spc8[4];
|
||||
// u32 stack2[4];
|
||||
//
|
||||
// static s32 var8007f834 = 0;
|
||||
//
|
||||
// sp12c = (g_Vars.lvupdate240 + 2.0f) * 0.25f;
|
||||
// fov = currentPlayerGetGunZoomFov();
|
||||
//
|
||||
// mainOverrideVariable("wallhit", &var8007f750);
|
||||
//
|
||||
// var8007f740 = 0;
|
||||
//
|
||||
// if (fov == 0.0f || fov == 60.0f) {
|
||||
// var8007f748 = 1;
|
||||
// } else {
|
||||
// f32 tmp = fov / g_Vars.currentplayer->zoominfovy;
|
||||
// var8007f748 = 60.0f / fov - 1.00f / tmp + 1;
|
||||
// }
|
||||
//
|
||||
// var8007f74c = 1.0f / var8007f748;
|
||||
//
|
||||
// numallocated = g_WallhitsNumFree + g_WallhitsNumUsed;
|
||||
//
|
||||
// if (numallocated < var8009cc70) {
|
||||
// wallhitReapOne();
|
||||
// } else if (numallocated < var8009cc74) {
|
||||
// var8007f834++;
|
||||
//
|
||||
// if (var8007f834 == 8) {
|
||||
// var8007f834 = 0;
|
||||
// wallhitReapOne();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// wallhit = g_Wallhits;
|
||||
//
|
||||
// for (i = 0; i < g_WallhitsMax; i++) {
|
||||
// f32 f0 = sp12c;
|
||||
//
|
||||
// if (wallhit->inuse) {
|
||||
// if (wallhit->timerspeed != 8) {
|
||||
// f0 *= 0.6f * ((wallhit->timerspeed - 8.0f) * 0.125f);
|
||||
// }
|
||||
//
|
||||
// if (wallhit->timermax) {
|
||||
// u32 amount = (u32)(f0 + 0.5f);
|
||||
//
|
||||
// if (wallhit->expanding) {
|
||||
// if (wallhit->timercur > wallhit->timermax) {
|
||||
// wallhit->timermax = 0;
|
||||
// wallhit->timercur = 0;
|
||||
// wallhit->inuse = true;
|
||||
// }
|
||||
//
|
||||
// wallhit->timercur += amount;
|
||||
// } else {
|
||||
// if (amount < wallhit->timercur) {
|
||||
// wallhit->timercur -= amount;
|
||||
// } else {
|
||||
// wallhitFree(wallhit);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (wallhit->timermax) {
|
||||
// f24 = (f32) wallhit->timercur / wallhit->timermax;
|
||||
//
|
||||
// if (f24 > 1.0f) {
|
||||
// f24 = 1.0f;
|
||||
// }
|
||||
//
|
||||
// f22 = f24;
|
||||
//
|
||||
// if (wallhit->expanding) {
|
||||
// f32 frac = 0.2f;
|
||||
// f32 sizefrac;
|
||||
// f32 f30;
|
||||
// s32 minindex;
|
||||
// f32 tmp;
|
||||
// s32 j;
|
||||
//
|
||||
// tmp = 1.5707964f * f24;
|
||||
// f30 = (1.0f - frac) * sinf(tmp);
|
||||
// f22 = 1.0f - tmp + 0.6f;
|
||||
//
|
||||
// wallhit->vertices2 = gfxAllocateVertices(4);
|
||||
//
|
||||
// midx = var800845dc.x; \
|
||||
// midy = var800845dc.y; \
|
||||
// midz = var800845dc.z;
|
||||
//
|
||||
// // Copy the vertices into a float array
|
||||
// for (j = 0; j < 4; j++) {
|
||||
// spc8[j].x = wallhit->vertices[j].x;
|
||||
// spc8[j].y = wallhit->vertices[j].y;
|
||||
// spc8[j].z = wallhit->vertices[j].z;
|
||||
// }
|
||||
//
|
||||
// // Sum the vertices and divide them by 4 to get the centre
|
||||
// minindex = 0;
|
||||
//
|
||||
// for (j = 0; j < 4; j++) {
|
||||
// midx = midx + spc8[j].x;
|
||||
// midy = midy + spc8[j].y;
|
||||
// midz = midz + spc8[j].z;
|
||||
//
|
||||
// // This should be j != 0, but minindex is unused
|
||||
// // so it doesn't affect anything
|
||||
// if (minindex != 0 && spc8[j].y < spc8[minindex].y) {
|
||||
// minindex = j;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// midx = 0.25f * midx;
|
||||
// midy = 0.25f * midy;
|
||||
// midz = 0.25f * midz;
|
||||
//
|
||||
// sizefrac = frac + f30;
|
||||
//
|
||||
// // Calculate and apply the new size
|
||||
// for (j = 0; j < 4; j++) {
|
||||
// f32 xradius = spc8[j].x - midx;
|
||||
// f32 yradius = spc8[j].y - midy;
|
||||
// f32 zradius = spc8[j].z - midz;
|
||||
//
|
||||
// wallhit->vertices2[j].x = midx + xradius * sizefrac;
|
||||
// wallhit->vertices2[j].y = midy + yradius * sizefrac;
|
||||
// wallhit->vertices2[j].z = midz + zradius * sizefrac;
|
||||
// wallhit->vertices2[j].s = wallhit->vertices[j].s;
|
||||
// wallhit->vertices2[j].t = wallhit->vertices[j].t;
|
||||
// wallhit->vertices2[j].colour = wallhit->vertices[j].colour;
|
||||
// }
|
||||
//
|
||||
// if (1);
|
||||
//
|
||||
// f24 *= 2.0f;
|
||||
//
|
||||
// if (f24 > 1.0f) {
|
||||
// f24 = 1.0f;
|
||||
// }
|
||||
//
|
||||
// if (1);
|
||||
// }
|
||||
//
|
||||
// for (j = 0; j < 4; j++) {
|
||||
// u32 alpha;
|
||||
//
|
||||
// if (f22 > 1.0f) {
|
||||
// f22 = 1.0f;
|
||||
// }
|
||||
//
|
||||
// alpha = wallhit->basecolours[j].a * f24;
|
||||
//
|
||||
// if (alpha > 255) {
|
||||
// alpha = 255;
|
||||
// }
|
||||
//
|
||||
// wallhit->finalcolours[j].a = alpha;
|
||||
// }
|
||||
// } else {
|
||||
// if (wallhit->inuse) {
|
||||
// wallhit->vertices2 = NULL;
|
||||
//
|
||||
// for (j = 0; j < 4; j++) {
|
||||
// wallhit->finalcolours[j].a = wallhit->basecolours[j].a;
|
||||
// }
|
||||
// } else {
|
||||
// wallhit->vertices2 = NULL;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// wallhit->unk6f_05 = true;
|
||||
// }
|
||||
//
|
||||
// wallhit++;
|
||||
//
|
||||
// if (1);
|
||||
// }
|
||||
//}
|
||||
void wallhitsTick(void)
|
||||
{
|
||||
f32 sp12c;
|
||||
f32 fov;
|
||||
s32 numallocated;
|
||||
s32 i;
|
||||
s32 j;
|
||||
u32 stack[3];
|
||||
f32 midx;
|
||||
f32 midy;
|
||||
f32 midz;
|
||||
f32 f22;
|
||||
f32 f24;
|
||||
struct wallhit *wallhit;
|
||||
struct coord spc8[4];
|
||||
u32 stack2[4];
|
||||
|
||||
static s32 var8007f834 = 0;
|
||||
|
||||
sp12c = (g_Vars.lvupdate240 + 2.0f) * 0.25f;
|
||||
fov = currentPlayerGetGunZoomFov();
|
||||
|
||||
mainOverrideVariable("wallhit", &var8007f750);
|
||||
|
||||
var8007f740 = 0;
|
||||
|
||||
if (fov == 0.0f || fov == 60.0f) {
|
||||
var8007f748 = 1;
|
||||
} else {
|
||||
f32 tmp = fov / g_Vars.currentplayer->zoominfovy;
|
||||
var8007f748 = 60.0f / fov - 1.00f / tmp + 1;
|
||||
}
|
||||
|
||||
var8007f74c = 1.0f / var8007f748;
|
||||
|
||||
numallocated = g_WallhitsNumFree + g_WallhitsNumUsed;
|
||||
|
||||
if (numallocated < var8009cc70) {
|
||||
wallhitReapOne();
|
||||
} else if (numallocated < var8009cc74) {
|
||||
var8007f834++;
|
||||
|
||||
if (var8007f834 == 8) {
|
||||
var8007f834 = 0;
|
||||
wallhitReapOne();
|
||||
}
|
||||
}
|
||||
|
||||
wallhit = g_Wallhits;
|
||||
|
||||
for (i = 0; i < g_WallhitsMax; i++) {
|
||||
f32 f0 = sp12c;
|
||||
|
||||
if (wallhit->inuse) {
|
||||
if (wallhit->timerspeed != 8) {
|
||||
f0 *= 0.6f * ((wallhit->timerspeed - 8.0f) * 0.125f);
|
||||
}
|
||||
|
||||
if (wallhit->timermax) {
|
||||
u32 amount = (u32)(f0 + 0.5f);
|
||||
|
||||
if (wallhit->expanding) {
|
||||
if (wallhit->timercur > wallhit->timermax) {
|
||||
wallhit->timermax = 0;
|
||||
wallhit->timercur = 0;
|
||||
wallhit->inuse = true;
|
||||
}
|
||||
|
||||
wallhit->timercur += amount;
|
||||
} else {
|
||||
if (amount < wallhit->timercur) {
|
||||
wallhit->timercur -= amount;
|
||||
} else {
|
||||
wallhitFree(wallhit);
|
||||
}
|
||||
}
|
||||
|
||||
if (wallhit->timermax) {
|
||||
f24 = (f32) wallhit->timercur / wallhit->timermax;
|
||||
|
||||
if (f24 > 1.0f) {
|
||||
f24 = 1.0f;
|
||||
}
|
||||
|
||||
f22 = f24;
|
||||
|
||||
if (wallhit->expanding) {
|
||||
f32 frac = 0.2f;
|
||||
f32 sizefrac;
|
||||
f32 f30;
|
||||
s32 minindex;
|
||||
f32 tmp;
|
||||
s32 j;
|
||||
|
||||
tmp = 1.5707964f * f24;
|
||||
f30 = (1.0f - frac) * sinf(tmp);
|
||||
f22 = 1.0f - tmp + 0.6f;
|
||||
|
||||
wallhit->vertices2 = gfxAllocateVertices(4);
|
||||
|
||||
midx = var800845dc.x; \
|
||||
midy = var800845dc.y; \
|
||||
midz = var800845dc.z;
|
||||
|
||||
// Copy the vertices into a float array
|
||||
for (j = 0; j < 4; j++) {
|
||||
spc8[j].x = wallhit->vertices[j].x;
|
||||
spc8[j].y = wallhit->vertices[j].y;
|
||||
spc8[j].z = wallhit->vertices[j].z;
|
||||
}
|
||||
|
||||
// Sum the vertices and divide them by 4 to get the centre
|
||||
minindex = 0;
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
midx = midx + spc8[j].x;
|
||||
midy = midy + spc8[j].y;
|
||||
midz = midz + spc8[j].z;
|
||||
|
||||
// This should be j != 0, but minindex is unused
|
||||
// so it doesn't affect anything
|
||||
if (minindex != 0 && spc8[j].y < spc8[minindex].y) {
|
||||
minindex = j;
|
||||
}
|
||||
}
|
||||
|
||||
midx = 0.25f * midx;
|
||||
midy = 0.25f * midy;
|
||||
midz = 0.25f * midz;
|
||||
|
||||
sizefrac = frac + f30;
|
||||
|
||||
// Calculate and apply the new size
|
||||
for (j = 0; j < 4; j++) {
|
||||
f32 xradius = spc8[j].x - midx;
|
||||
f32 yradius = spc8[j].y - midy;
|
||||
f32 zradius = spc8[j].z - midz;
|
||||
|
||||
wallhit->vertices2[j].x = midx + xradius * sizefrac;
|
||||
wallhit->vertices2[j].y = midy + yradius * sizefrac;
|
||||
wallhit->vertices2[j].z = midz + zradius * sizefrac;
|
||||
wallhit->vertices2[j].s = wallhit->vertices[j].s;
|
||||
wallhit->vertices2[j].t = wallhit->vertices[j].t;
|
||||
wallhit->vertices2[j].colour = wallhit->vertices[j].colour;
|
||||
}
|
||||
|
||||
if (1);
|
||||
|
||||
f24 *= 2.0f;
|
||||
|
||||
if (f24 > 1.0f) {
|
||||
f24 = 1.0f;
|
||||
}
|
||||
|
||||
if (1);
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
u32 alpha;
|
||||
|
||||
if (f22 > 1.0f) {
|
||||
f22 = 1.0f;
|
||||
}
|
||||
|
||||
alpha = wallhit->basecolours[j].a * f24;
|
||||
|
||||
if (alpha > 255) {
|
||||
alpha = 255;
|
||||
}
|
||||
|
||||
wallhit->finalcolours[j].a = alpha;
|
||||
}
|
||||
} else {
|
||||
if (wallhit->inuse) {
|
||||
wallhit->vertices2 = NULL;
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
wallhit->finalcolours[j].a = wallhit->basecolours[j].a;
|
||||
}
|
||||
} else {
|
||||
wallhit->vertices2 = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wallhit->unk6f_05 = true;
|
||||
}
|
||||
|
||||
wallhit++;
|
||||
|
||||
if (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const char var7f1b5a5c[] = "g_MaxRound = %s%s%f";
|
||||
const char var7f1b5a70[] = "";
|
||||
|
||||
+1136
-1128
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user