mirror of
https://github.com/ZDoom/Raze.git
synced 2025-04-04 23:12:15 +00:00
- moved a lot of shareable code out of the CON interpreter.
This commit is contained in:
parent
9ba0b18013
commit
60339a217c
9 changed files with 559 additions and 367 deletions
|
@ -27,6 +27,7 @@ struct FActorInfo
|
|||
int DefaultFlags = 0;
|
||||
int DefaultCstat = 0;
|
||||
int Health = 0; // not used yet - this will stand in if no CON defines a health value for Duke.
|
||||
FName DamageType = NAME_None; // damage type this item inflicts
|
||||
|
||||
// these are temporary. Due to how Build games handle their tiles, we cannot look up the textures when scripts are being parsed.
|
||||
TArray<FString> SpriteSetNames;
|
||||
|
|
|
@ -274,6 +274,7 @@ int ssp(DDukeActor* const actor, unsigned int cliptype) //The set sprite functio
|
|||
return movesprite_ex(actor, DVector3(actor->spr.Angles.Yaw.ToVector() * actor->vel.X, actor->vel.Z), cliptype, c) == kHitNone;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -3504,5 +3505,135 @@ void movefta(void)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actorsizeto(DDukeActor* actor, double x, double y)
|
||||
{
|
||||
// JBF 20030805: As I understand it, if repeat becomes 0 it basically kills the
|
||||
// sprite, which is why the "sizeto 0 41" calls in 1.3d became "sizeto 4 41" in
|
||||
// 1.4, so instead of patching the CONs I'll surruptitiously patch the code here
|
||||
//if (!isPlutoPak() && *insptr == 0) *insptr = 4;
|
||||
|
||||
double siz = (x - actor->spr.scale.X);
|
||||
actor->spr.scale.X = (clamp(actor->spr.scale.X + Sgn(siz) * REPEAT_SCALE, 0., 4.));
|
||||
|
||||
auto scale = actor->spr.scale.Y;
|
||||
auto tex = TexMan.GetGameTexture(actor->spr.spritetexture());
|
||||
if ((actor->isPlayer() && scale < 0.5626) || y < scale || (scale * (tex->GetDisplayHeight() + 8)) < actor->floorz - actor->ceilingz)
|
||||
{
|
||||
siz = (y - actor->spr.scale.Y);
|
||||
actor->spr.scale.Y = (clamp(actor->spr.scale.Y + Sgn(siz) * REPEAT_SCALE, 0., 4.));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void spawndebris(DDukeActor* g_ac, int dnum, int count)
|
||||
{
|
||||
if (dnum < 0 || dnum >= ScrapMax) return; // this code only works with scrap and nothing else.
|
||||
bool weap = fi.spawnweapondebris(g_ac->spr.picnum);
|
||||
|
||||
if (g_ac->insector())
|
||||
for (int j = count; j >= 0; j--)
|
||||
{
|
||||
int s;
|
||||
if (weap)
|
||||
s = 0;
|
||||
else s = (krand() % 3);
|
||||
DVector3 offs;
|
||||
offs.X = krandf(16) - 8;
|
||||
offs.Y = krandf(16) - 8;
|
||||
offs.Z = -krandf(16) - 8;
|
||||
|
||||
auto a = randomAngle();
|
||||
auto vel = krandf(8) + 2;
|
||||
auto zvel = -krandf(8);
|
||||
DVector2 scale(0.5 + (krand() & 15) * REPEAT_SCALE, 0.5 + (krand() & 15) * REPEAT_SCALE);
|
||||
|
||||
auto spawned = CreateActor(g_ac->sector(), g_ac->spr.pos + offs, PClass::FindActor("DukeScrap"), g_ac->spr.shade, scale, a, vel, zvel, g_ac, STAT_MISC);
|
||||
if (spawned)
|
||||
{
|
||||
spawned->spriteextra = dnum + s;
|
||||
if (weap)
|
||||
spawned->spr.yint = (j % 15) + 1;
|
||||
else spawned->spr.yint = -1;
|
||||
spawned->spr.pal = g_ac->spr.pal;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actoroperate(DDukeActor* g_ac)
|
||||
{
|
||||
if (g_ac->sector()->lotag == 0)
|
||||
{
|
||||
HitInfo hit{};
|
||||
neartag(g_ac->spr.pos.plusZ(-32), g_ac->sector(), g_ac->spr.Angles.Yaw, hit, 48, NT_Lotag | NT_NoSpriteCheck);
|
||||
auto sectp = hit.hitSector;
|
||||
if (sectp)
|
||||
{
|
||||
if (isanearoperator(sectp->lotag))
|
||||
if ((sectp->lotag & 0xff) == ST_23_SWINGING_DOOR || sectp->floorz == sectp->ceilingz)
|
||||
if ((sectp->lotag & 16384) == 0 && (sectp->lotag & 32768) == 0)
|
||||
{
|
||||
DukeSectIterator it(sectp);
|
||||
DDukeActor* a2;
|
||||
while ((a2 = it.Next()))
|
||||
{
|
||||
if (isactivator(a2))
|
||||
break;
|
||||
}
|
||||
if (a2 == nullptr)
|
||||
operatesectors(sectp, g_ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void garybanjo(DDukeActor* g_ac)
|
||||
{
|
||||
if (banjosound == 0)
|
||||
{
|
||||
int rnum = (krand() & 3) + 1;
|
||||
if (rnum == 4)
|
||||
{
|
||||
banjosound = 262;
|
||||
}
|
||||
else if (rnum == 1)
|
||||
{
|
||||
banjosound = 272;
|
||||
}
|
||||
else if (rnum == 2)
|
||||
{
|
||||
banjosound = 273;
|
||||
}
|
||||
else
|
||||
{
|
||||
banjosound = 273;
|
||||
}
|
||||
S_PlayActorSound(banjosound, g_ac, CHAN_WEAPON);
|
||||
}
|
||||
else if (!S_CheckActorSoundPlaying(g_ac, banjosound))
|
||||
S_PlayActorSound(banjosound, g_ac, CHAN_WEAPON);
|
||||
}
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -500,6 +500,7 @@ enum
|
|||
enum miscConstants
|
||||
{
|
||||
MAXSLEEPDIST = 16384,
|
||||
MAXSLEEPDISTF = 1024,
|
||||
SLEEPTIME = 1536,
|
||||
ZOFFSET6 = (4 << 8),
|
||||
FOURSLEIGHT = (1 << 8),
|
||||
|
|
|
@ -118,6 +118,26 @@ void purplelavacheck(player_struct* p);
|
|||
bool addphealth(player_struct* p, int amount, bool bigitem);
|
||||
bool playereat(player_struct* p, int amount, bool bigitem);
|
||||
void playerdrink(player_struct* p, int amount);
|
||||
bool playeraddammo(player_struct* p, int weaponindex, int amount);
|
||||
bool playeraddweapon(player_struct* p, int weaponindex, int amount);
|
||||
void playeraddinventory(player_struct* p, DDukeActor* item, int type, int amount);
|
||||
void actorsizeto(DDukeActor* actor, double x, double y);
|
||||
void spawndebris(DDukeActor* g_ac, int dnum, int count);
|
||||
bool checkp(DDukeActor* self, player_struct* p, int flags);
|
||||
bool playercheckinventory(player_struct* p, DDukeActor* item, int type, int amount);
|
||||
void playerstomp(player_struct* p, DDukeActor* stomped);
|
||||
void playerreset(player_struct* p, DDukeActor* g_ac);
|
||||
void wackplayer(player_struct* p);
|
||||
void actoroperate(DDukeActor* g_ac);
|
||||
void playerkick(player_struct* p, DDukeActor* g_ac);
|
||||
void garybanjo(DDukeActor* g_ac);
|
||||
bool ifsquished(DDukeActor* i, int p);
|
||||
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
||||
void tearitup(sectortype* sect);
|
||||
void destroyit(DDukeActor* actor);
|
||||
void mamaspawn(DDukeActor* actor);
|
||||
void forceplayerangle(player_struct* snum);
|
||||
|
||||
|
||||
bool checkhitceiling(sectortype* sectp);
|
||||
void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos);
|
||||
|
@ -181,9 +201,9 @@ int startrts(int lumpNum, int localPlayer);
|
|||
|
||||
void pickrandomspot(int pn);
|
||||
void premapcontroller(DDukeActor* ac);
|
||||
void resetinventory(int pn);
|
||||
void resetinventory(player_struct* pn);
|
||||
void resetplayerstats(int pn);
|
||||
void resetweapons(int pn);
|
||||
void resetweapons(player_struct* pn);
|
||||
void resetprestat(int snum, int g);
|
||||
void prelevel_common(int g);
|
||||
void cacheit_d();
|
||||
|
|
|
@ -81,13 +81,6 @@ struct ParseState
|
|||
};
|
||||
|
||||
int furthestcanseepoint(DDukeActor* i, DDukeActor* ts, DVector2& pos);
|
||||
bool ifsquished(DDukeActor* i, int p);
|
||||
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
||||
void tearitup(sectortype* sect);
|
||||
void destroyit(DDukeActor* actor);
|
||||
void mamaspawn(DDukeActor* actor);
|
||||
void forceplayerangle(int snum);
|
||||
|
||||
bool killthesprite = false;
|
||||
|
||||
void addspritetodelete(int spnum)
|
||||
|
@ -1459,7 +1452,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static bool ifcansee(DDukeActor* actor, int pnum)
|
||||
bool ifcansee(DDukeActor* actor, int pnum)
|
||||
{
|
||||
int j;
|
||||
DDukeActor* tosee;
|
||||
|
@ -1508,7 +1501,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
|
|||
|
||||
int ParseState::parse(void)
|
||||
{
|
||||
int j, l, s;
|
||||
int j, l;
|
||||
|
||||
if(killit_flag) return 1;
|
||||
|
||||
|
@ -1644,29 +1637,7 @@ int ParseState::parse(void)
|
|||
insptr++;
|
||||
break;
|
||||
case concmd_garybanjo:
|
||||
if (banjosound == 0)
|
||||
{
|
||||
int rnum = (krand() & 3) + 1;
|
||||
if (rnum == 4)
|
||||
{
|
||||
banjosound = 262;
|
||||
}
|
||||
else if (rnum == 1)
|
||||
{
|
||||
banjosound = 272;
|
||||
}
|
||||
else if (rnum == 2)
|
||||
{
|
||||
banjosound = 273;
|
||||
}
|
||||
else
|
||||
{
|
||||
banjosound = 273;
|
||||
}
|
||||
S_PlayActorSound(banjosound, g_ac, CHAN_WEAPON);
|
||||
}
|
||||
else if (!S_CheckActorSoundPlaying(g_ac, banjosound))
|
||||
S_PlayActorSound(banjosound, g_ac, CHAN_WEAPON);
|
||||
garybanjo(g_ac);
|
||||
insptr++;
|
||||
break;
|
||||
case concmd_motoloopsnd:
|
||||
|
@ -1707,42 +1678,13 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_pkick:
|
||||
insptr++;
|
||||
|
||||
if (ud.multimode > 1 && g_ac->isPlayer())
|
||||
{
|
||||
if (ps[otherp].quick_kick == 0)
|
||||
ps[otherp].quick_kick = 14;
|
||||
}
|
||||
else if (!g_ac->isPlayer() && ps[g_p].quick_kick == 0)
|
||||
ps[g_p].quick_kick = 14;
|
||||
playerkick(&ps[g_p], g_ac);
|
||||
break;
|
||||
case concmd_sizeto:
|
||||
{
|
||||
insptr++;
|
||||
|
||||
// JBF 20030805: As I understand it, if repeat becomes 0 it basically kills the
|
||||
// sprite, which is why the "sizeto 0 41" calls in 1.3d became "sizeto 4 41" in
|
||||
// 1.4, so instead of patching the CONs I'll surruptitiously patch the code here
|
||||
//if (!isPlutoPak() && *insptr == 0) *insptr = 4;
|
||||
|
||||
double siz = ((*insptr) * REPEAT_SCALE - g_ac->spr.scale.X);
|
||||
g_ac->spr.scale.X = (clamp(g_ac->spr.scale.X + Sgn(siz) * REPEAT_SCALE, 0., 4.));
|
||||
|
||||
insptr++;
|
||||
|
||||
auto scale = g_ac->spr.scale.Y;
|
||||
auto tex = TexMan.GetGameTexture(g_ac->spr.spritetexture());
|
||||
if ((g_ac->isPlayer() && scale < 0.5626) || *insptr * REPEAT_SCALE < scale || (scale * (tex->GetDisplayHeight() + 8)) < g_ac->floorz - g_ac->ceilingz)
|
||||
{
|
||||
siz = ((*insptr) * REPEAT_SCALE - g_ac->spr.scale.Y);
|
||||
g_ac->spr.scale.Y = (clamp(g_ac->spr.scale.Y + Sgn(siz) * REPEAT_SCALE, 0., 4.));
|
||||
}
|
||||
|
||||
insptr++;
|
||||
|
||||
actorsizeto(g_ac, *insptr * REPEAT_SCALE, *(insptr + 1) * REPEAT_SCALE);
|
||||
insptr += 2;
|
||||
break;
|
||||
|
||||
}
|
||||
case concmd_sizeat:
|
||||
insptr++;
|
||||
g_ac->spr.scale.X = ((uint8_t)*insptr * REPEAT_SCALE);
|
||||
|
@ -1852,15 +1794,7 @@ int ParseState::parse(void)
|
|||
return 1;
|
||||
case concmd_addammo:
|
||||
insptr++;
|
||||
if( ps[g_p].ammo_amount[*insptr] >= gs.max_ammo_amount[*insptr] )
|
||||
{
|
||||
killit_flag = 2;
|
||||
break;
|
||||
}
|
||||
addammo( *insptr, &ps[g_p], *(insptr+1) );
|
||||
if(ps[g_p].curr_weapon == KNEE_WEAPON)
|
||||
if( ps[g_p].gotweapon[*insptr] && (WeaponSwitch(g_p) & 1))
|
||||
fi.addweapon(&ps[g_p], *insptr, true);
|
||||
if (!playeraddammo(&ps[g_p], *insptr, *(insptr + 1))) killit_flag = 2;
|
||||
insptr += 2;
|
||||
break;
|
||||
case concmd_money:
|
||||
|
@ -1885,13 +1819,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_addkills:
|
||||
insptr++;
|
||||
if (g_ac->spriteextra < 1 || g_ac->spriteextra == 128 || !isRR())
|
||||
{
|
||||
if (*insptr) addkill(g_ac);
|
||||
else if (*insptr < 0) subkill(g_ac);
|
||||
}
|
||||
g_ac->actorstayput = nullptr;
|
||||
insptr++;
|
||||
dokill(&ps[g_p], g_ac, *insptr++);
|
||||
break;
|
||||
case concmd_lotsofglass:
|
||||
insptr++;
|
||||
|
@ -1904,16 +1832,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_addweapon:
|
||||
insptr++;
|
||||
if( ps[g_p].gotweapon[*insptr] == 0 ) fi.addweapon( &ps[g_p], *insptr, !!(WeaponSwitch(g_p) & 1));
|
||||
else if( ps[g_p].ammo_amount[*insptr] >= gs.max_ammo_amount[*insptr] )
|
||||
{
|
||||
killit_flag = 2;
|
||||
break;
|
||||
}
|
||||
addammo( *insptr, &ps[g_p], *(insptr+1) );
|
||||
if(ps[g_p].curr_weapon == KNEE_WEAPON)
|
||||
if( ps[g_p].gotweapon[*insptr] && (WeaponSwitch(g_p) & 1))
|
||||
fi.addweapon(&ps[g_p], *insptr, true);
|
||||
if (!playeraddweapon(&ps[g_p], *insptr, *(insptr + 1))) killit_flag = 2;
|
||||
insptr+=2;
|
||||
break;
|
||||
case concmd_debug:
|
||||
|
@ -2008,44 +1927,10 @@ int ParseState::parse(void)
|
|||
g_t[2] = 0;
|
||||
break;
|
||||
case concmd_debris:
|
||||
{
|
||||
insptr++;
|
||||
int dnum = *insptr - gs.firstdebris;
|
||||
if (dnum < 0 || dnum >= ScrapMax) break; // this code only works with scrap and nothing else.
|
||||
insptr++;
|
||||
int count = *insptr;
|
||||
bool weap = fi.spawnweapondebris(g_ac->spr.picnum);
|
||||
|
||||
|
||||
if(g_ac->insector())
|
||||
for(j = count; j >= 0; j--)
|
||||
{
|
||||
if(weap)
|
||||
s = 0;
|
||||
else s = (krand()%3);
|
||||
DVector3 offs;
|
||||
offs.X = krandf(16) - 8;
|
||||
offs.Y = krandf(16) - 8;
|
||||
offs.Z = -krandf(16) - 8;
|
||||
|
||||
auto a = randomAngle();
|
||||
auto vel = krandf(8) + 2;
|
||||
auto zvel = -krandf(8);
|
||||
DVector2 scale(0.5 + (krand() & 15) * REPEAT_SCALE, 0.5 + (krand() & 15) * REPEAT_SCALE);
|
||||
|
||||
auto spawned = CreateActor(g_ac->sector(), g_ac->spr.pos + offs, PClass::FindActor("DukeScrap"), g_ac->spr.shade, scale, a, vel, zvel, g_ac, STAT_MISC);
|
||||
if (spawned)
|
||||
{
|
||||
spawned->spriteextra = dnum + s;
|
||||
if (weap)
|
||||
spawned->spr.yint = (j % 15) + 1;
|
||||
else spawned->spr.yint = -1;
|
||||
spawned->spr.pal = g_ac->spr.pal;
|
||||
}
|
||||
}
|
||||
insptr++;
|
||||
}
|
||||
break;
|
||||
spawndebris(g_ac, *insptr - gs.firstdebris, *(insptr + 1));
|
||||
insptr += 2;
|
||||
break;
|
||||
case concmd_count:
|
||||
insptr++;
|
||||
g_t[0] = (short) *insptr;
|
||||
|
@ -2077,63 +1962,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_resetplayer:
|
||||
insptr++;
|
||||
|
||||
if(ud.multimode < 2)
|
||||
{
|
||||
gameaction = ga_autoloadgame;
|
||||
killit_flag = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// I am not convinced this is even remotely smart to be executed from here..
|
||||
pickrandomspot(g_p);
|
||||
g_ac->spr.pos = ps[g_p].GetActor()->getPosWithOffsetZ();
|
||||
ps[g_p].GetActor()->backuppos();
|
||||
ps[g_p].setbobpos();
|
||||
g_ac->backuppos();
|
||||
updatesector(ps[g_p].GetActor()->getPosWithOffsetZ(), &ps[g_p].cursector);
|
||||
SetActor(ps[g_p].GetActor(), ps[g_p].GetActor()->spr.pos);
|
||||
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
|
||||
g_ac->spr.shade = -12;
|
||||
g_ac->clipdist = 16;
|
||||
g_ac->spr.scale = DVector2(0.65625, 0.5625);
|
||||
g_ac->SetOwner(g_ac);
|
||||
g_ac->spr.xoffset = 0;
|
||||
g_ac->spr.pal = ps[g_p].palookup;
|
||||
|
||||
ps[g_p].last_extra = g_ac->spr.extra = gs.max_player_health;
|
||||
ps[g_p].wantweaponfire = -1;
|
||||
ps[g_p].GetActor()->PrevAngles.Pitch = ps[g_p].GetActor()->spr.Angles.Pitch = nullAngle;
|
||||
ps[g_p].on_crane = nullptr;
|
||||
ps[g_p].frag_ps = g_p;
|
||||
ps[g_p].Angles.PrevViewAngles.Pitch = ps[g_p].Angles.ViewAngles.Pitch = nullAngle;
|
||||
ps[g_p].opyoff = 0;
|
||||
ps[g_p].wackedbyactor = nullptr;
|
||||
ps[g_p].shield_amount = gs.max_armour_amount;
|
||||
ps[g_p].dead_flag = 0;
|
||||
ps[g_p].pals.a = 0;
|
||||
ps[g_p].footprintcount = 0;
|
||||
ps[g_p].weapreccnt = 0;
|
||||
ps[g_p].ftq = 0;
|
||||
ps[g_p].vel.X = ps[g_p].vel.Y = 0;
|
||||
if (!isRR()) ps[g_p].Angles.PrevViewAngles.Roll = ps[g_p].Angles.ViewAngles.Roll = nullAngle;
|
||||
|
||||
ps[g_p].falling_counter = 0;
|
||||
|
||||
g_ac->hitextra = -1;
|
||||
|
||||
g_ac->cgg = 0;
|
||||
g_ac->movflag = 0;
|
||||
g_ac->tempval = 0;
|
||||
g_ac->actorstayput = nullptr;
|
||||
g_ac->dispicnum = 0;
|
||||
g_ac->SetHitOwner(ps[g_p].GetActor());
|
||||
g_ac->temp_data[4] = 0;
|
||||
|
||||
resetinventory(g_p);
|
||||
resetweapons(g_p);
|
||||
}
|
||||
playerreset(&ps[g_p], g_ac);
|
||||
break;
|
||||
case concmd_ifcoop:
|
||||
parseifelse(ud.coop || numplayers > 2);
|
||||
|
@ -2163,7 +1992,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
|
||||
case concmd_ifinwater:
|
||||
parseifelse( g_ac->sector()->lotag == 2);
|
||||
parseifelse( g_ac->sector()->lotag == ST_2_UNDERWATER);
|
||||
break;
|
||||
case concmd_ifcount:
|
||||
insptr++;
|
||||
|
@ -2178,65 +2007,9 @@ int ParseState::parse(void)
|
|||
g_t[0] = 0;
|
||||
break;
|
||||
case concmd_addinventory:
|
||||
insptr+=2;
|
||||
switch(*(insptr-1))
|
||||
{
|
||||
case 0:
|
||||
ps[g_p].steroids_amount = *insptr;
|
||||
ps[g_p].inven_icon = 2;
|
||||
break;
|
||||
case 1:
|
||||
ps[g_p].shield_amount += *insptr;// 100;
|
||||
if(ps[g_p].shield_amount > gs.max_player_health)
|
||||
ps[g_p].shield_amount = gs.max_player_health;
|
||||
break;
|
||||
case 2:
|
||||
ps[g_p].scuba_amount = *insptr;// 1600;
|
||||
ps[g_p].inven_icon = 6;
|
||||
break;
|
||||
case 3:
|
||||
ps[g_p].holoduke_amount = *insptr;// 1600;
|
||||
ps[g_p].inven_icon = 3;
|
||||
break;
|
||||
case 4:
|
||||
ps[g_p].jetpack_amount = *insptr;// 1600;
|
||||
ps[g_p].inven_icon = 4;
|
||||
break;
|
||||
case 6:
|
||||
if (isRR())
|
||||
{
|
||||
switch (g_ac->spr.lotag)
|
||||
{
|
||||
case 100: ps[g_p].keys[1] = 1; break;
|
||||
case 101: ps[g_p].keys[2] = 1; break;
|
||||
case 102: ps[g_p].keys[3] = 1; break;
|
||||
case 103: ps[g_p].keys[4] = 1; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (g_ac->spr.pal)
|
||||
{
|
||||
case 0: ps[g_p].got_access |= 1; break;
|
||||
case 21: ps[g_p].got_access |= 2; break;
|
||||
case 23: ps[g_p].got_access |= 4; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
ps[g_p].heat_amount = *insptr;
|
||||
ps[g_p].inven_icon = 5;
|
||||
break;
|
||||
case 9:
|
||||
ps[g_p].inven_icon = 1;
|
||||
ps[g_p].firstaid_amount = *insptr;
|
||||
break;
|
||||
case 10:
|
||||
ps[g_p].inven_icon = 7;
|
||||
ps[g_p].boot_amount = *insptr;
|
||||
break;
|
||||
}
|
||||
insptr++;
|
||||
playeraddinventory(&ps[g_p], g_ac, *insptr, *(insptr+1));
|
||||
insptr += 2;
|
||||
break;
|
||||
case concmd_hitradius:
|
||||
fi.hitradius(g_ac, *(insptr + 1), *(insptr + 2), *(insptr + 3), *(insptr + 4), *(insptr + 5));
|
||||
|
@ -2317,19 +2090,12 @@ int ParseState::parse(void)
|
|||
}
|
||||
case concmd_slapplayer:
|
||||
insptr++;
|
||||
forceplayerangle(g_p);
|
||||
forceplayerangle(&ps[g_p]);
|
||||
ps[g_p].vel.XY() -= ps[g_p].GetActor()->spr.Angles.Yaw.ToVector() * 8;
|
||||
return 0;
|
||||
case concmd_wackplayer:
|
||||
insptr++;
|
||||
if (!isRR())
|
||||
forceplayerangle(g_p);
|
||||
else
|
||||
{
|
||||
ps[g_p].vel.XY() -= ps[g_p].GetActor()->spr.Angles.Yaw.ToVector() * 64;
|
||||
ps[g_p].jumping_counter = 767;
|
||||
ps[g_p].jumping_toggle = 1;
|
||||
}
|
||||
wackplayer(&ps[g_p]);
|
||||
return 0;
|
||||
case concmd_ifgapzl:
|
||||
insptr++;
|
||||
|
@ -2346,29 +2112,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_operate:
|
||||
insptr++;
|
||||
if( g_ac->sector()->lotag == 0 )
|
||||
{
|
||||
HitInfo hit{};
|
||||
neartag(g_ac->spr.pos.plusZ(-32), g_ac->sector(), g_ac->spr.Angles.Yaw, hit, 48, NT_Lotag | NT_NoSpriteCheck);
|
||||
auto sectp = hit.hitSector;
|
||||
if (sectp)
|
||||
{
|
||||
if (isanearoperator(sectp->lotag))
|
||||
if ((sectp->lotag & 0xff) == ST_23_SWINGING_DOOR || sectp->floorz == sectp->ceilingz)
|
||||
if ((sectp->lotag & 16384) == 0 && (sectp->lotag & 32768) == 0)
|
||||
{
|
||||
DukeSectIterator it(sectp);
|
||||
DDukeActor* a2;
|
||||
while ((a2 = it.Next()))
|
||||
{
|
||||
if (isactivator(a2))
|
||||
break;
|
||||
}
|
||||
if (a2 == nullptr)
|
||||
operatesectors(sectp, g_ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
actoroperate(g_ac);
|
||||
break;
|
||||
case concmd_ifinspace:
|
||||
parseifelse(ceilingspace(g_ac->sector()));
|
||||
|
@ -2583,75 +2327,11 @@ int ParseState::parse(void)
|
|||
|
||||
case concmd_ifpinventory:
|
||||
{
|
||||
insptr++;
|
||||
j = 0;
|
||||
switch(*(insptr++))
|
||||
{
|
||||
case 0:
|
||||
if( ps[g_p].steroids_amount != *insptr)
|
||||
j = 1;
|
||||
break;
|
||||
case 1:
|
||||
if(ps[g_p].shield_amount != gs.max_player_health )
|
||||
j = 1;
|
||||
break;
|
||||
case 2:
|
||||
if(ps[g_p].scuba_amount != *insptr) j = 1;
|
||||
break;
|
||||
case 3:
|
||||
if(ps[g_p].holoduke_amount != *insptr) j = 1;
|
||||
break;
|
||||
case 4:
|
||||
if(ps[g_p].jetpack_amount != *insptr) j = 1;
|
||||
break;
|
||||
case 6:
|
||||
if (isRR())
|
||||
{
|
||||
switch (g_ac->spr.lotag)
|
||||
{
|
||||
case 100:
|
||||
if (ps[g_p].keys[1]) j = 1;
|
||||
break;
|
||||
case 101:
|
||||
if (ps[g_p].keys[2]) j = 1;
|
||||
break;
|
||||
case 102:
|
||||
if (ps[g_p].keys[3]) j = 1;
|
||||
break;
|
||||
case 103:
|
||||
if (ps[g_p].keys[4]) j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (g_ac->spr.pal)
|
||||
{
|
||||
case 0:
|
||||
if (ps[g_p].got_access & 1) j = 1;
|
||||
break;
|
||||
case 21:
|
||||
if (ps[g_p].got_access & 2) j = 1;
|
||||
break;
|
||||
case 23:
|
||||
if (ps[g_p].got_access & 4) j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if(ps[g_p].heat_amount != *insptr) j = 1;
|
||||
break;
|
||||
case 9:
|
||||
if(ps[g_p].firstaid_amount != *insptr) j = 1;
|
||||
break;
|
||||
case 10:
|
||||
if(ps[g_p].boot_amount != *insptr) j = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
parseifelse(j);
|
||||
break;
|
||||
insptr++;
|
||||
j = playercheckinventory(&ps[g_p], g_ac, *insptr, *(insptr + 1));
|
||||
insptr ++;
|
||||
parseifelse(j);
|
||||
break;
|
||||
}
|
||||
case concmd_pstomp:
|
||||
insptr++;
|
||||
|
|
|
@ -387,4 +387,15 @@ inline void subkill(DDukeActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
inline void dokill(player_struct* p, DDukeActor* g_ac, int amount)
|
||||
{
|
||||
if (g_ac->spriteextra < 1 || g_ac->spriteextra == 128 || !isRR())
|
||||
{
|
||||
if (amount > 0) addkill(g_ac);
|
||||
else if (amount < 0) subkill(g_ac);
|
||||
}
|
||||
g_ac->actorstayput = nullptr;
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -113,9 +113,8 @@ void quickkill(player_struct* p)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void forceplayerangle(int snum)
|
||||
void forceplayerangle(player_struct* p)
|
||||
{
|
||||
player_struct* p = &ps[snum];
|
||||
const auto ang = (DAngle22_5 - randomAngle(45)) / 2.;
|
||||
|
||||
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(26.566);
|
||||
|
@ -1191,4 +1190,361 @@ void playerdrink(player_struct* p, int amount)
|
|||
p->last_extra = gs.max_player_health;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool playeraddammo(player_struct* p, int weaponindex, int amount)
|
||||
{
|
||||
if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
addammo(weaponindex, p, amount);
|
||||
if (p->curr_weapon == KNEE_WEAPON)
|
||||
if (p->gotweapon[weaponindex] && (WeaponSwitch(p - ps) & 1))
|
||||
fi.addweapon(p, weaponindex, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool playeraddweapon(player_struct* p, int weaponindex, int amount)
|
||||
{
|
||||
if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p- ps) & 1));
|
||||
else if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
addammo(weaponindex, p, amount);
|
||||
if (p->curr_weapon == KNEE_WEAPON)
|
||||
if (p->gotweapon[weaponindex] && (WeaponSwitch(p - ps) & 1))
|
||||
fi.addweapon(p, weaponindex, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void playeraddinventory(player_struct* p, DDukeActor* item, int type, int amount)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
p->steroids_amount = amount;
|
||||
p->inven_icon = 2;
|
||||
break;
|
||||
case 1:
|
||||
p->shield_amount += amount;// 100;
|
||||
if (p->shield_amount > gs.max_player_health)
|
||||
p->shield_amount = gs.max_player_health;
|
||||
break;
|
||||
case 2:
|
||||
p->scuba_amount = amount;// 1600;
|
||||
p->inven_icon = 6;
|
||||
break;
|
||||
case 3:
|
||||
p->holoduke_amount = amount;// 1600;
|
||||
p->inven_icon = 3;
|
||||
break;
|
||||
case 4:
|
||||
p->jetpack_amount = amount;// 1600;
|
||||
p->inven_icon = 4;
|
||||
break;
|
||||
case 6:
|
||||
if (isRR())
|
||||
{
|
||||
switch (item->spr.lotag)
|
||||
{
|
||||
case 100: p->keys[1] = 1; break;
|
||||
case 101: p->keys[2] = 1; break;
|
||||
case 102: p->keys[3] = 1; break;
|
||||
case 103: p->keys[4] = 1; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (item->spr.pal)
|
||||
{
|
||||
case 0: p->got_access |= 1; break;
|
||||
case 21: p->got_access |= 2; break;
|
||||
case 23: p->got_access |= 4; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
p->heat_amount = amount;
|
||||
p->inven_icon = 5;
|
||||
break;
|
||||
case 9:
|
||||
p->inven_icon = 1;
|
||||
p->firstaid_amount = amount;
|
||||
break;
|
||||
case 10:
|
||||
p->inven_icon = 7;
|
||||
p->boot_amount = amount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool checkp(DDukeActor* self, player_struct* p, int flags)
|
||||
{
|
||||
bool j = 0;
|
||||
|
||||
double vel = self->vel.X;
|
||||
unsigned plindex = unsigned(p - ps);
|
||||
|
||||
// sigh.. this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable.
|
||||
if ((flags & pducking) && p->on_ground && PlayerInput(plindex, SB_CROUCH))
|
||||
j = 1;
|
||||
else if ((flags & pfalling) && p->jumping_counter == 0 && !p->on_ground && p->vel.Z > 8)
|
||||
j = 1;
|
||||
else if ((flags & pjumping) && p->jumping_counter > 348)
|
||||
j = 1;
|
||||
else if ((flags & pstanding) && vel >= 0 && vel < 0.5)
|
||||
j = 1;
|
||||
else if ((flags & pwalking) && vel >= 0.5 && !(PlayerInput(plindex, SB_RUN)))
|
||||
j = 1;
|
||||
else if ((flags & prunning) && vel >= 0.5 && PlayerInput(plindex, SB_RUN))
|
||||
j = 1;
|
||||
else if ((flags & phigher) && p->GetActor()->getOffsetZ() < self->spr.pos.Z - 48)
|
||||
j = 1;
|
||||
else if ((flags & pwalkingback) && vel <= -0.5 && !(PlayerInput(plindex, SB_RUN)))
|
||||
j = 1;
|
||||
else if ((flags & prunningback) && vel <= -0.5 && (PlayerInput(plindex, SB_RUN)))
|
||||
j = 1;
|
||||
else if ((flags & pkicking) && (p->quick_kick > 0 || (p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 0)))
|
||||
j = 1;
|
||||
else if ((flags & pshrunk) && p->GetActor()->spr.scale.X < (isRR() ? 0.125 : 0.5))
|
||||
j = 1;
|
||||
else if ((flags & pjetpack) && p->jetpack_on)
|
||||
j = 1;
|
||||
else if ((flags & ponsteroids) && p->steroids_amount > 0 && p->steroids_amount < 400)
|
||||
j = 1;
|
||||
else if ((flags & ponground) && p->on_ground)
|
||||
j = 1;
|
||||
else if ((flags & palive) && p->GetActor()->spr.scale.X > (isRR() ? 0.125 : 0.5) && p->GetActor()->spr.extra > 0 && p->timebeforeexit == 0)
|
||||
j = 1;
|
||||
else if ((flags & pdead) && p->GetActor()->spr.extra <= 0)
|
||||
j = 1;
|
||||
else if ((flags & pfacing))
|
||||
{
|
||||
DAngle ang;
|
||||
if (self->isPlayer() && ud.multimode > 1)
|
||||
ang = absangle(ps[otherp].GetActor()->spr.Angles.Yaw, (p->GetActor()->spr.pos.XY() - ps[otherp].GetActor()->spr.pos.XY()).Angle());
|
||||
else
|
||||
ang = absangle(p->GetActor()->spr.Angles.Yaw, (self->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle());
|
||||
|
||||
j = ang < DAngle22_5;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool playercheckinventory(player_struct* p, DDukeActor* item, int type, int amount)
|
||||
{
|
||||
bool j = 0;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
if (p->steroids_amount != amount)
|
||||
j = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (p->shield_amount != gs.max_player_health)
|
||||
j = 1;
|
||||
break;
|
||||
case 2:
|
||||
if (p->scuba_amount != amount) j = 1;
|
||||
break;
|
||||
case 3:
|
||||
if (p->holoduke_amount != amount) j = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (p->jetpack_amount != amount) j = 1;
|
||||
break;
|
||||
case 6:
|
||||
if (isRR())
|
||||
{
|
||||
switch (item->spr.lotag)
|
||||
{
|
||||
case 100:
|
||||
if (p->keys[1]) j = 1;
|
||||
break;
|
||||
case 101:
|
||||
if (p->keys[2]) j = 1;
|
||||
break;
|
||||
case 102:
|
||||
if (p->keys[3]) j = 1;
|
||||
break;
|
||||
case 103:
|
||||
if (p->keys[4]) j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (item->spr.pal)
|
||||
{
|
||||
case 0:
|
||||
if (p->got_access & 1) j = 1;
|
||||
break;
|
||||
case 21:
|
||||
if (p->got_access & 2) j = 1;
|
||||
break;
|
||||
case 23:
|
||||
if (p->got_access & 4) j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (p->heat_amount != amount) j = 1;
|
||||
break;
|
||||
case 9:
|
||||
if (p->firstaid_amount != amount) j = 1;
|
||||
break;
|
||||
case 10:
|
||||
if (p->boot_amount != amount) j = 1;
|
||||
break;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void playerstomp(player_struct* p, DDukeActor* stomped)
|
||||
{
|
||||
if (p->knee_incs == 0 && p->GetActor()->spr.scale.X >= (isRR() ? 0.140625 : 0.625))
|
||||
if (cansee(stomped->spr.pos.plusZ(-4), stomped->sector(), p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector()))
|
||||
{
|
||||
p->knee_incs = 1;
|
||||
if (p->weapon_pos == 0)
|
||||
p->weapon_pos = -1;
|
||||
p->actorsqu = stomped;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void playerreset(player_struct* p, DDukeActor* g_ac)
|
||||
{
|
||||
if (ud.multimode < 2)
|
||||
{
|
||||
gameaction = ga_autoloadgame;
|
||||
g_ac->killit_flag = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// I am not convinced this is even remotely smart to be executed from here..
|
||||
pickrandomspot(int(p - ps));
|
||||
g_ac->spr.pos = p->GetActor()->getPosWithOffsetZ();
|
||||
p->GetActor()->backuppos();
|
||||
p->setbobpos();
|
||||
g_ac->backuppos();
|
||||
updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);
|
||||
SetActor(p->GetActor(), p->GetActor()->spr.pos);
|
||||
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
|
||||
g_ac->spr.shade = -12;
|
||||
g_ac->clipdist = 16;
|
||||
g_ac->spr.scale = DVector2(0.65625, 0.5625);
|
||||
g_ac->SetOwner(g_ac);
|
||||
g_ac->spr.xoffset = 0;
|
||||
g_ac->spr.pal = p->palookup;
|
||||
|
||||
p->last_extra = g_ac->spr.extra = gs.max_player_health;
|
||||
p->wantweaponfire = -1;
|
||||
p->GetActor()->PrevAngles.Pitch = p->GetActor()->spr.Angles.Pitch = nullAngle;
|
||||
p->on_crane = nullptr;
|
||||
p->frag_ps = int(p - ps);
|
||||
p->Angles.PrevViewAngles.Pitch = p->Angles.ViewAngles.Pitch = nullAngle;
|
||||
p->opyoff = 0;
|
||||
p->wackedbyactor = nullptr;
|
||||
p->shield_amount = gs.max_armour_amount;
|
||||
p->dead_flag = 0;
|
||||
p->pals.a = 0;
|
||||
p->footprintcount = 0;
|
||||
p->weapreccnt = 0;
|
||||
p->ftq = 0;
|
||||
p->vel.X = p->vel.Y = 0;
|
||||
if (!isRR()) p->Angles.PrevViewAngles.Roll = p->Angles.ViewAngles.Roll = nullAngle;
|
||||
|
||||
p->falling_counter = 0;
|
||||
|
||||
g_ac->hitextra = -1;
|
||||
|
||||
g_ac->cgg = 0;
|
||||
g_ac->movflag = 0;
|
||||
g_ac->tempval = 0;
|
||||
g_ac->actorstayput = nullptr;
|
||||
g_ac->dispicnum = 0;
|
||||
g_ac->SetHitOwner(p->GetActor());
|
||||
g_ac->temp_data[4] = 0;
|
||||
|
||||
resetinventory(p);
|
||||
resetweapons(p);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void wackplayer(player_struct* p)
|
||||
{
|
||||
if (!isRR())
|
||||
forceplayerangle(p);
|
||||
else
|
||||
{
|
||||
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector() * 64;
|
||||
p->jumping_counter = 767;
|
||||
p->jumping_toggle = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// moved out of the CON interpreter.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void playerkick(player_struct* p, DDukeActor* g_ac)
|
||||
{
|
||||
if (ud.multimode > 1 && g_ac->isPlayer())
|
||||
{
|
||||
if (ps[otherp].quick_kick == 0)
|
||||
ps[otherp].quick_kick = 14;
|
||||
}
|
||||
else if (!g_ac->isPlayer() && p->quick_kick == 0)
|
||||
p->quick_kick = 14;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -260,14 +260,9 @@ void resetplayerstats(int snum)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void resetweapons(int snum)
|
||||
void resetweapons(player_struct* p)
|
||||
{
|
||||
int weapon;
|
||||
player_struct* p;
|
||||
|
||||
p = &ps[snum];
|
||||
|
||||
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
|
||||
for (int weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
|
||||
{
|
||||
p->ammo_amount[weapon] = 0;
|
||||
}
|
||||
|
@ -299,7 +294,7 @@ void resetweapons(int snum)
|
|||
p->gotweapon[SLINGBLADE_WEAPON] = true;
|
||||
p->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
}
|
||||
OnEvent(EVENT_RESETWEAPONS, snum, nullptr, -1);
|
||||
OnEvent(EVENT_RESETWEAPONS, int(p - ps), nullptr, -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -308,12 +303,8 @@ void resetweapons(int snum)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void resetinventory(int snum)
|
||||
void resetinventory(player_struct* p)
|
||||
{
|
||||
player_struct* p;
|
||||
|
||||
p = &ps[snum];
|
||||
|
||||
p->inven_icon = 0;
|
||||
p->boot_amount = 0;
|
||||
p->scuba_on = 0;
|
||||
|
@ -372,7 +363,7 @@ void resetinventory(int snum)
|
|||
ufocnt = 0;
|
||||
hulkspawn = 2;
|
||||
}
|
||||
OnEvent(EVENT_RESETINVENTORY, snum, p->GetActor());
|
||||
OnEvent(EVENT_RESETINVENTORY, int(p - ps), p->GetActor());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1120,19 +1111,19 @@ void enterlevel(MapRecord *mi, int gamemode)
|
|||
auto pn = ps[i].GetActor()->sector()->floortexture;
|
||||
if (tileflags(pn) & TFLAG_CLEARINVENTORY)
|
||||
{
|
||||
resetinventory(i);
|
||||
resetinventory(&ps[i]);
|
||||
clearweapon = true;
|
||||
}
|
||||
if (clearweapon)
|
||||
{
|
||||
resetweapons(i);
|
||||
resetweapons(&ps[i]);
|
||||
ps[i].gotweapon[PISTOL_WEAPON] = false;
|
||||
ps[i].ammo_amount[PISTOL_WEAPON] = 0;
|
||||
ps[i].curr_weapon = KNEE_WEAPON;
|
||||
ps[i].kickback_pic = 0;
|
||||
ps[i].okickback_pic = ps[i].kickback_pic = 0;
|
||||
}
|
||||
if (currentLevel->flags & LEVEL_CLEARINVENTORY) resetinventory(i);
|
||||
if (currentLevel->flags & LEVEL_CLEARINVENTORY) resetinventory(&ps[i]);
|
||||
}
|
||||
resetmys();
|
||||
|
||||
|
@ -1160,8 +1151,8 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool)
|
|||
{
|
||||
for (int i = 0; i != -1; i = connectpoint2[i])
|
||||
{
|
||||
resetweapons(i);
|
||||
resetinventory(i);
|
||||
resetweapons(&ps[i]);
|
||||
resetinventory(&ps[i]);
|
||||
}
|
||||
|
||||
ps[0].last_extra = gs.max_player_health;
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
short tempval, basepicnum;
|
||||
unsigned short timetosleep;
|
||||
bool mapSpawned;
|
||||
uint8_t killit_flag;
|
||||
DVector2 ovel;
|
||||
DAngle hitang;
|
||||
double floorz, ceilingz;
|
||||
|
|
Loading…
Reference in a new issue