Remove coop/anti code paths

This commit is contained in:
Ryan Dwyer 2022-11-05 00:29:08 +10:00
parent 03151c9a3e
commit 05fe244f60
28 changed files with 327 additions and 2066 deletions

View File

@ -443,24 +443,10 @@ void amGetSlotDetails(s32 slot, u32 *flags, char *label)
default: // Orders screen
strcpy(label, "");
if (g_MissionConfig.iscoop) {
if (slot == 4) {
strcpy(label, langGet(L_MISC_474)); // "Perfect Buddies"
} else if (slot == 1) {
strcpy(label, langGet(L_MISC_472)); // "Aggressive"
} else if (slot == 7) {
strcpy(label, langGet(L_MISC_473)); // "Passive"
#if VERSION >= VERSION_NTSC_1_0
} else if (slot == 3) {
strcpy(label, langGet(L_MISC_475)); // "Stealth"
#endif
}
if (slot == 4) {
strcpy(label, langGet(L_MISC_172)); // "Orders"
} else {
if (slot == 4) {
strcpy(label, langGet(L_MISC_172)); // "Orders"
} else {
strcpy(label, botGetCommandName(g_AmBotCommands[slot]));
}
strcpy(label, botGetCommandName(g_AmBotCommands[slot]));
}
break;
}
@ -576,13 +562,8 @@ void amChangeScreen(s32 step)
}
} else {
// Solo missions, or MP with no teams
if (g_MissionConfig.iscoop && amGetFirstBuddyIndex() >= 0) {
// Weapon selection, second function and AI buddy commands
maxscreenindex = 2;
} else {
// Weapon selection and second function
maxscreenindex = 1;
}
// Weapon selection and second function
maxscreenindex = 1;
}
if (g_AmMenus[g_AmIndex].screenindex > maxscreenindex) {
@ -1350,42 +1331,12 @@ Gfx *amRender(Gfx *gdl)
mode = AMSLOTMODE_FOCUSED;
}
if (g_MissionConfig.iscoop && (buddynum = amGetFirstBuddyIndex(), buddynum >= 0)) {
if (mode == AMSLOTMODE_DEFAULT && g_AmMenus[g_AmIndex].screenindex >= 2) {
struct chrdata *chr = g_Vars.aibuddies[buddynum]->chr;
if (mode == AMSLOTMODE_DEFAULT && g_AmMenus[g_AmIndex].screenindex >= 2) {
s32 slotcmd = g_AmBotCommands[var800719a0[row][column]];
s32 botcmd = g_MpAllChrPtrs[mpchrnum]->aibot->command;
#if VERSION >= VERSION_NTSC_1_0
if (var800719a0[row][column] == 7) {
if (chr->hidden & CHRHFLAG_PASSIVE) {
mode = AMSLOTMODE_CURRENT;
}
} else if (var800719a0[row][column] == 1) {
if ((chr->hidden & CHRHFLAG_PASSIVE) == 0) {
mode = AMSLOTMODE_CURRENT;
}
}
#else
if (chr->hidden & CHRHFLAG_PASSIVE) {
if (var800719a0[row][column] == 7) {
mode = AMSLOTMODE_CURRENT;
}
} else {
if (var800719a0[row][column] == 1) {
mode = AMSLOTMODE_CURRENT;
}
}
#endif
}
} else {
if (g_Vars.normmplayerisrunning
&& mode == AMSLOTMODE_DEFAULT
&& g_AmMenus[g_AmIndex].screenindex >= 2) {
s32 slotcmd = g_AmBotCommands[var800719a0[row][column]];
s32 botcmd = g_MpAllChrPtrs[mpchrnum]->aibot->command;
if (slotcmd == botcmd) {
mode = AMSLOTMODE_CURRENT;
}
if (slotcmd == botcmd) {
mode = AMSLOTMODE_CURRENT;
}
}
@ -1408,22 +1359,8 @@ Gfx *amRender(Gfx *gdl)
}
// Render AI bot name and weapon
{
struct g_vars *vars = &g_Vars;
#if VERSION >= VERSION_JPN_FINAL
if (!(g_MissionConfig.iscoop && amGetFirstBuddyIndex() >= 0)
&& g_Vars.normmplayerisrunning
&& g_AmMenus[g_AmIndex].screenindex >= 2) {
gdl = amRenderAibotInfo(gdl, g_AmMenus[g_AmIndex].screenindex - 2);
}
#else
if (!(g_MissionConfig.iscoop && amGetFirstBuddyIndex() >= 0)
&& vars->normmplayerisrunning
&& g_AmMenus[g_AmIndex].screenindex >= 2) {
gdl = amRenderAibotInfo(gdl, g_AmMenus[g_AmIndex].screenindex - 2);
}
#endif
if (g_AmMenus[g_AmIndex].screenindex >= 2) {
gdl = amRenderAibotInfo(gdl, g_AmMenus[g_AmIndex].screenindex - 2);
}
// Note: the column and row values will never be 1 here, so this

View File

@ -1225,24 +1225,15 @@ void amTick(void)
if (toggle) {
if (g_AmMenus[g_AmIndex].screenindex >= 2) {
if (g_Vars.numaibuddies && g_MissionConfig.iscoop) {
// Bot command screen, in coop with AI buddies
if (g_AmMenus[g_AmIndex].slotnum == 4) {
gotonextscreen = true;
} else {
amApply(g_AmMenus[g_AmIndex].slotnum);
}
} else {
// Bot command screen, in multiplayer
if (g_AmBotCommands[g_AmMenus[g_AmIndex].slotnum] == MPBOTCOMMAND_ATTACK) {
amOpenPickTarget();
} else if (g_AmMenus[g_AmIndex].allbots == false) {
gotonextscreen = true;
}
// Bot command screen, in multiplayer
if (g_AmBotCommands[g_AmMenus[g_AmIndex].slotnum] == MPBOTCOMMAND_ATTACK) {
amOpenPickTarget();
} else if (g_AmMenus[g_AmIndex].allbots == false) {
gotonextscreen = true;
}
if (g_AmMenus[g_AmIndex].slotnum != 4) {
amApply(g_AmMenus[g_AmIndex].slotnum);
}
if (g_AmMenus[g_AmIndex].slotnum != 4) {
amApply(g_AmMenus[g_AmIndex].slotnum);
}
} else {
// Weapon or function screen

View File

@ -483,10 +483,6 @@ void bodyAllocateChr(s32 stagenum, struct packedchr *packed, s32 cmdindex)
chr->chrflags |= CHRCFLAG_CLONEABLE;
}
if (!g_Vars.normmplayerisrunning && g_MissionConfig.iscoop && g_Vars.numaibuddies > 0) {
chr->flags |= CHRFLAG0_AIVSAI;
}
if (random() % 5 == 0) {
// Make chr punch slower
chr->flags2 |= CHRFLAG1_ADJUSTPUNCHSPEED;

View File

@ -6152,17 +6152,6 @@ void bgunDisarm(struct prop *attackerprop)
bool drop;
if (!weaponHasFlag(weaponnum, WEAPONFLAG_UNDROPPABLE) && weaponnum <= WEAPON_RCP45) {
#if VERSION >= VERSION_NTSC_1_0
// Coop must not allow player to drop a mission critical weapon
// because AI lists can fail the mission if the player has zero
// quantity.
if (g_Vars.coopplayernum >= 0
&& (attackerprop == g_Vars.bond->prop || attackerprop == g_Vars.coop->prop)
&& bgunIsMissionCritical(weaponnum)) {
return;
}
#endif
if (weaponnum <= WEAPON_UNARMED || player->gunctrl.switchtoweaponnum != -1) {
return;
}

View File

@ -1022,9 +1022,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
// Handle shutting eyes in multiplayer
if (bmoveGetCrouchPos() == CROUCHPOS_SQUAT
&& g_Vars.currentplayer->crouchoffset == -90
&& g_Vars.mplayerisrunning
&& g_Vars.coopplayernum < 0) {
&& g_Vars.currentplayer->crouchoffset == -90) {
movedata.eyesshut = g_Vars.currentplayer->insightaimmode
&& !canmanualzoom
&& joyGetStickY(contpad2) < -30;
@ -1377,9 +1375,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
// Handle shutting eyes in multiplayer
if (bmoveGetCrouchPos() == CROUCHPOS_SQUAT
&& g_Vars.currentplayer->crouchoffset == -90
&& g_Vars.mplayerisrunning
&& g_Vars.coopplayernum <= -1) {
&& g_Vars.currentplayer->crouchoffset == -90) {
movedata.eyesshut = g_Vars.currentplayer->insightaimmode
&& !canmanualzoom
&& joyGetButtons(contpad1, c1allowedbuttons & (0 | D_CBUTTONS));

View File

@ -402,11 +402,7 @@ bool bwalkCalculateNewPositionWithPush(struct coord *delta, f32 rotateamount, bo
canpush = true;
}
} else if (chr->chrflags & CHRCFLAG_PUSHABLE) {
if (g_Vars.antiplayernum < 0
|| g_Vars.currentplayer != g_Vars.anti
|| (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE) == 0) {
canpush = true;
}
canpush = true;
}
if (canpush) {
@ -733,19 +729,6 @@ void bwalkUpdateVertical(void)
playerGetBbox(g_Vars.currentplayer->prop, &radius, &ymax, &ymin);
#if VERSION >= VERSION_NTSC_1_0
// Maybe reset counter-op's radius - not sure why
// Maybe it gets set to 0 when they die?
if (g_Vars.antiplayernum >= 0
&& g_Vars.currentplayer == g_Vars.anti
&& g_Vars.currentplayer->bond2.radius != 30
&& cdTestVolume(&g_Vars.currentplayer->prop->pos, 30, g_Vars.currentplayer->prop->rooms, CDTYPE_ALL, CHECKVERTICAL_YES, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y)) {
g_Vars.currentplayer->prop->chr->radius = 30;
g_Vars.currentplayer->bond2.radius = 30;
radius = 30;
}
#endif
// Determine if player is on a ladder
// If this comes up false, a second check is done... maybe checking if the
// player is touching a ladder from a room which shares the same coordinate

View File

@ -1352,16 +1352,6 @@ void chrRemove(struct prop *prop, bool delete)
chrClearReferences(prop - g_Vars.props);
projectilesUnrefOwner(prop);
if (g_Vars.normmplayerisrunning == false && g_MissionConfig.iscoop) {
s32 i;
for (i = 0; i < g_Vars.numaibuddies && i < 4; i++) {
if (g_Vars.aibuddies[i] == prop) {
g_Vars.aibuddies[i] = NULL;
}
}
}
chr->chrnum = -1;
rebuildTeams();
@ -2446,26 +2436,8 @@ s32 chrTick(struct prop *prop)
} else {
onscreen = func0f08e8ac(prop, &prop->pos, model0001af80(model), true);
if (g_Vars.mplayerisrunning) {
if (fulltick) {
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
if (onscreen) {
chr0f0220ec(chr, lvupdate240, 1);
} else if (model->anim->animnum2 != 0) {
chr0f0220ec(chr, lvupdate240, 0);
}
} else {
chr0f0220ec(chr, lvupdate240, 1);
}
}
} else if (onscreen) {
if (chr->act_stand.playwalkanim == true) {
chr0f0220ec(chr, lvupdate240, 0);
} else {
chr0f0220ec(chr, lvupdate240, 1);
}
} else if (model->anim->animnum2 != 0) {
chr0f0220ec(chr, lvupdate240, 0);
if (fulltick) {
chr0f0220ec(chr, lvupdate240, 1);
}
}
} else if (chr->actiontype == ACT_DEAD) {
@ -2543,10 +2515,6 @@ s32 chrTick(struct prop *prop)
prop->flags |= PROPFLAG_ONTHISSCREENTHISTICK | PROPFLAG_ONANYSCREENTHISTICK;
chr->chrflags |= CHRCFLAG_EVERONSCREEN;
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.bond) {
chr->hidden |= CHRHFLAG_00800000;
}
g_ModelJointPositionedFunc = &chrHandleJointPositioned;
g_CurModelChr = chr;
@ -2730,10 +2698,6 @@ s32 chrTick(struct prop *prop)
// Offscreen
prop->flags &= ~PROPFLAG_ONTHISSCREENTHISTICK;
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.bond) {
chr->hidden &= ~CHRHFLAG_00800000;
}
child = prop->child;
while (child) {
@ -5014,22 +4978,6 @@ void chrHit(struct shotdata *shotdata, struct hit *hit)
g_Vars.currentplayer->prop, hit->hitpart, hit->prop, hit->node,
hit->model, hit->hitthing.unk28 / 2, sp90);
if (g_Vars.antiplayernum >= 0
&& g_Vars.currentplayer == g_Vars.anti
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
return;
}
if (g_Vars.coopplayernum >= 0
&& g_Vars.coopfriendlyfire == 0
&& prop->type == PROPTYPE_PLAYER) {
return;
}
if (g_MissionConfig.iscoop && g_Vars.coopfriendlyfire == 0 && chr->team == TEAM_ALLY) {
return;
}
if (shield <= 0) {
if (hit->prop->type == PROPTYPE_WEAPON) {
// Shot a chr's weapon
@ -5383,8 +5331,7 @@ bool chrCalculateAutoAim(struct prop *prop, struct coord *arg1, f32 *arg2, f32 *
&& chr->actiontype != ACT_DEAD
&& (chr->chrflags & CHRCFLAG_NOAUTOAIM) == 0
&& ((chr->hidden & CHRHFLAG_CLOAKED) == 0)
&& !(prop->type == PROPTYPE_PLAYER && g_Vars.players[playermgrGetPlayerNumByProp(prop)]->isdead)
&& !(g_Vars.coopplayernum >= 0 && (prop == g_Vars.bond->prop || prop == g_Vars.coop->prop))) {
&& !(prop->type == PROPTYPE_PLAYER && g_Vars.players[playermgrGetPlayerNumByProp(prop)]->isdead)) {
struct model *model = chr->model;
Mtxf *mtx1;
Mtxf *mtx2;

View File

@ -4144,46 +4144,6 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
return;
}
// Don't damage if attacker was anti and chr is non-interactable by anti
if (g_Vars.antiplayernum >= 0
&& aprop
&& aprop == g_Vars.anti->prop
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
return;
}
// Don't damage if coop and friendly fire is off (human buddy)
if (g_Vars.coopplayernum >= 0
&& g_Vars.coopfriendlyfire == false
&& aprop
&& aprop != vprop
&& aprop->type == PROPTYPE_PLAYER
&& vprop->type == PROPTYPE_PLAYER) {
return;
}
// Don't damage if coop and friendly fire is off (AI buddy)
if (g_MissionConfig.iscoop
&& g_Vars.coopfriendlyfire == false
&& aprop
&& aprop != vprop
&& (aprop->type == PROPTYPE_PLAYER || aprop->type == PROPTYPE_CHR)
&& chr->team == TEAM_ALLY
&& aprop->chr->team == TEAM_ALLY) {
return;
}
// Don't allow coop AI to kill or destroy anything
// which anti wouldn't be able to
if (g_MissionConfig.iscoop
&& aprop
&& aprop != vprop
&& aprop->type == PROPTYPE_CHR
&& aprop->chr->team == TEAM_ALLY
&& (chr->hidden & CHRHFLAG_ANTINONINTERACTABLE)) {
return;
}
if (gset == NULL) {
gset = &gset2;
}
@ -4218,85 +4178,11 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
damage = 0;
}
// Apply damage scaling based on difficulty settings
if (g_Vars.mplayerisrunning == false) {
// Solo
if (explosion) {
if (vprop->type == PROPTYPE_PLAYER) {
damage *= g_ExplosionDamageTxScale;
}
} else if (aprop && aprop->type == PROPTYPE_PLAYER) {
// Player is attacking
damage *= g_PlayerDamageTxScale;
headshotdamagescale = 25;
} else if (aprop && aprop->type == PROPTYPE_CHR && vprop->type == PROPTYPE_PLAYER) {
// Chr is attacking player
damage *= g_PlayerDamageRxScale * pdmodeGetEnemyDamage();
}
if (vprop->type != PROPTYPE_PLAYER) {
damage /= pdmodeGetEnemyHealth();
}
if (vprop->type == PROPTYPE_PLAYER) {
healthscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->healthscale;
armourscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->armourscale;
}
} else if (g_Vars.coopplayernum >= 0) {
// Co-op
if (explosion) {
if (vprop->type == PROPTYPE_PLAYER) {
damage *= g_ExplosionDamageTxScale;
}
} else if (aprop && aprop->type == PROPTYPE_PLAYER && vprop->type != PROPTYPE_PLAYER) {
damage *= g_PlayerDamageTxScale;
headshotdamagescale = 25;
} else if (aprop && aprop->type == PROPTYPE_CHR && vprop->type == PROPTYPE_PLAYER) {
damage *= g_PlayerDamageRxScale * pdmodeGetEnemyDamage();
}
if (vprop->type != PROPTYPE_PLAYER) {
damage /= pdmodeGetEnemyHealth();
}
if (vprop->type == PROPTYPE_PLAYER) {
healthscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->healthscale;
armourscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->armourscale;
}
} else if (g_Vars.antiplayernum >= 0) {
// Anti
if (explosion) {
if (vprop == g_Vars.bond->prop) {
damage *= g_ExplosionDamageTxScale;
}
} else if (aprop && aprop == g_Vars.bond->prop) {
damage *= g_PlayerDamageTxScale;
headshotdamagescale = 25;
} else if (aprop && aprop != g_Vars.bond->prop && vprop == g_Vars.bond->prop) {
damage *= g_PlayerDamageRxScale * pdmodeGetEnemyDamage();
}
if (vprop != g_Vars.bond->prop) {
damage /= pdmodeGetEnemyHealth();
}
if (vprop == g_Vars.bond->prop) {
healthscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->healthscale;
armourscale = g_Vars.players[playermgrGetPlayerNumByProp(vprop)]->armourscale;
}
// Anti shooting other enemies is lethal
if (aprop && aprop == g_Vars.anti->prop && vprop != g_Vars.bond->prop) {
damage *= 100;
}
} else {
// Normal multiplayer
if (vprop->type == PROPTYPE_PLAYER) {
s32 prevplayernum = g_Vars.currentplayernum;
setCurrentPlayerNum(playermgrGetPlayerNumByProp(vprop));
damage *= g_Vars.currentplayerstats->damagescale;
setCurrentPlayerNum(prevplayernum);
}
if (vprop->type == PROPTYPE_PLAYER) {
s32 prevplayernum = g_Vars.currentplayernum;
setCurrentPlayerNum(playermgrGetPlayerNumByProp(vprop));
damage *= g_Vars.currentplayerstats->damagescale;
setCurrentPlayerNum(prevplayernum);
}
// Apply rumble
@ -8032,10 +7918,6 @@ void chrAlertOthersOfInjury(struct chrdata *chr, bool dying)
s32 numinrange = 0;
s32 numchrs = chrsGetNumSlots();
if (g_Vars.antiplayernum >= 0 && chr->prop == g_Vars.anti->prop) {
return;
}
if (chr->actiontype == ACT_ARGH) {
index = chr->act_argh.notifychrindex;
} else if (chr->actiontype == ACT_DIE || chr->actiontype == ACT_DRUGGEDDROP) {
@ -10123,12 +10005,7 @@ void chrTickShoot(struct chrdata *chr, s32 handnum)
sparksCreate(hitrooms[0], hitprop, &hitpos, NULL, NULL, SPARKTYPE_DEFAULT);
}
if (g_MissionConfig.iscoop && chr->team == TEAM_ALLY
&& (hitobj->flags2 & OBJFLAG2_IMMUNETOANTI)) {
// Co-op can't damage mission critical objects
} else {
objTakeGunfire(hitobj, gsetGetDamage(&gset), &hitpos, gset.weaponnum, playernum);
}
objTakeGunfire(hitobj, gsetGetDamage(&gset), &hitpos, gset.weaponnum, playernum);
}
} else if (hitsomething) {
// Hit the background
@ -13149,7 +13026,6 @@ void chraTickBg(void)
if (targetprop && (targetprop->type == PROPTYPE_CHR || targetprop->type == PROPTYPE_PLAYER)) {
if ((targetprop->type == PROPTYPE_PLAYER
&& !(g_Vars.antiplayernum >= 0 && g_Vars.anti && g_Vars.anti->prop == targetprop)
&& chrCompareTeams(chr, targetprop->chr, COMPARE_ENEMIES))) {
s32 time60;
s32 lastsee;
@ -13758,39 +13634,6 @@ s32 chrResolvePadId(struct chrdata *chr, s32 pad_id)
return pad_id;
}
/**
* For all chrs, clear their target and p1p2 values if set to the given player.
*
* This function is called when the given player has died. It causes all guards
* to switch their focus to the remaining coop player.
*/
void chrsClearRefsToPlayer(s32 playernum)
{
s32 otherplayernum;
s32 playerpropnum;
s32 i;
if (g_Vars.coopplayernum >= 0) {
if (playernum == g_Vars.bondplayernum) {
otherplayernum = g_Vars.coopplayernum;
playerpropnum = g_Vars.bond->prop - g_Vars.props;
} else {
otherplayernum = g_Vars.bondplayernum;
playerpropnum = g_Vars.coop->prop - g_Vars.props;
}
for (i = 0; i < chrsGetNumSlots(); i++) {
if (g_ChrSlots[i].p1p2 == playernum) {
g_ChrSlots[i].p1p2 = otherplayernum;
}
if (g_ChrSlots[i].target == playerpropnum) {
g_ChrSlots[i].target = -1;
}
}
}
}
s32 chrResolveId(struct chrdata *ref, s32 id)
{
if (ref) {
@ -13815,33 +13658,15 @@ s32 chrResolveId(struct chrdata *ref, s32 id)
id = g_Vars.bond->prop->chr->chrnum;
}
break;
case CHR_COOP:
if (g_Vars.coop && g_Vars.coop->prop && g_Vars.coop->prop->chr) {
id = g_Vars.coop->prop->chr->chrnum;
}
break;
case CHR_ANTI:
if (g_Vars.anti && g_Vars.anti->prop && g_Vars.anti->prop->chr) {
id = g_Vars.anti->prop->chr->chrnum;
}
break;
case CHR_P1P2:
{
u32 index = g_Vars.coopplayernum >= 0 ? ref->p1p2 : g_Vars.bondplayernum;
u32 index = g_Vars.bondplayernum;
struct player *player = g_Vars.players[index];
if (player && player->prop && player->prop->chr) {
id = player->prop->chr->chrnum;
}
}
break;
case CHR_P1P2_OPPOSITE:
if (g_Vars.coopplayernum >= 0) {
struct player *player = g_Vars.players[1 - ref->p1p2];
if (player && player->prop && player->prop->chr) {
id = player->prop->chr->chrnum;
}
}
break;
case CHR_TARGET:
{
struct prop *target = chrGetTargetProp(ref);
@ -13858,16 +13683,6 @@ s32 chrResolveId(struct chrdata *ref, s32 id)
id = g_Vars.bond->prop->chr->chrnum;
}
break;
case CHR_COOP:
if (g_Vars.coop && g_Vars.coop->prop && g_Vars.coop->prop->chr) {
id = g_Vars.coop->prop->chr->chrnum;
}
break;
case CHR_ANTI:
if (g_Vars.anti && g_Vars.anti->prop && g_Vars.anti->prop->chr) {
id = g_Vars.anti->prop->chr->chrnum;
}
break;
case CHR_P1P2:
{
struct player *player = g_Vars.players[g_Vars.bondplayernum];
@ -13876,14 +13691,6 @@ s32 chrResolveId(struct chrdata *ref, s32 id)
}
}
break;
case CHR_P1P2_OPPOSITE:
if (g_Vars.coopplayernum >= 0) {
struct player *player = g_Vars.players[g_Vars.coopplayernum];
if (player && player->prop && player->prop->chr) {
id = player->prop->chr->chrnum;
}
}
break;
}
}

View File

@ -840,11 +840,7 @@ void explosionInflictDamage(struct prop *expprop)
minfrac = (minfrac * 0.7f + 0.3f) * type->damage;
if (g_Vars.antiplayernum >= 0
&& g_Vars.antiplayernum == exp->owner
&& (obj->flags2 & OBJFLAG2_IMMUNETOANTI)) {
// anti cannot damage this obj
} else if (isfirstframe) {
if (isfirstframe) {
// Unblock path if this object is a path blocker
objUpdateLinkedScenery(obj, expprop);
@ -981,18 +977,12 @@ void explosionInflictDamage(struct prop *expprop)
minfrac *= 0.05f * g_Vars.lvupdate60freal;
}
if (g_Vars.normmplayerisrunning) {
{
struct chrdata *ownerchr = mpGetChrFromPlayerIndex(exp->owner);
if (ownerchr) {
ownerprop = ownerchr->prop;
}
} else if (exp->owner == g_Vars.bondplayernum) {
ownerprop = g_Vars.bond->prop;
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
ownerprop = g_Vars.coop->prop;
} else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) {
ownerprop = g_Vars.anti->prop;
}
chrDamageByExplosion(chr, minfrac, &spa0, ownerprop, &expprop->pos);
@ -1204,15 +1194,7 @@ u32 explosionTick(struct prop *prop)
scorchsize *= 0.8f + 0.2f * RANDOMFRAC();
if (g_Vars.normmplayerisrunning) {
chr = mpGetChrFromPlayerIndex(exp->owner);
} else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) {
chr = g_Vars.anti->prop->chr;
} else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) {
chr = g_Vars.coop->prop->chr;
} else {
chr = g_Vars.bond->prop->chr;
}
chr = mpGetChrFromPlayerIndex(exp->owner);
if (g_Rooms[exp->room].gfxdata) {
if (g_Rooms[exp->room].gfxdata->xlublocks && bgTestHitInRoom(&prop->pos, &exp->unk3d0, exp->room, &hitthing)) {

View File

@ -50,8 +50,8 @@ void gamefilePrintFlags(void)
void gamefileApplyOptions(struct gamefile *file)
{
s32 player1 = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) ? 0 : 4;
s32 player2 = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) ? 1 : 5;
s32 player1 = 4;
s32 player2 = 5;
optionsSetForwardPitch(player1, pakHasBitflag(GAMEFILEFLAG_P1_FORWARDPITCH, file->flags));
optionsSetAutoAim(player1, pakHasBitflag(GAMEFILEFLAG_P1_AUTOAIM, file->flags));
@ -139,8 +139,8 @@ void gamefileApplyOptions(struct gamefile *file)
void gamefileLoadDefaults(struct gamefile *file)
{
s32 player1 = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) ? 0 : 4;
s32 player2 = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) ? 1 : 5;
s32 player1 = 4;
s32 player2 = 5;
s32 i;
s32 j;
@ -274,8 +274,8 @@ s32 gamefileLoad(s32 device)
s32 ret;
u32 stack;
p1index = g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0 ? 0 : 4;
p2index = g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0 ? 1 : 5;
p1index = 4;
p2index = 5;
if (device >= 0) {
savebufferClear(&buffer);
@ -365,8 +365,8 @@ s32 gamefileSave(s32 device, s32 fileid, u16 deviceserial)
s32 p2index;
struct savebuffer buffer;
p1index = g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0 ? 0 : 4;
p2index = g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0 ? 1 : 5;
p1index = 4;
p2index = 5;
var80075bd0[0] = 1;

View File

@ -76,23 +76,6 @@ void gfxReset(void)
gfx = strtol(argFindByPrefix(1, "-mgfx"), NULL, 0) * 1024;
if (argFindByPrefix(1, "-mgfxtra")) {
// ******** Extra specified but are we in the correct game mode I wonder???\n
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) {
// ******** Extra Display List Memeory Required\n
// ******** Shall steal from video buffer\n
// ******** If you try and run hi-res then\n
// ******** you're gonna shafted up the arse\n
// ******** so don't blame me\n
gfxtra = strtol(argFindByPrefix(1, "-mgfxtra"), NULL, 0) * 1024;
} else {
// ******** No we're not so there\n
}
}
// ******** Original Amount required = %dK ber buffer\n
// ******** Extra Amount required = %dK ber buffer\n
// ******** Total of %dK (Double Buffered)\n
g_GfxSizesByPlayerCount[PLAYERCOUNT() - 1] = gfx + gfxtra;
}

View File

@ -85,10 +85,7 @@ u8 hudmsgsAreActive(void)
s32 hudmsgIsZoomRangeVisible(void)
{
return optionsGetShowZoomRange(g_Vars.currentplayerstats->mpindex)
&& (PLAYERCOUNT() == 1
|| !g_Vars.mplayerisrunning
|| g_Vars.coopplayernum >= 0
|| g_Vars.antiplayernum >= 0)
&& PLAYERCOUNT() == 1
&& currentPlayerGetSight() == SIGHT_ZOOM
&& g_Vars.currentplayer->cameramode != CAMERAMODE_THIRDPERSON;
}
@ -1493,13 +1490,6 @@ Gfx *hudmsgsRender(Gfx *gdl)
gdl = text0f153628(gdl);
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& g_InCutscene
&& g_MainIsEndscreen == 0
&& g_Vars.currentplayernum == 0) {
spdc = false;
}
for (i = 0; i < g_NumHudMessages; i++) {
msg = &g_HudMessages[i];

View File

@ -1114,17 +1114,10 @@ Gfx *lvRender(Gfx *gdl)
s32 i;
s32 playercount;
Gfx *savedgdl;
#if VERSION >= VERSION_NTSC_1_0
bool forcesingleplayer = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& playerHasSharedViewport();
#else
bool forcesingleplayer = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& ((g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE);
#endif
struct player *player;
struct chrdata *chr;
playercount = forcesingleplayer ? 1 : PLAYERCOUNT();
playercount = PLAYERCOUNT();
gSPClipRatio(gdl++, FRUSTRATIO_2);
@ -1134,11 +1127,7 @@ Gfx *lvRender(Gfx *gdl)
savedgdl = gdl;
if (forcesingleplayer) {
setCurrentPlayerNum(0);
g_Vars.currentplayerindex = 0;
islastplayer = true;
} else {
{
s32 nextplayernum = i + 1;
setCurrentPlayerNum(playermgrGetPlayerAtOrder(i));
islastplayer = playercount == nextplayernum;
@ -1225,10 +1214,7 @@ Gfx *lvRender(Gfx *gdl)
handsTickAttack();
// Calculate lookingatprop
if (PLAYERCOUNT() == 1
|| g_Vars.coopplayernum >= 0
|| g_Vars.antiplayernum >= 0
|| (weaponHasFlag(bgunGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK) && bmoveIsInSightAimMode())) {
if (bmoveIsInSightAimMode() && (PLAYERCOUNT() == 1 || weaponHasFlag(bgunGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK))) {
g_Vars.currentplayer->lookingatprop.prop = func0f061d54(HAND_RIGHT, 0, 0);
if (g_Vars.currentplayer->lookingatprop.prop) {
@ -1530,16 +1516,6 @@ Gfx *lvRender(Gfx *gdl)
playerStartNewLife();
}
}
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
#if VERSION >= VERSION_NTSC_1_0
&& playerHasSharedViewport()
#else
&& ((g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE)
#endif
&& g_Vars.currentplayernum != 0) {
gdl = savedgdl;
}
} // end of player loop
} // end of stage if-statements
@ -1593,172 +1569,29 @@ u32 var800840bc = 0;
void lvUpdateSoloHandicaps(void)
{
if (g_Vars.antiplayernum >= 0) {
if (g_Difficulty == DIFF_A) {
g_CctvWaitScale = 2;
g_CctvDamageRxScale = 2;
g_AutogunAccuracyScale = 0.5f;
g_AutogunDamageTxScale = 0.5f;
g_AutogunDamageRxScale = 2;
g_EnemyAccuracyScale = 0.5f;
g_PlayerDamageRxScale = 0.35f;
g_PlayerDamageTxScale = 4;
g_ExplosionDamageTxScale = 0.25f;
g_AutoAimScale = 1.5f;
g_AmmoQuantityScale = 3;
g_AttackWalkDurationScale = 0.2f;
} else if (g_Difficulty == DIFF_SA) {
g_CctvWaitScale = 2;
g_CctvDamageRxScale = 1.5f;
g_AutogunAccuracyScale = 0.5f;
g_AutogunDamageTxScale = 0.5f;
g_AutogunDamageRxScale = 1.5f;
g_EnemyAccuracyScale = 0.6f;
g_PlayerDamageRxScale = 0.5f;
g_PlayerDamageTxScale = 3;
g_ExplosionDamageTxScale = 0.25f;
g_AutoAimScale = 1.1f;
g_AmmoQuantityScale = 2.5f;
g_AttackWalkDurationScale = 0.5f;
} else {
g_CctvWaitScale = 2;
g_CctvDamageRxScale = 1;
g_AutogunAccuracyScale = 0.5f;
g_AutogunDamageTxScale = 0.5f;
g_AutogunDamageRxScale = 1;
g_EnemyAccuracyScale = 0.7f;
g_PlayerDamageRxScale = 0.65f;
g_PlayerDamageTxScale = 2;
g_ExplosionDamageTxScale = 0.25f;
g_AutoAimScale = 0.75f;
g_AmmoQuantityScale = 2;
g_AttackWalkDurationScale = 1;
}
} else if (g_Vars.coopplayernum >= 0) {
if (g_Difficulty == DIFF_A) {
g_CctvWaitScale = 2;
g_CctvDamageRxScale = 2;
g_AutogunAccuracyScale = 0.5f;
g_AutogunDamageTxScale = 0.5f;
g_AutogunDamageRxScale = 2;
g_EnemyAccuracyScale = 0.6f;
g_PlayerDamageRxScale = 0.5f;
g_PlayerDamageTxScale = 2;
g_ExplosionDamageTxScale = 0.25f;
g_AutoAimScale = 1.5f;
g_AmmoQuantityScale = 2;
g_AttackWalkDurationScale = 0.2f;
} else if (g_Difficulty == DIFF_SA) {
g_CctvWaitScale = 1;
g_CctvDamageRxScale = 1;
g_AutogunAccuracyScale = 0.75f;
g_AutogunDamageTxScale = 1;
g_AutogunDamageRxScale = 1;
g_EnemyAccuracyScale = 0.75f;
g_PlayerDamageRxScale = 1;
g_PlayerDamageTxScale = 1;
g_ExplosionDamageTxScale = 1;
#if VERSION >= VERSION_JPN_FINAL
g_AutoAimScale = 0.75f;
#else
g_AutoAimScale = g_Jpn ? 1.1f : 0.75f;
#endif
g_AmmoQuantityScale = 1.5f;
g_AttackWalkDurationScale = 0.5f;
} else {
g_CctvWaitScale = 1;
g_CctvDamageRxScale = 1;
g_AutogunAccuracyScale = 1;
g_AutogunDamageTxScale = 1.5f;
g_AutogunDamageRxScale = 1;
g_EnemyAccuracyScale = 1.5f;
g_PlayerDamageRxScale = 1.5f;
g_PlayerDamageTxScale = 1;
g_ExplosionDamageTxScale = 1.5f;
#if VERSION >= VERSION_JPN_FINAL
g_AutoAimScale = 0.2f;
#else
g_AutoAimScale = g_Jpn ? 0.75f : 0.2f;
#endif
g_AmmoQuantityScale = 1;
g_AttackWalkDurationScale = 1;
}
} else {
if (g_Difficulty == DIFF_A) {
f32 totalhealth;
f32 frac = 1;
f32 totalhealth;
f32 frac = 1;
if (g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
totalhealth = playerGetHealthFrac() + playerGetShieldFrac();
totalhealth = playerGetHealthFrac() + playerGetShieldFrac();
if (totalhealth <= 0.125f) {
frac = 0.5f;
} else if (totalhealth <= 0.6f) {
frac = (totalhealth - 0.125f) * 0.5f / 0.47500002384186f + 0.5f;
}
}
g_CctvWaitScale = 2;
g_CctvDamageRxScale = 2;
g_AutogunAccuracyScale = 0.5f * frac;
g_AutogunDamageTxScale = 0.5f * frac;
g_AutogunDamageRxScale = 2;
g_EnemyAccuracyScale = 0.6f;
g_PlayerDamageRxScale = 0.5f * frac;
g_PlayerDamageTxScale = 2;
g_ExplosionDamageTxScale = 0.25f * frac;
g_AutoAimScale = 1.5f;
g_AmmoQuantityScale = 2;
g_AttackWalkDurationScale = 0.2f;
} else if (g_Difficulty == DIFF_SA) {
g_CctvWaitScale = 1;
g_CctvDamageRxScale = 1;
g_AutogunAccuracyScale = 0.75f;
g_AutogunDamageTxScale = 0.75f;
g_AutogunDamageRxScale = 1;
g_EnemyAccuracyScale = 0.8f;
g_PlayerDamageRxScale = 0.6f;
g_PlayerDamageTxScale = 1;
g_ExplosionDamageTxScale = 0.75f;
#if VERSION >= VERSION_JPN_FINAL
g_AutoAimScale = 0.75f;
#else
g_AutoAimScale = g_Jpn ? 1.1f : 0.75f;
#endif
g_AmmoQuantityScale = 1.5f;
g_AttackWalkDurationScale = 0.5f;
} else if (g_Difficulty == DIFF_PA) {
g_CctvWaitScale = 1;
g_CctvDamageRxScale = 1;
g_AutogunAccuracyScale = 1;
g_AutogunDamageTxScale = 1;
g_AutogunDamageRxScale = 1;
g_EnemyAccuracyScale = 1.175f;
g_PlayerDamageRxScale = 1;
g_PlayerDamageTxScale = 1;
g_ExplosionDamageTxScale = 1;
#if VERSION >= VERSION_JPN_FINAL
g_AutoAimScale = 0.2f;
#else
g_AutoAimScale = g_Jpn ? 0.75f : 0.2f;
#endif
g_AmmoQuantityScale = 1;
g_AttackWalkDurationScale = 1;
} else if (g_Difficulty == DIFF_PD) {
g_CctvWaitScale = 1;
g_CctvDamageRxScale = 1;
g_AutogunAccuracyScale = 1;
g_AutogunDamageTxScale = 1;
g_AutogunDamageRxScale = 1;
g_EnemyAccuracyScale = 1.1f;
g_PlayerDamageRxScale = 1;
g_PlayerDamageTxScale = 1;
g_ExplosionDamageTxScale = 1;
g_AutoAimScale = 1;
g_AmmoQuantityScale = 1;
g_AttackWalkDurationScale = 1;
}
if (totalhealth <= 0.125f) {
frac = 0.5f;
} else if (totalhealth <= 0.6f) {
frac = (totalhealth - 0.125f) * 0.5f / 0.47500002384186f + 0.5f;
}
g_CctvWaitScale = 2;
g_CctvDamageRxScale = 2;
g_AutogunAccuracyScale = 0.5f * frac;
g_AutogunDamageTxScale = 0.5f * frac;
g_AutogunDamageRxScale = 2;
g_EnemyAccuracyScale = 0.6f;
g_PlayerDamageRxScale = 0.5f * frac;
g_PlayerDamageTxScale = 2;
g_ExplosionDamageTxScale = 0.25f * frac;
g_AutoAimScale = 1.5f;
g_AmmoQuantityScale = 2;
g_AttackWalkDurationScale = 0.2f;
}
#if PIRACYCHECKS

View File

@ -53,10 +53,6 @@ s32 menuhandlerControlStyleImpl(s32 operation, struct menuitem *item, union hand
L_OPTIONS_238, // "Double"
};
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpindex = g_Vars.currentplayerstats->mpindex;
}
switch (operation) {
case MENUOP_GETOPTIONCOUNT:
data->list.value = 8;
@ -103,11 +99,7 @@ s32 menuhandlerReversePitch(s32 operation, struct menuitem *item, union handlerd
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -122,8 +114,7 @@ s32 menuhandlerReversePitch(s32 operation, struct menuitem *item, union handlerd
s32 menuhandlerAimControl(s32 operation, struct menuitem *item, union handlerdata *data)
{
u32 playernum = (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
? g_Vars.currentplayerstats->mpindex : item->param3;
u32 playernum = item->param3;
#if VERSION >= VERSION_PAL_FINAL
s32 index = 0;
@ -315,11 +306,7 @@ s32 menuhandlerLookAhead(s32 operation, struct menuitem *item, union handlerdata
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -336,11 +323,7 @@ s32 menuhandlerHeadRoll(s32 operation, struct menuitem *item, union handlerdata
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -404,11 +387,6 @@ s32 menuhandlerHiRes(s32 operation, struct menuitem *item, union handlerdata *da
if (IS4MB()) {
return true;
}
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
if (PLAYERCOUNT() >= 2) {
return true;
}
}
break;
case MENUOP_GET:
return g_HiResEnabled == true;
@ -424,11 +402,7 @@ s32 menuhandlerAmmoOnScreen(s32 operation, struct menuitem *item, union handlerd
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -445,11 +419,7 @@ s32 menuhandlerShowGunFunction(s32 operation, struct menuitem *item, union handl
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_CHECKDISABLED:
@ -471,11 +441,7 @@ s32 menuhandlerShowMissionTime(s32 operation, struct menuitem *item, union handl
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -492,11 +458,7 @@ s32 menuhandlerAlwaysShowTarget(s32 operation, struct menuitem *item, union hand
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_CHECKDISABLED:
@ -518,11 +480,7 @@ s32 menuhandlerShowZoomRange(s32 operation, struct menuitem *item, union handler
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_CHECKDISABLED:
@ -544,11 +502,7 @@ s32 menuhandlerPaintball(s32 operation, struct menuitem *item, union handlerdata
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -565,11 +519,7 @@ s32 menuhandlerSightOnScreen(s32 operation, struct menuitem *item, union handler
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -586,11 +536,7 @@ s32 menuhandlerAutoAim(s32 operation, struct menuitem *item, union handlerdata *
{
u32 mpchrnum;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mpchrnum = g_Vars.currentplayerstats->mpindex;
} else {
mpchrnum = item->param3;
}
mpchrnum = item->param3;
switch (operation) {
case MENUOP_GET:
@ -662,7 +608,7 @@ s32 menudialog0010559c(s32 operation, struct menudialogdef *dialogdef, union han
case MENUOP_OPEN:
break;
case MENUOP_CLOSE:
if ((g_Vars.modifiedfiles & MODFILE_GAME) && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
if (g_Vars.modifiedfiles & MODFILE_GAME) {
if (filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_001, 0) == 0) {
data->dialog1.preventclose = true;
}

View File

@ -4128,14 +4128,6 @@ Gfx *dialogRender(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool l
bgx2 = dialog->x + dialog->width;
bgy2 = dialog->y + dialog->height;
#if VERSION >= VERSION_NTSC_1_0
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& menuGetRoot() == MENUROOT_MPENDSCREEN
&& !var8009dfc0) {
return gdl;
}
#endif
colour1 = MIXCOLOUR(dialog, unk28);
text0f156030(colour1);
@ -4162,13 +4154,6 @@ Gfx *dialogRender(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool l
#endif
sp170 = 1.0f - g_MenuData.unk010;
#if VERSION >= VERSION_NTSC_1_0
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && menuGetRoot() == MENUROOT_MPENDSCREEN) {
sp170 = 1.0f - dialog->statefrac;
}
#endif
sp170 = 1.0f - sp170 * sp170;
dialogheight *= sp170;
bgy2 = dialog->y + dialogheight;
@ -5950,19 +5935,9 @@ void menuReset(void)
g_MenuData.unk01c.unk004 = NULL;
if (g_Vars.stagenum == STAGE_CITRAINING) {
g_MissionConfig.iscoop = false;
g_MissionConfig.isanti = false;
g_MissionConfig.pdmode = false;
}
if (!g_Vars.mplayerisrunning) {
s32 max = 0;
if (g_Vars.stagenum == STAGE_CITRAINING) {
max = 4;
}
if (g_Vars.stagenum == STAGE_4MBMENU) {
max = 4;
}
@ -6282,20 +6257,6 @@ void dialogTick(struct menudialog *dialog, struct menuinputs *inputs, u32 tickfl
dialog->redrawtimer = 0.0f;
dialog->statefrac = 0.5f;
}
} else if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && menuGetRoot() == MENUROOT_MPENDSCREEN) {
if (var8009dfc0) {
#if VERSION >= VERSION_PAL_BETA
dialog->statefrac += g_Vars.diffframe240freal / 60.0f;
#else
dialog->statefrac += g_Vars.diffframe240 / 60.0f;
#endif
if (dialog->statefrac > 1.0f) {
dialog->state = MENUDIALOGSTATE_OPENING;
dialog->redrawtimer = 0.0f;
dialog->statefrac = 0.5f;
}
}
} else {
if (g_MenuData.nextbg == 255 || g_MenuData.bg != 0) {
dialog->state = MENUDIALOGSTATE_OPENING;
@ -9042,12 +9003,6 @@ u32 func0f0fd118(u32 playernum)
if (g_MpSetup.chrslots & (1 << playernum)) {
result = playernum;
}
} else {
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& PLAYERCOUNT() >= 2
&& playernum == 1) {
result = 1;
}
}
return result;

View File

@ -541,19 +541,7 @@ void menuTick(void)
case MENUROOT_MPPAUSE:
break;
case MENUROOT_MPENDSCREEN:
if (g_Vars.normmplayerisrunning) {
var80087260 = 3;
} else if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
struct mpplayerconfig tmp;
tmp = g_PlayerConfigsArray[4];
g_PlayerConfigsArray[4] = g_PlayerConfigsArray[0];
g_PlayerConfigsArray[0] = tmp;
tmp = g_PlayerConfigsArray[5];
g_PlayerConfigsArray[5] = g_PlayerConfigsArray[1];
g_PlayerConfigsArray[1] = tmp;
}
var80087260 = 3;
if (g_Vars.restartlevel) {
mainChangeToStage(mainGetStageNum());
@ -573,19 +561,6 @@ void menuTick(void)
mainChangeToStage(STAGE_4MBMENU);
}
break;
case MENUROOT_COOPCONTINUE:
if (g_Vars.coopplayernum >= 0) {
mpSetPaused(MPPAUSEMODE_UNPAUSED);
g_Vars.mplayerisrunning = false;
g_Vars.normmplayerisrunning = false;
g_Vars.lvmpbotlevel = 0;
titleSetNextStage(STAGE_CITRAINING);
setNumPlayers(1);
titleSetNextMode(TITLEMODE_SKIP);
mainChangeToStage(STAGE_CITRAINING);
g_MissionConfig.iscoop = false;
}
break;
}
}
}
@ -655,12 +630,6 @@ void menuTick(void)
}
g_Vars.players[i]->devicesinhibit = 0;
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& PLAYERCOUNT() >= 2
&& g_Menus[mpindex].curdialog) {
g_Vars.players[i]->devicesinhibit = 0;
}
}
}

View File

@ -179,12 +179,7 @@ void mpReset(void)
g_MpNumChrs = 0;
g_Vars.mplayerisrunning = true;
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
g_Vars.normmplayerisrunning = false;
} else {
g_Vars.normmplayerisrunning = true;
}
g_Vars.normmplayerisrunning = true;
g_Vars.perfectbuddynum = 0;
@ -192,59 +187,19 @@ void mpReset(void)
g_Vars.lvmpbotlevel = true;
}
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
struct mpplayerconfig tmp;
for (i = 0; i < 4; i++) {
if (g_MpSetup.chrslots & (1 << i)) {
g_Vars.playerstats[mpindex].mpindex = i;
tmp = g_PlayerConfigsArray[4];
g_PlayerConfigsArray[4] = g_PlayerConfigsArray[0];
g_PlayerConfigsArray[0] = tmp;
g_PlayerConfigsArray[i].contpad1 = i;
g_PlayerConfigsArray[i].contpad2 = 0;
tmp = g_PlayerConfigsArray[5];
g_PlayerConfigsArray[5] = g_PlayerConfigsArray[1];
g_PlayerConfigsArray[1] = tmp;
// Player index 0
g_Vars.playerstats[0].mpindex = 0;
g_PlayerConfigsArray[0].contpad1 = 0;
g_PlayerConfigsArray[0].contpad2 = 2;
if ((g_Vars.coopplayernum >= 0 && g_Vars.coopradaron)
|| (g_Vars.antiplayernum >= 0 && g_Vars.antiradaron)) {
g_PlayerConfigsArray[0].base.displayoptions |= MPDISPLAYOPTION_RADAR;
} else {
g_PlayerConfigsArray[0].base.displayoptions &= ~MPDISPLAYOPTION_RADAR;
}
// Player index 1
g_Vars.playerstats[1].mpindexu32 = 1;
g_PlayerConfigsArray[1].contpad1 = 1;
g_PlayerConfigsArray[1].contpad2 = 3;
if ((g_Vars.coopplayernum >= 0 && g_Vars.coopradaron)
|| (g_Vars.antiplayernum >= 0 && g_Vars.antiradaron)) {
g_PlayerConfigsArray[1].base.displayoptions |= MPDISPLAYOPTION_RADAR;
} else {
g_PlayerConfigsArray[1].base.displayoptions &= ~MPDISPLAYOPTION_RADAR;
}
g_MpNumChrs = 2;
} else {
for (i = 0; i < 4; i++) {
if (g_MpSetup.chrslots & (1 << i)) {
g_Vars.playerstats[mpindex].mpindex = i;
g_PlayerConfigsArray[i].contpad1 = i;
g_PlayerConfigsArray[i].contpad2 = 0;
mpCalculatePlayerTitle(&g_PlayerConfigsArray[i]);
mpCalculatePlayerTitle(&g_PlayerConfigsArray[i]);
g_PlayerConfigsArray[i].newtitle = g_PlayerConfigsArray[i].title;
g_MpNumChrs++;
mpindex++;
}
g_PlayerConfigsArray[i].newtitle = g_PlayerConfigsArray[i].title;
g_MpNumChrs++;
mpindex++;
}
}
@ -1258,8 +1213,6 @@ Gfx *mpRenderModalText(Gfx *gdl)
&& g_Vars.currentplayer->isdead
&& g_Vars.currentplayer->redbloodfinished
&& g_Vars.currentplayer->deathanimfinished
&& !(g_Vars.coopplayernum >= 0 && ((g_Vars.bond->isdead && g_Vars.coop->isdead) || !g_Vars.currentplayer->coopcanrestart || g_InCutscene))
&& !(g_Vars.antiplayernum >= 0 && ((g_Vars.currentplayer != g_Vars.anti || g_InCutscene)))
&& g_NumReasonsToEndMpMatch == 0) {
// Render "Press START" text
gdl = text0f153628(gdl);

View File

@ -488,7 +488,7 @@ void playerStartNewLife(void)
g_Vars.currentplayer->dostartnewlife = false;
if (g_Vars.coopplayernum < 0) {
{
struct prop *prop = g_Vars.currentplayer->prop->child;
while (prop) {
@ -545,36 +545,10 @@ void playerStartNewLife(void)
playerSetCamPropertiesWithRoom(&pos, &g_Vars.currentplayer->bond2.unk28,
&g_Vars.currentplayer->bond2.unk1c, rooms[0]);
if (g_Vars.coopplayernum >= 0) {
u32 stack;
bool ammotypesheld[33];
s32 stack2[2];
invClear();
for (i = 0; i != ARRAYCOUNT(ammotypesheld); i++) {
ammotypesheld[i] = false;
}
for (i = 1; i != ARRAYCOUNT(g_Weapons); i++) {
if (invHasSingleWeaponOrProp(i)) {
s32 ammotype = bgunGetAmmoTypeForWeapon(i, FUNC_PRIMARY);
if (ammotype >= 0 && ammotype <= AMMOTYPE_ECM_MINE) {
ammotypesheld[ammotype] = true;
}
}
}
for (i = 0; i != ARRAYCOUNT(ammotypesheld); i++) {
if (ammotypesheld[i] == false) {
g_Vars.currentplayer->ammoheldarr[i] = 0;
}
}
} else {
invClear();
for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->ammoheldarr); i++) {
g_Vars.currentplayer->ammoheldarr[i] = 0;
}
for (i = 0; i < ARRAYCOUNT(g_Vars.currentplayer->ammoheldarr); i++) {
g_Vars.currentplayer->ammoheldarr[i] = 0;
}
invGiveSingleWeapon(WEAPON_UNARMED);
@ -587,63 +561,53 @@ void playerStartNewLife(void)
if (cmd);
if (cmd);
if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti) {
while (cmd[0] != INTROCMD_END) {
switch (cmd[0]) {
case INTROCMD_SPAWN:
cmd += 3;
break;
case INTROCMD_CASE:
case INTROCMD_CASERESPAWN:
cmd += 3;
break;
case INTROCMD_HILL:
cmd += 2;
break;
case INTROCMD_WEAPON:
if (cmd[3] == 0) {
if (cmd[2] >= 0) {
invGiveDoubleWeapon(cmd[1], cmd[2]);
} else {
invGiveSingleWeapon(cmd[1]);
}
while (cmd[0] != INTROCMD_END) {
switch (cmd[0]) {
case INTROCMD_SPAWN:
cmd += 3;
break;
case INTROCMD_CASE:
case INTROCMD_CASERESPAWN:
cmd += 3;
break;
case INTROCMD_HILL:
cmd += 2;
break;
case INTROCMD_WEAPON:
if (cmd[3] == 0) {
if (cmd[2] >= 0) {
invGiveDoubleWeapon(cmd[1], cmd[2]);
} else {
invGiveSingleWeapon(cmd[1]);
}
cmd += 4;
break;
case INTROCMD_AMMO:
if (cmd[3] == 0) {
bgunSetAmmoQuantity(cmd[1], cmd[2]);
}
cmd += 4;
break;
case INTROCMD_3:
cmd += 8;
break;
case INTROCMD_4:
cmd += 2;
break;
case INTROCMD_OUTFIT:
cmd += 2;
break;
case INTROCMD_6:
cmd += 10;
break;
default:
cmd++;
break;
}
cmd += 4;
break;
case INTROCMD_AMMO:
if (cmd[3] == 0) {
bgunSetAmmoQuantity(cmd[1], cmd[2]);
}
cmd += 4;
break;
case INTROCMD_3:
cmd += 8;
break;
case INTROCMD_4:
cmd += 2;
break;
case INTROCMD_OUTFIT:
cmd += 2;
break;
case INTROCMD_6:
cmd += 10;
break;
default:
cmd++;
break;
}
}
}
if (g_Vars.coopplayernum >= 0 && g_Vars.currentplayer->stealhealth > 0) {
g_Vars.currentplayer->bondhealth = g_Vars.currentplayer->stealhealth;
g_Vars.currentplayer->oldhealth = 0;
g_Vars.currentplayer->oldarmour = 0;
g_Vars.currentplayer->apparenthealth = 0;
g_Vars.currentplayer->apparentarmour = 0;
}
bmoveUpdateRooms(g_Vars.currentplayer);
playerSpawn();
@ -802,123 +766,6 @@ void playerLoadDefaults(void)
g_Vars.currentplayer->unk1c3c = 0;
}
bool playerSpawnAnti(struct chrdata *hostchr, bool force)
{
struct prop *hostprop;
union modelrwdata *chrrootrwdata;
struct chrdata *playerchr = g_Vars.currentplayer->prop->chr;
union modelrwdata *playerrootrwdata;
hostprop = hostchr->prop;
hostchr->chrflags |= CHRCFLAG_PERIMDISABLEDTMP;
playerchr->hidden |= CHRHFLAG_00100000;
playerchr->radius = hostchr->radius;
if (chrMoveToPos(playerchr, &hostchr->prop->pos, hostchr->prop->rooms, chrGetInverseTheta(hostchr), false) || force) {
if (hostchr->weapons_held[0] && hostchr->weapons_held[1]) {
// Dual wielding
struct weaponobj *weapon1 = hostchr->weapons_held[0]->weapon;
struct weaponobj *weapon2 = hostchr->weapons_held[1]->weapon;
#if VERSION >= VERSION_NTSC_1_0
invGiveSingleWeapon(weapon1->weaponnum);
invGiveDoubleWeapon(weapon1->weaponnum, weapon1->weaponnum);
bgunEquipWeapon2(HAND_RIGHT, weapon1->weaponnum);
bgunEquipWeapon2(HAND_LEFT, weapon1->weaponnum);
#else
invGiveDoubleWeapon(weapon1->weaponnum, weapon2->weaponnum);
bgunEquipWeapon2(HAND_RIGHT, weapon1->weaponnum);
bgunEquipWeapon2(HAND_LEFT, weapon2->weaponnum);
#endif
} else if (hostchr->weapons_held[0]) {
// Right hand only
struct weaponobj *weapon = hostchr->weapons_held[0]->weapon;
if (weapon->weaponnum == WEAPON_SUPERDRAGON) {
invGiveSingleWeapon(WEAPON_DRAGON);
bgunEquipWeapon2(HAND_RIGHT, WEAPON_DRAGON);
} else {
invGiveSingleWeapon(weapon->weaponnum);
bgunEquipWeapon2(HAND_RIGHT, weapon->weaponnum);
}
} else if (hostchr->weapons_held[1]) {
// Left hand only
struct weaponobj *weapon = hostchr->weapons_held[1]->weapon;
if (weapon->weaponnum == WEAPON_SUPERDRAGON) {
invGiveSingleWeapon(WEAPON_DRAGON);
bgunEquipWeapon2(HAND_RIGHT, WEAPON_DRAGON);
} else {
invGiveSingleWeapon(weapon->weaponnum);
bgunEquipWeapon2(HAND_RIGHT, weapon->weaponnum);
}
} else {
// Unarmed
invGiveSingleWeapon(WEAPON_UNARMED);
bgunEquipWeapon2(HAND_RIGHT, WEAPON_UNARMED);
}
g_Vars.currentplayer->invdowntime = TICKS(-40);
g_Vars.currentplayer->usedowntime = TICKS(-40);
bgunGiveMaxAmmo(true);
g_Vars.currentplayer->bondhealth = (chrGetMaxDamage(hostchr) - hostchr->damage) * 0.125f;
if (g_Vars.currentplayer->bondhealth > 1) {
g_Vars.currentplayer->bondhealth = 1;
}
chrSetShield(playerchr, chrGetShield(hostchr));
g_Vars.currentplayer->haschrbody = false;
g_Vars.currentplayer->model00d4 = NULL;
chrRemove(g_Vars.currentplayer->prop, false);
if (hostchr->bodynum == BODY_SKEDAR) {
g_Vars.antiheadnum = HEAD_MRBLONDE;
g_Vars.antibodynum = BODY_MRBLONDE;
} else {
g_Vars.antiheadnum = hostchr->headnum;
g_Vars.antibodynum = hostchr->bodynum;
}
playerTickChrBody();
modelCopyAnimData(hostchr->model, playerchr->model);
func0f02e9a0(playerchr, 12);
chrrootrwdata = modelGetNodeRwData(hostchr->model, hostchr->model->filedata->rootnode);
playerrootrwdata = modelGetNodeRwData(playerchr->model, playerchr->model->filedata->rootnode);
playerrootrwdata->chrinfo = chrrootrwdata->chrinfo;
if (playerrootrwdata->chrinfo.unk34.y < 10) {
playerrootrwdata->chrinfo.unk34.y = 10;
}
if (playerrootrwdata->chrinfo.unk24.y < 10) {
playerrootrwdata->chrinfo.unk24.y = 10;
}
playerchr->radius = hostchr->radius;
g_Vars.currentplayer->bond2.radius = hostchr->radius;
chrRemove(hostprop, true);
propDeregisterRooms(hostprop);
propDelist(hostprop);
propDisable(hostprop);
propFree(hostprop);
return true;
}
hostchr->chrflags &= ~CHRCFLAG_PERIMDISABLEDTMP;
return false;
}
void playerSpawn(void)
{
f32 xdiff;
@ -949,145 +796,11 @@ void playerSpawn(void)
invGiveSingleWeapon(WEAPON_UNARMED);
playerSetShieldFrac(0);
if (g_Vars.mplayerisrunning) {
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti) {
numsqdists = 0;
force = false;
bgunEquipWeapon2(HAND_LEFT, g_DefaultWeapons[HAND_LEFT]);
bgunEquipWeapon2(HAND_RIGHT, g_DefaultWeapons[HAND_RIGHT]);
invGiveSingleWeapon(WEAPON_SUICIDEPILL);
bgunEquipWeapon2(HAND_LEFT, WEAPON_NONE);
bgunEquipWeapon2(HAND_RIGHT, WEAPON_UNARMED);
if (g_Vars.lvframenum > 0) {
s32 prevplayernum = g_Vars.currentplayernum;
setCurrentPlayerNum(g_Vars.bondplayernum);
bgun0f0a0c08(&sp84, &sp9c);
mtx4RotateVec(camGetProjectionMtxF(), &sp9c, &sp90);
mtx4TransformVec(camGetProjectionMtxF(), &sp84, &sp78);
setCurrentPlayerNum(prevplayernum);
}
if (g_Vars.currentplayer->model00d4 == NULL) {
playerTickChrBody();
}
for (i = 0; i < chrsGetNumSlots(); i++) {
if (g_ChrSlots[i].model
&& g_ChrSlots[i].prop
&& (g_ChrSlots[i].hidden & CHRHFLAG_00400000)
&& (g_ChrSlots[i].chrflags & CHRCFLAG_HIDDEN) == 0
&& g_ChrSlots[i].prop->type == PROPTYPE_CHR
&& !chrIsDead(&g_ChrSlots[i])
&& (g_ChrSlots[i].prop->flags & PROPFLAG_ENABLED)) {
if (g_Vars.bond->prop) {
xdiff = g_ChrSlots[i].prop->pos.x - g_Vars.bond->prop->pos.x;
ydiff = g_ChrSlots[i].prop->pos.y - g_Vars.bond->prop->pos.y;
zdiff = g_ChrSlots[i].prop->pos.z - g_Vars.bond->prop->pos.z;
} else {
xdiff = g_ChrSlots[i].prop->pos.x - g_Vars.currentplayer->prop->pos.x;
ydiff = g_ChrSlots[i].prop->pos.y - g_Vars.currentplayer->prop->pos.y;
zdiff = g_ChrSlots[i].prop->pos.z - g_Vars.currentplayer->prop->pos.z;
}
sqdist = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff;
if (g_Vars.lvframenum > 0
&& (g_ChrSlots[i].hidden & CHRHFLAG_00800000)
&& func0f06b39c(&sp78, &sp90, &g_ChrSlots[i].prop->pos, model0001af80(g_ChrSlots[i].model))
&& (random() % 8)) {
sqdist += 1000000;
}
// Insert sqdist to sorteddists, maintaining sort order,
// and mirror the changes into the sortedchrs array.
// Move j to the first sqdist that is further than the new one
for (j = 0; j < numsqdists; j++) {
if (sqdist < sorteddists[j]) {
break;
}
}
if (j < 10) {
// Move the higher sorteddists forward, removing the highest item
for (k = numsqdists; k > j; k--) {
if (k < 10) {
sortedchrs[k] = sortedchrs[k - 1];
sorteddists[k] = sorteddists[k - 1];
}
}
// Write new sqdist
sortedchrs[j] = &g_ChrSlots[i];
sorteddists[j] = sqdist;
if (numsqdists < 9) {
numsqdists++;
}
}
}
}
// Randomly swap some of the earlier elements so the player
// doesn't always spawn into the closest
if (numsqdists > 1 && (random() % 2) == 0) {
tmpchr = sortedchrs[0];
sqdist = sorteddists[0];
sortedchrs[0] = sortedchrs[1];
sorteddists[0] = sorteddists[1];
sortedchrs[1] = tmpchr;
sorteddists[1] = sqdist;
}
if (numsqdists > 2 && (random() % 4) == 0) {
tmpchr = sortedchrs[0];
sqdist = sorteddists[0];
sortedchrs[0] = sortedchrs[2];
sorteddists[0] = sorteddists[2];
sortedchrs[2] = tmpchr;
sorteddists[2] = sqdist;
}
// Iterate sortedchrs in order and try to spawn into any of them.
// The spawn may fail if the chr is on-screen, and potentially in
// some other conditions such as the chr being too close to a wall.
// If no chrs can be spawned into, iterate the list again but this
// time allowing the spawn to happen on-screen (force = true).
for (i = 0; i < numsqdists; i++) {
if (playerSpawnAnti(sortedchrs[i], force)) {
break;
}
if (i == numsqdists - 1) {
i = 0;
if (force) {
break;
}
force = true;
}
}
if (g_Vars.currentplayer->prop->chr) {
g_Vars.currentplayer->prop->chr->blurdrugamount = 0;
g_Vars.currentplayer->prop->chr->blurnumtimesdied = 0;
}
} else {
bgunEquipWeapon2(HAND_LEFT, g_DefaultWeapons[HAND_LEFT]);
bgunEquipWeapon2(HAND_RIGHT, g_DefaultWeapons[HAND_RIGHT]);
#if VERSION >= VERSION_NTSC_1_0
if (g_Vars.currentplayer->model00d4 == NULL
&& (IS8MB() || g_Vars.fourmeg2player || g_MpAllChrPtrs[g_Vars.currentplayernum] == NULL)) {
playerTickChrBody();
}
#else
if (g_Vars.currentplayer->model00d4 == NULL) {
playerTickChrBody();
}
#endif
}
if (g_Vars.currentplayer->model00d4 == NULL) {
playerTickChrBody();
}
playerUpdatePerimInfo();
@ -1129,110 +842,17 @@ void playersTickAllChrBodies(void)
void playerChooseBodyAndHead(s32 *bodynum, s32 *headnum, s32 *arg2)
{
s32 outfit;
bool solo;
if (g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpheadnum < mpGetNumHeads2()) {
*headnum = mpGetHeadId(g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpheadnum);
} else {
*headnum = g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpheadnum - mpGetNumHeads2();
if (g_Vars.antiplayernum >= 0
&& g_Vars.currentplayer == g_Vars.anti
&& g_Vars.antiheadnum >= 0
&& g_Vars.antibodynum >= 0) {
*headnum = g_Vars.antiheadnum;
*bodynum = g_Vars.antibodynum;
return;
}
if (g_Vars.normmplayerisrunning) {
if (g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpheadnum < mpGetNumHeads2()) {
*headnum = mpGetHeadId(g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpheadnum);
} else {
*headnum = g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpheadnum - mpGetNumHeads2();
if (arg2) {
*arg2 = true;
}
}
*bodynum = mpGetBodyId(g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpbodynum);
return;
}
outfit = g_Vars.currentplayer->bondtype;
solo = !(g_Vars.coopplayernum >= 0) || (g_Vars.currentplayer != g_Vars.coop);
if (g_Vars.stagenum == STAGE_VILLA && lvGetDifficulty() >= DIFF_PA) {
outfit = OUTFIT_NEGOTIATOR;
}
if (g_Vars.currentplayer->disguised) {
switch (g_Vars.stagenum) {
case STAGE_RESCUE: outfit = OUTFIT_LAB; break;
case STAGE_AIRBASE: outfit = OUTFIT_STEWARDESS; break;
if (arg2) {
*arg2 = true;
}
}
switch (outfit) {
default:
case OUTFIT_DEFAULT:
*bodynum = BODY_DARK_COMBAT;
*headnum = solo ? HEAD_DARK_COMBAT : HEAD_VD;
break;
case OUTFIT_ELVIS:
*bodynum = BODY_THEKING;
*headnum = solo ? HEAD_ELVIS : HEAD_ELVIS;
break;
case OUTFIT_TRENT:
*bodynum = BODY_TRENT;
*headnum = solo ? HEAD_TRENT : HEAD_TRENT;
break;
case OUTFIT_TRENCH:
*bodynum = BODY_DARK_TRENCH;
*headnum = solo ? HEAD_DARK_COMBAT : HEAD_VD;
break;
case OUTFIT_FROCK_RIPPED:
*bodynum = BODY_DARK_RIPPED;
*headnum = solo ? HEAD_DARK_FROCK : HEAD_VD;
break;
case OUTFIT_FROCK:
*bodynum = BODY_DARK_FROCK;
*headnum = solo ? HEAD_DARK_FROCK : HEAD_VD;
break;
case OUTFIT_LEATHER:
*bodynum = BODY_DARK_LEATHER;
*headnum = solo ? HEAD_DARK_COMBAT : HEAD_VD;
break;
case OUTFIT_DEEPSEA:
*bodynum = BODY_DARKWET;
*headnum = solo ? HEAD_DARK_COMBAT : HEAD_VD;
break;
case OUTFIT_WETSUIT:
*bodynum = BODY_DARKAQUALUNG;
*headnum = solo ? HEAD_DARKAQUA : HEAD_VD;
break;
case OUTFIT_SNOW:
*bodynum = BODY_DARKSNOW;
*headnum = solo ? HEAD_DARK_SNOW : HEAD_VD;
break;
case OUTFIT_LAB:
*bodynum = BODY_DARKLAB;
*headnum = solo ? HEAD_DARK_COMBAT : HEAD_VD;
break;
case OUTFIT_STEWARDESS:
*bodynum = BODY_DARK_AF1;
*headnum = solo ? HEAD_DARK_FROCK : HEAD_VD;
break;
case OUTFIT_NEGOTIATOR:
*bodynum = BODY_DARK_NEGOTIATOR;
*headnum = solo ? HEAD_DARK_FROCK : HEAD_VD;
break;
case OUTFIT_MRBLONDE:
*bodynum = BODY_MRBLONDE;
*headnum = solo ? HEAD_MRBLONDE : HEAD_MRBLONDE;
break;
case OUTFIT_MAIAN:
*bodynum = BODY_ELVIS1;
*headnum = solo ? HEAD_MAIAN_S : HEAD_MAIAN_S;
break;
}
*bodynum = mpGetBodyId(g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.mpbodynum);
}
/**
@ -1456,15 +1076,6 @@ void playerTickChrBody(void)
chr->radius = g_Vars.currentplayer->bond2.radius;
g_Vars.currentplayer->vv_eyeheight = (s32)g_HeadsAndBodies[bodynum].height;
#if VERSION >= VERSION_NTSC_1_0
if (g_Vars.antiplayernum >= 0
&& g_Vars.currentplayer == g_Vars.anti
&& g_Vars.currentplayer->vv_eyeheight > 159) {
g_Vars.currentplayer->vv_eyeheight = 159;
}
#endif
g_Vars.currentplayer->vv_headheight = g_Vars.currentplayer->vv_eyeheight;
if (headnum >= 0) {
@ -2733,54 +2344,31 @@ s16 playerGetFbHeight(void)
return height;
}
#if VERSION >= VERSION_NTSC_1_0
bool playerHasSharedViewport(void)
{
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& menuGetRoot() == MENUROOT_MPENDSCREEN
&& var8009dfc0 == 0) {
return true;
}
return (g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE;
}
#endif
s16 playerGetViewportWidth(void)
{
s16 width;
#if VERSION >= VERSION_NTSC_1_0
if (!playerHasSharedViewport())
#else
if ((!g_InCutscene || g_MainIsEndscreen) && menuGetRoot() != MENUROOT_COOPCONTINUE)
#endif
{
if (PLAYERCOUNT() >= 3) {
// 3/4 players
if (PLAYERCOUNT() >= 3) {
// 3/4 players
width = g_ViModes[g_ViRes].width / 2;
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
width--;
}
} else if (PLAYERCOUNT() == 2) {
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
// 2 players vsplit
width = g_ViModes[g_ViRes].width / 2;
if (g_Vars.currentplayernum == 0 || g_Vars.currentplayernum == 2) {
if (g_Vars.currentplayernum == 0) {
width--;
}
} else if (PLAYERCOUNT() == 2) {
if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL || g_Vars.fourmeg2player) {
// 2 players vsplit
width = g_ViModes[g_ViRes].width / 2;
if (g_Vars.currentplayernum == 0) {
width--;
}
} else {
// 2 players full width
width = g_ViModes[g_ViRes].width;
}
} else {
// 1 player
// 2 players full width
width = g_ViModes[g_ViRes].width;
}
} else {
// Probably cutscene
// 1 player
width = g_ViModes[g_ViRes].width;
}
@ -2789,11 +2377,7 @@ s16 playerGetViewportWidth(void)
s16 playerGetViewportLeft(void)
{
#if VERSION >= VERSION_NTSC_1_0
s32 something = !playerHasSharedViewport();
#else
s32 something = !((g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE);
#endif
s32 something = true;
s16 left;
if (PLAYERCOUNT() >= 3 && something != 0) {
@ -2829,13 +2413,7 @@ s16 playerGetViewportHeight(void)
{
s16 height;
if (PLAYERCOUNT() >= 2
#if VERSION >= VERSION_NTSC_1_0
&& !playerHasSharedViewport()
#else
&& !((g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE)
#endif
) {
if (PLAYERCOUNT() >= 2) {
s16 tmp = g_ViModes[g_ViRes].fullheight;
if (IS4MB() && !g_Vars.fourmeg2player) {
@ -2881,13 +2459,7 @@ s16 playerGetViewportTop(void)
{
s16 top;
if (PLAYERCOUNT() >= 2
#if VERSION >= VERSION_NTSC_1_0
&& !playerHasSharedViewport()
#else
&& !((g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE)
#endif
) {
if (PLAYERCOUNT() >= 2) {
top = g_ViModes[g_ViRes].fulltop;
if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL || PLAYERCOUNT() != 2) {
@ -3424,10 +2996,6 @@ void playerTick(bool arg0)
g_ViRes = g_HiResEnabled;
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() > 1) {
g_ViRes = VIRES_LO;
}
#if PAL
text0f1531dc(false);
#else
@ -4032,23 +3600,6 @@ void playerTick(bool arg0)
if (g_Vars.currentplayer->redbloodfinished == false) {
bgunHandlePlayerDead();
}
if (g_Vars.currentplayer->redbloodfinished && g_Vars.currentplayer->deathanimfinished) {
if (g_Vars.mplayerisrunning == false) {
mainEndStage();
} else if (g_Vars.coopplayernum >= 0) {
if (g_Vars.currentplayer == g_Vars.bond
&& g_Vars.coop->isdead
&& g_Vars.coop->redbloodfinished
&& g_Vars.coop->deathanimfinished) {
mainEndStage();
} else {
chrsClearRefsToPlayer(g_Vars.currentplayernum);
}
} else if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.bond) {
mainEndStage();
}
}
}
if (g_Vars.tickmode == TICKMODE_GE_FADEOUT && playerIsFadeComplete()) {
@ -4479,148 +4030,43 @@ Gfx *playerRenderHud(Gfx *gdl)
if (playerIsFadeComplete()) {
bool canrestart = false;
if (g_Vars.mplayerisrunning) {
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
// Coop or anti
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
u32 playernum = g_Vars.currentplayernum;
s32 playercount = PLAYERCOUNT();
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
s32 numdeaths = 0;
s32 i;
if (chr) {
chr->chrflags |= CHRCFLAG_HIDDEN;
}
if (chr) {
chr->chrflags |= CHRCFLAG_HIDDEN;
}
if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti) {
// Anti
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused()) {
g_Vars.currentplayer->dostartnewlife = true;
}
} else {
// Coop
if (g_Vars.coopplayernum >= 0 &&
(!g_Vars.bond->isdead || !g_Vars.coop->isdead)) {
f32 totalhealth;
u32 buddyplayernum = g_Vars.bondplayernum;
u32 prevplayernum = g_Vars.currentplayernum;
f32 stealhealth;
f32 shield;
for (i = 0; i < playercount; i++) {
numdeaths += g_Vars.playerstats[i].kills[playernum];
}
canrestart = joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
&& !mpIsPaused();
if (g_BossFile.locktype == MPLOCKTYPE_CHALLENGE) {
if (g_Vars.currentplayer->deadtimer < 0) {
g_Vars.currentplayer->deadtimer = TICKS(600);
}
// Get ready to respawn.
// The other player's health will be halved.
buddyplayernum = g_Vars.currentplayer == g_Vars.coop ? g_Vars.bondplayernum : g_Vars.coopplayernum;
if (g_Vars.currentplayer->deadtimer >= 0) {
g_Vars.currentplayer->deadtimer -= g_Vars.lvupdate60;
setCurrentPlayerNum(buddyplayernum);
shield = chrGetShield(g_Vars.currentplayer->prop->chr) * 0.125f;
totalhealth = g_Vars.currentplayer->bondhealth + shield;
#if VERSION >= VERSION_NTSC_FINAL
// NTSC final prevents coop from being able to respawn
// in Deep Sea after the mid cutscene. Without this condition,
// the player could respawn on the other side of the exit trigger.
// Additionally, the logic for coopcanrestart is different.
if (totalhealth > 0.125f
&& !(mainGetStageNum() == STAGE_DEEPSEA && chrHasStageFlag(NULL, 0x00000200))) {
if (canrestart) {
playerDisplayHealth();
stealhealth = totalhealth * 0.5f;
if (stealhealth < shield) {
chrSetShield(g_Vars.currentplayer->prop->chr, (shield - stealhealth) * 8.0f);
} else {
chrSetShield(g_Vars.currentplayer->prop->chr, 0);
g_Vars.currentplayer->bondhealth -= stealhealth - shield;
}
// Back to the player who died
setCurrentPlayerNum(prevplayernum);
g_Vars.currentplayer->dostartnewlife = true;
g_Vars.currentplayer->oldhealth = 0;
g_Vars.currentplayer->oldarmour = 0;
g_Vars.currentplayer->apparenthealth = 0;
g_Vars.currentplayer->apparentarmour = 0;
g_Vars.currentplayer->stealhealth = stealhealth;
} else {
setCurrentPlayerNum(prevplayernum);
}
g_Vars.currentplayer->coopcanrestart = true;
} else {
// Can't respawn
setCurrentPlayerNum(prevplayernum);
}
#else
if (totalhealth > 0.125f && canrestart) {
playerDisplayHealth();
stealhealth = totalhealth * 0.5f;
if (stealhealth < shield) {
chrSetShield(g_Vars.currentplayer->prop->chr, (shield - stealhealth) * 8.0f);
} else {
chrSetShield(g_Vars.currentplayer->prop->chr, 0);
g_Vars.currentplayer->bondhealth -= stealhealth - shield;
}
// Back to the player who died
setCurrentPlayerNum(prevplayernum);
g_Vars.currentplayer->dostartnewlife = true;
g_Vars.currentplayer->oldhealth = 0;
g_Vars.currentplayer->oldarmour = 0;
g_Vars.currentplayer->apparenthealth = 0;
g_Vars.currentplayer->apparentarmour = 0;
g_Vars.currentplayer->stealhealth = stealhealth;
} else {
setCurrentPlayerNum(prevplayernum);
}
if (totalhealth > 0.125f) {
g_Vars.currentplayer->coopcanrestart = true;
}
#endif
}
}
} else {
u32 playernum = g_Vars.currentplayernum;
s32 playercount = PLAYERCOUNT();
struct chrdata *chr = g_Vars.currentplayer->prop->chr;
s32 numdeaths = 0;
s32 i;
if (chr) {
chr->chrflags |= CHRCFLAG_HIDDEN;
}
for (i = 0; i < playercount; i++) {
numdeaths += g_Vars.playerstats[i].kills[playernum];
}
if (g_BossFile.locktype == MPLOCKTYPE_CHALLENGE) {
if (g_Vars.currentplayer->deadtimer < 0) {
g_Vars.currentplayer->deadtimer = TICKS(600);
}
if (g_Vars.currentplayer->deadtimer >= 0) {
g_Vars.currentplayer->deadtimer -= g_Vars.lvupdate60;
if (g_Vars.currentplayer->deadtimer < 0) {
canrestart = true;
}
}
}
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
&& !mpIsPaused()
&& g_NumReasonsToEndMpMatch == 0) {
if (g_Vars.currentplayer->deadtimer < 0) {
canrestart = true;
}
if (canrestart) {
g_Vars.currentplayer->dostartnewlife = true;
}
}
}
if (joyGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000)
&& !mpIsPaused()
&& g_NumReasonsToEndMpMatch == 0) {
canrestart = true;
}
if (canrestart) {
g_Vars.currentplayer->dostartnewlife = true;
}
}
}
}
@ -4681,12 +4127,7 @@ void playerDieByShooter(u32 shooter, bool force)
chrUncloak(g_Vars.currentplayer->prop->chr, true);
if (g_Vars.mplayerisrunning &&
(g_Vars.antiplayernum < 0
|| g_Vars.currentplayernum != g_Vars.antiplayernum
|| shooter != g_Vars.antiplayernum)) {
currentPlayerDropAllItems();
}
currentPlayerDropAllItems();
g_Vars.currentplayer->isdead = true;
g_Vars.currentplayer->bonddie = g_Vars.currentplayer->bond2;

View File

@ -58,14 +58,6 @@ void playermgrAllocatePlayers(s32 count)
setCurrentPlayerNum(0);
g_Vars.bond = g_Vars.players[g_Vars.bondplayernum];
if (g_Vars.coopplayernum >= 0) {
g_Vars.coop = g_Vars.players[g_Vars.coopplayernum];
g_Vars.anti = NULL;
} else if (g_Vars.antiplayernum >= 0) {
g_Vars.coop = NULL;
g_Vars.anti = g_Vars.players[g_Vars.antiplayernum];
}
} else {
playermgrAllocatePlayer(0);
setCurrentPlayerNum(0);
@ -76,10 +68,11 @@ void playermgrAllocatePlayers(s32 count)
playermgrSetViewSize(playerGetFbWidth(), playerGetFbHeight());
}
g_Vars.coop = NULL;
g_Vars.anti = NULL;
g_Vars.bond = g_Vars.players[0];
}
g_Vars.coop = NULL;
g_Vars.anti = NULL;
}
void playermgrAllocatePlayer(s32 index)

View File

@ -181,34 +181,10 @@ void playerReset(void)
propEnable(g_Vars.currentplayer->prop);
chrInit(g_Vars.currentplayer->prop);
if (g_Vars.coopplayernum >= 0) {
g_Vars.currentplayer->prop->chr->team = TEAM_ALLY;
} else if (g_Vars.antiplayernum >= 0) {
if (g_Vars.currentplayer == g_Vars.bond) {
g_Vars.currentplayer->prop->chr->team = TEAM_ALLY;
} else {
g_Vars.currentplayer->prop->chr->team = TEAM_ENEMY;
}
} else {
if (g_Vars.mplayerisrunning) {
g_Vars.currentplayer->prop->chr->team = 1 << g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.team;
} else {
g_Vars.currentplayer->prop->chr->team = TEAM_ALLY;
}
}
g_Vars.currentplayer->prop->chr->team = 1 << g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.team;
if (g_NumSpawnPoints > 0) {
if (g_Vars.coopplayernum >= 0) {
turnanglerad = M_BADTAU - scenarioChooseSpawnLocation(30, &pos, rooms, g_Vars.currentplayer->prop);
} else if (g_Vars.antiplayernum >= 0) {
turnanglerad = M_BADTAU - scenarioChooseSpawnLocation(30, &pos, rooms, g_Vars.currentplayer->prop);
} else {
if (g_Vars.mplayerisrunning == 0) {
g_NumSpawnPoints = 1;
}
turnanglerad = M_BADTAU - scenarioChooseSpawnLocation(30, &pos, rooms, g_Vars.currentplayer->prop);
}
turnanglerad = M_BADTAU - scenarioChooseSpawnLocation(30, &pos, rooms, g_Vars.currentplayer->prop);
}
groundy = cdFindGroundInfoAtCyl(&pos, 30, rooms,

View File

@ -1505,34 +1505,7 @@ s32 func0f068fc8(struct prop *prop, bool arg1)
} else if (obj->type == OBJTYPE_DOOR) {
struct doorobj *door = (struct doorobj *)obj;
if (g_Vars.normmplayerisrunning) {
actual = 255;
} else {
actualptr = arg1 == 0 ? &actual : NULL;
extraptr = arg1 == 1 ? &extra : NULL;
door0f068c04(prop, actualptr, extraptr);
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
if (g_Vars.currentplayernum == 1) {
if (actualptr) {
door->actual1 = actual & 0xff;
}
if (extraptr) {
door->extra1 = extra & 0xff;
}
} else {
if (actualptr) {
door->actual2 = actual & 0xff;
}
if (extraptr) {
door->extra2 = extra & 0xff;
}
}
}
}
actual = 255;
} else {
actual = func0f068b14(prop->rooms, 0);
extra = func0f068b14(prop->rooms, 1);
@ -1672,22 +1645,6 @@ void propCalculateShadeInfo(struct prop *prop, u8 *nextcol, u16 floorcol)
nextcol[0] >>= 1;
nextcol[1] >>= 1;
nextcol[2] >>= 1;
if (prop->type == PROPTYPE_DOOR && (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)) {
struct doorobj *door = prop->door;
if (g_Vars.currentplayernum == 0) {
door->shadeinfo1[0] = nextcol[0];
door->shadeinfo1[1] = nextcol[1];
door->shadeinfo1[2] = nextcol[2];
door->shadeinfo1[3] = nextcol[3];
} else {
door->shadeinfo2[0] = nextcol[0];
door->shadeinfo2[1] = nextcol[1];
door->shadeinfo2[2] = nextcol[2];
door->shadeinfo2[3] = nextcol[3];
}
}
}
/**
@ -4396,27 +4353,7 @@ void weaponTick(struct prop *prop)
// If a player manages to throw a mine on themselves, it will not detonate.
// You can't throw a mine on yourself anyway, so this check always passes
if (prop->parent == NULL || parentchr == NULL || mpPlayerGetIndex(parentchr) != ownerplayernum) {
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
if (ownerplayernum == 2) {
u32 mask = 0;
if (g_Vars.coop && g_Vars.coop->prop) {
mask |= 1 << playermgrGetPlayerNumByProp(g_Vars.coop->prop);
}
if (g_Vars.bond && g_Vars.bond->prop) {
mask |= 1 << playermgrGetPlayerNumByProp(g_Vars.bond->prop);
}
g_PlayersDetonatingMines &= mask;
if (g_PlayersDetonatingMines != 0) {
weapon->timer240 = 0;
}
} else if (g_PlayersDetonatingMines & 1 << ownerplayernum) {
weapon->timer240 = 0;
}
} else if (g_PlayersDetonatingMines & 1 << ownerplayernum) {
if (g_PlayersDetonatingMines & 1 << ownerplayernum) {
weapon->timer240 = 0;
}
}
@ -8984,16 +8921,7 @@ void cctvTick(struct prop *camprop)
f32 zdist;
bool canseeplayer = true;
// If playing in coop mode, cycle between players in alternating frames
if (g_Vars.coopplayernum >= 0) {
if (g_Vars.lvframenum & 1) {
playerprop = g_Vars.bond->prop;
} else {
playerprop = g_Vars.coop->prop;
}
} else {
playerprop = g_Vars.bond->prop;
}
playerprop = g_Vars.bond->prop;
// Check distance
xdist = playerprop->pos.x - camprop->pos.x;
@ -9094,10 +9022,6 @@ void cctvTick(struct prop *camprop)
obj->flags |= OBJFLAG_CAMERA_BONDINVIEW;
camera->seebondtime60 += g_Vars.lvupdate60;
if (g_Vars.coopplayernum >= 0) {
camera->seebondtime60 += g_Vars.lvupdate60;
}
if (camera->seebondtime60 >= (s32)(TICKS(300) * g_CctvWaitScale)) {
alarmActivate();
camera->seebondtime60 = 0;
@ -9439,15 +9363,7 @@ void autogunTick(struct prop *prop)
}
} else {
// Not configured for teams, so target a player
if (g_Vars.coopplayernum >= 0) {
if (g_Vars.lvframenum & 1) {
target = g_Vars.bond->prop;
} else {
target = g_Vars.coop->prop;
}
} else {
target = g_Vars.bond->prop;
}
target = g_Vars.bond->prop;
}
}
@ -9884,170 +9800,48 @@ void autogunTickShoot(struct prop *autogunprop)
// If multiplayer, or targeting a bad guy in solo
// (ie. autogun is a Defense autogun or a thrown laptop)
if (g_Vars.normmplayerisrunning
|| (targetprop && (targetprop->type == PROPTYPE_CHR))
|| (g_Vars.antiplayernum >= 0 && targetprop && targetprop == g_Vars.anti->prop)) {
if (cdExamLos08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
#if VERSION >= VERSION_PAL_FINAL
cdGetPos(&hitpos, 11480, "prop/propobj.c");
#elif VERSION >= VERSION_PAL_BETA
cdGetPos(&hitpos, 11480, "propobj.c");
#elif VERSION >= VERSION_NTSC_1_0
cdGetPos(&hitpos, 11458, "propobj.c");
#else
cdGetPos(&hitpos, 11296, "propobj.c");
#endif
if (cdExamLos08(&gunpos, gunrooms, &hitpos, CDTYPE_ALL, GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
cdGetPos(&hitpos, 11458, "propobj.c");
hitprop = cdGetObstacleProp();
hitprop = cdGetObstacleProp();
// SP: If the hit prop is a chr and it's our target
// MP: If the hit prop is a chr
if (hitprop
&& (hitprop->type == PROPTYPE_CHR || hitprop->type == PROPTYPE_PLAYER)
&& (g_Vars.normmplayerisrunning || targetprop == hitprop)) {
struct modelnode *hitnode = NULL;
struct model *hitmodel = NULL;
s32 hitside = -1;
s32 hitpart = HITPART_GENERAL;
f32 damage = gsetGetDamage(&gset);
struct chrdata *hitchr = hitprop->chr;
// SP: If the hit prop is a chr and it's our target
// MP: If the hit prop is a chr
if (hitprop
&& (hitprop->type == PROPTYPE_CHR || hitprop->type == PROPTYPE_PLAYER)
&& (g_Vars.normmplayerisrunning || targetprop == hitprop)) {
struct modelnode *hitnode = NULL;
struct model *hitmodel = NULL;
s32 hitside = -1;
s32 hitpart = HITPART_GENERAL;
f32 damage = gsetGetDamage(&gset);
struct chrdata *hitchr = hitprop->chr;
if (g_Vars.normmplayerisrunning) {
damage *= 0.5f;
}
if (ownerprop == hitprop || (ownerchr && chrCompareTeams(hitprop->chr, ownerchr, COMPARE_FRIENDS))) {
// A teammate entered the line of fire
makebeam = false;
fireleft = false;
fireright = false;
friendly = true;
}
if (fireleft || fireright) {
bgunPlayPropHitSound(&gset, hitprop, -1);
if (hitchr->model && chrGetShield(hitchr) > 0.0f) {
chrCalculateShieldHit(hitchr, &hitpos, &dir, &hitnode, &hitpart, &hitmodel, &hitside);
}
chrEmitSparks(hitchr, hitprop, hitpart, &hitpos, &dir, ownerchr);
func0f0341dc(hitchr, damage, &dir, &gset, ownerprop, HITPART_GENERAL, hitprop, hitnode, hitmodel, hitside, NULL);
}
} else {
missed = true;
if (g_Vars.normmplayerisrunning) {
damage *= 0.5f;
}
}
} else if (targetprop && targetprop->type == PROPTYPE_OBJ) {
// Laptop in firing range
struct prop *hitprop = NULL;
if (cdExamLos08(&gunpos, gunrooms, &hitpos,
CDTYPE_ALL & ~CDTYPE_PLAYERS,
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
#if VERSION >= VERSION_PAL_FINAL
cdGetPos(&hitpos, 11535, "prop/propobj.c");
#elif VERSION >= VERSION_PAL_BETA
cdGetPos(&hitpos, 11535, "propobj.c");
#elif VERSION >= VERSION_NTSC_1_0
cdGetPos(&hitpos, 11513, "propobj.c");
#else
cdGetPos(&hitpos, 11351, "propobj.c");
#endif
if (ownerprop == hitprop || (ownerchr && chrCompareTeams(hitprop->chr, ownerchr, COMPARE_FRIENDS))) {
// A teammate entered the line of fire
makebeam = false;
fireleft = false;
fireright = false;
friendly = true;
}
hitprop = cdGetObstacleProp();
if (fireleft || fireright) {
bgunPlayPropHitSound(&gset, hitprop, -1);
if (hitchr->model && chrGetShield(hitchr) > 0.0f) {
chrCalculateShieldHit(hitchr, &hitpos, &dir, &hitnode, &hitpart, &hitmodel, &hitside);
}
chrEmitSparks(hitchr, hitprop, hitpart, &hitpos, &dir, ownerchr);
func0f0341dc(hitchr, damage, &dir, &gset, ownerprop, HITPART_GENERAL, hitprop, hitnode, hitmodel, hitside, NULL);
}
} else {
missed = true;
}
if (hitprop && hitprop->type == PROPTYPE_OBJ) {
struct defaultobj *hitobj = hitprop->obj;
if (hitobj->modelnum == MODEL_TARGET) {
struct gset gset = { WEAPON_LAPTOPGUN, 0, 0, FUNC_SECONDARY };
missed = false;
if (chrIsUsingPaintball(ownerchr)) {
sparksCreate(hitprop->rooms[0], hitprop, &hitpos, 0, 0, SPARKTYPE_PAINT);
} else {
sparksCreate(hitprop->rooms[0], hitprop, &hitpos, 0, 0, SPARKTYPE_DEFAULT);
}
bgunPlayPropHitSound(&gset, hitprop, TEXTURE_00F2);
}
}
} else {
// Enemy autogun in solo
if (cdExamLos08(&gunpos, gunrooms, &hitpos,
CDTYPE_DOORS | CDTYPE_BG,
GEOFLAG_BLOCK_SHOOT) == CDRESULT_COLLISION) {
#if VERSION >= VERSION_PAL_FINAL
cdGetPos(&hitpos, 11561, "prop/propobj.c");
#elif VERSION >= VERSION_PAL_BETA
cdGetPos(&hitpos, 11561, "propobj.c");
#elif VERSION >= VERSION_NTSC_1_0
cdGetPos(&hitpos, 11539, "propobj.c");
#else
cdGetPos(&hitpos, 11377, "propobj.c");
#endif
missed = true;
}
if (g_Vars.lvframe60 == autogun->lastaimbond60
&& targetprop && targetprop->type == PROPTYPE_PLAYER) {
f32 x;
f32 y;
f32 z;
f32 sqguntotargetdist;
f32 sqguntohitdist;
f32 damage;
x = targetprop->pos.x - gunpos.x;
y = targetprop->pos.y - gunpos.y;
z = targetprop->pos.z - gunpos.z;
sqguntotargetdist = x * x + y * y + z * z;
x = hitpos.f[0] - gunpos.f[0];
y = hitpos.f[1] - gunpos.f[1];
z = hitpos.f[2] - gunpos.f[2];
sqguntohitdist = x * x + y * y + z * z;
if (sqguntohitdist >= sqguntotargetdist) {
f32 guntotargetdist = sqrtf(sqguntotargetdist);
f32 increment = 0.16f * g_Vars.lvupdate60freal * g_AutogunAccuracyScale;
if (guntotargetdist > 200.0f) {
increment *= 200.0f / guntotargetdist;
}
autogun->shotbondsum += increment;
if (autogun->shotbondsum >= 1.0f) {
hitpos.x = targetprop->pos.x;
hitpos.y = targetprop->pos.y;
hitpos.z = targetprop->pos.z;
missed = false;
if (random() % 2) {
hitpos.y += 2 + (random() % 10);
} else {
hitpos.y -= 2 + (random() % 10);
}
bgunPlayPropHitSound(&gset, targetprop, -1);
damage = 0.5f * g_AutogunDamageTxScale;
chrDamageByImpact(targetprop->chr, damage, &dir, &gset, 0, HITPART_GENERAL);
autogun->shotbondsum = 0.0f;
}
}
}
}
propSetPerimEnabled(autogunprop, true);
@ -14472,31 +14266,12 @@ Gfx *objRender(struct prop *prop, Gfx *gdl, bool xlupass)
}
}
if (prop->type == PROPTYPE_DOOR
&& (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)) {
struct doorobj *door = prop->door;
colour[0] = obj->shadecol[0];
colour[1] = obj->shadecol[1];
colour[2] = obj->shadecol[2];
colour[3] = obj->shadecol[3];
if (g_Vars.currentplayernum == 0) {
colour[0] = door->shadeinfo1[0];
colour[1] = door->shadeinfo1[1];
colour[2] = door->shadeinfo1[2];
colour[3] = door->shadeinfo1[3];
} else {
colour[0] = door->shadeinfo2[0];
colour[1] = door->shadeinfo2[1];
colour[2] = door->shadeinfo2[2];
colour[3] = door->shadeinfo2[3];
}
} else {
colour[0] = obj->shadecol[0];
colour[1] = obj->shadecol[1];
colour[2] = obj->shadecol[2];
colour[3] = obj->shadecol[3];
}
if (g_Vars.normmplayerisrunning) {
scenarioHighlightProp(prop, colour);
}
scenarioHighlightProp(prop, colour);
if (g_Vars.currentplayer->visionmode == VISIONMODE_XRAY) {
colour[g_Vars.currentplayer->epcol_0] = xrayalphafrac * 255.0f;
@ -16563,88 +16338,86 @@ void objHit(struct shotdata *shotdata, struct hit *hit)
}
}
if (g_Vars.antiplayernum < 0 || g_Vars.currentplayer != g_Vars.anti || (obj->flags2 & OBJFLAG2_IMMUNETOANTI) == 0) {
if (hit->hitthing.texturenum != 10000) {
f32 damage = gsetGetDamage(&shotdata->gset);
if (hit->hitthing.texturenum != 10000) {
f32 damage = gsetGetDamage(&shotdata->gset);
if (obj->type == OBJTYPE_AUTOGUN) {
damage *= g_AutogunDamageRxScale;
} else if (obj->type == OBJTYPE_CCTV) {
// Leftover from GE: shots to a CCTV's lens is a one hit kill
if (obj->model->filedata->skel == &g_SkelCctv) {
if (modelGetPart(obj->model->filedata, MODELPART_CCTV_LENS) == hit->unk44) {
damage *= 100.0f;
cctvHandleLensShot(obj);
}
}
damage *= g_CctvDamageRxScale;
} else if (explosiveshells) {
if (obj->type == OBJTYPE_GLASS || obj->type == OBJTYPE_TINTEDGLASS) {
if (obj->type == OBJTYPE_AUTOGUN) {
damage *= g_AutogunDamageRxScale;
} else if (obj->type == OBJTYPE_CCTV) {
// Leftover from GE: shots to a CCTV's lens is a one hit kill
if (obj->model->filedata->skel == &g_SkelCctv) {
if (modelGetPart(obj->model->filedata, MODELPART_CCTV_LENS) == hit->unk44) {
damage *= 100.0f;
} else {
damage *= 5.0f;
cctvHandleLensShot(obj);
}
}
objTakeGunfire(obj, damage, &sp110, shotdata->gset.weaponnum, g_Vars.currentplayernum);
if (obj->model->filedata->skel == &g_SkelWindowedDoor && !hit->unk4c) {
struct doorobj *door = (struct doorobj *)obj;
door->glasshits++;
if (door->glasshits >= 3) {
doorDestroyGlass(door);
}
damage *= g_CctvDamageRxScale;
} else if (explosiveshells) {
if (obj->type == OBJTYPE_GLASS || obj->type == OBJTYPE_TINTEDGLASS) {
damage *= 100.0f;
} else {
damage *= 5.0f;
}
}
objDropRecursively(hit->prop, false);
objTakeGunfire(obj, damage, &sp110, shotdata->gset.weaponnum, g_Vars.currentplayernum);
// Handle pushing and bouncing
if ((obj->hidden & OBJHFLAG_MOUNTED) == 0 && (obj->hidden & OBJHFLAG_GRABBED) == 0) {
if (obj->flags3 & OBJFLAG3_PUSHABLE) {
struct coord spb0;
struct coord spa4;
struct coord pushdir;
Mtxf sp58;
if (obj->model->filedata->skel == &g_SkelWindowedDoor && !hit->unk4c) {
struct doorobj *door = (struct doorobj *)obj;
door->glasshits++;
spb0.x = shotdata->dir.x * 3.0f;
spb0.y = shotdata->dir.y * 3.0f;
spb0.z = shotdata->dir.z * 3.0f;
if (door->glasshits >= 3) {
doorDestroyGlass(door);
}
}
}
mtx4MultMtx4(camGetProjectionMtxF(), &obj->model->matrices[hit->mtxindex], &sp58);
mtx4TransformVec(&sp58, &hit->hitthing.unk00, &spa4);
objDropRecursively(hit->prop, false);
pushdir.x = shotdata->dir.x;
pushdir.y = shotdata->dir.y;
pushdir.z = shotdata->dir.z;
// Handle pushing and bouncing
if ((obj->hidden & OBJHFLAG_MOUNTED) == 0 && (obj->hidden & OBJHFLAG_GRABBED) == 0) {
if (obj->flags3 & OBJFLAG3_PUSHABLE) {
struct coord spb0;
struct coord spa4;
struct coord pushdir;
Mtxf sp58;
func0f082e84(obj, &spa4, &pushdir, &spb0, true);
} else {
bool bounce = false;
spb0.x = shotdata->dir.x * 3.0f;
spb0.y = shotdata->dir.y * 3.0f;
spb0.z = shotdata->dir.z * 3.0f;
if (func0f085194(obj)) {
if ((obj->flags & OBJFLAG_00400000) == 0) {
bounce = true;
}
} else if (obj->flags & OBJFLAG_BOUNCEIFSHOT) {
mtx4MultMtx4(camGetProjectionMtxF(), &obj->model->matrices[hit->mtxindex], &sp58);
mtx4TransformVec(&sp58, &hit->hitthing.unk00, &spa4);
pushdir.x = shotdata->dir.x;
pushdir.y = shotdata->dir.y;
pushdir.z = shotdata->dir.z;
func0f082e84(obj, &spa4, &pushdir, &spb0, true);
} else {
bool bounce = false;
if (func0f085194(obj)) {
if ((obj->flags & OBJFLAG_00400000) == 0) {
bounce = true;
}
} else if (obj->flags & OBJFLAG_BOUNCEIFSHOT) {
bounce = true;
}
if (obj->flags2 & OBJFLAG2_00000002) {
if (!objIsHealthy(obj)) {
bounce = true;
}
if (obj->flags2 & OBJFLAG2_00000002) {
if (!objIsHealthy(obj)) {
bounce = true;
}
}
if (obj->flags2 & OBJFLAG2_LINKEDTOSAFE) {
bounce = false;
}
if (obj->flags2 & OBJFLAG2_LINKEDTOSAFE) {
bounce = false;
}
if (bounce) {
objBounce(obj, &shotdata->unk0c);
}
if (bounce) {
objBounce(obj, &shotdata->unk0c);
}
}
}
@ -16828,15 +16601,7 @@ bool propobjInteract(struct prop *prop)
bmoveGrabProp(prop);
}
if (g_Vars.normmplayerisrunning) {
scenarioHandleActivatedProp(g_Vars.currentplayer->prop->chr, prop);
} else {
if (g_Vars.currentplayernum == g_Vars.coopplayernum) {
obj->hidden |= OBJHFLAG_ACTIVATED_BY_COOP;
} else if (g_Vars.currentplayernum == g_Vars.bondplayernum) {
obj->hidden |= OBJHFLAG_ACTIVATED_BY_BOND;
}
}
scenarioHandleActivatedProp(g_Vars.currentplayer->prop->chr, prop);
doorCallLift(prop, false);
@ -21177,9 +20942,7 @@ void doorsActivate(struct prop *doorprop, bool allowliftclose)
}
}
if (g_Vars.currentplayernum == g_Vars.coopplayernum) {
door->base.hidden |= OBJHFLAG_ACTIVATED_BY_COOP;
} else if (g_Vars.currentplayernum == g_Vars.bondplayernum) {
if (g_Vars.currentplayernum == g_Vars.bondplayernum) {
door->base.hidden |= OBJHFLAG_ACTIVATED_BY_BOND;
}
@ -21265,9 +21028,7 @@ bool propdoorInteract(struct prop *doorprop)
}
}
if (g_Vars.currentplayernum == g_Vars.coopplayernum) {
door->base.hidden |= OBJHFLAG_ACTIVATED_BY_COOP;
} else if (g_Vars.currentplayernum == g_Vars.bondplayernum) {
if (g_Vars.currentplayernum == g_Vars.bondplayernum) {
door->base.hidden |= OBJHFLAG_ACTIVATED_BY_BOND;
}
@ -21607,63 +21368,7 @@ void currentPlayerDropAllItems(void)
|| (g_Vars.normmplayerisrunning
&& g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL
&& i == WEAPON_DATAUPLINK)) {
#if VERSION >= VERSION_NTSC_1_0
if (g_Vars.coopplayernum >= 0) {
bool canremove = true;
struct prop *child = g_Vars.currentplayer->prop->child;
while (child) {
struct defaultobj *obj = child->obj;
if (obj->type == OBJTYPE_WEAPON) {
struct weaponobj *weapon = child->weapon;
if (i == weapon->weaponnum && (obj->flags3 & OBJFLAG3_PLAYERUNDROPPABLE)) {
canremove = false;
break;
}
}
child = child->next;
}
if (canremove) {
invRemoveItemByNum(i);
}
if (!bgunIsMissionCritical(i)) {
weaponCreateForPlayerDrop(i);
}
} else {
weaponCreateForPlayerDrop(i);
}
#else
if (g_Vars.coopplayernum >= 0) {
bool canremove = true;
struct prop *child = g_Vars.currentplayer->prop->child;
while (child) {
struct defaultobj *obj = child->obj;
if (obj->type == OBJTYPE_WEAPON) {
struct weaponobj *weapon = child->weapon;
if (i == weapon->weaponnum && (obj->flags3 & OBJFLAG3_PLAYERUNDROPPABLE)) {
canremove = false;
break;
}
}
child = child->next;
}
if (canremove) {
invRemoveItemByNum(i);
}
}
weaponCreateForPlayerDrop(i);
#endif
}
}
}

View File

@ -253,18 +253,12 @@ Gfx *radarRender(Gfx *gdl)
playernum = g_Vars.currentplayernum;
playercount = PLAYERCOUNT();
if (g_Vars.mplayerisrunning) {
if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_NORADAR)) {
return gdl;
}
if (g_MpSetup.options & MPOPTION_NORADAR) {
return gdl;
}
if ((g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.displayoptions & 0x00000004) == 0) {
return gdl;
}
} else if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit & DEVICE_RTRACKER) == 0) {
if (!g_MissionConfig.iscoop || !g_Vars.coopradaron) {
return gdl;
}
if ((g_PlayerConfigsArray[g_Vars.currentplayerstats->mpindex].base.displayoptions & 0x00000004) == 0) {
return gdl;
}
if (g_Vars.currentplayer->mpmenuon || g_Vars.currentplayer->isdead) {
@ -348,43 +342,22 @@ Gfx *radarRender(Gfx *gdl)
}
}
// Draw dots for coop AI buddies
if (!g_Vars.normmplayerisrunning && g_MissionConfig.iscoop) {
for (i = 0; i < g_Vars.numaibuddies && i < 4; i++) {
struct prop *prop = g_Vars.aibuddies[i];
if (prop
&& prop->type == PROPTYPE_CHR
&& prop->chr
&& prop->chr->actiontype != ACT_DIE
&& prop->chr->actiontype != ACT_DEAD) {
pos.x = prop->pos.x - g_Vars.currentplayer->prop->pos.x;
pos.y = prop->pos.y - g_Vars.currentplayer->prop->pos.y;
pos.z = prop->pos.z - g_Vars.currentplayer->prop->pos.z;
gdl = radarDrawDot(gdl, prop, &pos, 0x00ff0000, 0, 0);
}
}
}
// Draw dots for MP simulants
if (g_Vars.normmplayerisrunning != 0) {
for (i = 0; i < g_BotCount; i++) {
if (!chrIsDead(g_MpBotChrPtrs[i])
&& (g_MpBotChrPtrs[i]->hidden & CHRHFLAG_CLOAKED) == 0
&& scenarioRadarChr(&gdl, g_MpBotChrPtrs[i]->prop) == false) {
pos.x = g_MpBotChrPtrs[i]->prop->pos.x - g_Vars.currentplayer->prop->pos.x;
pos.y = g_MpBotChrPtrs[i]->prop->pos.y - g_Vars.currentplayer->prop->pos.y;
pos.z = g_MpBotChrPtrs[i]->prop->pos.z - g_Vars.currentplayer->prop->pos.z;
for (i = 0; i < g_BotCount; i++) {
if (!chrIsDead(g_MpBotChrPtrs[i])
&& (g_MpBotChrPtrs[i]->hidden & CHRHFLAG_CLOAKED) == 0
&& scenarioRadarChr(&gdl, g_MpBotChrPtrs[i]->prop) == false) {
pos.x = g_MpBotChrPtrs[i]->prop->pos.x - g_Vars.currentplayer->prop->pos.x;
pos.y = g_MpBotChrPtrs[i]->prop->pos.y - g_Vars.currentplayer->prop->pos.y;
pos.z = g_MpBotChrPtrs[i]->prop->pos.z - g_Vars.currentplayer->prop->pos.z;
if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_TEAMSENABLED)) {
colour = g_TeamColours[radarGetTeamIndex(g_MpBotChrPtrs[i]->team)];
} else {
colour = 0x00ff0000;
}
gdl = radarDrawDot(gdl, g_MpBotChrPtrs[i]->prop, &pos, colour, 0, 0);
if (g_Vars.normmplayerisrunning && (g_MpSetup.options & MPOPTION_TEAMSENABLED)) {
colour = g_TeamColours[radarGetTeamIndex(g_MpBotChrPtrs[i]->team)];
} else {
colour = 0x00ff0000;
}
gdl = radarDrawDot(gdl, g_MpBotChrPtrs[i]->prop, &pos, colour, 0, 0);
}
}

View File

@ -706,10 +706,6 @@ void setupCreateMine(struct mineobj *mine, s32 cmdindex)
setupCreateObject(&mine->base, cmdindex);
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
mine->base.hidden = (mine->base.hidden & 0x0fffffff) | OBJHFLAG_20000000;
}
mine->base.prop->forcetick = true;
}
@ -1272,12 +1268,6 @@ void setupLoadFiles(s32 stagenum)
// Count the number of chrs and objects so enough model slots can be allocated
numchrs += setupCountCommandType(OBJTYPE_CHR);
if (!g_Vars.normmplayerisrunning && g_MissionConfig.iscoop && g_Vars.numaibuddies > 0) {
// @bug? The Hotshot buddy has two guns, but only one is counted here.
numchrs += g_Vars.numaibuddies;
numobjs += g_Vars.numaibuddies; // the buddy's weapon
}
numobjs += setupCountCommandType(OBJTYPE_WEAPON);
numobjs += setupCountCommandType(OBJTYPE_KEY);
numobjs += setupCountCommandType(OBJTYPE_HAT);
@ -1350,8 +1340,7 @@ void setupCreateProps(s32 stagenum)
s32 j;
s32 liftnum = 0;
withhovercars = !(stagenum == STAGE_EXTRACTION || stagenum == STAGE_DEFECTION)
|| !(g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0);
withhovercars = true;
escstepx = 0;
escstepy = 0;
@ -1376,12 +1365,6 @@ void setupCreateProps(s32 stagenum)
numchrs += setupCountCommandType(OBJTYPE_CHR);
if (g_Vars.normmplayerisrunning == false
&& g_MissionConfig.iscoop
&& g_Vars.numaibuddies > 0) {
numchrs += g_Vars.numaibuddies;
}
chrmgrConfigure(numchrs);
} else {
chrmgrConfigure(0);

View File

@ -37,14 +37,6 @@ bool sightIsPropFriendly(struct prop *prop)
return false;
}
if (g_Vars.coopplayernum >= 0 && prop->type == PROPTYPE_PLAYER) {
return true;
}
if (g_Vars.antiplayernum >= 0 && prop->type == PROPTYPE_PLAYER) {
return false;
}
if (g_Vars.normmplayerisrunning == false
&& prop->chr
&& (prop->chr->hidden2 & CHRH2FLAG_BLUESIGHT)) {
@ -1433,7 +1425,7 @@ Gfx *sightDraw(Gfx *gdl, bool sighton, s32 sight)
}
#endif
if (PLAYERCOUNT() >= 2 && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
if (PLAYERCOUNT() >= 2) {
sight = SIGHT_DEFAULT;
}

View File

@ -35,8 +35,6 @@ void wallhitReset(void)
if (IS4MB()) {
type = 0;
} else if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) {
type = 1;
} else if (PLAYERCOUNT() >= 2) {
type = 0;
}
@ -54,18 +52,6 @@ void wallhitReset(void)
var8009cc74 = 15;
g_WallhitTargetBloodRatio = 0.3f;
break;
case 1:
// 2 player coop/anti
g_WallhitsMax = 200;
g_MinPropWallhits = 25;
g_MaxPropWallhits = 100;
g_MinBgWallhitsPerRoom = 4;
g_MaxBgWallhitsPerRoom = 40;
var8009cc6c = 80;
var8009cc70 = 20;
var8009cc74 = 30;
g_WallhitTargetBloodRatio = 0.4f;
break;
case 2:
default:
// 1 player 8MB

View File

@ -1176,28 +1176,7 @@ void mainLoop(void)
g_Vars.lvmpbotlevel = 1;
}
if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) {
g_MpSetup.chrslots = 0x03;
mpReset();
} else if (g_Vars.perfectbuddynum) {
mpReset();
} else if (g_Vars.mplayerisrunning == false
&& (numplayers >= 2 || g_Vars.lvmpbotlevel || argFindByPrefix(1, "-play"))) {
g_MpSetup.chrslots = 1;
if (numplayers >= 2) {
g_MpSetup.chrslots |= 1 << 1;
}
if (numplayers >= 3) {
g_MpSetup.chrslots |= 1 << 2;
}
if (numplayers >= 4) {
g_MpSetup.chrslots |= 1 << 3;
}
g_MpSetup.stagenum = g_StageNum;
if (g_Vars.perfectbuddynum) {
mpReset();
}

View File

@ -1027,10 +1027,7 @@ void musicTick(void)
bool playnrg = false;
if (!g_SndDisabled) {
if (g_MusicDeathTimer240 > 0
&& (g_Vars.normmplayerisrunning
|| (g_Vars.antiplayernum >= 0 && !g_Vars.bond->isdead)
|| (g_Vars.coopplayernum >= 0 && (!g_Vars.bond->isdead || !g_Vars.coop->isdead)))) {
if (g_MusicDeathTimer240 > 0) {
// Someone is dying in MP, or anti is dying, or *one* person is dying in coop
g_MusicSilenceTimer60 = 0;
g_MusicDeathTimer240 -= g_Vars.lvupdate240;

View File

@ -210,16 +210,6 @@ void viReset(s32 stagenum)
fbsize = 320 * 240;
#endif
g_Vars.fourmeg2player = true;
} else if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && PLAYERCOUNT() == 2) {
#if VERSION >= VERSION_JPN_FINAL
fbsize = 320 * 220 * 2;
#elif VERSION >= VERSION_PAL_FINAL
fbsize = 320 * 266 * 2;
#elif VERSION >= VERSION_PAL_BETA
fbsize = 320 * 252 * 2;
#else
fbsize = 320 * 220 * 2;
#endif
}
}
@ -2526,18 +2516,7 @@ Gfx *viRenderViewportEdges(Gfx *gdl)
gDPSetScissor(gdl++, G_SC_NON_INTERLACE, 0, 0, viGetWidth(), viGetHeight());
gDPSetFillColor(gdl++, GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1));
#if VERSION >= VERSION_NTSC_1_0
if (PLAYERCOUNT() == 1
|| ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& playerHasSharedViewport() && g_Vars.currentplayernum == 0))
#else
if (PLAYERCOUNT() == 1
|| ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& (
(g_InCutscene && !g_MainIsEndscreen) || menuGetRoot() == MENUROOT_COOPCONTINUE
) && g_Vars.currentplayernum == 0))
#endif
{
if (PLAYERCOUNT() == 1) {
// Single viewport
if (viGetViewTop() > 0) {
// Fill above