Browse Source

Add no-light define and fix usage

pull/989/head
qndel 5 years ago committed by Anders Jenbo
parent
commit
6e096143f0
  1. 14
      Source/lighting.cpp
  2. 4
      Source/missiles.cpp
  3. 4
      Source/monster.cpp
  4. 1
      defs.h
  5. 2
      structs.h

14
Source/lighting.cpp

@ -1043,10 +1043,10 @@ int AddLight(int x, int y, int r)
int lid;
if (lightflag) {
return -1;
return NO_LIGHT;
}
lid = -1;
lid = NO_LIGHT;
if (numlights < MAXLIGHTS) {
lid = lightactive[numlights++];
@ -1065,7 +1065,7 @@ int AddLight(int x, int y, int r)
void AddUnLight(int i)
{
if (lightflag || i == -1) {
if (lightflag || i == NO_LIGHT) {
return;
}
@ -1075,7 +1075,7 @@ void AddUnLight(int i)
void ChangeLightRadius(int i, int r)
{
if (lightflag || i == -1) {
if (lightflag || i == NO_LIGHT) {
return;
}
@ -1089,7 +1089,7 @@ void ChangeLightRadius(int i, int r)
void ChangeLightXY(int i, int x, int y)
{
if (lightflag || i == -1) {
if (lightflag || i == NO_LIGHT) {
return;
}
@ -1104,7 +1104,7 @@ void ChangeLightXY(int i, int x, int y)
void ChangeLightOff(int i, int x, int y)
{
if (lightflag || i == -1) {
if (lightflag || i == NO_LIGHT) {
return;
}
@ -1119,7 +1119,7 @@ void ChangeLightOff(int i, int x, int y)
void ChangeLight(int i, int x, int y, int r)
{
if (lightflag || i == -1) {
if (lightflag || i == NO_LIGHT) {
return;
}

4
Source/missiles.cpp

@ -2727,7 +2727,7 @@ void AddAcid(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy, in
missile[mi]._mirange = 5 * (monster[id]._mint + 4);
else
missile[mi]._mirange = 1;
missile[mi]._mlid = -1;
missile[mi]._mlid = NO_LIGHT;
missile[mi]._miVar1 = sx;
missile[mi]._miVar2 = sy;
PutMissile(mi);
@ -3384,7 +3384,7 @@ int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, char micas
missile[mi]._midam = midam;
missile[mi]._miHitFlag = FALSE;
missile[mi]._midist = 0;
missile[mi]._mlid = -1;
missile[mi]._mlid = NO_LIGHT;
missile[mi]._mirnd = 0;
if (missiledata[mitype].mlSFX != -1) {

4
Source/monster.cpp

@ -501,7 +501,7 @@ void InitMonster(int i, int rd, int mtype, int x, int y)
monster[i]._mDelFlag = FALSE;
monster[i]._uniqtype = 0;
monster[i]._msquelch = 0;
monster[i].mlid = 0;
monster[i].mlid = NO_LIGHT; // BUGFIX monsters initial light id should be -1 (fixed)
monster[i]._mRndSeed = GetRndSeed();
monster[i]._mAISeed = GetRndSeed();
monster[i].mWhoHit = 0;
@ -804,7 +804,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int bosspacksize)
Monst->mMagicRes = Uniq->mMagicRes;
Monst->mtalkmsg = Uniq->mtalkmsg;
if (uniqindex == UMT_HORKDMN)
Monst->mlid = 0;
Monst->mlid = NO_LIGHT; // BUGFIX monsters initial light id should be -1 (fixed)
else
Monst->mlid = AddLight(Monst->_mx, Monst->_my, 3);

1
defs.h

@ -8,6 +8,7 @@
#define DMAXY 40
#define LIGHTSIZE 6912 // 27 * 256
#define NO_LIGHT -1
#define GMENU_SLIDER 0x40000000
#define GMENU_ENABLED 0x80000000

2
structs.h

@ -602,7 +602,7 @@ typedef struct MonsterStruct { // note: missing field _mAFNum
unsigned char leader;
unsigned char leaderflag;
unsigned char packsize;
unsigned char mlid;
Sint8 mlid; // BUGFIX -1 is used when not emitting light this should be signed (fixed)
const char *mName;
CMonster *MType;
MonsterData *MData;

Loading…
Cancel
Save