Improve mismatch of sightDrawDefault

This commit is contained in:
Ryan Dwyer 2022-06-16 17:19:05 +10:00
parent 42d21af4ce
commit 9b7b98d61c
15 changed files with 338 additions and 332 deletions

View File

@ -12703,7 +12703,7 @@ void bgunCreateFiredProjectile(s32 handnum)
weapon->base.projectile->flags |= PROJECTILEFLAG_00000010;
}
weapon->base.projectile->targetprop = g_Vars.currentplayer->cmpfollowprops[0].prop;
weapon->base.projectile->targetprop = g_Vars.currentplayer->trackedprops[0].prop;
if (funcdef->scale != 1.0f) {
weapon->base.model->scale *= funcdef->scale;
@ -12779,7 +12779,7 @@ void bgunCreateFiredProjectile(s32 handnum)
weapon->base.projectile->flags |= PROJECTILEFLAG_00000010;
}
weapon->base.projectile->targetprop = g_Vars.currentplayer->cmpfollowprops[0].prop;
weapon->base.projectile->targetprop = g_Vars.currentplayer->trackedprops[0].prop;
if (funcdef->scale != 1.0f) {
weapon->base.model->scale *= funcdef->scale;
@ -33020,6 +33020,15 @@ void bgunTickBoost(void)
}
}
/**
* gunsightoff is 0 if the full sight is visible, ie. player is holding R.
*
* Otherwise, gunsightoff holds bit values for reasons why the sight is off.
* This is typically 2, which is GUNSIGHTREASON_NOTAIMING.
*
* If the visible argument is true, it removes the reason from the field, thus
* making the sight visible if there are no other reasons.
*/
void bgunSetSightVisible(u32 reason, bool visible)
{
if (visible) {
@ -33032,7 +33041,8 @@ void bgunSetSightVisible(u32 reason, bool visible)
Gfx *bgunDrawSight(Gfx *gdl)
{
if (g_Vars.currentplayer->gunsightoff == false && !g_Vars.currentplayer->mpmenuon) {
if (g_Vars.currentplayer->gunsightoff == 0 && !g_Vars.currentplayer->mpmenuon) {
// Player is aiming with R
gdl = sightDraw(gdl, true, currentPlayerGetSight());
} else {
gdl = sightDraw(gdl, false, currentPlayerGetSight());

View File

@ -238,7 +238,7 @@ void bgunReset(void)
bgunCalculateBlend(HAND_LEFT);
g_Vars.currentplayer->gunammooff = 0;
g_Vars.currentplayer->gunsightoff = GUNSIGHTREASON_AIMING;
g_Vars.currentplayer->gunsightoff = GUNSIGHTREASON_NOTAIMING;
g_Vars.currentplayer->gunzoomfovs[0] = 15;
g_Vars.currentplayer->gunzoomfovs[1] = 60;
g_Vars.currentplayer->gunzoomfovs[2] = 30;

View File

@ -538,8 +538,8 @@ void bmoveResetMoveData(struct movedata *data)
data->weaponbackoffset = 0;
data->weaponforwardoffset = 0;
data->unk50 = 0;
data->unk54 = 0;
data->unk58 = 0;
data->aiming = false;
data->zooming = false;
data->crouchdown = false;
data->crouchup = false;
data->rleanleft = false;
@ -1039,8 +1039,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
&& (c2stickx < -30 || c2stickx > 30);
}
movedata.rleanleft = 0;
movedata.rleanright = 0;
movedata.rleanleft = false;
movedata.rleanright = false;
// Handle mine detonation
if ((((c1buttons & A_BUTTON) && (c1buttonsthisframe & B_BUTTON))
@ -1057,8 +1057,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
}
movedata.unk54 = g_Vars.currentplayer->insightaimmode;
movedata.unk58 = g_Vars.currentplayer->insightaimmode;
movedata.aiming = g_Vars.currentplayer->insightaimmode;
movedata.zooming = g_Vars.currentplayer->insightaimmode;
if (g_Vars.currentplayer->waitforzrelease
&& joyGetButtons(shootpad, shootallowedbuttons & Z_TRIG) == 0) {
@ -1409,8 +1409,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
}
movedata.unk54 = g_Vars.currentplayer->insightaimmode;
movedata.unk58 = g_Vars.currentplayer->insightaimmode;
movedata.aiming = g_Vars.currentplayer->insightaimmode;
movedata.zooming = g_Vars.currentplayer->insightaimmode;
if (g_Vars.currentplayer->waitforzrelease
&& (c1buttons & shootbuttons) == 0) {
@ -1470,7 +1470,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
chrsCheckForNoise(noiseradius);
}
bgunSetSightVisible(GUNSIGHTREASON_AIMING, movedata.unk54);
bgunSetSightVisible(GUNSIGHTREASON_NOTAIMING, movedata.aiming);
if (movedata.zoomoutfovpersec > 0) {
currentPlayerZoomOut(movedata.zoomoutfovpersec);
@ -1517,7 +1517,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
}
if (movedata.unk58) {
if (movedata.zooming) {
zoomfov = currentPlayerGetGunZoomFov();
}

View File

@ -1508,8 +1508,8 @@ void chrClearReferences(s32 propnum)
}
for (j = 0; j != 4; j++) {
if (g_Vars.players[i]->cmpfollowprops[j].prop == prop) {
g_Vars.players[i]->cmpfollowprops[j].prop = NULL;
if (g_Vars.players[i]->trackedprops[j].prop == prop) {
g_Vars.players[i]->trackedprops[j].prop = NULL;
}
}
}

View File

@ -566,52 +566,52 @@ void lvFadeReset(void)
g_FadeDelay = 0;
}
bool lvCheckCmpFollowThreat(struct threat *threat, s32 index)
bool lvUpdateTrackedProp(struct trackedprop *trackedprop, s32 index)
{
f32 sp76;
f32 sp72;
f32 sp68;
f32 sp64;
struct prop *prop = threat->prop;
f32 y1;
f32 x1;
f32 y2;
f32 x2;
struct prop *prop = trackedprop->prop;
struct chrdata *chr;
if (threat->prop && prop->chr) {
switch (threat->prop->type) {
if (trackedprop->prop && prop->chr) {
switch (trackedprop->prop->type) {
case PROPTYPE_PLAYER:
if (playermgrGetPlayerNumByProp(prop) == g_Vars.currentplayernum) {
return false;
}
// fall through
case PROPTYPE_CHR:
chr = threat->prop->chr;
chr = trackedprop->prop->chr;
if (chrIsDead(threat->prop->chr)) {
if (chrIsDead(trackedprop->prop->chr)) {
if (index >= 0) {
// Existing threat
// Existing trackedprop
if (g_Vars.currentplayer->targetset[index] < TICKS(129)) {
g_Vars.currentplayer->targetset[index] = TICKS(129);
}
if (g_Vars.currentplayer->targetset[index] >= (PAL ? 146 : 175)) {
threat->prop = NULL;
trackedprop->prop = NULL;
return false;
}
} else {
// Attempting to add a new threat, but chr is dead
threat->prop = NULL;
// lookingatprop
trackedprop->prop = NULL;
return false;
}
}
if ((threat->prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)
if ((trackedprop->prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)
&& (chr->chrflags & CHRCFLAG_NOAUTOAIM) == 0) {
struct model *model = chr->model;
sp72 = -1;
sp76 = -1;
sp64 = -2;
sp68 = -2;
x1 = -1;
y1 = -1;
x2 = -2;
y2 = -2;
if (modelSetRedBox(model, &sp64, &sp72, &sp68, &sp76)) {
if (modelGetScreenCoords(model, &x2, &x1, &y2, &y1)) {
break;
}
return false;
@ -619,15 +619,15 @@ bool lvCheckCmpFollowThreat(struct threat *threat, s32 index)
return false;
case PROPTYPE_OBJ:
case PROPTYPE_WEAPON:
if (threat->prop->flags & PROPFLAG_ONTHISSCREENTHISTICK) {
struct defaultobj *obj = threat->prop->obj;
if (trackedprop->prop->flags & PROPFLAG_ONTHISSCREENTHISTICK) {
struct defaultobj *obj = trackedprop->prop->obj;
struct model *model = obj->model;
sp72 = -1;
sp76 = -1;
sp64 = -2;
sp68 = -2;
x1 = -1;
y1 = -1;
x2 = -2;
y2 = -2;
if (modelSetRedBox(model, &sp64, &sp72, &sp68, &sp76)) {
if (modelGetScreenCoords(model, &x2, &x1, &y2, &y1)) {
break;
}
return false;
@ -641,10 +641,10 @@ bool lvCheckCmpFollowThreat(struct threat *threat, s32 index)
return false;
}
threat->x1 = sp72 - 2;
threat->x2 = sp64 + 2;
threat->y1 = sp76 - 2;
threat->y2 = sp68 + 2;
trackedprop->x1 = x1 - 2;
trackedprop->x2 = x2 + 2;
trackedprop->y1 = y1 - 2;
trackedprop->y2 = y2 + 2;
}
return true;
@ -773,7 +773,7 @@ void lvFindThreatsForProp(struct prop *prop, bool inchild, struct coord *playerp
if (pass) {
for (i = 0; i != 4; i++) {
if (g_Vars.currentplayer->cmpfollowprops[i].prop == prop) {
if (g_Vars.currentplayer->trackedprops[i].prop == prop) {
pass = false;
}
}
@ -785,7 +785,7 @@ void lvFindThreatsForProp(struct prop *prop, bool inchild, struct coord *playerp
sp76 = -2;
sp80 = -2;
if (!modelSetRedBox(model, &sp76, &sp84, &sp80, &sp88)) {
if (!modelGetScreenCoords(model, &sp76, &sp84, &sp80, &sp88)) {
pass = false;
}
}
@ -820,11 +820,11 @@ void lvFindThreatsForProp(struct prop *prop, bool inchild, struct coord *playerp
}
if (index >= 0) {
g_Vars.currentplayer->cmpfollowprops[index].prop = prop;
g_Vars.currentplayer->cmpfollowprops[index].x1 = sp84 - 2;
g_Vars.currentplayer->cmpfollowprops[index].x2 = sp76 + 2;
g_Vars.currentplayer->cmpfollowprops[index].y1 = sp88 - 2;
g_Vars.currentplayer->cmpfollowprops[index].y2 = sp80 + 2;
g_Vars.currentplayer->trackedprops[index].prop = prop;
g_Vars.currentplayer->trackedprops[index].x1 = sp84 - 2;
g_Vars.currentplayer->trackedprops[index].x2 = sp76 + 2;
g_Vars.currentplayer->trackedprops[index].y1 = sp88 - 2;
g_Vars.currentplayer->trackedprops[index].y2 = sp80 + 2;
g_Vars.currentplayer->targetset[index] = 0;
activeslots[index] = true;
distances[index] = sqdist;
@ -851,19 +851,19 @@ void func0f168f24(struct prop *prop, bool inchild, struct coord *playerpos, s32
struct model *model;
for (i = 0; i != 4; i++) {
if (g_Vars.currentplayer->cmpfollowprops[i].prop == prop
if (g_Vars.currentplayer->trackedprops[i].prop == prop
&& (prop->flags & PROPFLAG_ONTHISSCREENTHISTICK)) {
model = NULL;
if (prop->type == PROPTYPE_OBJ
|| prop->type == PROPTYPE_WEAPON
|| prop->type == PROPTYPE_DOOR) {
model = g_Vars.currentplayer->cmpfollowprops[i].prop->obj->model;
model = g_Vars.currentplayer->trackedprops[i].prop->obj->model;
} else {
if (prop->type == PROPTYPE_CHR
|| (prop->type == PROPTYPE_PLAYER
&& playermgrGetPlayerNumByProp(prop) != g_Vars.currentplayernum)) {
model = g_Vars.currentplayer->cmpfollowprops[i].prop->chr->model;
model = g_Vars.currentplayer->trackedprops[i].prop->chr->model;
}
}
@ -873,12 +873,12 @@ void func0f168f24(struct prop *prop, bool inchild, struct coord *playerpos, s32
sp116 = -2;
sp120 = -2;
if (modelSetRedBox(model, &sp116, &sp124, &sp120, &sp128)) {
if (modelGetScreenCoords(model, &sp116, &sp124, &sp120, &sp128)) {
activeslots[i] = true;
g_Vars.currentplayer->cmpfollowprops[i].x1 = sp124 - 2;
g_Vars.currentplayer->cmpfollowprops[i].x2 = sp116 + 2;
g_Vars.currentplayer->cmpfollowprops[i].y1 = sp128 - 2;
g_Vars.currentplayer->cmpfollowprops[i].y2 = sp120 + 2;
g_Vars.currentplayer->trackedprops[i].x1 = sp124 - 2;
g_Vars.currentplayer->trackedprops[i].x2 = sp116 + 2;
g_Vars.currentplayer->trackedprops[i].y1 = sp128 - 2;
g_Vars.currentplayer->trackedprops[i].y2 = sp120 + 2;
distances[i] =
(prop->pos.f[0] - playerpos->f[0]) * (prop->pos.f[0] - playerpos->f[0]) +
@ -923,9 +923,9 @@ void lvFindThreats(void)
for (i = 0; i != ARRAYCOUNT(activeslots); i++) {
if (!activeslots[i]) {
g_Vars.currentplayer->cmpfollowprops[i].prop = NULL;
g_Vars.currentplayer->cmpfollowprops[i].x1 = -1;
g_Vars.currentplayer->cmpfollowprops[i].x2 = -2;
g_Vars.currentplayer->trackedprops[i].prop = NULL;
g_Vars.currentplayer->trackedprops[i].x1 = -1;
g_Vars.currentplayer->trackedprops[i].x2 = -2;
}
}
@ -1230,14 +1230,14 @@ Gfx *lvRender(Gfx *gdl)
&& g_Vars.currentplayer->lookingatprop.prop
&& bmoveIsInSightAimMode()) {
func0f1a0924(g_Vars.currentplayer->lookingatprop.prop);
} else if (lvCheckCmpFollowThreat(&g_Vars.currentplayer->lookingatprop, -1) == 0) {
} else if (lvUpdateTrackedProp(&g_Vars.currentplayer->lookingatprop, -1) == 0) {
g_Vars.currentplayer->lookingatprop.prop = NULL;
}
for (j = 0; j < ARRAYCOUNT(g_Vars.currentplayer->cmpfollowprops); j++) {
if (!lvCheckCmpFollowThreat(&g_Vars.currentplayer->cmpfollowprops[j], j)) {
g_Vars.currentplayer->cmpfollowprops[j].x1 = -1;
g_Vars.currentplayer->cmpfollowprops[j].x2 = -2;
for (j = 0; j < ARRAYCOUNT(g_Vars.currentplayer->trackedprops); j++) {
if (!lvUpdateTrackedProp(&g_Vars.currentplayer->trackedprops[j], j)) {
g_Vars.currentplayer->trackedprops[j].x1 = -1;
g_Vars.currentplayer->trackedprops[j].x2 = -2;
}
}
}

View File

@ -433,7 +433,7 @@ void playermgrAllocatePlayer(s32 index)
g_Vars.players[index]->lookingatprop.prop = NULL;
for (i = 0; i < 4; i++) {
g_Vars.players[index]->cmpfollowprops[i].prop = NULL;
g_Vars.players[index]->trackedprops[i].prop = NULL;
}
g_Vars.players[index]->crosspos[0] = 0;

View File

@ -6497,12 +6497,12 @@ void autoaimTick(void)
if (iscmpsec) {
// For CMP on secondary mode, find the first prop that is within the aim limits
for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->cmpfollowprops); i++) {
struct threat *threat = &g_Vars.currentplayer->cmpfollowprops[i];
for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->trackedprops); i++) {
struct trackedprop *trackedprop = &g_Vars.currentplayer->trackedprops[i];
if (threat->prop
&& (threat->x1 >= 0 || threat->x2 >= 0)
&& (threat->y1 >= 0 || threat->y2 >= 0)) {
if (trackedprop->prop
&& (trackedprop->x1 >= 0 || trackedprop->x2 >= 0)
&& (trackedprop->y1 >= 0 || trackedprop->y2 >= 0)) {
// Define the aim limits
f32 top = camGetScreenTop() + camGetScreenHeight() * 0.125f;
f32 bottom = camGetScreenTop() + camGetScreenHeight() * 0.875f;
@ -6510,14 +6510,14 @@ void autoaimTick(void)
f32 right = camGetScreenLeft() + camGetScreenWidth() * 0.875f;
struct chrdata *chr = NULL;
bestprop = threat->prop;
bestprop = trackedprop->prop;
if (bestprop->type == PROPTYPE_OBJ
|| bestprop->type == PROPTYPE_WEAPON
|| bestprop->type == PROPTYPE_DOOR) {
// Threat is an object
aimpos[0] = (threat->x2 + threat->x1) / 2;
aimpos[1] = (threat->y2 + threat->y1) / 2;
// trackedprop is an object
aimpos[0] = (trackedprop->x2 + trackedprop->x1) / 2;
aimpos[1] = (trackedprop->y2 + trackedprop->y1) / 2;
if (bestprop->flags & PROPFLAG_ONTHISSCREENTHISTICK) {
struct defaultobj *obj = bestprop->obj;
@ -6532,15 +6532,15 @@ void autoaimTick(void)
}
}
} else {
// Threat is a chr
// trackedprop is a chr
chr = bestprop->chr;
aimpos[0] = (threat->x2 + threat->x1) / 2;
aimpos[0] = (trackedprop->x2 + trackedprop->x1) / 2;
if (chr && chr->race == RACE_EYESPY) {
aimpos[1] = (threat->y2 + threat->y1) >> 1;
aimpos[1] = (trackedprop->y2 + trackedprop->y1) >> 1;
} else {
// Aim 2/3 up the chr, so about their chest
aimpos[1] = (threat->y2 + threat->y1 * 2) / 3;
aimpos[1] = (trackedprop->y2 + trackedprop->y1 * 2) / 3;
}
}
@ -6562,7 +6562,7 @@ void autoaimTick(void)
}
// Don't use this prop if it's an undeployed eyespy, or if
// the threat is outside of the aim limits
// the trackedprop is outside of the aim limits
if (chr && chr->race == RACE_EYESPY) {
struct eyespy *eyespy = chrToEyespy(chr);
@ -6570,10 +6570,10 @@ void autoaimTick(void)
bestprop = NULL;
aimpos[0] = aimpos[1] = 0;
}
} else if (aimpos[0] > threat->x2
|| aimpos[0] < threat->x1
|| aimpos[1] > threat->y2
|| aimpos[1] < threat->y1) {
} else if (aimpos[0] > trackedprop->x2
|| aimpos[0] < trackedprop->x1
|| aimpos[1] > trackedprop->y2
|| aimpos[1] < trackedprop->y1) {
bestprop = NULL;
aimpos[0] = aimpos[1] = 0;
}

View File

@ -1273,7 +1273,7 @@ void func0f067d88(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg
func0f067bc4(model, arg3, arg4, 1);
}
bool func0f067dc4(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4)
bool modelGetScreenCoords2(struct model *model, f32 *x2, f32 *x1, f32 *y2, f32 *y1)
{
bool first = true;
@ -1307,20 +1307,20 @@ bool func0f067dc4(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg
func0f06803c(&sp50, sp64, sp5c, sp74, sp6c);
if (first || sp74[0] < *arg2) {
*arg2 = sp74[0];
if (first || sp74[0] < *x1) {
*x1 = sp74[0];
}
if (first || sp6c[0] > *arg1) {
*arg1 = sp6c[0];
if (first || sp6c[0] > *x2) {
*x2 = sp6c[0];
}
if (first || sp74[1] < *arg4) {
*arg4 = sp74[1];
if (first || sp74[1] < *y1) {
*y1 = sp74[1];
}
if (first || sp6c[1] > *arg3) {
*arg3 = sp6c[1];
if (first || sp6c[1] > *y2) {
*y2 = sp6c[1];
}
first = false;
@ -1348,9 +1348,9 @@ bool func0f067dc4(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg
return first ? false : true;
}
bool modelSetRedBox(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4)
bool modelGetScreenCoords(struct model *model, f32 *x2, f32 *x1, f32 *y2, f32 *y1)
{
return func0f067dc4(model, arg1, arg2, arg3, arg4);
return modelGetScreenCoords2(model, x2, x1, y2, y1);
}
void func0f06803c(struct coord *arg0, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4)

View File

@ -74,7 +74,7 @@ bool sightCanTargetProp(struct prop *prop, s32 max)
s32 i;
for (i = 0; i < max; i++) {
if (prop == g_Vars.currentplayer->cmpfollowprops[i].prop) {
if (prop == g_Vars.currentplayer->trackedprops[i].prop) {
return false;
}
}
@ -139,7 +139,7 @@ s32 sightFindFreeTargetIndex(s32 max)
s32 i;
for (i = 0; i < max; i++) {
if (g_Vars.currentplayer->cmpfollowprops[i].prop == NULL) {
if (g_Vars.currentplayer->trackedprops[i].prop == NULL) {
return i;
}
}
@ -151,14 +151,14 @@ void func0f0d7364(void)
{
s32 i;
for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->cmpfollowprops); i++) {
g_Vars.currentplayer->cmpfollowprops[i].prop = NULL;
for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->trackedprops); i++) {
g_Vars.currentplayer->trackedprops[i].prop = NULL;
}
}
void sightTick(bool sighton)
{
struct threat *threat;
struct trackedprop *trackedprop;
u8 newtarget;
s32 i;
s32 index;
@ -197,70 +197,70 @@ void sightTick(bool sighton)
if (newtarget != g_Vars.currentplayer->target) {
if (newtarget == 5) {
for (i = 0; i < 4; i++) {
g_Vars.currentplayer->cmpfollowprops[i].prop = NULL;
g_Vars.currentplayer->trackedprops[i].prop = NULL;
}
}
g_Vars.currentplayer->target = newtarget;
switch (newtarget) {
case SIGHTTARGET_0:
case SIGHTTARGET_1:
case SIGHTTARGET_2:
case SIGHTTARGET_3:
case SIGHTTARGET_4:
case SIGHTTARGET_NONE:
case SIGHTTARGET_DEFAULT:
case SIGHTTARGET_BETASCANNER:
case SIGHTTARGET_ROCKETLAUNCHER:
case SIGHTTARGET_CMP150:
break;
}
}
if (sighton && g_Vars.currentplayer->lastsighton == false && newtarget != 5) {
for (i = 0; i < 4; i++) {
g_Vars.currentplayer->cmpfollowprops[i].prop = NULL;
g_Vars.currentplayer->trackedprops[i].prop = NULL;
}
}
for (i = 0; i < 4; i++) {
threat = &g_Vars.currentplayer->cmpfollowprops[i];
trackedprop = &g_Vars.currentplayer->trackedprops[i];
if (threat->prop && !sightIsReactiveToProp(threat->prop)) {
threat->prop = NULL;
if (trackedprop->prop && !sightIsReactiveToProp(trackedprop->prop)) {
trackedprop->prop = NULL;
}
}
threat = &g_Vars.currentplayer->lookingatprop;
trackedprop = &g_Vars.currentplayer->lookingatprop;
if (threat->prop && !sightIsReactiveToProp(threat->prop)) {
threat->prop = NULL;
if (trackedprop->prop && !sightIsReactiveToProp(trackedprop->prop)) {
trackedprop->prop = NULL;
}
switch (g_Vars.currentplayer->target) {
case SIGHTTARGET_1:
case SIGHTTARGET_2:
// Conditionally copy lookingatprop to cmpfollowprops[0], overwriting anything that's there
case SIGHTTARGET_DEFAULT:
case SIGHTTARGET_BETASCANNER:
// Conditionally copy lookingatprop to trackedprops[0], overwriting anything that's there
if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop) {
if (g_Vars.currentplayer->lookingatprop.prop != g_Vars.currentplayer->cmpfollowprops[0].prop) {
if (g_Vars.currentplayer->lookingatprop.prop != g_Vars.currentplayer->trackedprops[0].prop) {
struct sndstate *handle;
handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1);
threat = &g_Vars.currentplayer->cmpfollowprops[0];
trackedprop = &g_Vars.currentplayer->trackedprops[0];
threat->prop = g_Vars.currentplayer->lookingatprop.prop;
threat->x1 = g_Vars.currentplayer->lookingatprop.x1;
threat->y1 = g_Vars.currentplayer->lookingatprop.y1;
threat->x2 = g_Vars.currentplayer->lookingatprop.x2;
threat->y2 = g_Vars.currentplayer->lookingatprop.y2;
trackedprop->prop = g_Vars.currentplayer->lookingatprop.prop;
trackedprop->x1 = g_Vars.currentplayer->lookingatprop.x1;
trackedprop->y1 = g_Vars.currentplayer->lookingatprop.y1;
trackedprop->x2 = g_Vars.currentplayer->lookingatprop.x2;
trackedprop->y2 = g_Vars.currentplayer->lookingatprop.y2;
g_Vars.currentplayer->targetset[0] = 0;
}
} else {
g_Vars.currentplayer->cmpfollowprops[0].prop = NULL;
g_Vars.currentplayer->trackedprops[0].prop = NULL;
}
}
break;
case SIGHTTARGET_3:
// Conditionally copy lookingatprop to cmpfollowprops[0], but only if that slot is empty
case SIGHTTARGET_ROCKETLAUNCHER:
// Conditionally copy lookingatprop to trackedprops[0], but only if that slot is empty
if (sighton && g_Vars.currentplayer->lookingatprop.prop
&& sightCanTargetProp(g_Vars.currentplayer->lookingatprop.prop, 1)) {
index = sightFindFreeTargetIndex(1);
@ -270,20 +270,20 @@ void sightTick(bool sighton)
handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1);
threat = &g_Vars.currentplayer->cmpfollowprops[index];
trackedprop = &g_Vars.currentplayer->trackedprops[index];
threat->prop = g_Vars.currentplayer->lookingatprop.prop;
threat->x1 = g_Vars.currentplayer->lookingatprop.x1;
threat->y1 = g_Vars.currentplayer->lookingatprop.y1;
threat->x2 = g_Vars.currentplayer->lookingatprop.x2;
threat->y2 = g_Vars.currentplayer->lookingatprop.y2;
trackedprop->prop = g_Vars.currentplayer->lookingatprop.prop;
trackedprop->x1 = g_Vars.currentplayer->lookingatprop.x1;
trackedprop->y1 = g_Vars.currentplayer->lookingatprop.y1;
trackedprop->x2 = g_Vars.currentplayer->lookingatprop.x2;
trackedprop->y2 = g_Vars.currentplayer->lookingatprop.y2;
g_Vars.currentplayer->targetset[index] = 0;
}
}
break;
case SIGHTTARGET_4:
// Conditionally copy lookingatprop to any cmpfollowprops slot, but only if the slot is empty
case SIGHTTARGET_CMP150:
// Conditionally copy lookingatprop to any trackedprops slot, but only if the slot is empty
if (sighton && g_Vars.currentplayer->lookingatprop.prop
&& sightCanTargetProp(g_Vars.currentplayer->lookingatprop.prop, 4)) {
index = sightFindFreeTargetIndex(4);
@ -293,20 +293,20 @@ void sightTick(bool sighton)
handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1);
threat = &g_Vars.currentplayer->cmpfollowprops[index];
trackedprop = &g_Vars.currentplayer->trackedprops[index];
threat->prop = g_Vars.currentplayer->lookingatprop.prop;
threat->x1 = g_Vars.currentplayer->lookingatprop.x1;
threat->y1 = g_Vars.currentplayer->lookingatprop.y1;
threat->x2 = g_Vars.currentplayer->lookingatprop.x2;
threat->y2 = g_Vars.currentplayer->lookingatprop.y2;
trackedprop->prop = g_Vars.currentplayer->lookingatprop.prop;
trackedprop->x1 = g_Vars.currentplayer->lookingatprop.x1;
trackedprop->y1 = g_Vars.currentplayer->lookingatprop.y1;
trackedprop->x2 = g_Vars.currentplayer->lookingatprop.x2;
trackedprop->y2 = g_Vars.currentplayer->lookingatprop.y2;
g_Vars.currentplayer->targetset[index] = 0;
}
}
break;
case SIGHTTARGET_0:
case SIGHTTARGET_5:
case SIGHTTARGET_NONE:
case SIGHTTARGET_THREATDETECTOR:
break;
}
@ -333,7 +333,7 @@ s32 sightCalculateBoxBound(s32 targetx, s32 viewleft, s32 timeelapsed, s32 timee
}
/**
* Draw a red (or blue) box around the given threat.
* Draw a red (or blue) box around the given trackedprop.
*
* textid can be:
* 0 to have no label
@ -343,7 +343,7 @@ s32 sightCalculateBoxBound(s32 targetx, s32 viewleft, s32 timeelapsed, s32 timee
* 6 to label it as "5"
* 7 or above to treat textid as a proper language text ID.
*/
Gfx *sightDrawTargetBox(Gfx *gdl, struct threat *threat, s32 textid, s32 time)
Gfx *sightDrawTargetBox(Gfx *gdl, struct trackedprop *trackedprop, s32 textid, s32 time)
{
s32 viewleft = viGetViewLeft() / g_ScaleX;
s32 viewtop = viGetViewTop();
@ -362,13 +362,13 @@ Gfx *sightDrawTargetBox(Gfx *gdl, struct threat *threat, s32 textid, s32 time)
time = TICKS(512);
}
boxleft = sightCalculateBoxBound(threat->x1 / g_ScaleX, viewleft, time, TICKS(80));
boxtop = sightCalculateBoxBound(threat->y1, viewtop, time, TICKS(80));
boxright = sightCalculateBoxBound(threat->x2 / g_ScaleX, viewright, time, TICKS(80));
boxbottom = sightCalculateBoxBound(threat->y2, viewbottom, time, TICKS(80));
boxleft = sightCalculateBoxBound(trackedprop->x1 / g_ScaleX, viewleft, time, TICKS(80));
boxtop = sightCalculateBoxBound(trackedprop->y1, viewtop, time, TICKS(80));
boxright = sightCalculateBoxBound(trackedprop->x2 / g_ScaleX, viewright, time, TICKS(80));
boxbottom = sightCalculateBoxBound(trackedprop->y2, viewbottom, time, TICKS(80));
if (threat->prop) {
colour = sightIsPropFriendly(threat->prop) ? 0x000ff60 : 0xff000060;
if (trackedprop->prop) {
colour = sightIsPropFriendly(trackedprop->prop) ? 0x000ff60 : 0xff000060;
gdl = gfxSetPrimColour(gdl, colour);
@ -435,11 +435,9 @@ u32 var80070f84 = 0x43200000;
u32 var80070f88 = 0x42f00000;
u32 var80070f8c = 0x00000000;
u32 var80070f90 = 0x00000000;
u32 var80070f94 = 0x00000000;
u32 var80070f98 = 0x00000000;
GLOBAL_ASM(
glabel func0f0d7f54
glabel sightDrawAimer
/* f0d7f54: 27bdff30 */ addiu $sp,$sp,-208
/* f0d7f58: afbf0024 */ sw $ra,0x24($sp)
/* f0d7f5c: afb30020 */ sw $s3,0x20($sp)
@ -987,7 +985,7 @@ glabel func0f0d7f54
#if VERSION == VERSION_PAL_FINAL
GLOBAL_ASM(
glabel func0f0d87a8
glabel sightDrawDelayedAimer
.late_rodata
glabel var7f1adde0
.word 0xc019999a
@ -1529,7 +1527,7 @@ glabel var7f1af0ccpf
);
#elif VERSION == VERSION_PAL_BETA
GLOBAL_ASM(
glabel func0f0d87a8
glabel sightDrawDelayedAimer
.late_rodata
glabel var7f1adde0
.word 0xc019999a
@ -2071,7 +2069,7 @@ glabel var7f1af0ccpf
);
#else
GLOBAL_ASM(
glabel func0f0d87a8
glabel sightDrawDelayedAimer
.late_rodata
glabel var7f1adde0
.word 0x3d4ccccd
@ -2719,7 +2717,7 @@ glabel var7f1ade50
/* f0d9050: 02602025 */ or $a0,$s3,$zero
/* f0d9054: 8fa50088 */ lw $a1,0x88($sp)
/* f0d9058: 8fa60084 */ lw $a2,0x84($sp)
/* f0d905c: 0fc35fd5 */ jal func0f0d7f54
/* f0d905c: 0fc35fd5 */ jal sightDrawAimer
/* f0d9060: 24070008 */ addiu $a3,$zero,0x8
/* f0d9064: 1000012e */ b .L0f0d9520
/* f0d9068: 00409825 */ or $s3,$v0,$zero
@ -2767,7 +2765,7 @@ glabel var7f1ade50
/* f0d90fc: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9100: 02203825 */ or $a3,$s1,$zero
/* f0d9104: afa30010 */ sw $v1,0x10($sp)
/* f0d9108: 0fc35fd5 */ jal func0f0d7f54
/* f0d9108: 0fc35fd5 */ jal sightDrawAimer
/* f0d910c: afb00014 */ sw $s0,0x14($sp)
/* f0d9110: 10000103 */ b .L0f0d9520
/* f0d9114: 00409825 */ or $s3,$v0,$zero
@ -2777,7 +2775,7 @@ glabel var7f1ade50
/* f0d9120: 8fa50088 */ lw $a1,0x88($sp)
/* f0d9124: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9128: 00113840 */ sll $a3,$s1,0x1
/* f0d912c: 0fc361ea */ jal func0f0d87a8
/* f0d912c: 0fc361ea */ jal sightDrawDelayedAimer
/* f0d9130: afb00014 */ sw $s0,0x14($sp)
/* f0d9134: 100000fa */ b .L0f0d9520
/* f0d9138: 00409825 */ or $s3,$v0,$zero
@ -2854,7 +2852,7 @@ glabel var7f1ade50
/* f0d9240: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9244: 02203825 */ or $a3,$s1,$zero
/* f0d9248: afa30010 */ sw $v1,0x10($sp)
/* f0d924c: 0fc35fd5 */ jal func0f0d7f54
/* f0d924c: 0fc35fd5 */ jal sightDrawAimer
/* f0d9250: afb00014 */ sw $s0,0x14($sp)
/* f0d9254: 3c08800a */ lui $t0,%hi(g_Vars+0x284)
/* f0d9258: 8d08a244 */ lw $t0,%lo(g_Vars+0x284)($t0)
@ -2921,7 +2919,7 @@ glabel var7f1ade50
/* f0d9334: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9338: 02203825 */ or $a3,$s1,$zero
/* f0d933c: afa30010 */ sw $v1,0x10($sp)
/* f0d9340: 0fc35fd5 */ jal func0f0d7f54
/* f0d9340: 0fc35fd5 */ jal sightDrawAimer
/* f0d9344: afb00014 */ sw $s0,0x14($sp)
/* f0d9348: 10000075 */ b .L0f0d9520
/* f0d934c: 00409825 */ or $s3,$v0,$zero
@ -3051,7 +3049,7 @@ glabel var7f1ade50
/* f0d9508: 8fa60084 */ lw $a2,0x84($sp)
/* f0d950c: 02203825 */ or $a3,$s1,$zero
/* f0d9510: afa30010 */ sw $v1,0x10($sp)
/* f0d9514: 0fc35fd5 */ jal func0f0d7f54
/* f0d9514: 0fc35fd5 */ jal sightDrawAimer
/* f0d9518: afb00014 */ sw $s0,0x14($sp)
/* f0d951c: 00409825 */ or $s3,$v0,$zero
.L0f0d9520:
@ -3181,7 +3179,7 @@ glabel var7f1ade50
/* f0d9050: 02602025 */ or $a0,$s3,$zero
/* f0d9054: 8fa50088 */ lw $a1,0x88($sp)
/* f0d9058: 8fa60084 */ lw $a2,0x84($sp)
/* f0d905c: 0fc35fd5 */ jal func0f0d7f54
/* f0d905c: 0fc35fd5 */ jal sightDrawAimer
/* f0d9060: 24070008 */ addiu $a3,$zero,0x8
/* f0d9064: 1000012e */ b .L0f0d9520
/* f0d9068: 00409825 */ or $s3,$v0,$zero
@ -3229,7 +3227,7 @@ glabel var7f1ade50
/* f0d90fc: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9100: 02203825 */ or $a3,$s1,$zero
/* f0d9104: afa30010 */ sw $v1,0x10($sp)
/* f0d9108: 0fc35fd5 */ jal func0f0d7f54
/* f0d9108: 0fc35fd5 */ jal sightDrawAimer
/* f0d910c: afb00014 */ sw $s0,0x14($sp)
/* f0d9110: 10000103 */ b .L0f0d9520
/* f0d9114: 00409825 */ or $s3,$v0,$zero
@ -3239,7 +3237,7 @@ glabel var7f1ade50
/* f0d9120: 8fa50088 */ lw $a1,0x88($sp)
/* f0d9124: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9128: 00113840 */ sll $a3,$s1,0x1
/* f0d912c: 0fc361ea */ jal func0f0d87a8
/* f0d912c: 0fc361ea */ jal sightDrawDelayedAimer
/* f0d9130: afb00014 */ sw $s0,0x14($sp)
/* f0d9134: 100000fa */ b .L0f0d9520
/* f0d9138: 00409825 */ or $s3,$v0,$zero
@ -3316,7 +3314,7 @@ glabel var7f1ade50
/* f0d9240: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9244: 02203825 */ or $a3,$s1,$zero
/* f0d9248: afa30010 */ sw $v1,0x10($sp)
/* f0d924c: 0fc35fd5 */ jal func0f0d7f54
/* f0d924c: 0fc35fd5 */ jal sightDrawAimer
/* f0d9250: afb00014 */ sw $s0,0x14($sp)
/* f0d9254: 3c08800a */ lui $t0,%hi(g_Vars+0x284)
/* f0d9258: 8d08a244 */ lw $t0,%lo(g_Vars+0x284)($t0)
@ -3383,7 +3381,7 @@ glabel var7f1ade50
/* f0d9334: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9338: 02203825 */ or $a3,$s1,$zero
/* f0d933c: afa30010 */ sw $v1,0x10($sp)
/* f0d9340: 0fc35fd5 */ jal func0f0d7f54
/* f0d9340: 0fc35fd5 */ jal sightDrawAimer
/* f0d9344: afb00014 */ sw $s0,0x14($sp)
/* f0d9348: 10000075 */ b .L0f0d9520
/* f0d934c: 00409825 */ or $s3,$v0,$zero
@ -3513,7 +3511,7 @@ glabel var7f1ade50
/* f0d9508: 8fa60084 */ lw $a2,0x84($sp)
/* f0d950c: 02203825 */ or $a3,$s1,$zero
/* f0d9510: afa30010 */ sw $v1,0x10($sp)
/* f0d9514: 0fc35fd5 */ jal func0f0d7f54
/* f0d9514: 0fc35fd5 */ jal sightDrawAimer
/* f0d9518: afb00014 */ sw $s0,0x14($sp)
/* f0d951c: 00409825 */ or $s3,$v0,$zero
.L0f0d9520:
@ -3531,58 +3529,34 @@ glabel var7f1ade50
GLOBAL_ASM(
glabel sightDrawDefault
.late_rodata
glabel var7f1addec
.word sightDrawDefault+0xbc # f0d9034
glabel var7f1addf0
.word sightDrawDefault+0xf4 # f0d906c
glabel var7f1addf4
.word sightDrawDefault+0x1c4 # f0d913c
glabel var7f1addf8
.word sightDrawDefault+0x310 # f0d9288
glabel var7f1addfc
.word sightDrawDefault+0x3d8 # f0d9350
glabel var7f1ade00
.word sightDrawDefault+0x3d8 # f0d9350
glabel var7f1ade04
.word sightDrawDefault+0x4d8 # f0d9450
glabel var7f1ade08
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade0c
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade10
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade14
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade18
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade1c
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade20
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade24
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade28
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade2c
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade30
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade34
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade38
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade3c
.word sightDrawDefault+0x4e8 # f0d9460
glabel var7f1ade40
.word sightDrawDefault+0x488 # f0d9400
glabel var7f1ade44
.word sightDrawDefault+0x4a4 # f0d941c
glabel var7f1ade48
.word sightDrawDefault+0x4c0 # f0d9438
glabel var7f1ade4c
.word sightDrawDefault+0x4c8 # f0d9440
glabel var7f1ade50
.word sightDrawDefault+0x4d0 # f0d9448
glabel jtbl_var7f1addec
.word .L0f0d9034
.word .L0f0d906c
.word .L0f0d913c
.word .L0f0d9288
.word .L0f0d9350
.word .L0f0d9350
glabel jtbl_var7f1ade04
.word .L0f0d9450
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9460
.word .L0f0d9400
.word .L0f0d941c
.word .L0f0d9438
.word .L0f0d9440
.word .L0f0d9448
.text
/* f0d8f78: 27bdff68 */ addiu $sp,$sp,-152
/* f0d8f7c: 3c08800a */ lui $t0,%hi(g_Vars+0x284)
@ -3628,11 +3602,12 @@ glabel var7f1ade50
/* f0d9014: 2da10006 */ sltiu $at,$t5,0x6
/* f0d9018: 10200141 */ beqz $at,.L0f0d9520
/* f0d901c: 000d6880 */ sll $t5,$t5,0x2
/* f0d9020: 3c017f1b */ lui $at,%hi(var7f1addec)
/* f0d9020: 3c017f1b */ lui $at,%hi(jtbl_var7f1addec)
/* f0d9024: 002d0821 */ addu $at,$at,$t5
/* f0d9028: 8c2dddec */ lw $t5,%lo(var7f1addec)($at)
/* f0d9028: 8c2dddec */ lw $t5,%lo(jtbl_var7f1addec)($at)
/* f0d902c: 01a00008 */ jr $t5
/* f0d9030: 00000000 */ nop
.L0f0d9034:
/* f0d9034: 8fae009c */ lw $t6,0x9c($sp)
/* f0d9038: 11c00139 */ beqz $t6,.L0f0d9520
/* f0d903c: 3c1800ff */ lui $t8,0xff
@ -3643,10 +3618,11 @@ glabel var7f1ade50
/* f0d9050: 02602025 */ or $a0,$s3,$zero
/* f0d9054: 8fa50088 */ lw $a1,0x88($sp)
/* f0d9058: 8fa60084 */ lw $a2,0x84($sp)
/* f0d905c: 0fc35fd5 */ jal func0f0d7f54
/* f0d905c: 0fc35fd5 */ jal sightDrawAimer
/* f0d9060: 24070008 */ addiu $a3,$zero,0x8
/* f0d9064: 1000012e */ b .L0f0d9520
/* f0d9068: 00409825 */ or $s3,$v0,$zero
.L0f0d906c:
/* f0d906c: 8fb9009c */ lw $t9,0x9c($sp)
/* f0d9070: 1320012b */ beqz $t9,.L0f0d9520
/* f0d9074: 00000000 */ nop
@ -3691,7 +3667,7 @@ glabel var7f1ade50
/* f0d90fc: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9100: 02203825 */ or $a3,$s1,$zero
/* f0d9104: afa30010 */ sw $v1,0x10($sp)
/* f0d9108: 0fc35fd5 */ jal func0f0d7f54
/* f0d9108: 0fc35fd5 */ jal sightDrawAimer
/* f0d910c: afb00014 */ sw $s0,0x14($sp)
/* f0d9110: 10000103 */ b .L0f0d9520
/* f0d9114: 00409825 */ or $s3,$v0,$zero
@ -3701,10 +3677,11 @@ glabel var7f1ade50
/* f0d9120: 8fa50088 */ lw $a1,0x88($sp)
/* f0d9124: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9128: 00113840 */ sll $a3,$s1,0x1
/* f0d912c: 0fc361ea */ jal func0f0d87a8
/* f0d912c: 0fc361ea */ jal sightDrawDelayedAimer
/* f0d9130: afb00014 */ sw $s0,0x14($sp)
/* f0d9134: 100000fa */ b .L0f0d9520
/* f0d9138: 00409825 */ or $s3,$v0,$zero
.L0f0d913c:
/* f0d913c: 8fad009c */ lw $t5,0x9c($sp)
/* f0d9140: 11a000f7 */ beqz $t5,.L0f0d9520
/* f0d9144: 00000000 */ nop
@ -3778,7 +3755,7 @@ glabel var7f1ade50
/* f0d9240: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9244: 02203825 */ or $a3,$s1,$zero
/* f0d9248: afa30010 */ sw $v1,0x10($sp)
/* f0d924c: 0fc35fd5 */ jal func0f0d7f54
/* f0d924c: 0fc35fd5 */ jal sightDrawAimer
/* f0d9250: afb00014 */ sw $s0,0x14($sp)
/* f0d9254: 3c08800a */ lui $t0,%hi(g_Vars+0x284)
/* f0d9258: 8d08a244 */ lw $t0,%lo(g_Vars+0x284)($t0)
@ -3793,6 +3770,7 @@ glabel var7f1ade50
/* f0d927c: 95071b90 */ lhu $a3,0x1b90($t0)
/* f0d9280: 100000a7 */ b .L0f0d9520
/* f0d9284: 00409825 */ or $s3,$v0,$zero
.L0f0d9288:
/* f0d9288: 00008025 */ or $s0,$zero,$zero
/* f0d928c: 00008825 */ or $s1,$zero,$zero
/* f0d9290: 24120001 */ addiu $s2,$zero,0x1
@ -3845,10 +3823,11 @@ glabel var7f1ade50
/* f0d9334: 8fa60084 */ lw $a2,0x84($sp)
/* f0d9338: 02203825 */ or $a3,$s1,$zero
/* f0d933c: afa30010 */ sw $v1,0x10($sp)
/* f0d9340: 0fc35fd5 */ jal func0f0d7f54
/* f0d9340: 0fc35fd5 */ jal sightDrawAimer
/* f0d9344: afb00014 */ sw $s0,0x14($sp)
/* f0d9348: 10000075 */ b .L0f0d9520
/* f0d934c: 00409825 */ or $s3,$v0,$zero
.L0f0d9350:
/* f0d9350: 00008025 */ or $s0,$zero,$zero
/* f0d9354: 00008825 */ or $s1,$zero,$zero
/* f0d9358: 24120001 */ addiu $s2,$zero,0x1
@ -3890,11 +3869,12 @@ glabel var7f1ade50
/* f0d93e0: 2f010014 */ sltiu $at,$t8,0x14
/* f0d93e4: 1020001e */ beqz $at,.L0f0d9460
/* f0d93e8: 0018c080 */ sll $t8,$t8,0x2
/* f0d93ec: 3c017f1b */ lui $at,%hi(var7f1ade04)
/* f0d93ec: 3c017f1b */ lui $at,%hi(jtbl_var7f1ade04)
/* f0d93f0: 00380821 */ addu $at,$at,$t8
/* f0d93f4: 8c38de04 */ lw $t8,%lo(var7f1ade04)($at)
/* f0d93f4: 8c38de04 */ lw $t8,%lo(jtbl_var7f1ade04)($at)
/* f0d93f8: 03000008 */ jr $t8
/* f0d93fc: 00000000 */ nop
.L0f0d9400:
/* f0d9400: 9059005f */ lbu $t9,0x5f($v0)
/* f0d9404: 16590003 */ bne $s2,$t9,.L0f0d9414
/* f0d9408: 00000000 */ nop
@ -3903,6 +3883,7 @@ glabel var7f1ade50
.L0f0d9414:
/* f0d9414: 10000012 */ b .L0f0d9460
/* f0d9418: 24064cd5 */ addiu $a2,$zero,0x4cd5
.L0f0d941c:
/* f0d941c: 904b005f */ lbu $t3,0x5f($v0)
/* f0d9420: 164b0003 */ bne $s2,$t3,.L0f0d9430
/* f0d9424: 00000000 */ nop
@ -3911,12 +3892,16 @@ glabel var7f1ade50
.L0f0d9430:
/* f0d9430: 1000000b */ b .L0f0d9460
/* f0d9434: 24064cd8 */ addiu $a2,$zero,0x4cd8
.L0f0d9438:
/* f0d9438: 10000009 */ b .L0f0d9460
/* f0d943c: 24064cd5 */ addiu $a2,$zero,0x4cd5
.L0f0d9440:
/* f0d9440: 10000007 */ b .L0f0d9460
/* f0d9444: 24064cd4 */ addiu $a2,$zero,0x4cd4
.L0f0d9448:
/* f0d9448: 10000005 */ b .L0f0d9460
/* f0d944c: 24064cd6 */ addiu $a2,$zero,0x4cd6
.L0f0d9450:
/* f0d9450: 904c005f */ lbu $t4,0x5f($v0)
/* f0d9454: 564c0003 */ bnel $s2,$t4,.L0f0d9464
/* f0d9458: 01096821 */ addu $t5,$t0,$t1
@ -3975,7 +3960,7 @@ glabel var7f1ade50
/* f0d9508: 8fa60084 */ lw $a2,0x84($sp)
/* f0d950c: 02203825 */ or $a3,$s1,$zero
/* f0d9510: afa30010 */ sw $v1,0x10($sp)
/* f0d9514: 0fc35fd5 */ jal func0f0d7f54
/* f0d9514: 0fc35fd5 */ jal sightDrawAimer
/* f0d9518: afb00014 */ sw $s0,0x14($sp)
/* f0d951c: 00409825 */ or $s3,$v0,$zero
.L0f0d9520:
@ -3991,36 +3976,48 @@ glabel var7f1ade50
);
#endif
u32 var80070f94 = 0;
s32 var80070f98 = 0;
// Mismatch: Goal loads g_Vars.lvupdate240 differently for add to var80070f98.
//Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
//{
// s32 s1;
// s32 sp90;
// s32 radius;
// s32 cornergap;
// u32 colour;
// s32 x = (s32)g_Vars.currentplayer->crosspos[0] / g_ScaleX; // 88
// s32 y = g_Vars.currentplayer->crosspos[1]; // 84
// struct trackedprop *trackedprop;
// s32 i;
//
// static s32 var80070f98 = 0;
//
// gdl = func0f153628(gdl);
//
// switch (g_Vars.currentplayer->target) {
// case SIGHTTARGET_0: // f0d9034
// case SIGHTTARGET_NONE: // f0d9034
// // SIGHTTARGET_NONE is used for unarmed, but this appears to be
// // unreachable. The aimer is never drawn when unarmed.
// if (sighton) {
// gdl = func0f0d7f54(gdl, x, y, 8, 5, 0x00ff0028);
// colour = 0x00ff0028;
// radius = 8;
// cornergap = 5;
// gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
// }
// break;
// case SIGHTTARGET_1: // f0d906c
// case SIGHTTARGET_DEFAULT: // f0d906c
// // For most guns, render the aimer if holding R
// if (sighton) {
// // 084
// if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
// colour = 0x00ff0028;
// s1 = 8;
// sp90 = 5;
// radius = 8;
// cornergap = 5;
// } else {
// // 094
// colour = sightIsPropFriendly(NULL) ? 0x0000ff60 : 0xff000060;
// s1 = 6;
// sp90 = 3;
// radius = 6;
// cornergap = 3;
// }
//
// // 0b8
@ -4028,29 +4025,29 @@ glabel var7f1ade50
//
// switch (var80070f94) {
// case 0:
// gdl = func0f0d7f54(gdl, x, y, s1, sp90, colour);
// gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
// break;
// case 1:
// gdl = func0f0d87a8(gdl, x, y, s1 * 2, sp90 * 2, colour);
// gdl = sightDrawDelayedAimer(gdl, x, y, radius * 2, cornergap * 2, colour);
// break;
// }
// }
// break;
// case SIGHTTARGET_2: // f0d913c
// case SIGHTTARGET_BETASCANNER: // f0d913c
// // An unused sight target. When holding R, it flashes the text
// // "Identify" and draws a red box around the targetted prop.
// if (sighton) {
// s32 textx; // 78
// s32 texty; // 74
//
// // 154
// if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
// colour = 0x00ff0028;
// s1 = 8;
// sp90 = 5;
// radius = 8;
// cornergap = 5;
// } else {
// // 164
// colour = sightIsPropFriendly(NULL) ? 0x0000ff60 : 0xff000060;
// s1 = 6;
// sp90 = 3;
// radius = 6;
// cornergap = 3;
// }
//
// var80070f98 += g_Vars.lvupdate240;
@ -4065,46 +4062,46 @@ glabel var7f1ade50
// viGetWidth(), viGetHeight(), 0, 0);
// }
//
// gdl = func0f0d7f54(gdl, x, y, s1, sp90, colour);
// gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
//
// if (g_Vars.currentplayer->lookingatprop.prop) {
// gdl = sightDrawTargetBox(gdl, &g_Vars.currentplayer->lookingatprop, 1, g_Vars.currentplayer->targetset[0]);
// }
// }
// break;
// case SIGHTTARGET_3: // f0d9288
// case SIGHTTARGET_ROCKETLAUNCHER: // f0d9288
// for (i = 0; i < 1; i++) {
// if (g_Vars.currentplayer->cmpfollowprops[i].prop) {
// gdl = sightDrawTargetBox(gdl, &g_Vars.currentplayer->cmpfollowprops[i], 0,
// g_Vars.currentplayer->targetset[i]);
// trackedprop = &g_Vars.currentplayer->trackedprops[i];
//
// if (trackedprop->prop) {
// gdl = sightDrawTargetBox(gdl, trackedprop, 0, g_Vars.currentplayer->targetset[i]);
// }
// }
//
// if (sighton) {
// if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
// colour = 0x00ff0028;
// s1 = 8;
// sp90 = 5;
// radius = 8;
// cornergap = 5;
// } else {
// colour = sightIsPropFriendly(NULL) ? 0x0000ff60 : 0xff000060;
// s1 = 6;
// sp90 = 3;
// radius = 6;
// cornergap = 3;
// }
//
// gdl = func0f0d7f54(gdl, x, y, s1, sp90, colour);
// gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
// }
// break;
// case SIGHTTARGET_4: // f0d9350
// case SIGHTTARGET_5: // f0d9350
// case SIGHTTARGET_CMP150: // f0d9350
// case SIGHTTARGET_THREATDETECTOR: // f0d9350
// for (i = 0; i < 4; i++) {
// struct threat *threat = &g_Vars.currentplayer->cmpfollowprops[i];
// struct prop *prop = threat->prop;
// struct trackedprop *trackedprop = &g_Vars.currentplayer->trackedprops[i];
//
// // 36c
// if (prop) {
// if (trackedprop->prop) {
// // 380
// if (g_Vars.currentplayer->target == SIGHTTARGET_5) {
// struct defaultobj *obj = prop->obj;
// if (g_Vars.currentplayer->target == SIGHTTARGET_THREATDETECTOR) {
// struct defaultobj *obj = trackedprop->prop->obj;
// struct weaponobj *weapon;
// u32 textid = 0;
//
@ -4117,7 +4114,7 @@ glabel var7f1ade50
// textid = L_GUN_215; // "AUTOGUN"
// }
//
// weapon = prop->weapon;
// weapon = trackedprop->prop->weapon;
//
// if (weapon && weapon->base.type == OBJTYPE_WEAPON) {
// switch (weapon->weaponnum) {
@ -4152,14 +4149,10 @@ glabel var7f1ade50
// }
// }
//
// gdl = sightDrawTargetBox(gdl, &g_Vars.currentplayer->cmpfollowprops[i], textid,
// g_Vars.currentplayer->targetset[i]);
// gdl = sightDrawTargetBox(gdl, trackedprop, textid, g_Vars.currentplayer->targetset[i]);
// } else {
// // CMP150-tracked prop - render with index number
// // For some reason i + 2 is passed instead of i + 1,
// // but this is compensated for in sightDrawTargetBox.
// gdl = sightDrawTargetBox(gdl, &g_Vars.currentplayer->cmpfollowprops[i], i + 2,
// g_Vars.currentplayer->targetset[i]);
// // CMP150-tracked prop
// gdl = sightDrawTargetBox(gdl, trackedprop, i + 2, g_Vars.currentplayer->targetset[i]);
// }
// }
// }
@ -4167,15 +4160,15 @@ glabel var7f1ade50
// if (sighton) {
// if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
// colour = 0x00ff0028;
// s1 = 8;
// sp90 = 5;
// radius = 8;
// cornergap = 5;
// } else {
// colour = sightIsPropFriendly(NULL) ? 0x0000ff60 : 0xff000060;
// s1 = 6;
// sp90 = 3;
// radius = 6;
// cornergap = 3;
// }
//
// gdl = func0f0d7f54(gdl, x, y, s1, sp90, colour);
// gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
// }
// break;
// }
@ -7957,6 +7950,9 @@ bool sightHasTargetWhileAiming(s32 sight)
return false;
}
/**
* sighton is true if the player is using the aimer (ie. holding R).
*/
Gfx *sightDraw(Gfx *gdl, bool sighton, s32 sight)
{
if (sight);

View File

@ -9158,20 +9158,20 @@ void func0f1a0924(struct prop *prop)
sp56 = -2;
sp60 = -2;
modelSetRedBox(obj->model, &sp56, &sp64, &sp60, &sp68);
modelGetScreenCoords(obj->model, &sp56, &sp64, &sp60, &sp68);
for (i = 0; i < 4; i++) {
if (g_Vars.currentplayer->cmpfollowprops[i].prop == prop) {
if (g_Vars.currentplayer->trackedprops[i].prop == prop) {
return;
}
if (g_Vars.currentplayer->cmpfollowprops[i].prop == NULL) {
g_Vars.currentplayer->cmpfollowprops[i].prop = prop;
if (g_Vars.currentplayer->trackedprops[i].prop == NULL) {
g_Vars.currentplayer->trackedprops[i].prop = prop;
g_Vars.currentplayer->cmpfollowprops[i].x1 = sp64 - 2;
g_Vars.currentplayer->cmpfollowprops[i].x2 = sp56 + 2;
g_Vars.currentplayer->cmpfollowprops[i].y1 = sp68 - 2;
g_Vars.currentplayer->cmpfollowprops[i].y2 = sp60 + 2;
g_Vars.currentplayer->trackedprops[i].x1 = sp64 - 2;
g_Vars.currentplayer->trackedprops[i].x2 = sp56 + 2;
g_Vars.currentplayer->trackedprops[i].y1 = sp68 - 2;
g_Vars.currentplayer->trackedprops[i].y2 = sp60 + 2;
g_Vars.currentplayer->targetset[i] = 0;
return;
}

View File

@ -1143,7 +1143,7 @@
#define GUNAMMOREASON_NOCONTROL 0x02
#define GUNSIGHTREASON_1 0x01
#define GUNSIGHTREASON_AIMING 0x02
#define GUNSIGHTREASON_NOTAIMING 0x02
#define GUNSIGHTREASON_NOCONTROL 0x04
#define GUNSIGHTREASON_DAMAGE 0x10
@ -3521,12 +3521,12 @@
#define SIGHT_MAIAN 6
#define SIGHT_NONE 7
#define SIGHTTARGET_0 0
#define SIGHTTARGET_1 1
#define SIGHTTARGET_2 2
#define SIGHTTARGET_3 3
#define SIGHTTARGET_4 4
#define SIGHTTARGET_5 5
#define SIGHTTARGET_NONE 0
#define SIGHTTARGET_DEFAULT 1
#define SIGHTTARGET_BETASCANNER 2
#define SIGHTTARGET_ROCKETLAUNCHER 3
#define SIGHTTARGET_CMP150 4
#define SIGHTTARGET_THREATDETECTOR 5
#define SKEL_BASIC 0x02
#define SKEL_CHRGUN 0x03

View File

@ -13,7 +13,7 @@ void lvUpdateMiscSfx(void);
void lvReset(s32 stagenum);
Gfx *lvRenderFade(Gfx *gdl);
void lvFadeReset(void);
bool lvCheckCmpFollowThreat(struct threat *threat, s32 index);
bool lvUpdateTrackedProp(struct trackedprop *trackedprop, s32 index);
void lvFindThreatsForProp(struct prop *prop, bool inchild, struct coord *playerpos, s32 *activeslots, f32 *param_5);
void func0f168f24(struct prop *prop, bool inchild, struct coord *playerpos, s32 *activeslots, f32 *distances);
void lvFindThreats(void);

View File

@ -60,8 +60,8 @@ bool func0f06797c(struct coord *coord, f32 arg1, s32 padnum);
bool func0f0679ac(struct model *model, f32 *max, f32 *min, f32 arg3[2], f32 arg4[2]);
void func0f067bc4(struct model *model, f32 *max, f32 *min, s32 axis);
void func0f067d88(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4);
bool func0f067dc4(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4);
bool modelSetRedBox(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4);
bool modelGetScreenCoords2(struct model *model, f32 *x2, f32 *x1, f32 *y2, f32 *y1);
bool modelGetScreenCoords(struct model *model, f32 *x2, f32 *x1, f32 *y2, f32 *y1);
void func0f06803c(struct coord *arg0, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4);
struct defaultobj *objFindByPadNum(s32 padnum);
struct defaultobj *objFindByPos(struct coord *pos, s16 *rooms);

View File

@ -11,9 +11,9 @@ s32 sightFindFreeTargetIndex(s32 max);
void func0f0d7364(void);
void sightTick(bool sighton);
s32 sightCalculateBoxBound(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
Gfx *sightDrawTargetBox(Gfx *gdl, struct threat *threat, s32 textid, s32 time);
Gfx *func0f0d7f54(Gfx *gdl, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5);
Gfx *func0f0d87a8(Gfx *gdl, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5);
Gfx *sightDrawTargetBox(Gfx *gdl, struct trackedprop *trackedprop, s32 textid, s32 time);
Gfx *sightDrawAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colour);
Gfx *sightDrawDelayedAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colour);
Gfx *sightDrawDefault(Gfx *gdl, bool sighton);
Gfx *sightDrawClassic(Gfx *gdl, bool sighton);
Gfx *sightDrawType2(Gfx *gdl, bool sighton);

View File

@ -2040,12 +2040,12 @@ struct playerbond {
/*0x0360 0x0394*/ struct coord unk28;
};
struct threat {
struct trackedprop {
struct prop *prop;
s16 x1; // x1
s16 y1; // y1
s16 x2; // x2
s16 y2; // y2
s16 x1;
s16 y1;
s16 x2;
s16 y2;
};
struct beam {
@ -2549,8 +2549,8 @@ struct player {
/*0x161c*/ u16 floorflags;
/*0x161e*/ u8 floortype;
/*0x1620*/ u32 aimtype;
/*0x1624*/ struct threat lookingatprop;
/*0x1630*/ struct threat cmpfollowprops[4];
/*0x1624*/ struct trackedprop lookingatprop;
/*0x1630*/ struct trackedprop trackedprops[4];
/*0x1660*/ f32 crosspos[2];
/*0x1668*/ f32 crosspossum[2];
/*0x1670*/ f32 guncrossdamp;
@ -2726,7 +2726,7 @@ struct player {
/*0x1b84*/ bool tickdiefinished;
/*0x1b88*/ s32 introanimnum;
/*0x1b8c*/ s32 lastsighton;
/*0x1b90*/ u16 targetset[4]; // related to cmpfollowprops
/*0x1b90*/ u16 targetset[4]; // related to trackedprops
/*0x1b98*/ u8 target;
/*0x1b9c*/ f32 speedthetacontrol;
/*0x1ba0*/ s32 cam_room;
@ -5233,18 +5233,18 @@ struct mpconfigfull {
};
struct movedata {
/*0x00*/ s32 canswivelgun;
/*0x04*/ s32 canmanualaim;
/*0x08*/ s32 triggeron;
/*0x00*/ bool canswivelgun;
/*0x04*/ bool canmanualaim;
/*0x08*/ bool triggeron;
/*0x0c*/ s32 btapcount;
/*0x10*/ s32 canlookahead;
/*0x10*/ bool canlookahead;
/*0x14*/ s32 unk14;
/*0x18*/ s32 cannaturalturn;
/*0x1c*/ s32 cannaturalpitch;
/*0x20*/ s32 digitalstepforward;
/*0x24*/ s32 digitalstepback;
/*0x28*/ s32 digitalstepleft;
/*0x2c*/ s32 digitalstepright;
/*0x18*/ bool cannaturalturn;
/*0x1c*/ bool cannaturalpitch;
/*0x20*/ bool digitalstepforward;
/*0x24*/ bool digitalstepback;
/*0x28*/ bool digitalstepleft;
/*0x2c*/ bool digitalstepright;
/*0x30*/ f32 unk30;
/*0x34*/ f32 unk34;
/*0x38*/ f32 speedvertadown;
@ -5254,20 +5254,20 @@ struct movedata {
/*0x48*/ s32 weaponbackoffset;
/*0x4c*/ s32 weaponforwardoffset;
/*0x50*/ u32 unk50;
/*0x54*/ u32 unk54;
/*0x58*/ u32 unk58;
/*0x54*/ bool aiming;
/*0x58*/ bool zooming;
/*0x5c*/ f32 zoomoutfovpersec;
/*0x60*/ f32 zoominfovpersec;
/*0x64*/ s32 crouchdown;
/*0x68*/ s32 crouchup;
/*0x6c*/ s32 rleanleft;
/*0x70*/ s32 rleanright;
/*0x74*/ s32 detonating;
/*0x78*/ s32 canautoaim;
/*0x7c*/ s32 farsighttempautoseek;
/*0x80*/ s32 eyesshut;
/*0x84*/ s32 invertpitch;
/*0x88*/ s32 disablelookahead;
/*0x6c*/ bool rleanleft;
/*0x70*/ bool rleanright;
/*0x74*/ bool detonating;
/*0x78*/ bool canautoaim;
/*0x7c*/ bool farsighttempautoseek;
/*0x80*/ bool eyesshut;
/*0x84*/ bool invertpitch;
/*0x88*/ bool disablelookahead;
/*0x8c*/ s32 c1stickxsafe; // raw values but adjusted to remove dead zone
/*0x90*/ s32 c1stickysafe;
/*0x94*/ s32 c1stickxraw; // raw values from control stick