- newowner and related code.

This commit is contained in:
Christoph Oelckers 2020-11-03 00:20:51 +01:00
parent c90e7d9b5f
commit 0eb10f0313
20 changed files with 79 additions and 82 deletions

View file

@ -202,7 +202,7 @@ void checkavailweapon(struct player_struct* player)
void clearcamera(player_struct* ps)
{
ps->newowner = -1;
ps->newOwner = nullptr;
ps->posx = ps->oposx;
ps->posy = ps->oposy;
ps->posz = ps->oposz;
@ -417,7 +417,7 @@ void moveplayers(void)
auto spri = &act->s;
if (act->GetOwner())
{
if (p->newowner >= 0) //Looking thru the camera
if (p->newOwner != nullptr) //Looking thru the camera
{
spri->x = p->oposx;
spri->y = p->oposy;
@ -482,7 +482,7 @@ void moveplayers(void)
p->posy = spri->y;
p->posz = spri->z - (20 << 8);
p->newowner = -1;
p->newOwner = nullptr;
if (p->wackedbyactor != nullptr && p->wackedbyactor->s.statnum < MAXSTATUS)
{
@ -4487,7 +4487,7 @@ void handle_se27(DDukeActor* actor)
ud.cameraactor = actor;
t[0]++;
}
else if (ud.recstat == 2 && ps[p].newowner == -1)
else if (ud.recstat == 2 && ps[p].newOwner == nullptr)
{
if (cansee(s->x, s->y, s->z, s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
{

View file

@ -515,7 +515,7 @@ SKIPWALLCHECK:
ps[p].numloogs = -1 - spri->yvel;
}
if (ps[p].newowner >= 0)
if (ps[p].newOwner != nullptr)
{
clearcamera(&ps[p]);
}
@ -2465,9 +2465,9 @@ static void greenslime(DDukeActor *actor)
if (t[2] < 348)
t[2] += 128;
if (ps[p].newowner >= 0)
if (ps[p].newOwner != nullptr)
{
ps[p].newowner = -1;
ps[p].newOwner = nullptr;
ps[p].posx = ps[p].oposx;
ps[p].posy = ps[p].oposy;
ps[p].posz = ps[p].oposz;
@ -3829,7 +3829,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player)
{
if (ps[playernum].newowner >= 0)
if (ps[playernum].newOwner != nullptr)
goalang = getangle(ps[playernum].oposx - spr->x, ps[playernum].oposy - spr->y);
else goalang = getangle(ps[playernum].posx - spr->x, ps[playernum].posy - spr->y);
angdif = getincangle(spr->ang, goalang) >> 2;
@ -3842,7 +3842,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player_slow)
{
if (ps[playernum].newowner >= 0)
if (ps[playernum].newOwner != nullptr)
goalang = getangle(ps[playernum].oposx - spr->x, ps[playernum].oposy - spr->y);
else goalang = getangle(ps[playernum].posx - spr->x, ps[playernum].posy - spr->y);
angdif = ksgn(getincangle(spr->ang, goalang)) << 5;

View file

@ -360,7 +360,7 @@ SKIPWALLCHECK:
if (spri2->picnum == APLAYER)
{
p = act2->PlayerIndex();
if (ps[p].newowner >= 0)
if (ps[p].newOwner != nullptr)
{
clearcamera(&ps[p]);
}
@ -3727,7 +3727,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player)
{
if (ps[pnum].newowner >= 0)
if (ps[pnum].newOwner != nullptr)
goalang = getangle(ps[pnum].oposx - spr->x, ps[pnum].oposy - spr->y);
else goalang = getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y);
angdif = getincangle(spr->ang, goalang) >> 2;
@ -3740,7 +3740,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player_slow)
{
if (ps[pnum].newowner >= 0)
if (ps[pnum].newOwner != nullptr)
goalang = getangle(ps[pnum].oposx - spr->x, ps[pnum].oposy - spr->y);
else goalang = getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y);
angdif = ksgn(getincangle(spr->ang, goalang)) << 5;
@ -3756,7 +3756,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if (a & antifaceplayerslow)
{
if (ps[pnum].newowner >= 0)
if (ps[pnum].newOwner != nullptr)
goalang = (getangle(ps[pnum].oposx - spr->x, ps[pnum].oposy - spr->y) + 1024) & 2047;
else goalang = (getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y) + 1024) & 2047;
angdif = ksgn(getincangle(spr->ang, goalang)) << 5;

View file

@ -174,7 +174,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
}
if (t->statnum == 99) continue;
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && h->GetOwner())
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
{
t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx);
t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy);
@ -324,7 +324,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (t->pal == 1) t->z -= (18 << 8);
if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0)
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
{
t->cstat |= 2;
if (screenpeek == myconnectindex && numplayers >= 2)
@ -417,14 +417,14 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
else s->yoffset = 0;
}
if (ps[p].newowner > -1)
if (ps[p].newOwner != nullptr)
{
t4 = ScriptCode[actorinfo[APLAYER].scriptaddress + 1];
t3 = 0;
t1 = ScriptCode[actorinfo[APLAYER].scriptaddress + 2];
}
if (ud.cameraactor == nullptr && ps[p].newowner == -1)
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0)
if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek))
{

View file

@ -159,7 +159,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
}
if (t->statnum == 99) continue;
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && h->GetOwner())
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
{
t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx);
t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy);
@ -371,7 +371,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (t->pal == 1) t->z -= (18 << 8);
if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0)
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
{
t->cstat |= 2;
if (screenpeek == myconnectindex && numplayers >= 2)
@ -468,14 +468,14 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
else s->yoffset = 0;
}
if (ps[p].newowner > -1)
if (ps[p].newOwner != nullptr)
{
t4 = ScriptCode[actorinfo[APLAYER].scriptaddress + 1];
t3 = 0;
t1 = ScriptCode[actorinfo[APLAYER].scriptaddress + 2];
}
if (ud.cameraactor == nullptr && ps[p].newowner == -1)
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0)
if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek))
{

View file

@ -213,7 +213,7 @@ void OffMotorcycle(player_struct *pl);
void OnBoat(player_struct *pl, DDukeActor* snum);
void OffBoat(player_struct *pl);
void cameratext(int i);
void cameratext(DDukeActor* i);
void dobonus(int bonusonly, const CompletionFunc& completion);
void dobonus_d(int bonusonly, const CompletionFunc& completion);
void dobonus_r(int bonusonly, const CompletionFunc& completion);

View file

@ -253,8 +253,8 @@ void drawoverlays(double smoothratio)
{
if (automapMode != am_full)
{
if (!isRR() && pp->newowner >= 0)
cameratext(pp->newowner);
if (!isRR() && pp->newOwner != nullptr)
cameratext(pp->newOwner);
else
{
fi.displayweapon(screenpeek, smoothratio);
@ -269,7 +269,7 @@ void drawoverlays(double smoothratio)
{
dointerpolations(smoothratio);
if (pp->newowner == -1 && playrunning())
if (pp->newOwner == nullptr && playrunning())
{
if (screenpeek == myconnectindex && numplayers > 1)
{
@ -299,7 +299,7 @@ void drawoverlays(double smoothratio)
StatusBar->UpdateStatusBar();
if (ps[myconnectindex].newowner == -1 && ud.cameraactor == nullptr)
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
{
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -getHalfLookAng(pp->angle.olook_ang.asq16(), pp->angle.look_ang.asq16(), cl_syncinput, smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1);
}
@ -317,14 +317,14 @@ void drawoverlays(double smoothratio)
//
//---------------------------------------------------------------------------
void cameratext(int i)
void cameratext(DDukeActor *cam)
{
auto drawitem = [=](int tile, double x, double y, bool flipx, bool flipy)
{
DrawTexture(twod, tileGetTexture(tile), x, y, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_CenterOffsetRel, true,
DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE);
};
if (!hittype[i].temp_data[0])
if (!cam->temp_data[0])
{
drawitem(TILE_CAMCORNER, 24, 33, false, false);
drawitem(TILE_CAMCORNER + 1, 320 - 26, 33, false, false);

View file

@ -538,8 +538,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_NEWOWNER:
if (bSet) ps[iPlayer].newowner = lValue;
else SetGameVarID((int)lVar2, ps[iPlayer].newowner, sActor, sPlayer);
if (bSet) ps[iPlayer].newOwner = ScriptIndexToActor(lValue);
else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].newOwner), sActor, sPlayer);
break;
case PLAYER_HURT_DELAY:
@ -2046,9 +2046,9 @@ int ParseState::parse(void)
case concmd_addphealth: // todo: move out to player.
insptr++;
if(!isRR() && ps[g_p].newowner >= 0)
if(!isRR() && ps[g_p].newOwner != nullptr)
{
ps[g_p].newowner = -1;
ps[g_p].newOwner = nullptr;
ps[g_p].posx = ps[g_p].oposx;
ps[g_p].posy = ps[g_p].oposy;
ps[g_p].posz = ps[g_p].oposz;

View file

@ -291,7 +291,7 @@ void displayweapon_d(int snum, double smoothratio)
gs = p->GetActor()->s.shade;
if(gs > 24) gs = 24;
bool playerVars = p->newowner >= 0 || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0);
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0);
bool playerAnims = animatefist(gs,snum,look_anghalf) || animateknuckles(gs,snum,hard_landing,look_anghalf,horiz16th) ||
animatetip(gs,snum,hard_landing,look_anghalf,horiz16th) || animateaccess(gs,snum,hard_landing,look_anghalf,horiz16th);

View file

@ -136,7 +136,7 @@ void displayweapon_r(int snum, double smoothratio)
gs = p->GetActor()->s.shade;
if(gs > 24) gs = 24;
if(p->newowner >= 0 || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0))
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0))
return;
int opos = p->oweapon_pos * p->oweapon_pos;

View file

@ -119,7 +119,7 @@ void hud_input(int plnum)
if (p->GetActor()->s.extra <= 0) return;
// Activate an inventory item. This just forwards to the other inventory bits. If the inventory selector was taken out of the playsim this could be removed.
if (PlayerInput(plnum, SB_INVUSE) && p->newowner == -1)
if (PlayerInput(plnum, SB_INVUSE) && p->newOwner == nullptr)
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_INVENTORY, plnum, nullptr, -1);
@ -270,7 +270,7 @@ void hud_input(int plnum)
}
}
if (PlayerUseItem(plnum, ICON_HOLODUKE) && (isRR() || p->newowner == -1))
if (PlayerUseItem(plnum, ICON_HOLODUKE) && (isRR() || p->newOwner == nullptr))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_HOLODUKEON, plnum, nullptr, -1);
@ -327,7 +327,7 @@ void hud_input(int plnum)
}
}
if (isRR() && PlayerUseItem(plnum, ICON_HEATS) && p->newowner == -1)
if (isRR() && PlayerUseItem(plnum, ICON_HEATS) && p->newOwner == nullptr)
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
@ -412,7 +412,7 @@ void hud_input(int plnum)
}
}
if (PlayerUseItem(plnum, ICON_JETPACK) && (isRR() || p->newowner == -1))
if (PlayerUseItem(plnum, ICON_JETPACK) && (isRR() || p->newOwner == nullptr))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USEJETPACK, plnum, nullptr, -1);
@ -821,7 +821,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
auto p = &ps[playerNum];
bool blocked = movementBlocked(playerNum) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god);
if (blocked && ps[playerNum].newowner < 0)
if (blocked && ps[playerNum].newOwner == nullptr)
{
// neutralize all movement when blocked or in automap follow mode
loc.fvel = loc.svel = 0;
@ -846,7 +846,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
loc.svel = input.svel = 0;
}
if (p->on_crane == nullptr && p->newowner == -1)
if (p->on_crane == nullptr && p->newOwner == nullptr)
{
// input.avel already added to loc in processMovement()
loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL);
@ -860,7 +860,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
loc.avel = input.avel = 0;
}
if (p->newowner == -1 && !(p->sync.actions & SB_CENTERVIEW))
if (p->newOwner == nullptr && !(p->sync.actions & SB_CENTERVIEW))
{
// input.horz already added to loc in processMovement()
loc.horz = clamp(loc.horz, -MAXHORIZVEL, MAXHORIZVEL);

View file

@ -1032,7 +1032,7 @@ bool movementBlocked(int snum)
p->hard_landing ||
p->access_incs > 0 ||
p->knee_incs > 0 ||
p->newowner >= 0 ||
p->newOwner != nullptr ||
(blockingweapon() && p->kickback_pic > 1 && p->kickback_pic < weapondelay()));
}

View file

@ -2710,7 +2710,7 @@ static void processweapon(int snum, ESyncBits actions, int psect)
void processinput_d(int snum)
{
int j, i, k, doubvel, fz, cz, truefdist;
int j, k, doubvel, fz, cz, truefdist;
Collision chz, clz;
bool shrunk;
ESyncBits actions;
@ -2831,9 +2831,8 @@ void processinput_d(int snum)
if (p->transporter_hold < 0)
p->transporter_hold++;
if (p->newowner >= 0)
if (p->newOwner != nullptr)
{
i = p->newowner;
p->posxv = p->posyv = s->xvel = 0;
fi.doincrements(p);
@ -2846,6 +2845,7 @@ void processinput_d(int snum)
doubvel = TICSPERFRAME;
checklook(snum,actions);
int ii = 40;
if (p->on_crane != nullptr)
goto HORIZONLY;
@ -2859,8 +2859,6 @@ void processinput_d(int snum)
// Shrinking code
i = 40;
if (psectlotag == ST_2_UNDERWATER)
{
underwater(snum, actions, psect, fz, cz);
@ -3016,8 +3014,8 @@ void processinput_d(int snum)
HORIZONLY:
if (psectlotag == 1 || p->spritebridge == 1) i = (4L << 8);
else i = (20L << 8);
if (psectlotag == 1 || p->spritebridge == 1) ii = (4L << 8);
else ii = (20L << 8);
if (sector[p->cursectnum].lotag == 2) k = 0;
else k = 1;
@ -3033,7 +3031,7 @@ HORIZONLY:
else
clipmove_ex(&p->posx, &p->posy,
&p->posz, &p->cursectnum,
p->posxv, p->posyv, 164L, (4L << 8), i, CLIPMASK0, clip);
p->posxv, p->posyv, 164L, (4L << 8), ii, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->posz += 32 << 8;

View file

@ -3677,9 +3677,8 @@ void processinput_r(int snum)
if (p->transporter_hold < 0)
p->transporter_hold++;
if (p->newowner >= 0)
if (p->newOwner != nullptr)
{
i = p->newowner;
p->posxv = p->posyv = s->xvel = 0;
fi.doincrements(p);

View file

@ -142,7 +142,7 @@ void resetplayerstats(int snum)
p->angle.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
p->newowner =-1;
p->newOwner =nullptr;
p->jumping_counter = 0;
p->hard_landing = 0;
p->posxv = 0; //!!

View file

@ -258,9 +258,9 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
//
//---------------------------------------------------------------------------
static inline int16_t getcamspriteang(short const newowner, double const smoothratio)
static inline int16_t getcamspriteang(DDukeActor* newOwner, double const smoothratio)
{
return hittype[newowner].tempang + xs_CRoundToInt(fmulscale16(((sprite[newowner].ang - hittype[newowner].tempang + 1024) & 2047) - 1024, smoothratio));
return newOwner->tempang + xs_CRoundToInt(fmulscale16(((newOwner->s.ang - newOwner->tempang + 1024) & 2047) - 1024, smoothratio));
}
//---------------------------------------------------------------------------
@ -282,9 +282,9 @@ void animatecamsprite(double smoothratio)
auto act = &hittype[spriteNum];
auto sp = &act->s;
if (p->newowner >= 0) sp->owner = p->newowner;
if (p->newOwner != nullptr) act->SetOwner(p->newOwner);
if (sp->owner >= 0 && dist(p->GetActor(), act) < VIEWSCREEN_ACTIVE_DISTANCE)
if (act->GetOwner() && dist(p->GetActor(), act) < VIEWSCREEN_ACTIVE_DISTANCE)
{
auto tex = tileGetTexture(sp->picnum);
TileFiles.MakeCanvas(TILE_VIEWSCR, tex->GetDisplayWidth(), tex->GetDisplayHeight());
@ -294,8 +294,8 @@ void animatecamsprite(double smoothratio)
screen->RenderTextureView(canvas, [=](IntRect& rect)
{
auto camera = &sprite[sp->owner];
auto ang = getcamspriteang(sp->owner, smoothratio);
auto camera = &act->GetOwner()->s;
auto ang = getcamspriteang(act->GetOwner(), smoothratio);
// Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself.
drawrooms(camera->x, camera->y, camera->z, ang, 100 + camera->shade, camera->sectnum); // why 'shade'...?
display_mirror = 1; // should really be 'display external view'.
@ -592,10 +592,10 @@ void displayrooms(int snum, double smoothratio)
}
}
if (p->newowner >= 0)
if (p->newOwner != nullptr)
{
auto spr = &sprite[p->newowner];
cang = buildang(getcamspriteang(p->newowner, smoothratio));
auto spr = &p->newOwner->s;
cang = buildang(getcamspriteang(p->newOwner, smoothratio));
choriz = buildhoriz(spr->shade);
cposx = spr->pos.x;
cposy = spr->pos.y;
@ -633,7 +633,7 @@ void displayrooms(int snum, double smoothratio)
if (p->GetActor()->s.pal == 1) cposz -= (18 << 8);
else if (p->spritebridge == 0 && p->newowner < 0)
else if (p->spritebridge == 0 && p->newOwner == nullptr)
{
if (cposz < (p->truecz + (4 << 8))) cposz = cz + (4 << 8);
else if (cposz > (p->truefz - (4 << 8))) cposz = fz - (4 << 8);

View file

@ -173,7 +173,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("tipincs", w.tipincs)
("wantweaponfire", w.wantweaponfire)
("holoduke_amount", w.holoduke_amount)
("newowner", w.newowner)
("newowner", w.newOwner)
("hurt_delay", w.hurt_delay)
("hbomb_hold_delay", w.hbomb_hold_delay)
("jumping_counter", w.jumping_counter)

View file

@ -1451,9 +1451,9 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
if (s->statnum == 10)
{
p = s->yvel;
if (ps[p].newowner >= 0)
if (ps[p].newOwner != nullptr)
{
ps[p].newowner = -1;
ps[p].newOwner = nullptr;
ps[p].posx = ps[p].oposx;
ps[p].posy = ps[p].oposy;
ps[p].posz = ps[p].oposz;
@ -1536,7 +1536,7 @@ void checksectors_d(int snum)
if (ud.cashman && PlayerInput(snum, SB_OPEN))
fi.lotsofmoney(p->GetActor(), 2);
if (p->newowner >= 0)
if (p->newOwner != nullptr)
{
if (abs(PlayerInputSideVel(snum)) > 768 || abs(PlayerInputForwardVel(snum)) > 768)
{
@ -1553,7 +1553,7 @@ void checksectors_d(int snum)
if (PlayerInput(snum, SB_ESCAPE))
{
if (p->newowner >= 0)
if (p->newOwner != nullptr)
{
i = -1;
goto CLEARCAMERAS;
@ -1578,7 +1578,7 @@ void checksectors_d(int snum)
if (wall[hitscanwall].lotag)
return;
if (p->newowner >= 0)
if (p->newOwner != nullptr)
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else
{
@ -1618,7 +1618,7 @@ void checksectors_d(int snum)
}
}
if (p->newowner == -1 && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag))
neartagsector = p->GetActor()->s.sectnum;
@ -1721,7 +1721,7 @@ void checksectors_d(int snum)
p->cursectnum = j;
// parallaxtype = 2;
p->newowner = acti->GetIndex();
p->newOwner = acti;
return;
}
}
@ -1734,7 +1734,7 @@ void checksectors_d(int snum)
p->posx = p->oposx;
p->posy = p->oposy;
p->posz = p->oposz;
p->newowner = -1;
p->newOwner = nullptr;
updatesector(p->posx, p->posy, &p->cursectnum);
setpal(p);
@ -1745,15 +1745,15 @@ void checksectors_d(int snum)
if (act->s.picnum == CAMERA1) act->s.yvel = 0;
}
}
else if (p->newowner >= 0)
p->newowner = -1;
else if (p->newOwner != nullptr)
p->newOwner = nullptr;
return;
}
}
if (!PlayerInput(snum, SB_OPEN)) return;
else if (p->newowner >= 0) { i = -1; goto CLEARCAMERAS; }
else if (p->newOwner != nullptr) { i = -1; goto CLEARCAMERAS; }
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == nullptr)
if (abs(hits(p->GetActor())) < 512)
@ -1772,7 +1772,7 @@ void checksectors_d(int snum)
fi.checkhitswitch(snum, neartagwall, nullptr);
return;
}
else if (p->newowner >= 0)
else if (p->newOwner != nullptr)
{
i = -1;
goto CLEARCAMERAS;

View file

@ -2400,9 +2400,9 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
if (s->statnum == 10)
{
p = s->yvel;
if (ps[p].newowner >= 0)
if (ps[p].newOwner != nullptr)
{
ps[p].newowner = -1;
ps[p].newOwner = nullptr;
ps[p].posx = ps[p].oposx;
ps[p].posy = ps[p].oposy;
ps[p].posz = ps[p].oposz;
@ -2556,7 +2556,7 @@ void checksectors_r(int snum)
neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
}
if (p->newowner >= 0)
if (p->newOwner != nullptr)
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else
{
@ -2589,7 +2589,7 @@ void checksectors_r(int snum)
}
}
if (p->newowner == -1 && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag))
neartagsector = p->GetActor()->s.sectnum;

View file

@ -208,7 +208,7 @@ struct player_struct
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
short holoduke_amount, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum;
short got_access, weapon_ang, firstaid_amount;
@ -217,7 +217,7 @@ struct player_struct
short cheat_phase;
short extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound;
DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum, *dummyplayersprite;
DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum, *dummyplayersprite, *newOwner;
short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag;