- all shorts done!

This commit is contained in:
Christoph Oelckers 2021-11-22 00:40:13 +01:00
parent 620cc72f0e
commit a30450d6fb
15 changed files with 86 additions and 85 deletions

View file

@ -436,7 +436,6 @@ Collision aimove(DWHActor* actor)
int ox = spr.x;
int oy = spr.y;
int oz = spr.z;
// short osect = spr.sectnum;
Collision moveStat = movesprite(actor, (bcos(spr.ang) * TICSPERFRAME) << 3,
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, CLIFFCLIP);
@ -466,7 +465,7 @@ Collision aifly(DWHActor* actor) {
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, CLIFFCLIP);
spr.z -= TICSPERFRAME << 8;
short ocs = spr.cstat;
auto ocs = spr.cstat;
spr.cstat = 0;
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
spr.cstat = ocs;
@ -686,7 +685,7 @@ void attack(PLAYER& plr, DWHActor* actor) {
auto& pspr = plr.actor()->s();
if (!droptheshield && plr.shieldpoints > 0 && plr.selectedgun > 0 && plr.selectedgun < 5) {
short a = getangle(spr.x - plr.x, spr.y - plr.y);
int a = getangle(spr.x - plr.x, spr.y - plr.y);
auto ang = plr.angle.ang.asbuild();
if ((a < ang && ang - a < 128) || (a > ang && ((ang + a) & 2047) < 128)) {
if (krand() % 100 > 80) {

View file

@ -3,15 +3,15 @@
BEGIN_WH_NS
short adjusthp(int hp);
int adjusthp(int hp);
struct EnemyInfo
{
short sizx, sizy;
int16_t sizx, sizy;
int attackdist;
int attackdamage;
int attackheight;
short health;
int16_t health;
bool fly;
int clipdist;
int score;
@ -29,7 +29,7 @@ struct EnemyInfo
this->score = score;
}
short (*getHealth)(EnemyInfo& e, SPRITE& spr) = [](EnemyInfo& e, SPRITE& spr)
int (*getHealth)(EnemyInfo& e, SPRITE& spr) = [](EnemyInfo& e, SPRITE& spr)
{
return adjusthp(e.health);
};

View file

@ -591,7 +591,7 @@ void premapGoblin(DWHActor* actor) {
if (spr.hitag < 90 || spr.hitag > 99)
enemy[GOBLINTYPE].info.set(spr);
else {
short ohitag = spr.hitag;
auto ohitag = spr.hitag;
enemy[GOBLINTYPE].info.set(spr);
if (spr.pal != 0)
spr.xrepeat = 30;

View file

@ -727,7 +727,7 @@ void createGonzoAI() {
return out;
};
e.info.getHealth = [](EnemyInfo& e, SPRITE& spr) ->short
e.info.getHealth = [](EnemyInfo& e, SPRITE& spr)
{
switch (spr.picnum) {
case KURTAT:

View file

@ -46,7 +46,7 @@ static void fleerat(PLAYER& plr, DWHActor* actor)
if (moveStat.type == kHitWall) {
WALL& wal = wall[moveStat.index];
short wallang = ((getangle(wall[wal.point2].x - wal.x, wall[wal.point2].y - wal.y) + 512)
int wallang = ((getangle(wall[wal.point2].x - wal.x, wall[wal.point2].y - wal.y) + 512)
& 2047);
spr.ang = (krand() & 512 - 256 + wallang);
}
@ -94,7 +94,7 @@ static void fleerat(PLAYER& plr, DWHActor* actor)
void createRatAI() {
auto& e = enemy[RATTYPE];
e.info.Init(32, 32, 512, 120, 0, 32, false, 0, 0);
e.info.getHealth = [](EnemyInfo&, SPRITE& spr) -> short
e.info.getHealth = [](EnemyInfo&, SPRITE& spr)
{
return 10;
};

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 = std::max((tspr.xrepeat - ((fz - tspr.z) >> 10)), 1);
int siz = std::max((tspr.xrepeat - ((fz - tspr.z) >> 10)), 1);
if(siz > 4) {
SPRITE& tshadow = tsprite[spritesortcnt];
tshadow = tspr;

View file

@ -193,7 +193,7 @@ void plrfireweapon(PLAYER& plr) {
weaponuseless = 1;
}
break;
case 2: // short sword
case 2: // Short sword
if (plr.ammo[plr.selectedgun] == 10) {
showmessage("Short Sword is damaged", 360);
}
@ -451,7 +451,7 @@ void weaponsprocess(int snum) {
if ((plr.currweaponanim == 5 || plr.currweaponanim == 9) && plr.currweapontics == 8)
swingdasound(plr.currweapon, plr.weapon[plr.currweapon] == 3);
break;
case 2: // shortsword
case 2: // Shortsword
if (plr.currweaponframe == GOBSWORDATTACK + 4 || plr.currweaponframe == ZSHORTATTACK + 7)
if (plr.currweaponanim == 4 && plr.currweapontics == 10)
swingdasound(plr.currweapon, plr.weapon[plr.currweapon] == 3);
@ -938,7 +938,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
if (plr.currweaponanim == 5 || plr.currweaponanim == 9 && plr.currweapontics == 8)
swingdapunch(plr, plr.currweapon);
break;
case 2: // short sword
case 2: // Short sword
if (plr.currweaponframe == GOBSWORDATTACK + 4 || plr.currweaponframe == ZSHORTATTACK + 7)
if (plr.currweaponanim == 4 && plr.currweapontics == 10)
swingdapunch(plr, plr.currweapon);
@ -1080,7 +1080,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
k = (krand() & 3) + 5;
break;
case 2: // short sword
case 2: // Short sword
if (isWh2()) {
k = (krand() % 10) + 5;
break;
@ -1205,7 +1205,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
if (plr.currweaponanim == 5 || plr.currweaponanim == 9 && plr.currweapontics == 8)
swingdacrunch(plr, plr.currweapon);
break;
case 2: // short sword
case 2: // Short sword
if (plr.currweaponframe == GOBSWORDATTACK + 4 || plr.currweaponframe == ZSHORTATTACK + 7)
if (plr.currweaponanim == 4 && plr.currweapontics == 10)
swingdacrunch(plr, plr.currweapon);
@ -1305,7 +1305,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
chunksofmeat(plr, hitActor, pHitInfo.hitx, pHitInfo.hity,
pHitInfo.hitz, pHitInfo.hitsect, daang);
break;
case 2: // short sword
case 2: // Short sword
if (plr.currweaponframe == GOBSWORDATTACK + 4
|| plr.currweaponframe == ZSHORTATTACK + 7)
if (plr.currweaponanim == 4 && plr.currweapontics == 10)
@ -1510,7 +1510,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
chunksofmeat(plr, hitActor, pHitInfo.hitx, pHitInfo.hity,
pHitInfo.hitz, pHitInfo.hitsect, daang);
break;
case 2: // short sword
case 2: // Short sword
if (plr.currweaponframe == GOBSWORDATTACK + 4
|| plr.currweaponframe == ZSHORTATTACK + 7)
if (plr.currweaponanim == 4 && plr.currweapontics == 10)
@ -2388,7 +2388,7 @@ void swingdaweapon(PLAYER& plr) {
shootgun(plr, daang, 0);
plr.hasshot = 1;
break;
case 2: // shortsword
case 2: // Shortsword
shootgun(plr, daang, 0);
plr.hasshot = 1;
break;
@ -2446,7 +2446,7 @@ void swingdacrunch(PLAYER& plr, int daweapon) {
if ((krand() % 2) != 0)
spritesound(S_GORE1 + (krand() % 4), plr.actor());
break;
case 2: // short sword
case 2: // Short sword
spritesound(S_SWORD2 + (krand() % 3), plr.actor());
break;
case 3: // morningstar
@ -2491,7 +2491,7 @@ void swingdasound(int daweapon, boolean enchanted) {
case 1: // knife
SND_Sound(S_PLRWEAPON1);
break;
case 2: // short sword
case 2: // Short sword
if (isWh2() && enchanted)
SND_Sound(S_FIRESWING);
else

View file

@ -22,13 +22,13 @@ int playertorch = 0;
uint8_t ceilingshadearray[MAXSECTORS];
uint8_t floorshadearray[MAXSECTORS];
uint8_t wallshadearray[MAXWALLS];
short floormirrorsector[64];
int floormirrorsector[64];
int floormirrorcnt;
// We owe this to Java. Unfortunately WitchavenGDX was a bit sloppy with the use of its global variables so the wrapper is here to stay. :(
int zr_ceilz, zr_florz;
Collision zr_florHit;
void getzrange(int x, int y, int z, short sectnum, int walldist, int cliptype)
void getzrange(int x, int y, int z, int sectnum, int walldist, int cliptype)
{
int zr_ceilhit; // The game does not use this.
int lflorhit;
@ -44,7 +44,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange
nt.tagactor = tagsprite >= 0 ? &whActors[tagsprite] : nullptr;
}
int hitscan(int xs, int ys, int zs, short sectnum, int vx, int vy, int vz, Hitscan& hit, int cliptype)
int hitscan(int xs, int ys, int zs, int sectnum, int vx, int vy, int vz, Hitscan& hit, int cliptype)
{
return ::hitscan(xs, ys, zs, sectnum, vx, vy, vz, &hit.hitsect, &hit.hitwall, &hit.hitsprite, &hit.hitx, &hit.hity, &hit.hitz, cliptype);
}

View file

@ -161,13 +161,13 @@ extern int playertorch;
extern uint8_t ceilingshadearray[MAXSECTORS];
extern uint8_t floorshadearray[MAXSECTORS];
extern uint8_t wallshadearray[MAXWALLS];
extern short floormirrorsector[64];
extern int floormirrorsector[64];
extern int floormirrorcnt;
extern int arrowcnt, throwpikecnt;
extern int zr_ceilz, zr_florz;
extern Collision zr_florHit;
void getzrange(int x, int y, int z, short sectnum, int walldist, int cliptype);
void getzrange(int x, int y, int z, int sectnum, int walldist, int cliptype);
struct Neartag {
int taghitdist;
@ -181,13 +181,13 @@ struct Hitscan {
short hitsect = -1, hitwall = -1, hitsprite = -1;
};
int hitscan(int xs, int ys, int zs, short sectnum, int vx, int vy, int vz, Hitscan& hit, int cliptype);
int hitscan(int xs, int ys, int zs, int sectnum, int vx, int vy, int vz, Hitscan& hit, int cliptype);
Point rotatepoint(int xpivot, int ypivot, int x, int y, int16_t daang);
// whobj
extern byte flashflag;
extern short torchpattern[];
extern const uint8_t torchpattern[];
extern int monsterwarptime;
void timerprocess(PLAYER& plr);
@ -217,7 +217,7 @@ inline int PLAYER::playerNum()
return int(this - player);
}
extern PLOCATION gPrevPlayerLoc[MAXPLAYERS];
extern short monsterangle[MAXSPRITESONSCREEN], monsterlist[MAXSPRITESONSCREEN];
extern int16_t monsterangle[MAXSPRITESONSCREEN], monsterlist[MAXSPRITESONSCREEN];
extern int shootgunzvel;
extern boolean justteleported;
extern int victor;
@ -231,7 +231,7 @@ void playerdead(PLAYER& plr);
void initplayersprite(PLAYER& plr);
void updateviewmap(PLAYER& plr);
void plruse(PLAYER& plr);
void chunksofmeat(PLAYER& plr, DWHActor* hitsprite, int hitx, int hity, int hitz, short hitsect, int daang);
void chunksofmeat(PLAYER& plr, DWHActor* hitsprite, int hitx, int hity, int hitz, int hitsect, int daang);
void addhealth(PLAYER& plr, int hp);
void addarmor(PLAYER& plr, int arm);
void addscore(PLAYER* plr, int score);
@ -253,21 +253,22 @@ extern int d_soundplayed;
extern int delaycnt;
extern Delayitem delayitem[MAXSECTORS];
extern short ironbarsector[16];
extern short ironbarscnt;
extern int ironbarsector[16];
extern int ironbarscnt;
extern int ironbarsgoal1[16], ironbarsgoal2[16];
extern short ironbarsdone[16];
extern int16_t ironbarsdone[16];
extern DWHActor* ironbarsanim[16];
extern int ironbarsgoal[16];
extern int16_t ironbarsgoal[16];
extern short warpsectorlist[64], warpsectorcnt;
extern short xpanningsectorlist[16], xpanningsectorcnt;
extern short ypanningwalllist[128], ypanningwallcnt;
extern short floorpanninglist[64], floorpanningcnt;
extern int warpsectorlist[64], warpsectorcnt;
extern int xpanningsectorlist[16], xpanningsectorcnt;
extern int ypanningwalllist[128], ypanningwallcnt;
extern int floorpanninglist[64], floorpanningcnt;
extern SwingDoor swingdoor[MAXSWINGDOORS];
extern short swingcnt;
extern int swingcnt;
extern short dragsectorlist[16], dragxdir[16], dragydir[16], dragsectorcnt;
extern int16_t dragxdir[16], dragydir[16];
extern int dragsectorlist[16], dragsectorcnt;
extern int dragx1[16], dragy1[16], dragx2[16], dragy2[16], dragfloorz[16];
@ -352,13 +353,13 @@ void randompotion(DWHActor* i);
// whfx
extern short skypanlist[64], skypancnt;
extern short lavadrylandsector[32];
extern short lavadrylandcnt;
extern short bobbingsectorlist[16], bobbingsectorcnt;
extern int skypanlist[64], skypancnt;
extern int lavadrylandsector[32];
extern int lavadrylandcnt;
extern int bobbingsectorlist[16], bobbingsectorcnt;
extern DWHActor* lastbat;
extern short revolveclip[16];
extern short revolvesector[4], revolveang[4], revolvecnt;
extern int revolveclip[16];
extern int revolvesector[4], revolveang[4], revolvecnt;
extern int revolvex[4][32], revolvey[4][32];
extern int revolvepivotx[4], revolvepivoty[4];
extern int warpx, warpy, warpz, warpang;
@ -378,7 +379,7 @@ void panningfx();
void revolvefx();
void bobbingsector();
void teleporter();
void warp(int x, int y, int z, int daang, short dasector);
void warp(int x, int y, int z, int daang, int dasector);
void warpsprite(DWHActor* spritenum);
void ironbars();
void sectorsounds();
@ -400,7 +401,7 @@ void shards(DWHActor* i, int type);
// animate
struct ANIMATION
{
short id;
int16_t id;
byte type;
int goal;
int vel;

View file

@ -9,11 +9,11 @@ BEGIN_WH_NS
void animateobjs(PLAYER& plr) {
boolean hitdamage = false;
short osectnum = 0;
int osectnum = 0;
int dax, day, daz = 0, j, k;
Collision moveStat = 0;
short startwall, endwall;
int startwall, endwall;
if (plr.sector < 0 || plr.sector >= numsectors)
return;

View file

@ -15,20 +15,20 @@ BEGIN_WH_NS
#define WATERMAXDROPS 1
short skypanlist[64], skypancnt;
short lavadrylandsector[32];
short lavadrylandcnt;
short bobbingsectorlist[16], bobbingsectorcnt;
int skypanlist[64], skypancnt;
int lavadrylandsector[32];
int lavadrylandcnt;
int bobbingsectorlist[16], bobbingsectorcnt;
DWHActor* lastbat = nullptr;
short revolveclip[16];
short revolvesector[4], revolveang[4], revolvecnt;
int revolveclip[16];
int revolvesector[4], revolveang[4], revolvecnt;
int revolvex[4][32], revolvey[4][32];
int revolvepivotx[4], revolvepivoty[4];
static int revolvesyncstat;
static short revolvesyncang, revolvesyncrotang;
static int revolvesyncang, revolvesyncrotang;
static int revolvesyncx, revolvesyncy;
int warpx, warpy, warpz, warpang;
@ -359,7 +359,7 @@ void panningfx() {
void revolvefx() {
short startwall, endwall;
int startwall, endwall;
int dax, day;
PLAYER& plr = player[pyrn];
@ -370,7 +370,7 @@ void revolvefx() {
endwall = (startwall + sector[revolvesector[i]].wallnum - 1);
revolveang[i] = ((revolveang[i] + 2048 - ((TICSPERFRAME) << 1)) & 2047);
for (short k = startwall; k <= endwall; k++) {
for (int k = startwall; k <= endwall; k++) {
Point out = rotatepoint(revolvepivotx[i], revolvepivoty[i], revolvex[i][k - startwall],
revolvey[i][k - startwall], revolveang[i]);
dax = out.getX();
@ -396,15 +396,15 @@ void revolvefx() {
void bobbingsector() {
for (int i = 0; i < bobbingsectorcnt; i++) {
short dasector = bobbingsectorlist[i];
int dasector = bobbingsectorlist[i];
sector[dasector].floorz += bsin(PlayClock << 4, -6);
}
}
void teleporter() {
short dasector;
short startwall, endwall;
int dasector;
int startwall, endwall;
int i, j;
int s;
int16_t daang;
@ -477,7 +477,7 @@ void teleporter() {
}
}
void warp(int x, int y, int z, int daang, short dasector) {
void warp(int x, int y, int z, int daang, int dasector) {
warpx = x;
warpy = y;
warpz = z;
@ -517,7 +517,7 @@ void warpsprite(DWHActor* actor) {
if (monsterwarptime > 0)
return;
auto& spr = actor->s();
short dasectnum = spr.sectnum;
int dasectnum = spr.sectnum;
warpfxsprite(actor);
warp(spr.x, spr.y, spr.z, spr.ang, dasectnum);
spr.x = warpx;

View file

@ -196,8 +196,8 @@ void preparesectors() {
boolean prepareboard(const char* fname) {
short i;
short treesize;
int i;
int treesize;
PLAYER& plr = player[0];

View file

@ -8,12 +8,12 @@ byte flashflag = 0x00;
static const int eg_onyx_effect = 1;
short torchpattern[] = { 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 5, 5, 4, 4, 3, 3, 3, 2, 2, 2 };
const uint8_t torchpattern[] = { 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 5, 5, 4, 4, 3, 3, 3, 2, 2, 2 };
// EG 19 Aug 2017 - Try to prevent monsters teleporting back and forth wildly
int monsterwarptime;
short adjusthp(int hp) {
int adjusthp(int hp) {
#if 0
// this doesn't do much because 'factor' will always be 0 due to integer division
float factor = (krand() % 20) / 100;

View file

@ -7,7 +7,7 @@ BEGIN_WH_NS
PLAYER player[MAXPLAYERS];
PLOCATION gPrevPlayerLoc[MAXPLAYERS];
short monsterangle[MAXSPRITESONSCREEN], monsterlist[MAXSPRITESONSCREEN];
int16_t monsterangle[MAXSPRITESONSCREEN], monsterlist[MAXSPRITESONSCREEN];
int shootgunzvel;
boolean justteleported;
@ -282,10 +282,10 @@ void plruse(PLAYER& plr) {
}
}
void chunksofmeat(PLAYER& plr, DWHActor* hitActor, int hitx, int hity, int hitz, short hitsect, int daang) {
void chunksofmeat(PLAYER& plr, DWHActor* hitActor, int hitx, int hity, int hitz, int hitsect, int daang) {
short k;
short zgore = 0;
int k;
int zgore = 0;
int chunk = REDCHUNKSTART;
int newchunk;

View file

@ -7,21 +7,22 @@ int d_soundplayed = 0;
int delaycnt;
Delayitem delayitem[MAXSECTORS];
short ironbarsector[16];
short ironbarscnt;
int ironbarsector[16];
int ironbarscnt;
int ironbarsgoal1[16], ironbarsgoal2[16];
short ironbarsdone[16];
int16_t ironbarsdone[16];
DWHActor* ironbarsanim[16];
int ironbarsgoal[16];
int16_t ironbarsgoal[16];
short warpsectorlist[64], warpsectorcnt;
short xpanningsectorlist[16], xpanningsectorcnt;
short ypanningwalllist[128], ypanningwallcnt;
short floorpanninglist[64], floorpanningcnt;
int warpsectorlist[64], warpsectorcnt;
int xpanningsectorlist[16], xpanningsectorcnt;
int ypanningwalllist[128], ypanningwallcnt;
int floorpanninglist[64], floorpanningcnt;
SwingDoor swingdoor[MAXSWINGDOORS];
short swingcnt;
int swingcnt;
short dragsectorlist[16], dragxdir[16], dragydir[16], dragsectorcnt;
int16_t dragxdir[16], dragydir[16];
int dragsectorlist[16], dragsectorcnt;
int dragx1[16], dragy1[16], dragx2[16], dragy2[16], dragfloorz[16];
@ -96,7 +97,7 @@ void operatesector(PLAYER& plr, int s) {
int doorantic, doorkey, doortype;
int temp1, temp2, temp3;
short k;
int k;
int keysok = 0;
int datag = sector[s].lotag;
@ -892,7 +893,7 @@ void operatesector(PLAYER& plr, int s) {
void animatetags(int nPlayer) {
int endwall, good, j, k, oldang, startwall;
short i;
int i;
int dasector;
PLAYER& plr = player[nPlayer];