- WH: removed all (short) casts.

This commit is contained in:
Christoph Oelckers 2021-11-22 00:20:36 +01:00
parent 8cb68f1b12
commit cc389cc3b3
35 changed files with 413 additions and 413 deletions

View file

@ -498,7 +498,7 @@ void aisearch(PLAYER& plr, DWHActor* actor, boolean fly) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -509,15 +509,15 @@ void aisearch(PLAYER& plr, DWHActor* actor, boolean fly) {
if (moveStat.type != kHitNone) {
if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7),
spr.sectnum) && spr.lotag < 0) {
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (spr.lotag < 0) {
if (krand() % 100 > 50)
spr.ang = (short)((spr.ang + 512) & 2047);
spr.ang = ((spr.ang + 512) & 2047);
else
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
spr.lotag = 30;
}
@ -613,9 +613,9 @@ void castspell(PLAYER& plr, DWHActor* actor) {
spawned.xrepeat = 64;
spawned.yrepeat = 64;
if (spr.picnum == SPAWNFIREBALL)
spawned.ang = (short)((getangle(plr.x - spawned.x, plr.y - spawned.y) + 2048) & 2047);
spawned.ang = ((getangle(plr.x - spawned.x, plr.y - spawned.y) + 2048) & 2047);
else
spawned.ang = (short)(((getangle(plr.x - spawned.x, plr.y - spawned.y) + (krand() & 15)
spawned.ang = (((getangle(plr.x - spawned.x, plr.y - spawned.y) + (krand() & 15)
- 8) + 2048) & 2047);
spawned.xvel = bcos(spawned.ang, -6);
spawned.yvel = bsin(spawned.ang, -6);
@ -624,9 +624,9 @@ void castspell(PLAYER& plr, DWHActor* actor) {
if (discrim == 0)
discrim = 1;
if (isWh2())
spawned.zvel = (short)(((plr.z + (8 << 8) - spawned.z) << 7) / discrim);
spawned.zvel = (((plr.z + (8 << 8) - spawned.z) << 7) / discrim);
else
spawned.zvel = (short)(((plr.z + (48 << 8) - spawned.z) << 7) / discrim);
spawned.zvel = (((plr.z + (48 << 8) - spawned.z) << 7) / discrim);
spawnedactor->SetOwner(actor);
spawned.clipdist = 16;
@ -652,9 +652,9 @@ void skullycastspell(PLAYER& plr, DWHActor* actor) {
spawned.xrepeat = 64;
spawned.yrepeat = 64;
if (spr.picnum == SPAWNFIREBALL)
spawned.ang = (short)((getangle(plr.x - spawned.x, plr.y - spawned.y) + 2048) & 2047);
spawned.ang = ((getangle(plr.x - spawned.x, plr.y - spawned.y) + 2048) & 2047);
else
spawned.ang = (short)(((getangle(plr.x - spawned.x, plr.y - spawned.y) + (krand() & 15)
spawned.ang = (((getangle(plr.x - spawned.x, plr.y - spawned.y) + (krand() & 15)
- 8) + 2048) & 2047);
spawned.xvel = bcos(spawned.ang, -6);
spawned.yvel = bsin(spawned.ang, -6);
@ -662,7 +662,7 @@ void skullycastspell(PLAYER& plr, DWHActor* actor) {
int discrim = ksqrt((plr.x - spawned.x) * (plr.x - spawned.x) + (plr.y - spawned.y) * (plr.y - spawned.y));
if (discrim == 0)
discrim = 1;
spawned.zvel = (short)(((plr.z + (48 << 8) - spawned.z) << 7) / discrim);
spawned.zvel = (((plr.z + (48 << 8) - spawned.z) << 7) / discrim);
spawnedactor->SetOwner(actor);
spawned.clipdist = 16;
@ -931,7 +931,7 @@ int checkmove(DWHActor* actor, int dax, int day) {
Collision moveStat = movesprite(actor, dax, day, 0, 4 << 8, 4 << 8, CLIFFCLIP);
if (moveStat.type != kHitNone)
spr.ang = (short)((spr.ang + TICSPERFRAME) & 2047);
spr.ang = ((spr.ang + TICSPERFRAME) & 2047);
return moveStat.legacyVal;
}
@ -978,9 +978,9 @@ boolean checksight(PLAYER& plr, DWHActor* actor) {
spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum) && plr.invisibletime < 0) {
checksight_ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (((spr.ang + 2048 - checksight_ang) & 2047) < 1024)
spr.ang = (short)((spr.ang + 2048 - (TICSPERFRAME << 1)) & 2047);
spr.ang = ((spr.ang + 2048 - (TICSPERFRAME << 1)) & 2047);
else
spr.ang = (short)((spr.ang + (TICSPERFRAME << 1)) & 2047);
spr.ang = ((spr.ang + (TICSPERFRAME << 1)) & 2047);
return true;
}
@ -1003,7 +1003,7 @@ void monsterweapon(DWHActor* actor) {
if ((krand() % 100) < 75)
return;
auto spawnedactor = InsertActor(spr.sectnum, (short)0);
auto spawnedactor = InsertActor(spr.sectnum, 0);
auto& weap = spawnedactor->s();
weap.x = spr.x;
@ -1016,8 +1016,8 @@ void monsterweapon(DWHActor* actor) {
weap.backuploc();
int type = (krand() % 4);
weap.picnum = (short)(FLASKBLUE + type);
weap.detail = (short)(FLASKBLUETYPE + type);
weap.picnum = (FLASKBLUE + type);
weap.detail = (FLASKBLUETYPE + type);
weap.xrepeat = 25;
weap.yrepeat = 20;

View file

@ -18,14 +18,14 @@ struct EnemyInfo
void Init(int sizx, int sizy, int dist, int height, int damage, int clipdist, bool fly, int health, int score)
{
this->sizx = (short) sizx;
this->sizy = (short) sizy;
this->sizx = sizx;
this->sizy = sizy;
this->attackdist = dist;
this->attackheight = height;
this->attackdamage = damage;
this->clipdist = clipdist;
this->fly = fly;
this->health = (short) health;
this->health = health;
this->score = score;
}
@ -53,7 +53,7 @@ struct EnemyInfo
if((spr.cstat & 514) != 0)
tflag = spr.cstat & 514;
spr.cstat = (short) (0x101 | tflag);
spr.cstat = (0x101 | tflag);
}
};

View file

@ -41,7 +41,7 @@ static void chasedemon(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, CHASE); // NEW
}
}
@ -102,9 +102,9 @@ static void facedemon(PLAYER& plr, DWHActor* actor)
boolean cansee = ::cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -114,7 +114,7 @@ static void facedemon(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);

View file

@ -24,7 +24,7 @@ static void chasedevil(PLAYER& plr, DWHActor* actor)
if (!checkdist(plr, actor)) {
if (aimove(actor).type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -34,7 +34,7 @@ static void chasedevil(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE); // NEW
}
}
@ -108,7 +108,7 @@ static void facedevil(PLAYER& plr, DWHActor* actor)
if (cansee && plr.invisibletime < 0) {
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -118,7 +118,7 @@ static void facedevil(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -199,7 +199,7 @@ static void resurectdevil(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = DEVIL;
spr.hitag = (short)adjusthp(60);
spr.hitag = adjusthp(60);
spr.lotag = 100;
spr.cstat |= 1;
}

View file

@ -219,7 +219,7 @@ static void resurectdragon(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = DRAGON;
spr.hitag = (short)adjusthp(900);
spr.hitag = adjusthp(900);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -278,7 +278,7 @@ static void facedragon(PLAYER& plr, DWHActor* actor)
if (cansee && plr.invisibletime < 0) {
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -288,7 +288,7 @@ static void facedragon(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -351,7 +351,7 @@ static void firebreath(PLAYER& plr, DWHActor* actor, int a, int b, int c)
spawned.shade = -15;
spawned.xrepeat = 128;
spawned.yrepeat = 128;
spawned.ang = (short)((((getangle(plr.x - spawned.x, plr.y - spawned.y)
spawned.ang = ((((getangle(plr.x - spawned.x, plr.y - spawned.y)
+ (krand() & 15) - 8) + 2048) + ((b * 22) + (k * 10))) & 2047);
spawned.xvel = bcos(spawned.ang, -6);
spawned.yvel = bsin(spawned.ang, -6);
@ -360,9 +360,9 @@ static void firebreath(PLAYER& plr, DWHActor* actor, int a, int b, int c)
if (discrim == 0)
discrim = 1;
if (c == HIGH)
spawned.zvel = (short)(((plr.z + (32 << 8) - spawned.z) << 7) / discrim);
spawned.zvel = (((plr.z + (32 << 8) - spawned.z) << 7) / discrim);
else
spawned.zvel = (short)((((plr.z + (8 << 8)) - spawned.z) << 7) / discrim);// NEW
spawned.zvel = ((((plr.z + (8 << 8)) - spawned.z) << 7) / discrim);// NEW
spawnedactor->SetOwner(actor);
spawned.clipdist = 16;

View file

@ -26,7 +26,7 @@ static void chasefatwitch(PLAYER& plr, DWHActor* actor)
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -35,7 +35,7 @@ static void chasefatwitch(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE); // NEW
}
}
@ -69,7 +69,7 @@ static void resurectfatwitch(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = FATWITCH;
spr.hitag = (short)adjusthp(90);
spr.hitag = adjusthp(90);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -121,7 +121,7 @@ static void facefatwitch(PLAYER& plr, DWHActor* actor)
if (cansee && plr.invisibletime < 0) {
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -131,7 +131,7 @@ static void facefatwitch(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -260,14 +260,14 @@ static void throwspank(PLAYER& plr, DWHActor* actor)
spawned.shade = -15;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.ang = (short)(((getangle(plr.x - spawned.x, plr.y - spawned.y) + (krand() & 15)
spawned.ang = (((getangle(plr.x - spawned.x, plr.y - spawned.y) + (krand() & 15)
- 8) + 2048) & 2047);
spawned.xvel = bcos(spawned.ang, -6);
spawned.yvel = bsin(spawned.ang, -6);
long discrim = ksqrt((plr.x - spawned.x) * (plr.x - spawned.x) + (plr.y - spawned.y) * (plr.y - spawned.y));
int discrim = ksqrt((plr.x - spawned.x) * (plr.x - spawned.x) + (plr.y - spawned.y) * (plr.y - spawned.y));
if (discrim == 0)
discrim = 1;
spawned.zvel = (short)(((plr.z + (48 << 8) - spawned.z) << 7) / discrim);
spawned.zvel = (((plr.z + (48 << 8) - spawned.z) << 7) / discrim);
spawnedactor->SetOwner(actor);
spawned.clipdist = 16;
spawned.lotag = 512;
@ -298,7 +298,7 @@ void premapFatwitch(DWHActor* actor) {
ChangeActorStat(actor, FACE);
enemy[FATWITCHTYPE].info.set(spr);
if (spr.pal == 7)
spr.hitag = (short)adjusthp(290);
spr.hitag = adjusthp(290);
if (krand() % 100 > 50)
spr.extra = 1;

View file

@ -17,14 +17,14 @@ static void chasefish(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -32,24 +32,24 @@ static void chasefish(PLAYER& plr, DWHActor* actor)
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -102,13 +102,13 @@ static void attackfish(PLAYER& plr, DWHActor* actor)
if (spr.lotag >= 64) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -157,10 +157,10 @@ static void facefish(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -170,7 +170,7 @@ static void facefish(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);

View file

@ -19,14 +19,14 @@ static void chasefred(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -34,24 +34,24 @@ static void chasefred(PLAYER& plr, DWHActor* actor)
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -156,10 +156,10 @@ static void facefred(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -169,7 +169,7 @@ static void facefred(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -203,13 +203,13 @@ static void attackfred(PLAYER& plr, DWHActor* actor)
if (spr.lotag >= 64) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -283,7 +283,7 @@ static void resurectfred(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = FRED;
spr.hitag = (short)adjusthp(40);
spr.hitag = adjusthp(40);
spr.lotag = 100;
spr.cstat |= 1;
}

View file

@ -19,45 +19,45 @@ static void chasegoblin(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -138,7 +138,7 @@ static void facegoblin(PLAYER& plr, DWHActor* actor)
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
spr.picnum = GOBLIN;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -148,7 +148,7 @@ static void facegoblin(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -213,7 +213,7 @@ static void standgoblin(PLAYER& plr, DWHActor* actor)
default:
spr.picnum = GOBLIN;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -248,14 +248,14 @@ static void attackgoblin(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 31) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
spr.picnum = GOBLIN;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -274,7 +274,7 @@ static void resurectgoblin(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = GOBLIN;
spr.hitag = (short)adjusthp(35);
spr.hitag = adjusthp(35);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -387,13 +387,13 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
}
if (!found) {
if (spr.pal == 5)
spr.hitag = (short)adjusthp(35);
spr.hitag = adjusthp(35);
else if (spr.pal == 4)
spr.hitag = (short)adjusthp(25);
spr.hitag = adjusthp(25);
else
spr.hitag = (short)adjusthp(15);
spr.hitag = adjusthp(15);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -413,13 +413,13 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
spr.ang = getangle(ownerspr.x - spr.x, ownerspr.y - spr.y);
else if (moveStat.type == kHitWall) {
spr.extra = 3;
spr.ang = (short)((spr.ang + (krand() & 256 - 128)) & 2047);
spr.ang = ((spr.ang + (krand() & 256 - 128)) & 2047);
spr.lotag = 60;
}
else if (moveStat.type == kHitSprite) {
if (moveStat.actor != owneractor) {
spr.extra = 3;
spr.ang = (short)((spr.ang + (krand() & 256 - 128)) & 2047);
spr.ang = ((spr.ang + (krand() & 256 - 128)) & 2047);
spr.lotag = 60;
}
else spr.ang = getangle(ownerspr.x - spr.x, ownerspr.y - spr.y);
@ -469,7 +469,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
else { // i attack k flee
spr.extra = 0;
ownerspr.extra = 3;
ownerspr.ang = (short)((spr.ang + (krand() & 256 - 128)) & 2047);
ownerspr.ang = ((spr.ang + (krand() & 256 - 128)) & 2047);
ownerspr.lotag = 60;
}
}
@ -491,7 +491,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
spr.lotag -= TICSPERFRAME;
if (aimove(actor).type != kHitNone)
spr.ang = (short)(krand() & 2047);
spr.ang = (krand() & 2047);
processfluid(actor, zr_florHit, false);
SetActorPos(actor, &spr.pos);

View file

@ -24,7 +24,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -33,11 +33,11 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
break;
}
else if ((krand() & 0) == 1) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
break;
}
@ -50,7 +50,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -90,9 +90,9 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
daang = (spr.ang + 256) & 2047;
else
daang = (spr.ang - 256) & 2047;
spr.ang = (short)daang;
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -100,7 +100,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
@ -117,38 +117,38 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
@ -199,19 +199,19 @@ static void resurectgonzo(PLAYER& plr, DWHActor* actor)
switch (spr.picnum) {
case GONZOCSWDEAD:
spr.picnum = GONZOCSW;
spr.hitag = (short)adjusthp(50);
spr.hitag = adjusthp(50);
break;
case GONZOGSWDEAD:
spr.picnum = GONZOGSW;
spr.hitag = (short)adjusthp(100);
spr.hitag = adjusthp(100);
break;
case GONZOGHMDEAD:
spr.picnum = GONZOGHM;
spr.hitag = (short)adjusthp(40);
spr.hitag = adjusthp(40);
break;
case GONZOGSHDEAD:
spr.picnum = GONZOGSH;
spr.hitag = (short)adjusthp(50);
spr.hitag = adjusthp(50);
break;
}
spr.lotag = 100;
@ -326,10 +326,10 @@ static void facegonzo(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -339,7 +339,7 @@ static void facegonzo(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -386,13 +386,13 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 46) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -418,13 +418,13 @@ static void attackgonzo(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 31) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -662,17 +662,17 @@ static void gonzopike(DWHActor* actor, PLAYER& plr) {
spawned.cstat = 21;
spawned.picnum = THROWPIKE;
spawned.ang = (short)(((spr.ang + 2048 + 96) - 512) & 2047);
spawned.ang = (((spr.ang + 2048 + 96) - 512) & 2047);
spawned.xrepeat = 24;
spawned.yrepeat = 24;
spawned.clipdist = 32;
spawned.extra = spr.ang;
spawned.shade = -15;
spawned.xvel = (short)((krand() & 256) - 128);
spawned.yvel = (short)((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = (short)(((plr.z + (8 << 8) - spr.z) << 7) / ksqrt((plr.x - spr.x) * (plr.x - spr.x) + (plr.y - spr.y) * (plr.y - spr.y)));
spawned.zvel = (((plr.z + (8 << 8) - spr.z) << 7) / ksqrt((plr.x - spr.x) * (plr.x - spr.x) + (plr.y - spr.y) * (plr.y - spr.y)));
spawned.zvel += ((krand() % 256) - 128);

View file

@ -22,45 +22,45 @@ static void chasegron(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
}
@ -75,7 +75,7 @@ static void chasegron(PLAYER& plr, DWHActor* actor)
if (!checkdist(plr, actor)) {
if (aimove(actor).type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -84,7 +84,7 @@ static void chasegron(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE); // NEW
}
}
@ -130,17 +130,17 @@ static void resurectgron(PLAYER& plr, DWHActor* actor)
switch (krand() % 3) {
case 0:
spr.picnum = GRONHAL;
spr.hitag = (short)adjusthp(120);
spr.hitag = adjusthp(120);
spr.extra = 3;
break;
case 1:
spr.picnum = GRONSW;
spr.hitag = (short)adjusthp(120);
spr.hitag = adjusthp(120);
spr.extra = 0;
break;
case 2:
spr.picnum = GRONMU;
spr.hitag = (short)adjusthp(120);
spr.hitag = adjusthp(120);
spr.extra = 2;
break;
}
@ -254,10 +254,10 @@ static void facegron(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -267,7 +267,7 @@ static void facegron(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -302,13 +302,13 @@ static void attackgron(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 31) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -461,16 +461,16 @@ static void throwhalberd(DWHActor* actor) {
spawned.picnum = THROWHALBERD;
spawned.detail = THROWHALBERDTYPE;
spawned.ang = (short)(((spr.ang + 2048) - 512) & 2047);
spawned.ang = (((spr.ang + 2048) - 512) & 2047);
spawned.xrepeat = 8;
spawned.yrepeat = 16;
spawned.clipdist = 32;
spawned.extra = spr.ang;
spawned.shade = -15;
spawned.xvel = (short)((krand() & 256) - 128);
spawned.yvel = (short)((krand() & 256) - 128);
spawned.zvel = (short)((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = ((krand() & 256) - 128);
spawnedactor->SetOwner(actor);
spawned.lotag = 0;
spawned.hitag = 0;

View file

@ -38,7 +38,7 @@ static void chaseguardian(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, CHASE); // NEW
}
}
@ -125,10 +125,10 @@ static void faceguardian(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -138,7 +138,7 @@ static void faceguardian(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);

View file

@ -18,45 +18,45 @@ static void chaseimp(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -155,7 +155,7 @@ static void resurectimp(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = IMP;
spr.hitag = (short)adjusthp(20);
spr.hitag = adjusthp(20);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -169,10 +169,10 @@ static void faceimp(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -182,7 +182,7 @@ static void faceimp(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -252,13 +252,13 @@ static void attackimp(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 32) { //original 64
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else

View file

@ -36,7 +36,7 @@ static void chasejudy(PLAYER& plr, DWHActor* actor)
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -45,7 +45,7 @@ static void chasejudy(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE); // NEW
}
}
@ -79,7 +79,7 @@ static void resurectjudy(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = JUDY;
spr.hitag = (short)adjusthp(200);
spr.hitag = adjusthp(200);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -133,7 +133,7 @@ static void facejudy(PLAYER& plr, DWHActor* actor)
if (cansee && plr.invisibletime < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -143,7 +143,7 @@ static void facejudy(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -239,7 +239,7 @@ static void castjudy(PLAYER& plr, DWHActor* actor)
while (auto itActor = it.Next())
{
SPRITE& spr = itActor->s();
spr.lotag = (short)((krand() % 120) + 120);
spr.lotag = ((krand() % 120) + 120);
kills--;
SetNewStatus(itActor, RESURECT);
}
@ -358,7 +358,7 @@ void judyOperate(PLAYER& plr)
{
SPRITE& spri = actor->s();
spri.ang = (short)(getangle(plr.x - spri.x, plr.y - spri.y) & 2047);
spri.ang = (getangle(plr.x - spri.x, plr.y - spri.y) & 2047);
if (cansee(plr.x, plr.y, plr.z, plr.sector, spri.x, spri.y,
spri.z - (tileHeight(spri.picnum) << 7), spri.sectnum)) {
spri.lotag -= TICSPERFRAME;
@ -398,7 +398,7 @@ void spawnabaddy(DWHActor* actor, int monster) {
else if (monster == GONZOGSH)
premapGonzo(spawnedactor);
spawned.picnum = (short)monster;
spawned.picnum = monster;
killcnt++;
SetActorPos(spawnedactor, &spawned.pos);

View file

@ -26,7 +26,7 @@ static void chasekatie(PLAYER& plr, DWHActor* actor)
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -35,7 +35,7 @@ static void chasekatie(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE); // NEW
}
}
@ -69,7 +69,7 @@ static void resurectkatie(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = KATIE;
spr.hitag = (short)adjusthp(200);
spr.hitag = adjusthp(200);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -101,14 +101,14 @@ static void facekatie(PLAYER& plr, DWHActor* actor)
{
SPRITE& spr = actor->s();
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
boolean cansee = ::cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7),
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -118,7 +118,7 @@ static void facekatie(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);

View file

@ -21,45 +21,45 @@ static void chasekobold(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -139,10 +139,10 @@ static void facekobold(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -152,7 +152,7 @@ static void facekobold(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -220,13 +220,13 @@ static void attackkobold(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 34) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -245,7 +245,7 @@ static void resurectkobold(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = KOBOLD;
spr.hitag = (short)adjusthp(30);
spr.hitag = adjusthp(30);
spr.lotag = 100;
spr.cstat |= 1;
}

View file

@ -12,7 +12,7 @@ static void standkurt(PLAYER& plr, DWHActor* actor)
if (cansee(spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum, plr.x, plr.y,
plr.z, plr.sector) && plr.invisibletime < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else

View file

@ -18,45 +18,45 @@ static void chaseminotaur(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -97,7 +97,7 @@ static void resurectminotaur(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = MINOTAUR;
spr.hitag = (short)adjusthp(100);
spr.hitag = adjusthp(100);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -178,10 +178,10 @@ static void faceminotaur(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -191,7 +191,7 @@ static void faceminotaur(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -225,13 +225,13 @@ static void attackminotaur(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 31) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else

View file

@ -13,7 +13,7 @@ static void standnewguy(PLAYER& plr, DWHActor* actor)
if (cansee(spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum, plr.x, plr.y,
plr.z, plr.sector) && plr.invisibletime < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
@ -35,45 +35,45 @@ static void chasenewguy(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -115,19 +115,19 @@ static void resurectnewguy(PLAYER& plr, DWHActor* actor)
switch (j) {
case 0:
spr.extra = 30;
spr.hitag = (short)adjusthp(85);
spr.hitag = adjusthp(85);
break;
case 1:
spr.extra = 20;
spr.hitag = (short)adjusthp(85);
spr.hitag = adjusthp(85);
break;
case 2:
spr.extra = 10;
spr.hitag = (short)adjusthp(45);
spr.hitag = adjusthp(45);
break;
case 3:
spr.extra = 0;
spr.hitag = (short)adjusthp(15);
spr.hitag = adjusthp(15);
break;
}
spr.xrepeat = 35;
@ -201,7 +201,7 @@ static void facenewguy(PLAYER& plr, DWHActor* actor)
if (cansee && plr.invisibletime < 0) {
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -211,7 +211,7 @@ static void facenewguy(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -292,13 +292,13 @@ static void attacknewguy(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 31) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -371,17 +371,17 @@ static void newguyarrow(DWHActor* actor, PLAYER& plr) {
spawned.cstat = 21;
spawned.picnum = WALLARROW;
spawned.ang = (short)(((spr.ang + 2048 + 96) - 512) & 2047);
spawned.ang = (((spr.ang + 2048 + 96) - 512) & 2047);
spawned.xrepeat = 24;
spawned.yrepeat = 24;
spawned.clipdist = 32;
spawned.extra = spr.ang;
spawned.shade = -15;
spawned.xvel = (short)((krand() & 256) - 128);
spawned.yvel = (short)((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = (short)(((plr.z + (8 << 8) - spr.z) << 7) / ksqrt((plr.x - spr.x) * (plr.x - spr.x) + (plr.y - spr.y) * (plr.y - spr.y)));
spawned.zvel = (((plr.z + (8 << 8) - spr.z) << 7) / ksqrt((plr.x - spr.x) * (plr.x - spr.x) + (plr.y - spr.y) * (plr.y - spr.y)));
spawned.zvel += ((krand() % 256) - 128);

View file

@ -11,7 +11,7 @@ static void chaserat(PLAYER& plr, DWHActor* actor)
static void searchrat(PLAYER& plr, DWHActor* actor)
{
SPRITE& spr = actor->s();
spr.ang = (short) (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -20,7 +20,7 @@ static void facerat(PLAYER& plr, DWHActor* actor)
SPRITE& spr = actor->s();
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
spr.ang = (short) (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
actor->SetPlayerOwner(plr.playerNum());
SetNewStatus(actor, FLEE);
}
@ -40,22 +40,22 @@ static void fleerat(PLAYER& plr, DWHActor* actor)
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
return;
}
if (moveStat.type == kHitWall) {
WALL& wal = wall[moveStat.index];
short wallang = (short)((getangle(wall[wal.point2].x - wal.x, wall[wal.point2].y - wal.y) + 512)
short wallang = ((getangle(wall[wal.point2].x - wal.x, wall[wal.point2].y - wal.y) + 512)
& 2047);
spr.ang = (short)(krand() & 512 - 256 + wallang);
spr.ang = (krand() & 512 - 256 + wallang);
}
if (moveStat.type == kHitSprite) {
SPRITE& sp = moveStat.actor->s();
actor->SetOwner(moveStat.actor);
spr.ang = getangle(sp.x - spr.x, sp.y - spr.y);
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
}
if (abs(plr.x - spr.x) <= 1024 && abs(plr.y - spr.y) <= 1024) {

View file

@ -18,45 +18,45 @@ static void chaseskeleton(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -118,10 +118,10 @@ static void faceskeleton(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -131,7 +131,7 @@ static void faceskeleton(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -197,7 +197,7 @@ static void standskeleton(PLAYER& plr, DWHActor* actor)
}
else {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -229,13 +229,13 @@ static void attackskeleton(PLAYER& plr, DWHActor* actor)
if (spr.lotag == 16) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
}
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else
@ -254,7 +254,7 @@ static void resurectskeleton(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = SKELETON;
spr.hitag = (short)adjusthp(10);
spr.hitag = adjusthp(10);
spr.lotag = 100;
spr.cstat |= 1;
}

View file

@ -23,7 +23,7 @@ static void chaseskully(PLAYER& plr, DWHActor* actor)
if (!checkdist(plr, actor)) {
if (aimove(actor).type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
@ -32,7 +32,7 @@ static void chaseskully(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE); // NEW
}
}
@ -66,7 +66,7 @@ static void resurectskully(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = SKULLY;
spr.hitag = (short)adjusthp(100);
spr.hitag = adjusthp(100);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -120,7 +120,7 @@ static void faceskully(PLAYER& plr, DWHActor* actor)
spr.ang = getangle(plr.x - spr.x, plr.y - spr.y);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -130,7 +130,7 @@ static void faceskully(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);

View file

@ -18,45 +18,45 @@ static void chasespider(PLAYER& plr, DWHActor* actor)
spr.sectnum) && plr.invisibletime < 0) {
if (checkdist(plr, actor)) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, ATTACK);
}
else if (krand() % 63 > 60) {
spr.ang = (short)(((krand() & 128 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 128 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
auto moveStat = aimove(actor);
if (moveStat.type == kHitFloor)
{
spr.ang = (short)((spr.ang + 1024) & 2047);
spr.ang = ((spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
return;
}
if (moveStat.type == kHitSprite) {
if (moveStat.actor != plr.actor()) {
short daang = (short)((spr.ang - 256) & 2047);
short daang = ((spr.ang - 256) & 2047);
spr.ang = daang;
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else
SetNewStatus(actor, SKIRMISH);
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, SKIRMISH);
}
}
}
}
else {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
@ -97,7 +97,7 @@ static void resurectspider(PLAYER& plr, DWHActor* actor)
if (spr.lotag < 0) {
SetNewStatus(actor, FACE);
spr.picnum = SPIDER;
spr.hitag = (short)adjusthp(15);
spr.hitag = adjusthp(15);
spr.lotag = 100;
spr.cstat |= 1;
}
@ -157,10 +157,10 @@ static void facespider(PLAYER& plr, DWHActor* actor)
spr.sectnum);
if (cansee && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -170,7 +170,7 @@ static void facespider(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else if (cansee) SetNewStatus(actor, FLEE);
@ -202,7 +202,7 @@ static void attackspider(PLAYER& plr, DWHActor* actor)
if (spr.lotag >= 64) {
if (checksight(plr, actor))
if (checkdist(plr, actor)) {
spr.ang = (short)checksight_ang;
spr.ang = checksight_ang;
attack(plr, actor);
if (krand() % 100 > ((plr.lvl * 7) + 20)) {
spritesound(S_SPIDERBITE, actor);
@ -216,7 +216,7 @@ static void attackspider(PLAYER& plr, DWHActor* actor)
}
else if (spr.lotag < 0) {
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, FLEE);
}
else

View file

@ -33,7 +33,7 @@ static void chasewillow(PLAYER& plr, DWHActor* actor)
if (krand() % 8 == 0) // NEW
SetNewStatus(actor, ATTACK); // NEW
else { // NEW
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
SetNewStatus(actor, CHASE); // NEW
}
}
@ -147,10 +147,10 @@ static void facewillow(PLAYER& plr, DWHActor* actor)
if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y, spr.z - (tileHeight(spr.picnum) << 7),
spr.sectnum) && plr.invisibletime < 0) {
spr.ang = (short)(getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
spr.ang = (getangle(plr.x - spr.x, plr.y - spr.y) & 2047);
if (plr.shadowtime > 0) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang + 1024) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047);
SetNewStatus(actor, FLEE);
}
else {
@ -160,7 +160,7 @@ static void facewillow(PLAYER& plr, DWHActor* actor)
}
else { // get off the wall
if (actor->GetOwner() == plr.actor()) {
spr.ang = (short)(((krand() & 512 - 256) + spr.ang) & 2047);
spr.ang = (((krand() & 512 - 256) + spr.ang) & 2047);
SetNewStatus(actor, FINDME);
}
else SetNewStatus(actor, FLEE);

View file

@ -38,7 +38,7 @@ int setanimation(int index, int thegoal, int thevel, int theacc, int type)
if (j == -1) j = gAnimationCount;
ANIMATION& gAnm = gAnimationData[j];
gAnm.id = (short)index;
gAnm.id = index;
gAnm.goal = thegoal;
gAnm.vel = thevel;
gAnm.acc = theacc;

View file

@ -344,7 +344,7 @@ void analyzesprites(PLAYER& plr, int dasmoothratio,tspritetype* tsprite, int& sp
if (spritesortcnt < (MAXSPRITESONSCREEN - 2)) {
int fz = getflorzofslope(tspr.sectnum, tspr.x, tspr.y);
if (fz > plr.z) {
short siz = (short) std::max((tspr.xrepeat - ((fz - tspr.z) >> 10)), 1);
short siz = std::max((tspr.xrepeat - ((fz - tspr.z) >> 10)), 1);
if(siz > 4) {
SPRITE& tshadow = tsprite[spritesortcnt];
tshadow = tspr;

View file

@ -141,7 +141,7 @@ void randompotion(DWHActor* actor) {
return;
auto& spr = actor->s();
auto spawnedactor = InsertActor(spr.sectnum, (short)0);
auto spawnedactor = InsertActor(spr.sectnum, 0);
auto& spawned = spawnedactor->s();
spawned.x = spr.x;
@ -154,8 +154,8 @@ void randompotion(DWHActor* actor) {
spawned.xrepeat = 64;
spawned.yrepeat = 64;
int type = krand() % 4;
spawned.picnum = (short)(FLASKBLUE + type);
spawned.detail = (short)(FLASKBLUETYPE + type);
spawned.picnum = (FLASKBLUE + type);
spawned.detail = (FLASKBLUETYPE + type);
spawned.backuploc();
}

View file

@ -421,11 +421,11 @@ void medusa(PLAYER& plr, DWHActor* actor) {
break;
case GRONTYPE:
if(pic == GRONHAL || pic == GRONHALATTACK)
spr.picnum = (short) GRONHALDIE;
spr.picnum = GRONHALDIE;
else if(pic == GRONMU || pic == GRONMUATTACK)
spr.picnum = (short) GRONMUDIE;
spr.picnum = GRONMUDIE;
else if(pic == GRONSW || pic == GRONSWATTACK)
spr.picnum = (short) GRONSWDIE;
spr.picnum = GRONSWDIE;
break;
}
spr.pal = 6;

View file

@ -1702,7 +1702,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
neartag(pHitInfo.hitx, pHitInfo.hity, pHitInfo.hitz, pHitInfo.hitsect, daang, ntag, 1024, 3);
if (ntag.tagsector < 0) {
auto spawnedactor = InsertActor(pHitInfo.hitsect, (short) 0);
auto spawnedactor = InsertActor(pHitInfo.hitsect, 0);
auto& spawned = spawnedactor->s();
spawned.x = pHitInfo.hitx;
@ -1714,7 +1714,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.pal = 0;
spawned.xrepeat = 16;
spawned.yrepeat = 48;
spawned.ang = (short) (((daang) - 512 + (krand() & 128 - 64)) & 2047);
spawned.ang = (((daang) - 512 + (krand() & 128 - 64)) & 2047);
spawned.xvel = 0;
spawned.yvel = 0;
spawned.zvel = 0;
@ -1765,7 +1765,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.pal = 0;
spawned.xrepeat = 32;
spawned.yrepeat = 32;
spawned.ang = (short) daang;
spawned.ang = daang;
spawned.xvel = 0;
spawned.yvel = 0;
spawned.zvel = 0;
@ -1816,7 +1816,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
chunksofmeat(plr, hitActor, pHitInfo.hitx, pHitInfo.hity, pHitInfo.hitz,
pHitInfo.hitsect, daang);
} else {
hitspr.ang = (short) (getangle(plr.x - hitspr.x,
hitspr.ang = (getangle(plr.x - hitspr.x,
plr.y - hitspr.y) & 2047);
SetNewStatus(hitActor, PAIN);
}
@ -1919,7 +1919,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
if (pHitInfo.hitsect < 0 && pHitInfo.hitsprite < 0 || pHitInfo.hitwall >= 0) {
neartag(pHitInfo.hitx, pHitInfo.hity, pHitInfo.hitz, (short)pHitInfo.hitsect, (short)daang, ntag, 1024, 3);
neartag(pHitInfo.hitx, pHitInfo.hity, pHitInfo.hitz, pHitInfo.hitsect, daang, ntag, 1024, 3);
if (ntag.tagsector >= 0) {
if (sector[ntag.tagsector].lotag >= 60 && sector[ntag.tagsector].lotag <= 69) {
@ -1960,16 +1960,16 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.z = plr.z + (24 << 8);
spawned.cstat = 21;
spawned.picnum = THROWPIKE;
spawned.ang = (short) (((daang + 2048 + 96) - 512) & 2047);
spawned.ang = (((daang + 2048 + 96) - 512) & 2047);
spawned.xrepeat = 24;
spawned.yrepeat = 24;
spawned.clipdist = 32;
spawned.extra = (short) daang;
spawned.extra = daang;
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
if (shootgunzvel != 0) {
spawned.zvel = (short) shootgunzvel;
spawned.zvel = shootgunzvel;
shootgunzvel = 0;
} else {
spawned.zvel = plr.horizon.horiz.asq16() >> 12;
@ -1998,8 +1998,8 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.clipdist = 32;
spawned.extra = plr.angle.ang.asbuild();
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = plr.horizon.horiz.asq16() >> 12;
spawnedactor->SetPlayerOwner(plr.playerNum());
spawned.lotag = 1024;
@ -2026,8 +2026,8 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.extra = plr.angle.ang.asbuild();
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
// spawned.zvel=((krand()&256)-128);
spawned.zvel = plr.horizon.horiz.asq16() >> 12;
spawnedactor->SetPlayerOwner(plr.playerNum());
@ -2060,16 +2060,16 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.z = plr.z + (24 << 8);
spawned.cstat = 21;
spawned.picnum = THROWPIKE;
spawned.ang = (short) daang;
spawned.ang = daang;
spawned.xrepeat = 24;
spawned.yrepeat = 24;
spawned.clipdist = 32;
spawned.extra = (short) daang;
spawned.extra = daang;
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = plr.horizon.horiz.asq16() >> 12;
spawnedactor->SetPlayerOwner(plr.playerNum());
spawned.lotag = 1024;
@ -2095,8 +2095,8 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.clipdist = 32;
spawned.extra = plr.angle.ang.asbuild();
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = plr.horizon.horiz.asq16() >> 12;
spawnedactor->SetPlayerOwner(plr.playerNum());
spawned.lotag = 1024;
@ -2122,9 +2122,9 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.extra = plr.angle.ang.asbuild();
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.zvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = ((krand() & 256) - 128);
spawnedactor->SetPlayerOwner(plr.playerNum());
spawned.lotag = 1024;
spawned.hitag = 0;
@ -2153,12 +2153,12 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.pal = 0;
spawned.xrepeat = 16;
spawned.yrepeat = 16;
spawned.ang = (short) daang;
spawned.ang = daang;
spawned.xvel = bcos(daang, -5);
spawned.yvel = bsin(daang, -5);
if (shootgunzvel != 0) {
spawned.zvel = (short) shootgunzvel;
spawned.zvel = shootgunzvel;
shootgunzvel = 0;
} else {
spawned.zvel = plr.horizon.horiz.asq16() >> 12;
@ -2199,7 +2199,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.yvel = bsin(daang, -7);
if (shootgunzvel != 0) {
spawned.zvel = (short) shootgunzvel;
spawned.zvel = shootgunzvel;
shootgunzvel = 0;
} else {
spawned.zvel = plr.horizon.horiz.asq16() >> 12;

View file

@ -63,7 +63,7 @@ void animateobjs(PLAYER& plr) {
spr.lotag = -100;
if (spr.lotag < 0) {
daz = spr.zvel -= TICSPERFRAME << 4;
spr.ang = (short) ((spr.ang + (TICSPERFRAME << 2)) & 2047);
spr.ang = ((spr.ang + (TICSPERFRAME << 2)) & 2047);
movesprite(actor, (bcos(spr.ang) * TICSPERFRAME) << 3,
(bsin(spr.ang) * TICSPERFRAME) << 3, daz, 4 << 8, 4 << 8, 1);
@ -72,7 +72,7 @@ void animateobjs(PLAYER& plr) {
spr.x = sparksx;
spr.y = sparksy;
spr.z = sparksz;
spr.ang = (short) ((krand() % 2047) & 2047);
spr.ang = ((krand() % 2047) & 2047);
spr.zvel = 0;
SetActorPos(actor, &spr.pos);
@ -94,7 +94,7 @@ void animateobjs(PLAYER& plr) {
if (spr.lotag < 0) {
daz = spr.zvel += TICSPERFRAME << 4;
spr.ang = (short) ((spr.ang + (TICSPERFRAME << 2)) & 2047);
spr.ang = ((spr.ang + (TICSPERFRAME << 2)) & 2047);
movesprite(actor, (bcos(spr.ang) * TICSPERFRAME) << 3,
(bsin(spr.ang) * TICSPERFRAME) << 3, daz, 4 << 8, 4 << 8, 1);
@ -103,7 +103,7 @@ void animateobjs(PLAYER& plr) {
spr.x = sparksx;
spr.y = sparksy;
spr.z = sparksz;
spr.ang = (short) ((krand() % 2047) & 2047);
spr.ang = ((krand() % 2047) & 2047);
spr.zvel = 0;
SetActorPos(actor, &spr.pos);
@ -124,7 +124,7 @@ void animateobjs(PLAYER& plr) {
if (spr.lotag < 0) {
daz = 0;
spr.ang = (short) ((spr.ang + (TICSPERFRAME << 2)) & 2047);
spr.ang = ((spr.ang + (TICSPERFRAME << 2)) & 2047);
movesprite(actor, (bcos(spr.ang) * TICSPERFRAME) << 3,
(bsin(spr.ang) * TICSPERFRAME) << 3, daz, 4 << 8, 4 << 8, 1);
@ -133,7 +133,7 @@ void animateobjs(PLAYER& plr) {
spr.x = sparksx;
spr.y = sparksy;
spr.z = sparksz;
spr.ang = (short) ((krand() % 2047) & 2047);
spr.ang = ((krand() % 2047) & 2047);
spr.zvel = 0;
SetActorPos(actor, &spr.pos);
@ -157,7 +157,7 @@ void animateobjs(PLAYER& plr) {
spr.yrepeat = 24;
spr.clipdist = 32;
ChangeActorStat(actor, FACE);
spr.hitag = (short) adjusthp(100);
spr.hitag = adjusthp(100);
spr.lotag = 100;
spr.cstat |= 0x101;
spr.extra = 0;
@ -170,7 +170,7 @@ void animateobjs(PLAYER& plr) {
spr.yrepeat = 24;
spr.clipdist = 32;
ChangeActorStat(actor, FACE);
spr.hitag = (short) adjusthp(100);
spr.hitag = adjusthp(100);
spr.lotag = 100;
spr.cstat |= 0x101;
spr.extra = 0;
@ -183,7 +183,7 @@ void animateobjs(PLAYER& plr) {
spr.yrepeat = 24;
spr.clipdist = 32;
ChangeActorStat(actor, FACE);
spr.hitag = (short) adjusthp(100);
spr.hitag = adjusthp(100);
spr.lotag = 100;
spr.cstat |= 0x101;
spr.extra = 0;
@ -196,7 +196,7 @@ void animateobjs(PLAYER& plr) {
spr.yrepeat = 30;
spr.clipdist = 64;
ChangeActorStat(actor, FACE);
spr.hitag = (short) adjusthp(300);
spr.hitag = adjusthp(300);
spr.lotag = 100;
spr.cstat |= 0x101;
spr.extra = 4;
@ -210,7 +210,7 @@ void animateobjs(PLAYER& plr) {
spr.yrepeat = 26;
spr.clipdist = 48;
ChangeActorStat(actor, FACE);
spr.hitag = (short) adjusthp(100);
spr.hitag = adjusthp(100);
spr.lotag = 100;
spr.cstat |= 0x101;
spr.extra = 30;
@ -284,7 +284,7 @@ void animateobjs(PLAYER& plr) {
sector[osectnum].ceilingshade = (byte) ((sector[osectnum].ceilingshade + j) >> 1);
sector[osectnum].floorshade = (byte) ((sector[osectnum].floorshade + j) >> 1);
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = (byte) ((wall[k].shade + j) >> 1);
}
@ -300,7 +300,7 @@ void animateobjs(PLAYER& plr) {
sector[osectnum].floorshade = (byte) j;
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = (byte) j;
}
@ -311,21 +311,21 @@ void animateobjs(PLAYER& plr) {
plr.Sector()->ceilingshade = ceilingshadearray[plr.sector];
plr.Sector()->floorshade = floorshadearray[plr.sector];
startwall = plr.Sector()->wallptr;
endwall = (short) (startwall + plr.Sector()->wallnum - 1);
endwall = (startwall + plr.Sector()->wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = wallshadearray[k];
}
sector[plr.oldsector].ceilingshade = ceilingshadearray[plr.oldsector];
sector[plr.oldsector].floorshade = floorshadearray[plr.oldsector];
startwall = sector[plr.oldsector].wallptr;
endwall = (short) (startwall + sector[plr.oldsector].wallnum - 1);
endwall = (startwall + sector[plr.oldsector].wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = wallshadearray[k];
}
sector[osectnum].ceilingshade = ceilingshadearray[osectnum];
sector[osectnum].floorshade = floorshadearray[osectnum];
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = wallshadearray[k];
}
@ -333,7 +333,7 @@ void animateobjs(PLAYER& plr) {
sector[osectnum].ceilingshade = ceilingshadearray[osectnum];
sector[osectnum].floorshade = floorshadearray[osectnum];
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = wallshadearray[k];
}
@ -413,7 +413,7 @@ void animateobjs(PLAYER& plr) {
spr.lotag -= TICSPERFRAME;
if (spr.lotag < 0) {
spr.extra--;
spr.lotag = (short) (krand() & 48 + 24);
spr.lotag = (krand() & 48 + 24);
bats(plr, actor);
if (spr.extra == 0)
ChangeActorStat(actor, 0);
@ -438,7 +438,7 @@ void animateobjs(PLAYER& plr) {
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
SetActorPos(actor, &spr.pos);
if (moveStat.type != kHitNone)
spr.ang = (short) (krand() & 2047);
spr.ang = (krand() & 2047);
}
break;
case 1: // flying in circles
@ -447,16 +447,16 @@ void animateobjs(PLAYER& plr) {
if (spr.lotag < 0 && spot) {
spr.extra = 2;
spr.lotag = 512;
spr.ang = (short) (((getangle(spot->s().x - spr.x, spot->s().y - spr.y) & 2047) - 1024) & 2047);
spr.ang = (((getangle(spot->s().x - spr.x, spot->s().y - spr.y) & 2047) - 1024) & 2047);
} else {
spr.z -= TICSPERFRAME << 4;
spr.ang = (short) ((spr.ang + (TICSPERFRAME << 2)) & 2047);
spr.ang = ((spr.ang + (TICSPERFRAME << 2)) & 2047);
moveStat = movesprite(actor,
(bcos(spr.ang) * TICSPERFRAME) << 3,
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
SetActorPos(actor, &spr.pos);
if (moveStat.type != kHitNone)
spr.ang = (short) (krand() & 2047);
spr.ang = (krand() & 2047);
}
break;
}
@ -480,7 +480,7 @@ void animateobjs(PLAYER& plr) {
continue;
}
if (moveStat.type != kHitNone)
spr.ang = (short) (krand() & 2047);
spr.ang = (krand() & 2047);
}
break;
}
@ -497,7 +497,7 @@ void animateobjs(PLAYER& plr) {
sector[osectnum].ceilingshade = (byte) j;
sector[osectnum].floorshade = (byte) j;
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++)
wall[k].shade = (byte) j;
}
@ -512,7 +512,7 @@ void animateobjs(PLAYER& plr) {
j = (torchpattern[PlayClock % 38]);
sector[osectnum].floorshade = (byte) j;
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++)
wall[k].shade = (byte) j;
// startredflash(j);
@ -817,7 +817,7 @@ void animateobjs(PLAYER& plr) {
sector[osectnum].ceilingshade = (byte) j;
sector[osectnum].floorshade = (byte) j;
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++)
wall[k].shade = (byte) j;
spr.lotag -= TICSPERFRAME;
@ -846,14 +846,14 @@ void animateobjs(PLAYER& plr) {
sector[osectnum].ceilingshade = (byte) j;
sector[osectnum].floorshade = (byte) j;
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++)
wall[k].shade = (byte) j;
if (spr.lotag < 0) {
sector[osectnum].ceilingshade = ceilingshadearray[osectnum];
sector[osectnum].floorshade = floorshadearray[osectnum];
startwall = sector[osectnum].wallptr;
endwall = (short) (startwall + sector[osectnum].wallnum - 1);
endwall = (startwall + sector[osectnum].wallnum - 1);
for (k = startwall; k <= endwall; k++) {
wall[k].shade = wallshadearray[k];
}
@ -901,7 +901,7 @@ void animateobjs(PLAYER& plr) {
spr.z += spr.zvel;
if (spr.z < spr.sector()->ceilingz + (4 << 8)) {
spr.z = spr.sector()->ceilingz + (4 << 8);
spr.zvel = (short) -(spr.zvel >> 1);
spr.zvel = -(spr.zvel >> 1);
}
if (spr.z > spr.sector()->floorz - (4 << 8)) {
spr.z = spr.sector()->floorz - (4 << 8);
@ -1028,7 +1028,7 @@ void animateobjs(PLAYER& plr) {
spr.z -= spr.zvel;
if (spr.z < spr.sector()->ceilingz + (4 << 8)) {
spr.z = spr.sector()->ceilingz + (4 << 8);
spr.zvel = (short) -(spr.zvel >> 1);
spr.zvel = -(spr.zvel >> 1);
}
if (spr.z > spr.sector()->floorz - (4 << 8)) {
spr.z = spr.sector()->floorz - (4 << 8);
@ -1218,7 +1218,7 @@ void animateobjs(PLAYER& plr) {
if (plr.invisibletime < 0) {
spr.lotag -= TICSPERFRAME;
if (spr.lotag < 0) {
spr.lotag = (short) (krand() & 120 + 360);
spr.lotag = (krand() & 120 + 360);
if (cansee(plr.x, plr.y, plr.z, plr.sector, spr.x, spr.y,
spr.z - (tileHeight(spr.picnum) << 7), spr.sectnum)) {
// JSA_NEW
@ -1281,11 +1281,11 @@ void animateobjs(PLAYER& plr) {
if (spr.z < spr.sector()->ceilingz + (4 << 8)) {
spr.z = spr.sector()->ceilingz + (4 << 8);
spr.zvel = (short) -(spr.zvel >> 1);
spr.zvel = -(spr.zvel >> 1);
}
if (spr.z > spr.sector()->floorz - (4 << 8)) {
spr.z = spr.sector()->floorz - (4 << 8);
spr.zvel = (short) -(spr.zvel >> 1);
spr.zvel = -(spr.zvel >> 1);
}
spr.xrepeat += TICSPERFRAME;
@ -1420,7 +1420,7 @@ void animateobjs(PLAYER& plr) {
spr.zvel += (TICSPERFRAME << 5);
if (spr.z < spr.sector()->ceilingz + (4 << 8)) {
spr.z = spr.sector()->ceilingz + (4 << 8);
spr.zvel = (short) -(spr.zvel >> 1);
spr.zvel = -(spr.zvel >> 1);
}
if (spr.z > spr.sector()->floorz - (4 << 8) && spr.picnum != EXPLOSION) {
spr.z = spr.sector()->floorz - (4 << 8);

View file

@ -367,9 +367,9 @@ void revolvefx() {
for (int i = 0; i < revolvecnt; i++) {
startwall = sector[revolvesector[i]].wallptr;
endwall = (short) (startwall + sector[revolvesector[i]].wallnum - 1);
endwall = (startwall + sector[revolvesector[i]].wallnum - 1);
revolveang[i] = (short) ((revolveang[i] + 2048 - ((TICSPERFRAME) << 1)) & 2047);
revolveang[i] = ((revolveang[i] + 2048 - ((TICSPERFRAME) << 1)) & 2047);
for (short k = startwall; k <= endwall; k++) {
Point out = rotatepoint(revolvepivotx[i], revolvepivoty[i], revolvex[i][k - startwall],
revolvey[i][k - startwall], revolveang[i]);
@ -383,7 +383,7 @@ void revolvefx() {
revolvesyncrotang = 0;
revolvesyncx = plr.x;
revolvesyncy = plr.y;
revolvesyncrotang = (short) ((revolvesyncrotang + 2048 - ((TICSPERFRAME) << 1)) & 2047);
revolvesyncrotang = ((revolvesyncrotang + 2048 - ((TICSPERFRAME) << 1)) & 2047);
Point out = rotatepoint(revolvepivotx[i], revolvepivoty[i], revolvesyncx, revolvesyncy,
revolvesyncrotang);
viewBackupPlayerLoc(pyrn);
@ -420,7 +420,7 @@ void teleporter() {
sector[dasector].ceilingshade = (byte) j;
sector[dasector].floorshade = (byte) j;
startwall = sector[dasector].wallptr;
endwall = (short) (startwall + sector[dasector].wallnum - 1);
endwall = (startwall + sector[dasector].wallnum - 1);
for (s = startwall; s <= endwall; s++)
wall[s].shade = (byte) j;
}
@ -437,8 +437,8 @@ void teleporter() {
plr.x = warpx;
plr.y = warpy;
plr.z = warpz;
daang = (short) warpang;
plr.sector = (short) warpsect;
daang = warpang;
plr.sector = warpsect;
warpfxsprite(plr.actor());
plr.angle.settarget(daang);
plr.justwarpedfx = 48;
@ -493,7 +493,7 @@ void warp(int x, int y, int z, int daang, short dasector) {
// find center of sector
int startwall = sector[warpsect].wallptr;
int endwall = (short) (startwall + sector[warpsect].wallnum - 1);
int endwall = (startwall + sector[warpsect].wallnum - 1);
int dax = 0, day = 0, i = 0;
for (int s = startwall; s <= endwall; s++) {
dax += wall[s].x;
@ -523,8 +523,8 @@ void warpsprite(DWHActor* actor) {
spr.x = warpx;
spr.y = warpy;
spr.z = warpz;
spr.ang = (short) warpang;
dasectnum = (short) warpsect;
spr.ang = warpang;
dasectnum = warpsect;
warpfxsprite(actor);
SetActorPos(actor, spr.x, spr.y, spr.z);
@ -807,7 +807,7 @@ void makeasplash(int picnum, PLAYER& plr) {
spawned.y = plr.y;
spawned.z = plr.Sector()->floorz + (tileHeight(picnum) << 8);
spawned.cstat = 0; // Hitscan does not hit other bullets
spawned.picnum = (short) picnum;
spawned.picnum = picnum;
spawned.shade = 0;
spawned.pal = 0;
spawned.xrepeat = 64;
@ -846,7 +846,7 @@ void makemonstersplash(int picnum, DWHActor* actor) {
spawned.y = spr.y;
spawned.z = sector[spr.sectnum].floorz + (tileHeight(picnum) << 8);
spawned.cstat = 0; // Hitscan does not hit other bullets
spawned.picnum = (short) picnum;
spawned.picnum = picnum;
spawned.shade = 0;
if (sector[spr.sectnum].floorpal == 9)
@ -904,11 +904,11 @@ void bats(PLAYER& plr, DWHActor* actor) {
spawned.shade = 0;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.ang = (short) ((spr.ang + (krand() & 128 - 256)) & 2047);
spawned.ang = ((spr.ang + (krand() & 128 - 256)) & 2047);
spawnedactor->SetOwner(actor);
spawned.clipdist = 16;
spawned.lotag = 128;
//spawned.hitag = (short) k; // see: flying in circles
//spawned.hitag = k; // see: flying in circles
spawned.extra = 0;
spawned.backuploc();
@ -957,7 +957,7 @@ void cracks() {
auto& spk = itActor->s();
if (plr.Sector()->hitag == spk.hitag) {
spk.lotag = 36;
spk.zvel = (short) (krand() & 1024 + 512);
spk.zvel = (krand() & 1024 + 512);
SetNewStatus(itActor, SHOVE);
}
}
@ -1027,9 +1027,9 @@ void warpfxsprite(DWHActor* actor) {
spawned.extra = 0;
spawned.shade = -31;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.zvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = ((krand() & 256) - 128);
spawnedactor->SetOwner(actor);
spawned.lotag = 12;
spawned.hitag = 0;
@ -1122,10 +1122,10 @@ void makesparks(DWHActor* actor, int type) {
spawned.shade = 0;
spawned.xrepeat = 24;
spawned.yrepeat = 24;
spawned.ang = (short) ((krand() % 2047) & 2047);
spawned.ang = ((krand() % 2047) & 2047);
spawnedactor->SetOwner(nullptr);
spawned.clipdist = 16;
spawned.lotag = (short) (krand() % 100);
spawned.lotag = (krand() % 100);
spawned.hitag = 0;
spawned.extra = 0;
@ -1141,18 +1141,18 @@ void shards(DWHActor* actor, int type) {
spawned.x = spr.x + (((krand() % 512) - 256) << 2);
spawned.y = spr.y + (((krand() % 512) - 256) << 2);
spawned.z = spr.z - (getPlayerHeight() << 8) + (((krand() % 48) - 16) << 7);
spawned.zvel = (short) (krand() % 256);
spawned.zvel = (krand() % 256);
spawned.cstat = 0;
spawned.picnum = (short) (SHARD + (krand() % 3));
spawned.picnum = (SHARD + (krand() % 3));
spawned.shade = 0;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.ang = (short) (spr.ang + ((krand() % 512) - 256) & 2047);
spawned.ang = (spr.ang + ((krand() % 512) - 256) & 2047);
spawnedactor->SetOwner(actor);
spawned.clipdist = 16;
spawned.lotag = (short) (120 + (krand() % 100));
spawned.lotag = (120 + (krand() % 100));
spawned.hitag = 0;
spawned.extra = (short) type;
spawned.extra = type;
spawned.pal = 0;
spawned.backuploc();
}

View file

@ -33,13 +33,13 @@ void preparesectors() {
// spikesector[spikecnt++] = i;
if (sector[i].lotag == 70)
skypanlist[skypancnt++] = (short) i;
skypanlist[skypancnt++] = i;
if (sector[i].lotag >= 80 && sector[i].lotag <= 89)
floorpanninglist[floorpanningcnt++] = (short) i;
floorpanninglist[floorpanningcnt++] = i;
if (sector[i].lotag >= 900 && sector[i].lotag <= 999) {
lavadrylandsector[lavadrylandcnt] = (short) i;
lavadrylandsector[lavadrylandcnt] = i;
lavadrylandcnt++;
}
@ -61,7 +61,7 @@ void preparesectors() {
revolvey[revolvecnt][k] = wall[j].y;
k++;
}
revolvesector[revolvecnt] = (short) i;
revolvesector[revolvecnt] = i;
revolveang[revolvecnt] = 0;
revolveclip[revolvecnt] = 1;
@ -111,7 +111,7 @@ void preparesectors() {
}
break;
case 11:
xpanningsectorlist[xpanningsectorcnt++] = (short) i;
xpanningsectorlist[xpanningsectorcnt++] = i;
break;
case 12:
dasector = i;
@ -166,22 +166,22 @@ void preparesectors() {
dragy2[dragsectorcnt] -= (day2 - wall[sector[i].wallptr].y);
dragfloorz[dragsectorcnt] = sector[i].floorz;
dragsectorlist[dragsectorcnt++] = (short) i;
dragsectorlist[dragsectorcnt++] = i;
break;
case 10:
case 14:
// case 15:
// captureflag sector
case 4002:
warpsectorlist[warpsectorcnt++] = (short) i;
warpsectorlist[warpsectorcnt++] = i;
break;
case 10000:
bobbingsectorlist[bobbingsectorcnt++] = (short) i;
bobbingsectorlist[bobbingsectorcnt++] = i;
}
if (sector[i].floorpicnum == TELEPAD && sector[i].lotag == 0)
warpsectorlist[warpsectorcnt++] = (short) i;
warpsectorlist[warpsectorcnt++] = i;
if (sector[i].floorpicnum == FLOORMIRROR)
floormirrorsector[floormirrorcnt++] = (short) i;
floormirrorsector[floormirrorcnt++] = i;
}
ypanningwallcnt = 0;
@ -189,7 +189,7 @@ void preparesectors() {
wallshadearray[i] = wall[i].shade;
if (wall[i].lotag == 1) {
if (ypanningwallcnt < countof(ypanningwalllist))
ypanningwalllist[ypanningwallcnt++] = (short) i;
ypanningwalllist[ypanningwallcnt++] = i;
}
}
}
@ -315,12 +315,12 @@ boolean prepareboard(const char* fname) {
}
if (spr.picnum == SNDLOOP) { // loop on
spr.sector()->extra = (short) (32768 | (spr.lotag << 1) | 1);
spr.sector()->extra = (32768 | (spr.lotag << 1) | 1);
DeleteActor(actor);
}
if (spr.picnum == SNDLOOPOFF) { // loop off
spr.sector()->extra = (short) (32768 | (spr.lotag << 1));
spr.sector()->extra = (32768 | (spr.lotag << 1));
DeleteActor(actor);
}
@ -676,7 +676,7 @@ boolean prepareboard(const char* fname) {
break;
case PINE:
treesize = (short) (((krand() % 5) + 3) << 4);
treesize = (((krand() % 5) + 3) << 4);
spr.xrepeat = (uint8_t)treesize;
spr.yrepeat = (uint8_t)treesize;
break;
@ -752,7 +752,7 @@ boolean prepareboard(const char* fname) {
// oh my... (todo: turn into a compat patch.
SPRITE& spr = sprite[185];
if(spr.picnum == 172 && spr.x == -36864 && spr.y == -53504)
deletesprite((short) 185);
deletesprite( 185);
}
if(mapon == 13) {
@ -773,7 +773,7 @@ boolean prepareboard(const char* fname) {
if (justteleported) { // next level
plr.hvel = 0;
auto pactor = InsertActor(plr.sector, (short)0);
auto pactor = InsertActor(plr.sector, 0);
auto& pspr = pactor->s();
plr.theactor = pactor;
@ -794,7 +794,7 @@ boolean prepareboard(const char* fname) {
pactor->SetPlayerOwner(myconnectindex);
pspr.lotag = 0;
pspr.hitag = 0;
pspr.pal = (short) (isWh2() ? 10 : 1);
pspr.pal = (isWh2() ? 10 : 1);
if(isWh2())
pspr.clipdist = 48;

View file

@ -20,11 +20,11 @@ short adjusthp(int hp) {
int howhard = difficulty;
if (krand() % 100 > 50)
return (short) ((hp * (factor + 1)) * howhard);
return ((hp * (factor + 1)) * howhard);
else
return (short) ((hp - (hp * (factor))) * howhard);
return ((hp - (hp * (factor))) * howhard);
#else
return (short)(hp * difficulty);
return (hp * difficulty);
#endif
}
@ -146,7 +146,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
break;
case EVILSPIRIT:
ChangeActorStat(actor, EVILSPIRIT);
spr.lotag = (short) (120 + (krand() & 64));
spr.lotag = (120 + (krand() & 64));
break;
case PATROL:
ChangeActorStat(actor, PATROL);
@ -228,7 +228,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
break;
case DEVILFIRE:
ChangeActorStat(actor, DEVILFIRE);
spr.lotag = (short) (krand() & 120 + 360);
spr.lotag = (krand() & 120 + 360);
break;
case DRIP:
ChangeActorStat(actor, DRIP);
@ -386,7 +386,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
case FINDME:
spr.lotag = 360;
if (spr.picnum == RAT) {
spr.ang = (short) (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
ChangeActorStat(actor, FLEE);
} else
ChangeActorStat(actor, FINDME);
@ -394,7 +394,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
case SKIRMISH:
spr.lotag = 60;
if (spr.picnum == RAT) {
spr.ang = (short) (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
spr.ang = (((krand() & 512 - 256) + spr.ang + 1024) & 2047); // NEW
ChangeActorStat(actor, FLEE);
} else
ChangeActorStat(actor, SKIRMISH);
@ -408,7 +408,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
ChangeActorStat(actor, WITCHSIT);
break;
case DORMANT:
spr.lotag = (short) (krand() & 2047 + 2047);
spr.lotag = (krand() & 2047 + 2047);
break;
case ACTIVE:
spr.lotag = 360;
@ -472,7 +472,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
ChangeActorStat(actor, FLEE);
if (!isWh2() && spr.picnum == DEVILATTACK && spr.picnum == DEVIL)
spr.lotag = (short) (120 + (krand() & 360));
spr.lotag = (120 + (krand() & 360));
else
spr.lotag = 60;
break;
@ -1338,7 +1338,7 @@ void SetNewStatus(DWHActor* actor, const int seq)
case WILLOWEXPLO + 2:
spr.pal = 0;
spr.cstat &= ~3;
ChangeActorStat(actor, (short) 0);
ChangeActorStat(actor, 0);
DeleteActor(actor);
addscore(aiGetPlayerTarget(actor), isWh2() ? 15 : 150);
return;
@ -1418,10 +1418,10 @@ void explosion(DWHActor* actor, int x, int y, int z, int ownr) {
spawned.shade = -15;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.ang = (short) (krand() & 2047);
spawned.xvel = (short) ((krand() & 511) - 256);
spawned.yvel = (short) ((krand() & 511) - 256);
spawned.zvel = (short) ((krand() & 511) - 256);
spawned.ang = (krand() & 2047);
spawned.xvel = ((krand() & 511) - 256);
spawned.yvel = ((krand() & 511) - 256);
spawned.zvel = ((krand() & 511) - 256);
spawnedactor->CopyOwner(actor);
spawned.hitag = 0;
spawned.pal = 0;
@ -1458,10 +1458,10 @@ void explosion2(DWHActor* actor, int x, int y, int z, int ownr) {
spawned.shade = -25;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.ang = (short) (krand() & 2047);
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.zvel = (short) ((krand() & 256) - 128);
spawned.ang = (krand() & 2047);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = ((krand() & 256) - 128);
spawnedactor->CopyOwner(actor);
spawned.hitag = 0;
spawned.pal = 0;
@ -1521,10 +1521,10 @@ void icecubes(DWHActor* actor, int x, int y, int z, int ownr) {
spawned.xrepeat = 16;
spawned.yrepeat = 16;
spawned.ang = (short) (((krand() & 1023) - 1024) & 2047);
spawned.xvel = (short) ((krand() & 1023) - 512);
spawned.yvel = (short) ((krand() & 1023) - 512);
spawned.zvel = (short) ((krand() & 1023) - 512);
spawned.ang = (((krand() & 1023) - 1024) & 2047);
spawned.xvel = ((krand() & 1023) - 512);
spawned.yvel = ((krand() & 1023) - 512);
spawned.zvel = ((krand() & 1023) - 512);
spawned.pal = 6;
spawnedactor->CopyOwner(actor);
@ -1806,28 +1806,28 @@ void trowajavlin(DWHActor* actor) {
switch (spr.lotag) {
case 91:
spawned.picnum = WALLARROW;
spawned.ang = (short) (((spr.ang + 2048) - 512) & 2047);
spawned.ang = (((spr.ang + 2048) - 512) & 2047);
spawned.xrepeat = 16;
spawned.yrepeat = 48;
spawned.clipdist = 24;
break;
case 92:
spawned.picnum = DART;
spawned.ang = (short) (((spr.ang + 2048) - 512) & 2047);
spawned.ang = (((spr.ang + 2048) - 512) & 2047);
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.clipdist = 16;
break;
case 93:
spawned.picnum = HORIZSPIKEBLADE;
spawned.ang = (short) (((spr.ang + 2048) - 512) & 2047);
spawned.ang = (((spr.ang + 2048) - 512) & 2047);
spawned.xrepeat = 16;
spawned.yrepeat = 48;
spawned.clipdist = 32;
break;
case 94:
spawned.picnum = THROWPIKE;
spawned.ang = (short) (((spr.ang + 2048) - 512) & 2047);
spawned.ang = (((spr.ang + 2048) - 512) & 2047);
spawned.xrepeat = 24;
spawned.yrepeat = 24;
spawned.clipdist = 32;
@ -1836,9 +1836,9 @@ void trowajavlin(DWHActor* actor) {
spawned.extra = spr.ang;
spawned.shade = -15;
spawned.xvel = (short) ((krand() & 256) - 128);
spawned.yvel = (short) ((krand() & 256) - 128);
spawned.zvel = (short) ((krand() & 256) - 128);
spawned.xvel = ((krand() & 256) - 128);
spawned.yvel = ((krand() & 256) - 128);
spawned.zvel = ((krand() & 256) - 128);
spawnedactor->SetOwner(nullptr);
spawned.lotag = 0;
@ -1849,7 +1849,7 @@ void trowajavlin(DWHActor* actor) {
void spawnhornskull(DWHActor* actor) {
auto& spr = actor->s();
auto spawnedactor = InsertActor(spr.sectnum, (short) 0);
auto spawnedactor = InsertActor(spr.sectnum, 0);
auto& spawned = spawnedactor->s();
spawned.x = spr.x;
@ -1869,7 +1869,7 @@ void spawnhornskull(DWHActor* actor) {
void spawnapentagram(DWHActor* actor) {
auto& spr = actor->s();
auto spawnedactor = InsertActor(spr.sectnum, (short) 0);
auto spawnedactor = InsertActor(spr.sectnum, 0);
auto& spawned = spawnedactor->s();
spawned.x = spr.x;

View file

@ -90,7 +90,7 @@ void initplayersprite(PLAYER& plr) {
plr.height = getPlayerHeight();
plr.z = plr.Sector()->floorz - (plr.height << 8);
auto pactor = InsertActor(plr.sector, (short)0);
auto pactor = InsertActor(plr.sector, 0);
plr.theactor = pactor;
auto& spr = pactor->s();
@ -111,7 +111,7 @@ void initplayersprite(PLAYER& plr) {
pactor->SetPlayerOwner(myconnectindex);
spr.lotag = 0;
spr.hitag = 0;
spr.pal = (short) (isWh2() ? 10 : 1);
spr.pal = (isWh2() ? 10 : 1);
if(isWh2())
spr.clipdist = 48;
@ -238,7 +238,7 @@ void updateviewmap(PLAYER& plr) {
void plruse(PLAYER& plr) {
Neartag nt;
neartag(plr.x, plr.y, plr.z, (short) plr.sector, plr.angle.ang.asbuild(), nt, 1024, 3);
neartag(plr.x, plr.y, plr.z, plr.sector, plr.angle.ang.asbuild(), nt, 1024, 3);
if (nt.tagsector >= 0) {
if (sector[nt.tagsector].hitag == 0) {
@ -416,17 +416,17 @@ void chunksofmeat(PLAYER& plr, DWHActor* hitActor, int hitx, int hity, int hitz,
if (plr.weapon[2] == 3 && plr.currweapon == 2) {
spawned.picnum = ARROWFLAME;
} else {
spawned.picnum = (short) chunk; // = REDCHUNKSTART + (rand() % 8);
spawned.picnum = chunk; // = REDCHUNKSTART + (rand() % 8);
}
spawned.shade = -16;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.clipdist = 16;
spawned.ang = (short) (((krand() & 1023) - 1024) & 2047);
spawned.xvel = (short) ((krand() & 1023) - 512);
spawned.yvel = (short) ((krand() & 1023) - 512);
spawned.zvel = (short) ((krand() & 1023) - 512);
spawned.ang = (((krand() & 1023) - 1024) & 2047);
spawned.xvel = ((krand() & 1023) - 512);
spawned.yvel = ((krand() & 1023) - 512);
spawned.zvel = ((krand() & 1023) - 512);
if (newchunk == 1)
spawned.zvel <<= 1;
spawnedactor->SetPlayerOwner(plr.playerNum());
@ -592,7 +592,7 @@ void lockon(PLAYER& plr, int numshots, int shootguntype) {
daang = monsterangle[s];
shootgunzvel = ((spr.z - (48 << 8) - plr.z) << 8)
/ ksqrt((spr.x - plr.x) * (spr.x - plr.x) + (spr.y - plr.y) * (spr.y - plr.y));
s = (short) ((s + 1) % n);
s = ((s + 1) % n);
} else {
daang += (128 / numshots);
}

View file

@ -950,7 +950,7 @@ void animatetags(int nPlayer) {
dragydir[i] = -16;
for (j = startwall; j <= endwall; j++)
dragpoint((short) j, wall[j].x + dragxdir[i], wall[j].y + dragydir[i]);
dragpoint( j, wall[j].x + dragxdir[i], wall[j].y + dragydir[i]);
j = sector[dasector].floorz;
StartInterpolation(dasector, Interp_Sect_Ceilingz);
@ -985,17 +985,17 @@ void animatetags(int nPlayer) {
}
for (k = 1; k <= 3; k++) {
Point out = rotatepoint(swingdoor[i].x[0], swingdoor[i].y[0], swingdoor[i].x[k],
swingdoor[i].y[k], (short) swingdoor[i].ang);
swingdoor[i].y[k], swingdoor[i].ang);
StartInterpolation(swingdoor[i].wall[k], Interp_Wall_X);
StartInterpolation(swingdoor[i].wall[k], Interp_Wall_Y);
dragpoint((short)swingdoor[i].wall[k], out.getX(), out.getY());
dragpoint(swingdoor[i].wall[k], out.getX(), out.getY());
}
if (swingdoor[i].anginc != 0) {
if (plr.sector == swingdoor[i].sector) {
good = 1;
for (k = 1; k <= 3; k++) {
if (clipinsidebox(plr.x, plr.y, (short) swingdoor[i].wall[k], 512) != 0) {
if (clipinsidebox(plr.x, plr.y, swingdoor[i].wall[k], 512) != 0) {
good = 0;
break;
}
@ -1004,11 +1004,11 @@ void animatetags(int nPlayer) {
swingdoor[i].ang = oldang;
for (k = 1; k <= 3; k++) {
Point out = rotatepoint(swingdoor[i].x[0], swingdoor[i].y[0], swingdoor[i].x[k],
swingdoor[i].y[k], (short) swingdoor[i].ang);
swingdoor[i].y[k], swingdoor[i].ang);
StartInterpolation(swingdoor[i].wall[k], Interp_Wall_X);
StartInterpolation(swingdoor[i].wall[k], Interp_Wall_Y);
dragpoint((short)swingdoor[i].wall[k], out.getX(), out.getY());
dragpoint(swingdoor[i].wall[k], out.getX(), out.getY());
}
swingdoor[i].anginc = -swingdoor[i].anginc;
break;