mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-18 09:41:06 +00:00
- another batch of smaller stuff.
This commit is contained in:
parent
0138f7e333
commit
35ba63cb3e
10 changed files with 38 additions and 36 deletions
|
@ -6,8 +6,8 @@ BEGIN_WH_NS
|
|||
|
||||
Item items[MAXITEMS - ITEMSBASE];
|
||||
|
||||
boolean isItemSprite(int i) {
|
||||
return (sprite[i].detail & 0xFF) >= ITEMSBASE && (sprite[i].detail & 0xFF) < MAXITEMS;
|
||||
boolean isItemSprite(DWHActor* actor) {
|
||||
return (actor->s().detail & 0xFF) >= ITEMSBASE && (actor->s().detail & 0xFF) < MAXITEMS;
|
||||
}
|
||||
|
||||
void InitItems()
|
||||
|
|
|
@ -136,16 +136,17 @@ void updatepotion(PLAYER& plr, int vial) {
|
|||
}
|
||||
}
|
||||
|
||||
void randompotion(int i) {
|
||||
void randompotion(DWHActor* actor) {
|
||||
if ((krand() % 100) > 20)
|
||||
return;
|
||||
|
||||
auto spawnedactor = InsertActor(sprite[i].sectnum, (short)0);
|
||||
auto& spr = actor->s();
|
||||
auto spawnedactor = InsertActor(spr.sectnum, (short)0);
|
||||
auto& spawned = spawnedactor->s();
|
||||
|
||||
spawned.x = sprite[i].x;
|
||||
spawned.y = sprite[i].y;
|
||||
spawned.z = sprite[i].z - (12 << 8);
|
||||
spawned.x = spr.x;
|
||||
spawned.y = spr.y;
|
||||
spawned.z = spr.z - (12 << 8);
|
||||
spawned.shade = -12;
|
||||
spawned.pal = 0;
|
||||
spawned.cstat = 0;
|
||||
|
|
|
@ -9,18 +9,19 @@ void addTile(int num)
|
|||
markTileForPrecache(num, 0);
|
||||
}
|
||||
|
||||
void cachespritenum(int i)
|
||||
void cachespritenum(DWHActor* actor)
|
||||
{
|
||||
auto& spr = actor->s();
|
||||
int maxc = 1;
|
||||
if (sprite[i].picnum == RAT || sprite[i].picnum == GUARDIAN)
|
||||
if (spr.picnum == RAT || spr.picnum == GUARDIAN)
|
||||
maxc = 15;
|
||||
if (sprite[i].picnum == HANGMAN)
|
||||
if (spr.picnum == HANGMAN)
|
||||
maxc = 40;
|
||||
|
||||
if (sprite[i].picnum == GRONHAL || sprite[i].picnum == GRONMU || sprite[i].picnum == GRONSW)
|
||||
if (spr.picnum == GRONHAL || spr.picnum == GRONMU || spr.picnum == GRONSW)
|
||||
maxc = 19;
|
||||
|
||||
switch (sprite[i].picnum)
|
||||
switch (spr.picnum)
|
||||
{
|
||||
case GOBLINSTAND:
|
||||
case GOBLIN:
|
||||
|
@ -54,7 +55,7 @@ void cachespritenum(int i)
|
|||
maxc = 18;
|
||||
break;
|
||||
}
|
||||
for (int j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++)
|
||||
for (int j = spr.picnum; j < (spr.picnum + maxc); j++)
|
||||
addTile(j);
|
||||
}
|
||||
|
||||
|
@ -73,7 +74,7 @@ void precacheTiles()
|
|||
WHSpriteIterator it;
|
||||
while (auto itActor = it.Next())
|
||||
{
|
||||
cachespritenum(itActor->GetSpriteIndex());
|
||||
cachespritenum(itActor);
|
||||
}
|
||||
|
||||
addTile(BAT);
|
||||
|
|
|
@ -154,7 +154,7 @@ void GameInterface::UpdateSounds()
|
|||
listener.underwater = false;
|
||||
listener.Environment = 0;
|
||||
|
||||
listener.ListenerObject = &sprite[player[pyrn].spritenum];
|
||||
listener.ListenerObject = &player[pyrn].actor()->s();
|
||||
soundEngine->SetListener(listener);
|
||||
soundEngine->UpdateSounds(I_GetTime());
|
||||
}
|
||||
|
|
|
@ -369,13 +369,13 @@ void nukespell(PLAYER& plr, short const j) {
|
|||
}
|
||||
}
|
||||
|
||||
void medusa(PLAYER& plr, short j) {
|
||||
auto& spr = sprite[j];
|
||||
void medusa(PLAYER& plr, DWHActor* actor) {
|
||||
auto& spr = actor->s();
|
||||
|
||||
if(spr.hitag <= 0) //don't freeze dead enemies
|
||||
return;
|
||||
|
||||
newstatus(j, FROZEN);
|
||||
SetNewStatus(actor, FROZEN);
|
||||
int pic = spr.picnum;
|
||||
switch (spr.detail) {
|
||||
|
||||
|
|
|
@ -16,11 +16,12 @@ int dahand = 0;
|
|||
int oweapondrop, weapondrop;
|
||||
double osnakex, osnakey, snakex, snakey;
|
||||
|
||||
boolean checkmedusadist(int i, int x, int y, int z, int lvl) {
|
||||
boolean checkmedusadist(DWHActor* actor, int x, int y, int z, int lvl) {
|
||||
auto& spr = actor->s();
|
||||
int attackdist = (isWh2() ? 8192 : 1024) + (lvl << 9);
|
||||
|
||||
if ((abs(x - sprite[i].x) + abs(y - sprite[i].y) < attackdist)
|
||||
&& (abs((z >> 8) - ((sprite[i].z >> 8) - (tileHeight(sprite[i].picnum) >> 1))) <= 120))
|
||||
if ((abs(x - spr.x) + abs(y - spr.y) < attackdist)
|
||||
&& (abs((z >> 8) - ((spr.z >> 8) - (tileHeight(spr.picnum) >> 1))) <= 120))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -1012,7 +1013,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
|
|||
|
||||
if (checkweapondist(pHitInfo.hitsprite, plr.x, plr.y, plr.z, plr.selectedgun)) {
|
||||
madeahit = true;
|
||||
auto& hitspr = sprite[pHitInfo.hitsprite];
|
||||
auto& hitspr = hitActor->s();
|
||||
|
||||
switch (hitspr.detail) {
|
||||
|
||||
|
@ -1277,7 +1278,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
|
|||
hitspr.hitag = 1;
|
||||
}
|
||||
if (krand() % 100 > 50)
|
||||
medusa(plr, pHitInfo.hitsprite);
|
||||
medusa(plr, hitActor);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1484,7 +1485,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
|
|||
hitspr.hitag = 1;
|
||||
}
|
||||
if (krand() % 100 > 75)
|
||||
medusa(plr, pHitInfo.hitsprite);
|
||||
medusa(plr, hitActor);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1778,8 +1779,8 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
|
|||
(bsin(spawned.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
|
||||
spawned.backuploc();
|
||||
}
|
||||
if ((pHitInfo.hitsprite >= 0) && (sprite[pHitInfo.hitsprite].statnum < MAXSTATUS)) {
|
||||
auto& hitspr = sprite[pHitInfo.hitsprite];
|
||||
if ((hitActor != nullptr) && (hitActor->s().statnum < MAXSTATUS)) {
|
||||
auto& hitspr = hitActor->s();
|
||||
switch (hitspr.detail) {
|
||||
case KURTTYPE:
|
||||
case KATIETYPE:
|
||||
|
@ -1901,8 +1902,8 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
|
|||
if (cansee(plr.x, plr.y, plr.z, plr.sector, spk.x, spk.y,
|
||||
spk.z - (tileHeight(spk.picnum) << 7), spk.sectnum)) {
|
||||
// distance check
|
||||
if (checkmedusadist(i, plr.x, plr.y, plr.z, plr.lvl))
|
||||
medusa(plr, i);
|
||||
if (checkmedusadist(itActor, plr.x, plr.y, plr.z, plr.lvl))
|
||||
medusa(plr, itActor);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2260,7 +2261,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
|
|||
if (cansee(plr.x, plr.y, plr.z, plr.sector, spk.x, spk.y,
|
||||
spk.z - (tileHeight(spk.picnum) << 7), spk.sectnum))
|
||||
if ((isWh2() && itActor->GetPlayerOwner() != plr.playerNum())
|
||||
|| checkmedusadist(j, plr.x, plr.y, plr.z, 12))
|
||||
|| checkmedusadist(itActor, plr.x, plr.y, plr.z, 12))
|
||||
nukespell(plr, j);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -307,7 +307,6 @@ extern int dahand;
|
|||
extern int oweapondrop, weapondrop;
|
||||
extern double osnakex, osnakey, snakex, snakey;
|
||||
|
||||
boolean checkmedusadist(int i, int x, int y, int z, int lvl);
|
||||
void autoweaponchange(PLAYER& plr, int dagun);
|
||||
void weaponchange(int snum);
|
||||
void plrfireweapon(PLAYER& plr);
|
||||
|
@ -319,7 +318,7 @@ void swingdaweapon(PLAYER& plr);
|
|||
void swingdacrunch(PLAYER& plr, int daweapon);
|
||||
void swingdasound(int daweapon, boolean enchanted);
|
||||
|
||||
boolean isItemSprite(int i);
|
||||
boolean isItemSprite(DWHActor* i);
|
||||
void InitItems();
|
||||
void wepdatainit();
|
||||
|
||||
|
@ -333,7 +332,7 @@ boolean changebook(PLAYER& plr, int i);
|
|||
boolean lvlspellcheck(PLAYER& plr);
|
||||
void speelbookprocess(PLAYER& plr);
|
||||
void nukespell(PLAYER& plr, short j);
|
||||
void medusa(PLAYER& plr, short j);
|
||||
void medusa(PLAYER& plr, DWHActor* j);
|
||||
void displayspelltext(PLAYER& plr);
|
||||
void orbpic(PLAYER& plr, int currentorb);
|
||||
|
||||
|
@ -345,7 +344,7 @@ void usapotion(PLAYER& plr);
|
|||
boolean potionspace(PLAYER& plr, int vial);
|
||||
void updatepotion(PLAYER& plr, int vial);
|
||||
void potionpic(PLAYER& plr, int currentpotion, int x, int y, int scale);
|
||||
void randompotion(int i);
|
||||
void randompotion(DWHActor* i);
|
||||
|
||||
// whfx
|
||||
|
||||
|
|
|
@ -1425,7 +1425,7 @@ void animateobjs(PLAYER& plr) {
|
|||
else {
|
||||
switch (spr.picnum) {
|
||||
case FSHATTERBARREL + 2:
|
||||
randompotion(i);
|
||||
randompotion(actor);
|
||||
ChangeActorStat(actor, 0);
|
||||
break;
|
||||
case STAINGLASS1 + 6:
|
||||
|
|
|
@ -728,7 +728,7 @@ boolean prepareboard(const char* fname) {
|
|||
}
|
||||
|
||||
|
||||
if(isItemSprite(i)) {
|
||||
if(isItemSprite(actor)) {
|
||||
Item& item = items[(spr.detail & 0xFF) - ITEMSBASE];
|
||||
if(item.sizx != -1 && item.sizy != -1) {
|
||||
spr.xrepeat = (uint8_t)item.sizx;
|
||||
|
|
|
@ -124,7 +124,7 @@ void processobjs(PLAYER& plr) {
|
|||
dz = abs((plr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if(isItemSprite(actor->GetSpriteIndex()))
|
||||
if(isItemSprite(actor))
|
||||
items[(tspr.detail & 0xFF) - ITEMSBASE].pickup(plr, actor);
|
||||
|
||||
if (tspr.picnum >= EXPLOSTART && tspr.picnum <= EXPLOEND && actor->GetPlayerOwner() != plr.playerNum())
|
||||
|
|
Loading…
Reference in a new issue