Clean up more implicit bool conversion
This commit is contained in:
parent
eb2cd5f654
commit
d8fa29c972
17 changed files with 80 additions and 98 deletions
|
|
@ -34,7 +34,7 @@ public:
|
|||
DWORD *status)
|
||||
= 0;
|
||||
virtual bool SNetSendTurn(char *data, unsigned int size) = 0;
|
||||
virtual int SNetGetProviderCaps(struct _SNETCAPS *caps) = 0;
|
||||
virtual void SNetGetProviderCaps(struct _SNETCAPS *caps) = 0;
|
||||
virtual bool SNetRegisterEventHandler(event_type evtype,
|
||||
SEVTHANDLER func)
|
||||
= 0;
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ bool base::SNetSendTurn(char *data, unsigned int size)
|
|||
return true;
|
||||
}
|
||||
|
||||
int base::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
void base::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
{
|
||||
caps->size = 0; // engine writes only ?!?
|
||||
caps->flags = 0; // unused
|
||||
|
|
@ -199,7 +199,6 @@ int base::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
|||
caps->defaultturnssec = 10; // ?
|
||||
caps->defaultturnsintransit = 1; // maximum acceptable number
|
||||
// of turns in queue?
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool base::SNetUnregisterEventHandler(event_type evtype, SEVTHANDLER func)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual bool SNetReceiveTurns(char **data, unsigned int *size,
|
||||
DWORD *status);
|
||||
virtual bool SNetSendTurn(char *data, unsigned int size);
|
||||
virtual int SNetGetProviderCaps(struct _SNETCAPS *caps);
|
||||
virtual void SNetGetProviderCaps(struct _SNETCAPS *caps);
|
||||
virtual bool SNetRegisterEventHandler(event_type evtype,
|
||||
SEVTHANDLER func);
|
||||
virtual bool SNetUnregisterEventHandler(event_type evtype,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual bool SNetReceiveTurns(char **data, unsigned int *size,
|
||||
DWORD *status);
|
||||
virtual bool SNetSendTurn(char *data, unsigned int size);
|
||||
virtual int SNetGetProviderCaps(struct _SNETCAPS *caps);
|
||||
virtual void SNetGetProviderCaps(struct _SNETCAPS *caps);
|
||||
virtual bool SNetRegisterEventHandler(event_type evtype,
|
||||
SEVTHANDLER func);
|
||||
virtual bool SNetUnregisterEventHandler(event_type evtype,
|
||||
|
|
@ -109,9 +109,9 @@ bool cdwrap<T>::SNetSendTurn(char *data, unsigned int size)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
int cdwrap<T>::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
void cdwrap<T>::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
{
|
||||
return dvlnet_wrap->SNetGetProviderCaps(caps);
|
||||
dvlnet_wrap->SNetGetProviderCaps(caps);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ bool loopback::SNetSendTurn(char *data, unsigned int size)
|
|||
return true;
|
||||
}
|
||||
|
||||
int loopback::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
void loopback::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
{
|
||||
caps->size = 0; // engine writes only ?!?
|
||||
caps->flags = 0; // unused
|
||||
|
|
@ -63,7 +63,6 @@ int loopback::SNetGetProviderCaps(struct _SNETCAPS *caps)
|
|||
caps->defaultturnssec = 10; // ?
|
||||
caps->defaultturnsintransit = 1; // maximum acceptable number
|
||||
// of turns in queue?
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool loopback::SNetRegisterEventHandler(event_type evtype,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual bool SNetReceiveTurns(char **data, unsigned int *size,
|
||||
DWORD *status);
|
||||
virtual bool SNetSendTurn(char *data, unsigned int size);
|
||||
virtual int SNetGetProviderCaps(struct _SNETCAPS *caps);
|
||||
virtual void SNetGetProviderCaps(struct _SNETCAPS *caps);
|
||||
virtual bool SNetRegisterEventHandler(event_type evtype,
|
||||
SEVTHANDLER func);
|
||||
virtual bool SNetUnregisterEventHandler(event_type evtype,
|
||||
|
|
|
|||
|
|
@ -541,9 +541,9 @@ void InitItems()
|
|||
SpawnRock();
|
||||
if (QuestStatus(Q_ANVIL))
|
||||
SpawnQuestItem(IDI_ANVIL, { 2 * setpc_x + 27, 2 * setpc_y + 27 }, 0, 1);
|
||||
if (sgGameInitInfo.bCowQuest && currlevel == 20)
|
||||
if (sgGameInitInfo.bCowQuest != 0 && currlevel == 20)
|
||||
SpawnQuestItem(IDI_BROWNSUIT, { 25, 25 }, 3, 1);
|
||||
if (sgGameInitInfo.bCowQuest && currlevel == 19)
|
||||
if (sgGameInitInfo.bCowQuest != 0 && currlevel == 19)
|
||||
SpawnQuestItem(IDI_GREYSUIT, { 25, 25 }, 3, 1);
|
||||
if (currlevel > 0 && currlevel < 16)
|
||||
AddInitItems();
|
||||
|
|
@ -985,20 +985,15 @@ static bool ItemMinStats(const PlayerStruct &player, ItemStruct *x)
|
|||
|
||||
void CalcPlrItemMin(PlayerStruct &player)
|
||||
{
|
||||
ItemStruct *pi = player.InvList;
|
||||
int i = player._pNumInv;
|
||||
|
||||
while (i--) {
|
||||
pi->_iStatFlag = ItemMinStats(player, pi);
|
||||
pi++;
|
||||
for (int i = 0; i < player._pNumInv; i++) {
|
||||
auto &item = player.InvList[i];
|
||||
item._iStatFlag = ItemMinStats(player, &item);
|
||||
}
|
||||
|
||||
pi = player.SpdList;
|
||||
for (i = MAXBELTITEMS; i != 0; i--) {
|
||||
if (!pi->isEmpty()) {
|
||||
pi->_iStatFlag = ItemMinStats(player, pi);
|
||||
for (auto &item : player.SpdList) {
|
||||
if (!item.isEmpty()) {
|
||||
item._iStatFlag = ItemMinStats(player, &item);
|
||||
}
|
||||
pi++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ void nthread_set_turn_upper_bit()
|
|||
|
||||
void nthread_start(bool set_turn_upper_bit)
|
||||
{
|
||||
const char *err, *err2;
|
||||
const char *err;
|
||||
DWORD largestMsgSize;
|
||||
_SNETCAPS caps;
|
||||
|
||||
|
|
@ -157,10 +157,7 @@ void nthread_start(bool set_turn_upper_bit)
|
|||
else
|
||||
turn_upper_bit = 0;
|
||||
caps.size = 36;
|
||||
if (!SNetGetProviderCaps(&caps)) {
|
||||
err = SDL_GetError();
|
||||
app_fatal("SNetGetProviderCaps:\n%s", err);
|
||||
}
|
||||
SNetGetProviderCaps(&caps);
|
||||
gdwTurnsInTransit = caps.defaultturnsintransit;
|
||||
if (!caps.defaultturnsintransit)
|
||||
gdwTurnsInTransit = 1;
|
||||
|
|
@ -191,8 +188,8 @@ void nthread_start(bool set_turn_upper_bit)
|
|||
nthread_should_run = true;
|
||||
sghThread = CreateThread(nthread_handler, &glpNThreadId);
|
||||
if (sghThread == nullptr) {
|
||||
err2 = SDL_GetError();
|
||||
app_fatal("nthread2:\n%s", err2);
|
||||
err = SDL_GetError();
|
||||
app_fatal("nthread2:\n%s", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ bool pfile_ui_set_hero_infos(bool (*ui_add_hero_info)(_uiheroinfo *))
|
|||
strcpy(hero_names[i], pkplr.pName);
|
||||
bool hasSaveGame = pfile_archive_contains_game(archive);
|
||||
if (hasSaveGame)
|
||||
pkplr.bIsHellfire = gbIsHellfireSaveGame;
|
||||
pkplr.bIsHellfire = gbIsHellfireSaveGame ? 1 : 0;
|
||||
|
||||
UnPackPlayer(&pkplr, 0, false);
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ bool pfile_ui_save_create(_uiheroinfo *heroinfo)
|
|||
uint32_t save_num = pfile_get_save_num_from_name(heroinfo->name);
|
||||
if (save_num >= MAX_CHARACTERS) {
|
||||
for (save_num = 0; save_num < MAX_CHARACTERS; save_num++) {
|
||||
if (!hero_names[save_num][0])
|
||||
if (hero_names[save_num][0] == '\0')
|
||||
break;
|
||||
}
|
||||
if (save_num >= MAX_CHARACTERS)
|
||||
|
|
@ -395,7 +395,7 @@ void pfile_read_player_from_save(char name[16], int playerId)
|
|||
|
||||
gbValidSaveFile = pfile_archive_contains_game(archive);
|
||||
if (gbValidSaveFile)
|
||||
pkplr.bIsHellfire = gbIsHellfireSaveGame;
|
||||
pkplr.bIsHellfire = gbIsHellfireSaveGame ? 1 : 0;
|
||||
|
||||
pfile_SFileCloseArchive(&archive);
|
||||
|
||||
|
|
|
|||
|
|
@ -140,16 +140,16 @@ bool PlrDirOK(int pnum, Direction dir)
|
|||
|
||||
Point position = player.position.tile;
|
||||
Point futurePosition = position + dir;
|
||||
if (futurePosition.x < 0 || !dPiece[futurePosition.x][futurePosition.y] || !PosOkPlayer(pnum, futurePosition)) {
|
||||
if (futurePosition.x < 0 || dPiece[futurePosition.x][futurePosition.y] == 0 || !PosOkPlayer(pnum, futurePosition)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dir == DIR_E) {
|
||||
return !SolidLoc(position + DIR_SE) && !(dFlags[position.x + 1][position.y] & BFLAG_PLAYERLR);
|
||||
return !SolidLoc(position + DIR_SE) && (dFlags[position.x + 1][position.y] & BFLAG_PLAYERLR) == 0;
|
||||
}
|
||||
|
||||
if (dir == DIR_W) {
|
||||
return !SolidLoc(position + DIR_SW) && !(dFlags[position.x][position.y + 1] & BFLAG_PLAYERLR);
|
||||
return !SolidLoc(position + DIR_SW) && (dFlags[position.x][position.y + 1] & BFLAG_PLAYERLR) == 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -181,7 +181,7 @@ void HandleWalkMode(int pnum, Point vel, Direction dir)
|
|||
void StartWalkAnimation(PlayerStruct &player, Direction dir, bool pmWillBeCalled)
|
||||
{
|
||||
int skippedFrames = -2;
|
||||
if (currlevel == 0 && sgGameInitInfo.bRunInTown)
|
||||
if (currlevel == 0 && sgGameInitInfo.bRunInTown != 0)
|
||||
skippedFrames = 2;
|
||||
if (pmWillBeCalled)
|
||||
skippedFrames += 1;
|
||||
|
|
@ -1326,7 +1326,7 @@ void PlrDoTrans(Point position)
|
|||
} else {
|
||||
for (i = position.y - 1; i <= position.y + 1; i++) {
|
||||
for (j = position.x - 1; j <= position.x + 1; j++) {
|
||||
if (!nSolidTable[dPiece[j][i]] && dTransVal[j][i]) {
|
||||
if (!nSolidTable[dPiece[j][i]] && dTransVal[j][i] != 0) {
|
||||
TransList[dTransVal[j][i]] = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1409,7 +1409,7 @@ void PM_ChangeOffset(int pnum)
|
|||
|
||||
player.position.offset2 += player.position.velocity;
|
||||
|
||||
if (currlevel == 0 && sgGameInitInfo.bRunInTown) {
|
||||
if (currlevel == 0 && sgGameInitInfo.bRunInTown != 0) {
|
||||
player.position.offset2 += player.position.velocity;
|
||||
}
|
||||
|
||||
|
|
@ -1418,7 +1418,7 @@ void PM_ChangeOffset(int pnum)
|
|||
px -= player.position.offset2.x >> 8;
|
||||
py -= player.position.offset2.y >> 8;
|
||||
|
||||
if (pnum == myplr && ScrollInfo._sdir) {
|
||||
if (pnum == myplr && ScrollInfo._sdir != SDIR_NONE) {
|
||||
ScrollInfo.offset.x += px;
|
||||
ScrollInfo.offset.y += py;
|
||||
}
|
||||
|
|
@ -1658,47 +1658,43 @@ void StartPlrHit(int pnum, int dam, bool forcehit)
|
|||
SetPlayerOld(player);
|
||||
}
|
||||
|
||||
void RespawnDeadItem(ItemStruct *itm, int x, int y)
|
||||
static void RespawnDeadItem(ItemStruct *itm, Point target)
|
||||
{
|
||||
if (numitems >= MAXITEMS)
|
||||
return;
|
||||
|
||||
int ii = AllocateItem();
|
||||
|
||||
dItem[x][y] = ii + 1;
|
||||
dItem[target.x][target.y] = ii + 1;
|
||||
|
||||
items[ii] = *itm;
|
||||
items[ii].position = { x, y };
|
||||
items[ii].position = target;
|
||||
RespawnItem(&items[ii], true);
|
||||
|
||||
itm->_itype = ITYPE_NONE;
|
||||
}
|
||||
|
||||
static void PlrDeadItem(PlayerStruct &player, ItemStruct *itm, int xx, int yy)
|
||||
static void PlrDeadItem(PlayerStruct &player, ItemStruct *itm, Point direction)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
if (itm->isEmpty())
|
||||
return;
|
||||
|
||||
int x = xx + player.position.tile.x;
|
||||
int y = yy + player.position.tile.y;
|
||||
if ((xx || yy) && ItemSpaceOk({ x, y })) {
|
||||
RespawnDeadItem(itm, x, y);
|
||||
Point target = direction + player.position.tile;
|
||||
if (direction != Point { 0, 0 } && ItemSpaceOk(target)) {
|
||||
RespawnDeadItem(itm, target);
|
||||
player.HoldItem = *itm;
|
||||
NetSendCmdPItem(false, CMD_RESPAWNITEM, { x, y });
|
||||
NetSendCmdPItem(false, CMD_RESPAWNITEM, target);
|
||||
return;
|
||||
}
|
||||
|
||||
for (k = 1; k < 50; k++) {
|
||||
for (j = -k; j <= k; j++) {
|
||||
y = j + player.position.tile.y;
|
||||
for (i = -k; i <= k; i++) {
|
||||
x = i + player.position.tile.x;
|
||||
if (ItemSpaceOk({ x, y })) {
|
||||
RespawnDeadItem(itm, x, y);
|
||||
for (int k = 1; k < 50; k++) {
|
||||
for (int j = -k; j <= k; j++) {
|
||||
for (int i = -k; i <= k; i++) {
|
||||
Point target = Point { i, j } + player.position.tile;
|
||||
if (ItemSpaceOk(target)) {
|
||||
RespawnDeadItem(itm, target);
|
||||
player.HoldItem = *itm;
|
||||
NetSendCmdPItem(false, CMD_RESPAWNITEM, { x, y });
|
||||
NetSendCmdPItem(false, CMD_RESPAWNITEM, target);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1713,9 +1709,8 @@ void
|
|||
StartPlayerKill(int pnum, int earflag)
|
||||
{
|
||||
bool diablolevel;
|
||||
int i, pdd;
|
||||
int i;
|
||||
ItemStruct ear;
|
||||
ItemStruct *pi;
|
||||
|
||||
if ((DWORD)pnum >= MAX_PLRS) {
|
||||
app_fatal("StartPlayerKill: illegal player %i", pnum);
|
||||
|
|
@ -1734,7 +1729,7 @@ StartPlayerKill(int pnum, int earflag)
|
|||
|
||||
player.Say(HeroSpeech::OofAh);
|
||||
|
||||
if (player._pgfxnum) {
|
||||
if (player._pgfxnum != 0) {
|
||||
player._pgfxnum = 0;
|
||||
ResetPlayerGFX(player);
|
||||
SetPlrAnims(player);
|
||||
|
|
@ -1748,7 +1743,7 @@ StartPlayerKill(int pnum, int earflag)
|
|||
SetPlayerHitPoints(pnum, 0);
|
||||
player.deathFrame = 1;
|
||||
|
||||
if (pnum != myplr && !earflag && !diablolevel) {
|
||||
if (pnum != myplr && earflag == 0 && !diablolevel) {
|
||||
for (i = 0; i < NUM_INVLOC; i++) {
|
||||
player.InvBody[i]._itype = ITYPE_NONE;
|
||||
}
|
||||
|
|
@ -1766,7 +1761,7 @@ StartPlayerKill(int pnum, int earflag)
|
|||
deathdelay = 30;
|
||||
|
||||
if (pcurs >= CURSOR_FIRSTITEM) {
|
||||
PlrDeadItem(player, &player.HoldItem, 0, 0);
|
||||
PlrDeadItem(player, &player.HoldItem, { 0, 0 });
|
||||
NewCursor(CURSOR_HAND);
|
||||
}
|
||||
|
||||
|
|
@ -1791,16 +1786,13 @@ StartPlayerKill(int pnum, int earflag)
|
|||
ear._ivalue = player._pLevel;
|
||||
|
||||
if (FindGetItem(IDI_EAR, ear._iCreateInfo, ear._iSeed) == -1) {
|
||||
PlrDeadItem(player, &ear, 0, 0);
|
||||
PlrDeadItem(player, &ear, { 0, 0 });
|
||||
}
|
||||
} else {
|
||||
pi = &player.InvBody[0];
|
||||
i = NUM_INVLOC;
|
||||
while (i--) {
|
||||
pdd = (i + player._pdir) & 7;
|
||||
Point offset = Point { 0, 0 } + static_cast<Direction>(pdd);
|
||||
PlrDeadItem(player, pi, offset.x, offset.y);
|
||||
pi++;
|
||||
Direction pdd = player._pdir;
|
||||
for (auto &item : player.InvBody) {
|
||||
pdd = left[pdd];
|
||||
PlrDeadItem(player, &item, Point::fromDirection(pdd));
|
||||
}
|
||||
|
||||
CalcPlrInv(pnum, false);
|
||||
|
|
@ -1828,7 +1820,7 @@ static int DropGold(int pnum, int amount, bool skipFullStacks)
|
|||
GetGoldSeed(pnum, &player.HoldItem);
|
||||
SetPlrHandGoldCurs(&player.HoldItem);
|
||||
player.HoldItem._ivalue = amount;
|
||||
PlrDeadItem(player, &player.HoldItem, 0, 0);
|
||||
PlrDeadItem(player, &player.HoldItem, { 0, 0 });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1838,7 +1830,7 @@ static int DropGold(int pnum, int amount, bool skipFullStacks)
|
|||
GetGoldSeed(pnum, &player.HoldItem);
|
||||
SetPlrHandGoldCurs(&player.HoldItem);
|
||||
player.HoldItem._ivalue = item._ivalue;
|
||||
PlrDeadItem(player, &player.HoldItem, 0, 0);
|
||||
PlrDeadItem(player, &player.HoldItem, { 0, 0 });
|
||||
i = -1;
|
||||
}
|
||||
|
||||
|
|
@ -1883,7 +1875,7 @@ void StripTopGold(int pnum)
|
|||
player.HoldItem._ivalue = val;
|
||||
SetPlrHandGoldCurs(&player.HoldItem);
|
||||
if (!GoldAutoPlace(player))
|
||||
PlrDeadItem(player, &player.HoldItem, 0, 0);
|
||||
PlrDeadItem(player, &player.HoldItem, { 0, 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2153,7 +2145,7 @@ bool PM_DoWalk(int pnum, int variant)
|
|||
}
|
||||
|
||||
//Update the "camera" tile position
|
||||
if (pnum == myplr && ScrollInfo._sdir) {
|
||||
if (pnum == myplr && ScrollInfo._sdir != SDIR_NONE) {
|
||||
ViewX = player.position.tile.x - ScrollInfo.tile.x;
|
||||
ViewY = player.position.tile.y - ScrollInfo.tile.y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void DrawPlrMsg(const CelOutputBuffer &out)
|
|||
|
||||
pMsg = plr_msgs;
|
||||
for (i = 0; i < PMSG_COUNT; i++) {
|
||||
if (pMsg->str[0])
|
||||
if (pMsg->str[0] != '\0')
|
||||
PrintPlrMsg(out, x, y, width, pMsg->str, text_color_from_player_num[pMsg->player]);
|
||||
pMsg++;
|
||||
y += 35;
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ void ResyncQuests()
|
|||
}
|
||||
if (currlevel == quests[Q_MUSHROOM]._qlevel) {
|
||||
if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && quests[Q_MUSHROOM]._qvar1 == QS_INIT) {
|
||||
SpawnQuestItem(IDI_FUNGALTM, { 0, 0 }, 5, true);
|
||||
SpawnQuestItem(IDI_FUNGALTM, { 0, 0 }, 5, 1);
|
||||
quests[Q_MUSHROOM]._qvar1 = QS_TOMESPAWNED;
|
||||
} else {
|
||||
if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
|
||||
|
|
@ -694,7 +694,7 @@ void ResyncQuests()
|
|||
}
|
||||
if (currlevel == quests[Q_VEIL]._qlevel + 1 && quests[Q_VEIL]._qactive == QUEST_ACTIVE && quests[Q_VEIL]._qvar1 == 0) {
|
||||
quests[Q_VEIL]._qvar1 = 1;
|
||||
SpawnQuestItem(IDI_GLDNELIX, { 0, 0 }, 5, true);
|
||||
SpawnQuestItem(IDI_GLDNELIX, { 0, 0 }, 5, 1);
|
||||
}
|
||||
if (setlevel && setlvlnum == SL_VILEBETRAYER) {
|
||||
if (quests[Q_BETRAYER]._qvar1 >= 4)
|
||||
|
|
@ -793,7 +793,7 @@ void QuestlogDown()
|
|||
void QuestlogEnter()
|
||||
{
|
||||
PlaySFX(IS_TITLSLCT);
|
||||
if (numqlines && qline != 22)
|
||||
if (numqlines != 0 && qline != 22)
|
||||
InitQTextMsg(quests[qlist[(qline - qtopline) / 2]]._qmsg);
|
||||
questlog = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ void DrawMissilePrivate(const CelOutputBuffer &out, MissileStruct *m, int sx, in
|
|||
int mx = sx + m->position.offset.x - m->_miAnimWidth2;
|
||||
int my = sy + m->position.offset.y;
|
||||
CelSprite cel { m->_miAnimData, m->_miAnimWidth };
|
||||
if (m->_miUniqTrans)
|
||||
if (m->_miUniqTrans != 0)
|
||||
Cl2DrawLightTbl(out, mx, my, cel, m->_miAnimFrame, m->_miUniqTrans + 3);
|
||||
else if (m->_miLightFlag)
|
||||
Cl2DrawLight(out, mx, my, cel, m->_miAnimFrame);
|
||||
|
|
@ -345,13 +345,13 @@ static void DrawMonster(const CelOutputBuffer &out, int x, int y, int mx, int my
|
|||
}
|
||||
|
||||
char trans = 0;
|
||||
if (monster[m]._uniqtype)
|
||||
if (monster[m]._uniqtype != 0)
|
||||
trans = monster[m]._uniqtrans + 4;
|
||||
if (monster[m]._mmode == MM_STONE)
|
||||
trans = 2;
|
||||
if (plr[myplr]._pInfraFlag && light_table_index > 8)
|
||||
trans = 1;
|
||||
if (trans)
|
||||
if (trans != 0)
|
||||
Cl2DrawLightTbl(out, mx, my, cel, nCel, trans);
|
||||
else
|
||||
Cl2DrawLight(out, mx, my, cel, nCel);
|
||||
|
|
@ -451,7 +451,7 @@ static void DrawPlayer(const CelOutputBuffer &out, int pnum, int x, int y, int p
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(dFlags[x][y] & BFLAG_LIT) || (plr[myplr]._pInfraFlag && light_table_index > 8)) {
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 || (plr[myplr]._pInfraFlag && light_table_index > 8)) {
|
||||
Cl2DrawLightTbl(out, px, py, *pCelSprite, nCel, 1);
|
||||
DrawPlayerIcons(out, pnum, px, py, true);
|
||||
return;
|
||||
|
|
@ -564,7 +564,7 @@ static void drawCell(const CelOutputBuffer &out, int x, int y, int sx, int sy)
|
|||
{
|
||||
MICROS *pMap = &dpiece_defs_map_2[x][y];
|
||||
level_piece_id = dPiece[x][y];
|
||||
cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]);
|
||||
cel_transparency_active = nTransTable[level_piece_id] && TransList[dTransVal[x][y]];
|
||||
cel_foliage_active = !nSolidTable[level_piece_id];
|
||||
for (int i = 0; i < (MicroTileLen / 2); i++) {
|
||||
level_cel_block = pMap->mt[2 * i];
|
||||
|
|
@ -678,7 +678,7 @@ static void DrawMonsterHelper(const CelOutputBuffer &out, int x, int y, int oy,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(dFlags[x][y] & BFLAG_LIT) && !plr[myplr]._pInfraFlag)
|
||||
if ((dFlags[x][y] & BFLAG_LIT) == 0 && !plr[myplr]._pInfraFlag)
|
||||
return;
|
||||
|
||||
if (mi < 0 || mi >= MAXMONSTERS) {
|
||||
|
|
@ -806,7 +806,7 @@ static void scrollrt_draw_dungeon(const CelOutputBuffer &out, int sx, int sy, in
|
|||
assert((DWORD)(sy - 1) < MAXDUNY);
|
||||
DrawPlayerHelper(out, sx, sy - 1, dx, dy);
|
||||
}
|
||||
if (bFlag & BFLAG_MONSTLR && negMon < 0) {
|
||||
if ((bFlag & BFLAG_MONSTLR) != 0 && negMon < 0) {
|
||||
DrawMonsterHelper(out, sx, sy, -1, dx, dy);
|
||||
}
|
||||
if ((bFlag & BFLAG_DEAD_PLAYER) != 0) {
|
||||
|
|
@ -1056,9 +1056,9 @@ void CalcTileOffset(int *offsetX, int *offsetY)
|
|||
y = (gnViewportHeight / 2) % TILE_HEIGHT;
|
||||
}
|
||||
|
||||
if (x)
|
||||
if (x != 0)
|
||||
x = (TILE_WIDTH - x) / 2;
|
||||
if (y)
|
||||
if (y != 0)
|
||||
y = (TILE_HEIGHT - y) / 2;
|
||||
|
||||
*offsetX = x;
|
||||
|
|
@ -1424,7 +1424,7 @@ void ScrollView()
|
|||
*/
|
||||
void EnableFrameCount()
|
||||
{
|
||||
frameflag = frameflag == 0;
|
||||
frameflag = !frameflag;
|
||||
framestart = SDL_GetTicks();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ bool SNetUnregisterEventHandler(event_type, SEVTHANDLER);
|
|||
bool SNetRegisterEventHandler(event_type, SEVTHANDLER);
|
||||
bool SNetSetBasePlayer(int);
|
||||
bool SNetInitializeProvider(uint32_t provider, struct GameData *gameData);
|
||||
int SNetGetProviderCaps(struct _SNETCAPS *);
|
||||
void SNetGetProviderCaps(struct _SNETCAPS *);
|
||||
bool SFileEnableDirectAccess(bool enable);
|
||||
|
||||
#if defined(__GNUC__) || defined(__cplusplus)
|
||||
|
|
|
|||
|
|
@ -67,12 +67,12 @@ bool SNetSendTurn(char *data, unsigned int databytes)
|
|||
return dvlnet_inst->SNetSendTurn(data, databytes);
|
||||
}
|
||||
|
||||
int SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
void SNetGetProviderCaps(struct _SNETCAPS *caps)
|
||||
{
|
||||
#ifndef NONET
|
||||
std::lock_guard<SdlMutex> lg(storm_net_mutex);
|
||||
#endif
|
||||
return dvlnet_inst->SNetGetProviderCaps(caps);
|
||||
dvlnet_inst->SNetGetProviderCaps(caps);
|
||||
}
|
||||
|
||||
bool SNetUnregisterEventHandler(event_type evtype, SEVTHANDLER func)
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ bool CheckThemeObj3(int xp, int yp, int t, int f)
|
|||
return false;
|
||||
if (dTransVal[xp + trm3x[i]][yp + trm3y[i]] != themes[t].ttval)
|
||||
return false;
|
||||
if (dObject[xp + trm3x[i]][yp + trm3y[i]])
|
||||
if (dObject[xp + trm3x[i]][yp + trm3y[i]] != 0)
|
||||
return false;
|
||||
if (f != -1 && GenerateRnd(f) == 0)
|
||||
return false;
|
||||
|
|
@ -736,7 +736,7 @@ void Theme_Library(int t)
|
|||
for (xp = 1; xp < MAXDUNX - 1; xp++) {
|
||||
if (CheckThemeObj3(xp, yp, t, -1) && dMonster[xp][yp] == 0 && GenerateRnd(librnd[leveltype - 1]) == 0) {
|
||||
AddObject(OBJ_BOOKSTAND, xp, yp);
|
||||
if (GenerateRnd(2 * librnd[leveltype - 1]) != 0 && dObject[xp][yp]) { /// BUGFIX: check dObject[xp][yp] was populated by AddObject (fixed)
|
||||
if (GenerateRnd(2 * librnd[leveltype - 1]) != 0 && dObject[xp][yp] != 0) { /// BUGFIX: check dObject[xp][yp] was populated by AddObject (fixed)
|
||||
oi = dObject[xp][yp] - 1;
|
||||
object[oi]._oSelFlag = 0;
|
||||
object[oi]._oAnimFrame += 2;
|
||||
|
|
|
|||
|
|
@ -169,14 +169,14 @@ void T_Pass3()
|
|||
T_FillSector("Levels\\TownData\\Sector4s.DUN", 0, 0);
|
||||
|
||||
if (gbIsSpawn || !gbIsMultiplayer) {
|
||||
if (gbIsSpawn || (!(plr[myplr].pTownWarps & 1) && (!gbIsHellfire || plr[myplr]._pLevel < 10))) {
|
||||
if (gbIsSpawn || ((plr[myplr].pTownWarps & 1) == 0 && (!gbIsHellfire || plr[myplr]._pLevel < 10))) {
|
||||
T_FillTile(pMegaTiles.get(), 48, 20, 320);
|
||||
}
|
||||
if (gbIsSpawn || (!(plr[myplr].pTownWarps & 2) && (!gbIsHellfire || plr[myplr]._pLevel < 15))) {
|
||||
if (gbIsSpawn || ((plr[myplr].pTownWarps & 2) == 0 && (!gbIsHellfire || plr[myplr]._pLevel < 15))) {
|
||||
T_FillTile(pMegaTiles.get(), 16, 68, 332);
|
||||
T_FillTile(pMegaTiles.get(), 16, 70, 331);
|
||||
}
|
||||
if (gbIsSpawn || (!(plr[myplr].pTownWarps & 4) && (!gbIsHellfire || plr[myplr]._pLevel < 20))) {
|
||||
if (gbIsSpawn || ((plr[myplr].pTownWarps & 4) == 0 && (!gbIsHellfire || plr[myplr]._pLevel < 20))) {
|
||||
for (x = 36; x < 46; x++) {
|
||||
T_FillTile(pMegaTiles.get(), x, 78, GenerateRnd(4) + 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue