mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
SAGA2: Replace elementsof with ARRAYSIZE
This commit is contained in:
parent
44c4ad38e9
commit
37bd0e9c38
@ -1330,7 +1330,7 @@ void *Actor::archive(void *buf) {
|
|||||||
a->currentRecoveryPoints = currentRecoveryPoints;
|
a->currentRecoveryPoints = currentRecoveryPoints;
|
||||||
a->leaderID = leader != NULL ? leader->thisID() : Nothing;
|
a->leaderID = leader != NULL ? leader->thisID() : Nothing;
|
||||||
a->followersID = followers != NULL ? getBandID(followers) : NoBand;
|
a->followersID = followers != NULL ? getBandID(followers) : NoBand;
|
||||||
for (i = 0; i < elementsof(a->armorObjects); i++)
|
for (i = 0; i < ARRAYSIZE(a->armorObjects); i++)
|
||||||
a->armorObjects[i] = armorObjects[i];
|
a->armorObjects[i] = armorObjects[i];
|
||||||
a->currentTargetID = currentTarget != NULL ? currentTarget->thisID() : Nothing;
|
a->currentTargetID = currentTarget != NULL ? currentTarget->thisID() : Nothing;
|
||||||
for (i = 0; i < actorScriptVars; i++)
|
for (i = 0; i < actorScriptVars; i++)
|
||||||
@ -3076,7 +3076,7 @@ bool Actor::pathFindState(void) {
|
|||||||
// Add knowledge package to actor
|
// Add knowledge package to actor
|
||||||
|
|
||||||
bool Actor::addKnowledge(uint16 kID) {
|
bool Actor::addKnowledge(uint16 kID) {
|
||||||
for (int i = 0; i < elementsof(knowledge); i++) {
|
for (int i = 0; i < ARRAYSIZE(knowledge); i++) {
|
||||||
if (knowledge[i] == 0) {
|
if (knowledge[i] == 0) {
|
||||||
knowledge[i] = kID;
|
knowledge[i] = kID;
|
||||||
return true;
|
return true;
|
||||||
@ -3089,7 +3089,7 @@ bool Actor::addKnowledge(uint16 kID) {
|
|||||||
// Remove knowledge package from actor
|
// Remove knowledge package from actor
|
||||||
|
|
||||||
bool Actor::removeKnowledge(uint16 kID) {
|
bool Actor::removeKnowledge(uint16 kID) {
|
||||||
for (int i = 0; i < elementsof(knowledge); i++) {
|
for (int i = 0; i < ARRAYSIZE(knowledge); i++) {
|
||||||
if (knowledge[i] == kID) {
|
if (knowledge[i] == kID) {
|
||||||
knowledge[i] = 0;
|
knowledge[i] = 0;
|
||||||
return true;
|
return true;
|
||||||
@ -3102,7 +3102,7 @@ bool Actor::removeKnowledge(uint16 kID) {
|
|||||||
// Remove all knowledge package from actor
|
// Remove all knowledge package from actor
|
||||||
|
|
||||||
void Actor::clearKnowledge(void) {
|
void Actor::clearKnowledge(void) {
|
||||||
for (int i = 0; i < elementsof(knowledge); i++) {
|
for (int i = 0; i < ARRAYSIZE(knowledge); i++) {
|
||||||
knowledge[i] = 0;
|
knowledge[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3117,7 +3117,7 @@ void Actor::useKnowledge(scriptCallFrame &scf) {
|
|||||||
|
|
||||||
// First, search for the class with the best response
|
// First, search for the class with the best response
|
||||||
|
|
||||||
for (int i = 0; i < elementsof(knowledge); i++) {
|
for (int i = 0; i < ARRAYSIZE(knowledge); i++) {
|
||||||
if (knowledge[i]) {
|
if (knowledge[i]) {
|
||||||
scriptResult res;
|
scriptResult res;
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ int16 openAutoMap() {
|
|||||||
scrollBtn = new gCompButton(*pAutoMap, scrollBtnRect, scrollBtnImage, numBtnImages, 0, cmdAutoMapScroll);
|
scrollBtn = new gCompButton(*pAutoMap, scrollBtnRect, scrollBtnImage, numBtnImages, 0, cmdAutoMapScroll);
|
||||||
|
|
||||||
pAutoMap->setDecorations(autoMapDecorations,
|
pAutoMap->setDecorations(autoMapDecorations,
|
||||||
elementsof(autoMapDecorations),
|
ARRAYSIZE(autoMapDecorations),
|
||||||
decRes, 'M', 'A', 'P');
|
decRes, 'M', 'A', 'P');
|
||||||
|
|
||||||
// attach the structure to the book
|
// attach the structure to the book
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
BandList::BandList(void) {
|
BandList::BandList(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(array); i++)
|
for (i = 0; i < ARRAYSIZE(array); i++)
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ void *BandList::newBand(void) {
|
|||||||
// Place a specific Band into the active list and return its address
|
// Place a specific Band into the active list and return its address
|
||||||
|
|
||||||
void *BandList::newBand(BandID id) {
|
void *BandList::newBand(BandID id) {
|
||||||
assert(id >= 0 && id < elementsof(array));
|
assert(id >= 0 && id < ARRAYSIZE(array));
|
||||||
|
|
||||||
BandPlaceHolder *bp;
|
BandPlaceHolder *bp;
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ Band::Band(void **buf) {
|
|||||||
bufferPtr = (ObjectID *)bufferPtr + 1;
|
bufferPtr = (ObjectID *)bufferPtr + 1;
|
||||||
|
|
||||||
// Restore the member count
|
// Restore the member count
|
||||||
assert(*((int16 *)bufferPtr) < elementsof(members));
|
assert(*((int16 *)bufferPtr) < ARRAYSIZE(members));
|
||||||
memberCount = *((int16 *)bufferPtr);
|
memberCount = *((int16 *)bufferPtr);
|
||||||
bufferPtr = (int16 *)bufferPtr + 1;
|
bufferPtr = (int16 *)bufferPtr + 1;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool add(Actor *newMember) {
|
bool add(Actor *newMember) {
|
||||||
if (memberCount < elementsof(members)) {
|
if (memberCount < ARRAYSIZE(members)) {
|
||||||
members[memberCount++] = newMember;
|
members[memberCount++] = newMember;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
|
@ -1241,7 +1241,7 @@ TangibleContainerWindow::TangibleContainerWindow(
|
|||||||
if (deathFlag) {
|
if (deathFlag) {
|
||||||
// set the decorations for this window
|
// set the decorations for this window
|
||||||
setDecorations(deathDecorations,
|
setDecorations(deathDecorations,
|
||||||
elementsof(deathDecorations),
|
ARRAYSIZE(deathDecorations),
|
||||||
containerRes, 'F', 'R', 'M');
|
containerRes, 'F', 'R', 'M');
|
||||||
massWeightIndicator = NULL;
|
massWeightIndicator = NULL;
|
||||||
} else {
|
} else {
|
||||||
@ -1258,7 +1258,7 @@ TangibleContainerWindow::TangibleContainerWindow(
|
|||||||
|
|
||||||
// set the decorations for this window
|
// set the decorations for this window
|
||||||
setDecorations(winDecs[bgndType],
|
setDecorations(winDecs[bgndType],
|
||||||
elementsof(brassDecorations), // brass was arb, all should have same
|
ARRAYSIZE(brassDecorations), // brass was arb, all should have same
|
||||||
containerRes, 'F', 'R', 'M');
|
containerRes, 'F', 'R', 'M');
|
||||||
|
|
||||||
// set the userdata such that we can extract the container object later
|
// set the userdata such that we can extract the container object later
|
||||||
@ -1343,7 +1343,7 @@ IntangibleContainerWindow::IntangibleContainerWindow(
|
|||||||
|
|
||||||
// set the decorations for this window
|
// set the decorations for this window
|
||||||
setDecorations(mentalDecorations,
|
setDecorations(mentalDecorations,
|
||||||
elementsof(mentalDecorations),
|
ARRAYSIZE(mentalDecorations),
|
||||||
containerRes, 'F', 'R', 'M');
|
containerRes, 'F', 'R', 'M');
|
||||||
|
|
||||||
setMindContainer(nd.mindType, *this);
|
setMindContainer(nd.mindType, *this);
|
||||||
@ -1928,7 +1928,7 @@ void setMindContainer(int index, IntangibleContainerWindow &cw) {
|
|||||||
ObjectID id;
|
ObjectID id;
|
||||||
|
|
||||||
assert(index >= 0);
|
assert(index >= 0);
|
||||||
assert(index < elementsof(classTable));
|
assert(index < ARRAYSIZE(classTable));
|
||||||
|
|
||||||
int containerClass = classTable[index];
|
int containerClass = classTable[index];
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ void DisplayNode::drawObject(void) {
|
|||||||
buildColorTable(
|
buildColorTable(
|
||||||
mainColors,
|
mainColors,
|
||||||
bubbleColorTable,
|
bubbleColorTable,
|
||||||
elementsof(bubbleColorTable));
|
ARRAYSIZE(bubbleColorTable));
|
||||||
|
|
||||||
if (a->kludgeCount < 0 || ++a->kludgeCount >= bubbleSpriteCount)
|
if (a->kludgeCount < 0 || ++a->kludgeCount >= bubbleSpriteCount)
|
||||||
a->kludgeCount = 0;
|
a->kludgeCount = 0;
|
||||||
|
@ -74,7 +74,7 @@ CDocumentAppearance scrollAppearance(
|
|||||||
Rect16(0, 0, 0, 0), // (No page 2)
|
Rect16(0, 0, 0, 0), // (No page 2)
|
||||||
Rect16(184, 206, 44, 42), // Close button rect
|
Rect16(184, 206, 44, 42), // Close button rect
|
||||||
scrollDecorations,
|
scrollDecorations,
|
||||||
elementsof(scrollDecorations),
|
ARRAYSIZE(scrollDecorations),
|
||||||
MKTAG('S', 'C', 'R', 'L'),
|
MKTAG('S', 'C', 'R', 'L'),
|
||||||
MKTAG('S', 'R', 'L', 0)
|
MKTAG('S', 'R', 'L', 0)
|
||||||
);
|
);
|
||||||
@ -101,7 +101,7 @@ CDocumentAppearance bookAppearance(
|
|||||||
Rect16(218, 26, 135, 205), // Page 2
|
Rect16(218, 26, 135, 205), // Page 2
|
||||||
Rect16(231, 217, 34, 27), // Close button rect
|
Rect16(231, 217, 34, 27), // Close button rect
|
||||||
bookDecorations,
|
bookDecorations,
|
||||||
elementsof(bookDecorations),
|
ARRAYSIZE(bookDecorations),
|
||||||
MKTAG('B', 'O', 'O', 'K'),
|
MKTAG('B', 'O', 'O', 'K'),
|
||||||
MKTAG('B', 'K', 'D', 0)
|
MKTAG('B', 'K', 'D', 0)
|
||||||
);
|
);
|
||||||
@ -123,7 +123,7 @@ CDocumentAppearance parchAppearance(
|
|||||||
Rect16(0, 0, 0, 0), // (No page 2)
|
Rect16(0, 0, 0, 0), // (No page 2)
|
||||||
Rect16(164, 229, 20, 20), // Close button rect
|
Rect16(164, 229, 20, 20), // Close button rect
|
||||||
parchDecorations,
|
parchDecorations,
|
||||||
elementsof(parchDecorations),
|
ARRAYSIZE(parchDecorations),
|
||||||
MKTAG('P', 'A', 'R', 'C'),
|
MKTAG('P', 'A', 'R', 'C'),
|
||||||
MKTAG('P', 'C', 'H', 0)
|
MKTAG('P', 'C', 'H', 0)
|
||||||
);
|
);
|
||||||
|
@ -594,31 +594,31 @@ void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
|
|||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
asleepStr,
|
asleepStr,
|
||||||
elementsof(asleepStr) - 1,
|
ARRAYSIZE(asleepStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
} else if (a->enchantmentFlags & (1 << actorParalyzed)) {
|
} else if (a->enchantmentFlags & (1 << actorParalyzed)) {
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
paralysedStr,
|
paralysedStr,
|
||||||
elementsof(paralysedStr) - 1,
|
ARRAYSIZE(paralysedStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
} else if (a->enchantmentFlags & (1 << actorBlind)) {
|
} else if (a->enchantmentFlags & (1 << actorBlind)) {
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
blindStr,
|
blindStr,
|
||||||
elementsof(blindStr) - 1,
|
ARRAYSIZE(blindStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
} else if (a->enchantmentFlags & (1 << actorFear)) {
|
} else if (a->enchantmentFlags & (1 << actorFear)) {
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
afraidStr,
|
afraidStr,
|
||||||
elementsof(afraidStr) - 1,
|
ARRAYSIZE(afraidStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
} else if (pa->isAggressive()) {
|
} else if (pa->isAggressive()) {
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
angryStr,
|
angryStr,
|
||||||
elementsof(angryStr) - 1,
|
ARRAYSIZE(angryStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,24 +627,24 @@ void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
|
|||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
commaStr,
|
commaStr,
|
||||||
elementsof(commaStr) - 1,
|
ARRAYSIZE(commaStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
badlyWoundedStr,
|
badlyWoundedStr,
|
||||||
elementsof(badlyWoundedStr) - 1,
|
ARRAYSIZE(badlyWoundedStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
} else if (stats.vitality * 2 > a->effectiveStats.vitality * 3) {
|
} else if (stats.vitality * 2 > a->effectiveStats.vitality * 3) {
|
||||||
if (length != 0)
|
if (length != 0)
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
commaStr,
|
commaStr,
|
||||||
elementsof(commaStr) - 1,
|
ARRAYSIZE(commaStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
hurtStr,
|
hurtStr,
|
||||||
elementsof(hurtStr) - 1,
|
ARRAYSIZE(hurtStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,24 +653,24 @@ void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
|
|||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
commaStr,
|
commaStr,
|
||||||
elementsof(commaStr) - 1,
|
ARRAYSIZE(commaStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
poisonedStr,
|
poisonedStr,
|
||||||
elementsof(poisonedStr) - 1,
|
ARRAYSIZE(poisonedStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
} else if (a->enchantmentFlags & (1 << actorDiseased)) {
|
} else if (a->enchantmentFlags & (1 << actorDiseased)) {
|
||||||
if (length != 0)
|
if (length != 0)
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
commaStr,
|
commaStr,
|
||||||
elementsof(commaStr) - 1,
|
ARRAYSIZE(commaStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
diseasedStr,
|
diseasedStr,
|
||||||
elementsof(diseasedStr) - 1,
|
ARRAYSIZE(diseasedStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ void CPortrait::getStateString(char buf[], int8 size, uint16 brotherID) {
|
|||||||
length += appendToStr(
|
length += appendToStr(
|
||||||
&buf[length],
|
&buf[length],
|
||||||
normalStr,
|
normalStr,
|
||||||
elementsof(normalStr) - 1,
|
ARRAYSIZE(normalStr) - 1,
|
||||||
size - length - 1);
|
size - length - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,7 +705,7 @@ CStatusLine::CStatusLine(gPanelList &list,
|
|||||||
lineDisplayed = false;
|
lineDisplayed = false;
|
||||||
queueHead = queueTail = 0;
|
queueHead = queueTail = 0;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(lineQueue); i++)
|
for (i = 0; i < ARRAYSIZE(lineQueue); i++)
|
||||||
lineQueue[i].text = nullptr;
|
lineQueue[i].text = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ ActiveMission *ActiveMission::newMission(ObjectID genID, uint16 script) {
|
|||||||
int i;
|
int i;
|
||||||
ActiveMission *ms = NULL;
|
ActiveMission *ms = NULL;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(activeMissions); i++) {
|
for (i = 0; i < ARRAYSIZE(activeMissions); i++) {
|
||||||
if (!(activeMissions[i]._data.missionFlags & inUse)) {
|
if (!(activeMissions[i]._data.missionFlags & inUse)) {
|
||||||
ms = &activeMissions[i];
|
ms = &activeMissions[i];
|
||||||
break;
|
break;
|
||||||
@ -58,7 +58,7 @@ ActiveMission *ActiveMission::newMission(ObjectID genID, uint16 script) {
|
|||||||
|
|
||||||
ms->_data.numKnowledgeIDs = ms->_data.numObjectIDs = 0;
|
ms->_data.numKnowledgeIDs = ms->_data.numObjectIDs = 0;
|
||||||
|
|
||||||
memset(ms->_data.missionVars, 0, elementsof(ms->_data.missionVars));
|
memset(ms->_data.missionVars, 0, ARRAYSIZE(ms->_data.missionVars));
|
||||||
|
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ ActiveMission *ActiveMission::newMission(ObjectID genID, uint16 script) {
|
|||||||
int ActiveMission::findMission(ObjectID genID) {
|
int ActiveMission::findMission(ObjectID genID) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(activeMissions); i++) {
|
for (i = 0; i < ARRAYSIZE(activeMissions); i++) {
|
||||||
if (activeMissions[i]._data.missionFlags & inUse
|
if (activeMissions[i]._data.missionFlags & inUse
|
||||||
&& activeMissions[i]._data.generatorID == genID) {
|
&& activeMissions[i]._data.generatorID == genID) {
|
||||||
return i;
|
return i;
|
||||||
@ -81,7 +81,7 @@ int ActiveMission::findMission(ObjectID genID) {
|
|||||||
|
|
||||||
ActiveMission *ActiveMission::missionAddress(int index) {
|
ActiveMission *ActiveMission::missionAddress(int index) {
|
||||||
assert(index >= 0);
|
assert(index >= 0);
|
||||||
assert(index < elementsof(activeMissions));
|
assert(index < ARRAYSIZE(activeMissions));
|
||||||
|
|
||||||
return &activeMissions[index];
|
return &activeMissions[index];
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ ActiveMission *ActiveMission::missionAddress(int index) {
|
|||||||
// Add record of object creation to mission
|
// Add record of object creation to mission
|
||||||
|
|
||||||
bool ActiveMission::addObjectID(ObjectID objID) {
|
bool ActiveMission::addObjectID(ObjectID objID) {
|
||||||
if (_data.numObjectIDs < elementsof(_data.missionObjectList)) {
|
if (_data.numObjectIDs < ARRAYSIZE(_data.missionObjectList)) {
|
||||||
_data.missionObjectList[_data.numObjectIDs++] = objID;
|
_data.missionObjectList[_data.numObjectIDs++] = objID;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ bool ActiveMission::removeObjectID(ObjectID objID) {
|
|||||||
bool ActiveMission::addKnowledgeID(ObjectID actor, uint16 knowledgeID) {
|
bool ActiveMission::addKnowledgeID(ObjectID actor, uint16 knowledgeID) {
|
||||||
if (!isActor(actor)) return false;
|
if (!isActor(actor)) return false;
|
||||||
|
|
||||||
if (_data.numKnowledgeIDs < elementsof(_data.missionKnowledgeList)) {
|
if (_data.numKnowledgeIDs < ARRAYSIZE(_data.missionKnowledgeList)) {
|
||||||
Actor *a = (Actor *)GameObject::objectAddress(actor);
|
Actor *a = (Actor *)GameObject::objectAddress(actor);
|
||||||
|
|
||||||
if (!a->addKnowledge(knowledgeID)) return false;
|
if (!a->addKnowledge(knowledgeID)) return false;
|
||||||
@ -191,7 +191,7 @@ void ActiveMission::cleanup(void) {
|
|||||||
void initMissions(void) {
|
void initMissions(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(activeMissions); i++)
|
for (i = 0; i < ARRAYSIZE(activeMissions); i++)
|
||||||
activeMissions[i]._data.missionFlags &= ~inUse;
|
activeMissions[i]._data.missionFlags &= ~inUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
void cleanup(void);
|
void cleanup(void);
|
||||||
|
|
||||||
bool spaceForObject(void) {
|
bool spaceForObject(void) {
|
||||||
return _data.numObjectIDs < elementsof(_data.missionObjectList);
|
return _data.numObjectIDs < ARRAYSIZE(_data.missionObjectList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add record of object creation to mission
|
// Add record of object creation to mission
|
||||||
|
@ -361,7 +361,7 @@ static MotionTaskList &mTaskList = *((MotionTaskList *)mTaskListBuffer);
|
|||||||
// Initialize the MotionTaskList
|
// Initialize the MotionTaskList
|
||||||
|
|
||||||
MotionTaskList::MotionTaskList(void) {
|
MotionTaskList::MotionTaskList(void) {
|
||||||
for (int i = 0; i < elementsof(array); i++) {
|
for (int i = 0; i < ARRAYSIZE(array); i++) {
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ MotionTaskList::MotionTaskList(void **buf) {
|
|||||||
int16 i,
|
int16 i,
|
||||||
motionTaskCount;
|
motionTaskCount;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(array); i++) {
|
for (i = 0; i < ARRAYSIZE(array); i++) {
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3283,7 +3283,7 @@ const uint8 twoHandedSwingArray[] = {
|
|||||||
const CombatMotionSet twoHandedSwingSet =
|
const CombatMotionSet twoHandedSwingSet =
|
||||||
CombatMotionSet(
|
CombatMotionSet(
|
||||||
twoHandedSwingArray,
|
twoHandedSwingArray,
|
||||||
elementsof(twoHandedSwingArray));
|
ARRAYSIZE(twoHandedSwingArray));
|
||||||
|
|
||||||
// Construct a subset of all high two handed swing types
|
// Construct a subset of all high two handed swing types
|
||||||
const uint8 twoHandedHighSwingArray[] = {
|
const uint8 twoHandedHighSwingArray[] = {
|
||||||
@ -3295,7 +3295,7 @@ const uint8 twoHandedHighSwingArray[] = {
|
|||||||
const CombatMotionSet twoHandedHighSwingSet =
|
const CombatMotionSet twoHandedHighSwingSet =
|
||||||
CombatMotionSet(
|
CombatMotionSet(
|
||||||
twoHandedHighSwingArray,
|
twoHandedHighSwingArray,
|
||||||
elementsof(twoHandedHighSwingArray));
|
ARRAYSIZE(twoHandedHighSwingArray));
|
||||||
|
|
||||||
// Construct a subset of all low two handed swing types
|
// Construct a subset of all low two handed swing types
|
||||||
const uint8 twoHandedLowSwingArray[] = {
|
const uint8 twoHandedLowSwingArray[] = {
|
||||||
@ -3307,7 +3307,7 @@ const uint8 twoHandedLowSwingArray[] = {
|
|||||||
const CombatMotionSet twoHandedLowSwingSet =
|
const CombatMotionSet twoHandedLowSwingSet =
|
||||||
CombatMotionSet(
|
CombatMotionSet(
|
||||||
twoHandedLowSwingArray,
|
twoHandedLowSwingArray,
|
||||||
elementsof(twoHandedLowSwingArray));
|
ARRAYSIZE(twoHandedLowSwingArray));
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Handle all two handed swing motions
|
// Handle all two handed swing motions
|
||||||
@ -3402,7 +3402,7 @@ const uint8 oneHandedSwingArray[] = {
|
|||||||
const CombatMotionSet oneHandedSwingSet =
|
const CombatMotionSet oneHandedSwingSet =
|
||||||
CombatMotionSet(
|
CombatMotionSet(
|
||||||
oneHandedSwingArray,
|
oneHandedSwingArray,
|
||||||
elementsof(oneHandedSwingArray));
|
ARRAYSIZE(oneHandedSwingArray));
|
||||||
|
|
||||||
// Construct a subset of all high one handed swing types
|
// Construct a subset of all high one handed swing types
|
||||||
const uint8 oneHandedHighSwingArray[] = {
|
const uint8 oneHandedHighSwingArray[] = {
|
||||||
@ -3412,7 +3412,7 @@ const uint8 oneHandedHighSwingArray[] = {
|
|||||||
const CombatMotionSet oneHandedHighSwingSet =
|
const CombatMotionSet oneHandedHighSwingSet =
|
||||||
CombatMotionSet(
|
CombatMotionSet(
|
||||||
oneHandedHighSwingArray,
|
oneHandedHighSwingArray,
|
||||||
elementsof(oneHandedHighSwingArray));
|
ARRAYSIZE(oneHandedHighSwingArray));
|
||||||
|
|
||||||
// Construct a subset of all low one handed swing types
|
// Construct a subset of all low one handed swing types
|
||||||
const uint8 oneHandedLowSwingArray[] = {
|
const uint8 oneHandedLowSwingArray[] = {
|
||||||
@ -3422,7 +3422,7 @@ const uint8 oneHandedLowSwingArray[] = {
|
|||||||
const CombatMotionSet oneHandedLowSwingSet =
|
const CombatMotionSet oneHandedLowSwingSet =
|
||||||
CombatMotionSet(
|
CombatMotionSet(
|
||||||
oneHandedLowSwingArray,
|
oneHandedLowSwingArray,
|
||||||
elementsof(oneHandedLowSwingArray));
|
ARRAYSIZE(oneHandedLowSwingArray));
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Handle all one handed swing motions
|
// Handle all one handed swing motions
|
||||||
|
@ -1250,7 +1250,7 @@ void GameObject::deleteObject(void) {
|
|||||||
if (a->leftHandObject == id) a->leftHandObject = Nothing;
|
if (a->leftHandObject == id) a->leftHandObject = Nothing;
|
||||||
if (a->rightHandObject == id) a->rightHandObject = Nothing;
|
if (a->rightHandObject == id) a->rightHandObject = Nothing;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(a->armorObjects); i++)
|
for (i = 0; i < ARRAYSIZE(a->armorObjects); i++)
|
||||||
if (a->armorObjects[i] == id)
|
if (a->armorObjects[i] == id)
|
||||||
a->wear(Nothing, i);
|
a->wear(Nothing, i);
|
||||||
}
|
}
|
||||||
@ -3246,7 +3246,7 @@ static ActiveRegion activeRegionList[playerActors];
|
|||||||
void updateActiveRegions(void) {
|
void updateActiveRegions(void) {
|
||||||
int16 i;
|
int16 i;
|
||||||
|
|
||||||
for (i = 0; i < elementsof(activeRegionList); i++)
|
for (i = 0; i < ARRAYSIZE(activeRegionList); i++)
|
||||||
activeRegionList[i].update();
|
activeRegionList[i].update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3761,7 +3761,7 @@ bool ActiveRegionObjectIterator::nextActiveRegion(void) {
|
|||||||
TilePoint currentRegionSize;
|
TilePoint currentRegionSize;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (++activeRegionIndex >= elementsof(activeRegionList))
|
if (++activeRegionIndex >= ARRAYSIZE(activeRegionList))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int16 prevRegionIndex;
|
int16 prevRegionIndex;
|
||||||
@ -3941,7 +3941,7 @@ ObjectID ActiveRegionObjectIterator::first(GameObject **obj) {
|
|||||||
|
|
||||||
ObjectID ActiveRegionObjectIterator::next(GameObject **obj) {
|
ObjectID ActiveRegionObjectIterator::next(GameObject **obj) {
|
||||||
assert(activeRegionIndex >= 0);
|
assert(activeRegionIndex >= 0);
|
||||||
assert(activeRegionIndex < elementsof(activeRegionList));
|
assert(activeRegionIndex < ARRAYSIZE(activeRegionList));
|
||||||
|
|
||||||
ObjectID currentObjectID;
|
ObjectID currentObjectID;
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ bool ProtoObj::acceptInsertionAtAction(
|
|||||||
|
|
||||||
// Creates a color translation table for this object
|
// Creates a color translation table for this object
|
||||||
void ProtoObj::getColorTranslation(ColorTable map) {
|
void ProtoObj::getColorTranslation(ColorTable map) {
|
||||||
buildColorTable(map, colorMap, elementsof(colorMap));
|
buildColorTable(map, colorMap, ARRAYSIZE(colorMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 ProtoObj::containmentSet(void) {
|
uint16 ProtoObj::containmentSet(void) {
|
||||||
@ -1106,7 +1106,7 @@ bool InventoryProto::dropAction(
|
|||||||
|
|
||||||
static const int8 dirOffsetTable[] = { 0, 1, -1, 2, -2, 3, -3 };
|
static const int8 dirOffsetTable[] = { 0, 1, -1, 2, -2, 3, -3 };
|
||||||
|
|
||||||
for (i = 0; i < elementsof(dirOffsetTable); i++) {
|
for (i = 0; i < ARRAYSIZE(dirOffsetTable); i++) {
|
||||||
TilePoint testPt;
|
TilePoint testPt;
|
||||||
Direction testDir;
|
Direction testDir;
|
||||||
|
|
||||||
@ -2852,7 +2852,7 @@ ContainerWindow *EnchantmentProto::makeWindow( GameObject *Obj )
|
|||||||
|
|
||||||
// set the decorations for this window
|
// set the decorations for this window
|
||||||
window->setDecorations( enchantDecorations,
|
window->setDecorations( enchantDecorations,
|
||||||
elementsof( enchantDecorations ),
|
ARRAYSIZE( enchantDecorations ),
|
||||||
decRes, 'E', 'F', 'R' );
|
decRes, 'E', 'F', 'R' );
|
||||||
|
|
||||||
|
|
||||||
|
@ -867,13 +867,13 @@ DirMaskGroup *MaskComputer::computeMask(uint8 crossSection) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arraySize < elementsof(array)) {
|
if (arraySize < ARRAYSIZE(array)) {
|
||||||
// Allocate a new place for this mask group
|
// Allocate a new place for this mask group
|
||||||
maskGroup = ptrArray[arraySize] = &array[arraySize];
|
maskGroup = ptrArray[arraySize] = &array[arraySize];
|
||||||
arraySize++;
|
arraySize++;
|
||||||
} else
|
} else
|
||||||
// Discard last referenced mask group in array
|
// Discard last referenced mask group in array
|
||||||
maskGroup = ptrArray[elementsof(array) - 1];
|
maskGroup = ptrArray[ARRAYSIZE(array) - 1];
|
||||||
|
|
||||||
// Compute the new group of masks
|
// Compute the new group of masks
|
||||||
maskGroup->computeMask(crossSection);
|
maskGroup->computeMask(crossSection);
|
||||||
@ -1525,12 +1525,12 @@ void PathRequest::initialize(void) {
|
|||||||
*tablePtrPtr = node;
|
*tablePtrPtr = node;
|
||||||
|
|
||||||
if (nextAvailableLookupNode
|
if (nextAvailableLookupNode
|
||||||
>= elementsof(volumeLookupNodePool))
|
>= ARRAYSIZE(volumeLookupNodePool))
|
||||||
goto big_break;
|
goto big_break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++objectVolumes >= elementsof(objectVolumeArray)) break;
|
if (++objectVolumes >= ARRAYSIZE(objectVolumeArray)) break;
|
||||||
}
|
}
|
||||||
big_break:
|
big_break:
|
||||||
|
|
||||||
@ -1607,7 +1607,7 @@ void PathRequest::finish(void) {
|
|||||||
assert(cell != nullptr);
|
assert(cell != nullptr);
|
||||||
|
|
||||||
if (cell->direction != dirInvalid) {
|
if (cell->direction != dirInvalid) {
|
||||||
res = &tempResult[elementsof(tempResult)];
|
res = &tempResult[ARRAYSIZE(tempResult)];
|
||||||
|
|
||||||
prevDir = dirInvalid;
|
prevDir = dirInvalid;
|
||||||
|
|
||||||
@ -1648,8 +1648,8 @@ void PathRequest::finish(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resultSteps) {
|
if (resultSteps) {
|
||||||
while (stepCount < elementsof(path)
|
while (stepCount < ARRAYSIZE(path)
|
||||||
&& res < &tempResult[elementsof(tempResult)]) {
|
&& res < &tempResult[ARRAYSIZE(tempResult)]) {
|
||||||
*resultSteps++ = *res++;
|
*resultSteps++ = *res++;
|
||||||
stepCount++;
|
stepCount++;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ void PlayerActor::handleAttacked(void) {
|
|||||||
// Return a pointer to a PlayerActor given it's ID
|
// Return a pointer to a PlayerActor given it's ID
|
||||||
|
|
||||||
PlayerActor *getPlayerActorAddress(PlayerActorID id) {
|
PlayerActor *getPlayerActorAddress(PlayerActorID id) {
|
||||||
assert(id >= 0 && id < elementsof(playerList));
|
assert(id >= 0 && id < ARRAYSIZE(playerList));
|
||||||
|
|
||||||
return &playerList[id];
|
return &playerList[id];
|
||||||
}
|
}
|
||||||
|
@ -2342,7 +2342,7 @@ C_Call *actorCFuncList[] = {
|
|||||||
scriptActorImNotQuiteDead,
|
scriptActorImNotQuiteDead,
|
||||||
};
|
};
|
||||||
|
|
||||||
CallTable actorCFuncs = { actorCFuncList, elementsof(actorCFuncList), 0 };
|
CallTable actorCFuncs = { actorCFuncList, ARRAYSIZE(actorCFuncList), 0 };
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Return the id of this TAI
|
// Return the id of this TAI
|
||||||
@ -2615,7 +2615,7 @@ C_Call *tagCFuncList[] = {
|
|||||||
scriptTagReleaseLock,
|
scriptTagReleaseLock,
|
||||||
};
|
};
|
||||||
|
|
||||||
CallTable tagCFuncs = { tagCFuncList, elementsof(tagCFuncList), 0 };
|
CallTable tagCFuncs = { tagCFuncList, ARRAYSIZE(tagCFuncList), 0 };
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Find a mission by generator id
|
// Find a mission by generator id
|
||||||
@ -2696,7 +2696,7 @@ C_Call *missionCFuncList[] = {
|
|||||||
scriptMissionMakeActor,
|
scriptMissionMakeActor,
|
||||||
};
|
};
|
||||||
|
|
||||||
CallTable missionCFuncs = { missionCFuncList, elementsof(missionCFuncList), 0 };
|
CallTable missionCFuncs = { missionCFuncList, ARRAYSIZE(missionCFuncList), 0 };
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Global functions
|
// Global functions
|
||||||
@ -4014,6 +4014,6 @@ C_Call *globalCFuncList[] = {
|
|||||||
scriptBigMul,
|
scriptBigMul,
|
||||||
};
|
};
|
||||||
|
|
||||||
CallTable globalCFuncs = { globalCFuncList, elementsof(globalCFuncList), 0 };
|
CallTable globalCFuncs = { globalCFuncList, ARRAYSIZE(globalCFuncList), 0 };
|
||||||
|
|
||||||
} // end of namespace Saga2
|
} // end of namespace Saga2
|
||||||
|
@ -482,7 +482,7 @@ bool ProtaganistSensor::check(SenseInfo &info, uint32 senseFlags) {
|
|||||||
int16 i;
|
int16 i;
|
||||||
bool objIsActor = isActor(getObject());
|
bool objIsActor = isActor(getObject());
|
||||||
|
|
||||||
for (i = 0; i < (long)elementsof(playerActorIDs); i++) {
|
for (i = 0; i < (long)ARRAYSIZE(playerActorIDs); i++) {
|
||||||
Actor *protag =
|
Actor *protag =
|
||||||
getPlayerActorAddress(playerActorIDs[i])->getActor();
|
getPlayerActorAddress(playerActorIDs[i])->getActor();
|
||||||
|
|
||||||
|
@ -680,18 +680,18 @@ void abortAllSpeeches(void) {
|
|||||||
void sentenceGenerator(char *sentence) {
|
void sentenceGenerator(char *sentence) {
|
||||||
int16 index;
|
int16 index;
|
||||||
|
|
||||||
index = rand() % elementsof(names);
|
index = rand() % ARRAYSIZE(names);
|
||||||
strcat(sentence, names[index]);
|
strcat(sentence, names[index]);
|
||||||
index = rand() % elementsof(verbs);
|
index = rand() % ARRAYSIZE(verbs);
|
||||||
strcat(sentence, verbs[index]);
|
strcat(sentence, verbs[index]);
|
||||||
index = rand() % elementsof(adjectives);
|
index = rand() % ARRAYSIZE(adjectives);
|
||||||
strcat(sentence, adjectives[index]);
|
strcat(sentence, adjectives[index]);
|
||||||
index = rand() % elementsof(nouns);
|
index = rand() % ARRAYSIZE(nouns);
|
||||||
strcat(sentence, nouns[index]);
|
strcat(sentence, nouns[index]);
|
||||||
|
|
||||||
// for(int i=0; i<elementsof(sentenceParts); i++)
|
// for(int i=0; i<ARRAYSIZE(sentenceParts); i++)
|
||||||
// {
|
// {
|
||||||
// strcat(sentence,sentenceParts[i].index = rand() % elementsof(sentenceParts[i]);
|
// strcat(sentence,sentenceParts[i].index = rand() % ARRAYSIZE(sentenceParts[i]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1015,7 +1015,7 @@ bool isVisible(GameObject *obj) {
|
|||||||
SpeechTaskList::SpeechTaskList(void) {
|
SpeechTaskList::SpeechTaskList(void) {
|
||||||
lockFlag = false;
|
lockFlag = false;
|
||||||
|
|
||||||
for (int i = 0; i < (long)elementsof(array); i++) {
|
for (int i = 0; i < (long)ARRAYSIZE(array); i++) {
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1032,7 +1032,7 @@ SpeechTaskList::SpeechTaskList(void **buf) {
|
|||||||
lockFlag = false;
|
lockFlag = false;
|
||||||
|
|
||||||
// Initialize the free list
|
// Initialize the free list
|
||||||
for (i = 0; i < (long)elementsof(array); i++) {
|
for (i = 0; i < (long)ARRAYSIZE(array); i++) {
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ void ActorAppearance::loadSpriteBanks(int16 banksNeeded) {
|
|||||||
appearanceLRU.push_back(this);
|
appearanceLRU.push_back(this);
|
||||||
|
|
||||||
// Load in additional sprite banks if requested...
|
// Load in additional sprite banks if requested...
|
||||||
for (bank = 0; bank < (long)elementsof(spriteBanks); bank++) {
|
for (bank = 0; bank < (long)ARRAYSIZE(spriteBanks); bank++) {
|
||||||
// Load the sprite handle...
|
// Load the sprite handle...
|
||||||
if (spriteBanks[bank] == nullptr && (banksNeeded & (1 << bank))) {
|
if (spriteBanks[bank] == nullptr && (banksNeeded & (1 << bank))) {
|
||||||
Common::SeekableReadStream *stream = loadResourceToStream(spriteRes, id + MKTAG(0, 0, 0, bank), "sprite bank");
|
Common::SeekableReadStream *stream = loadResourceToStream(spriteRes, id + MKTAG(0, 0, 0, bank), "sprite bank");
|
||||||
@ -666,7 +666,7 @@ ActorAppearance *LoadActorAppearance(uint32 id, int16 banksNeeded) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dump the sprites being stored
|
// Dump the sprites being stored
|
||||||
for (bank = 0; bank < (long)elementsof(aa->spriteBanks); bank++) {
|
for (bank = 0; bank < (long)ARRAYSIZE(aa->spriteBanks); bank++) {
|
||||||
if (aa->spriteBanks[bank])
|
if (aa->spriteBanks[bank])
|
||||||
delete aa->spriteBanks[bank];
|
delete aa->spriteBanks[bank];
|
||||||
aa->spriteBanks[bank] = nullptr;
|
aa->spriteBanks[bank] = nullptr;
|
||||||
@ -845,7 +845,7 @@ void initSprites(void) {
|
|||||||
initQuickMem(0x10000);
|
initQuickMem(0x10000);
|
||||||
|
|
||||||
// Initialize actor appearance table
|
// Initialize actor appearance table
|
||||||
for (i = 0; i < elementsof(appearanceTable); i++) {
|
for (i = 0; i < ARRAYSIZE(appearanceTable); i++) {
|
||||||
ActorAppearance *aa = &appearanceTable[i];
|
ActorAppearance *aa = &appearanceTable[i];
|
||||||
|
|
||||||
aa->useCount = 0;
|
aa->useCount = 0;
|
||||||
|
@ -38,13 +38,8 @@ typedef uint32 ChunkID;
|
|||||||
|
|
||||||
#define FTA
|
#define FTA
|
||||||
|
|
||||||
// #define LEAVE goto exitit // bail out of function
|
|
||||||
#define unless(x) if((x)==NULL) // an inverted if statement
|
#define unless(x) if((x)==NULL) // an inverted if statement
|
||||||
|
|
||||||
#ifndef elementsof
|
|
||||||
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
#define offsetof(type,field) (uint32)&(((type *)0)->field)
|
#define offsetof(type,field) (uint32)&(((type *)0)->field)
|
||||||
#endif
|
#endif
|
||||||
|
@ -2170,11 +2170,11 @@ TilePoint GoAwayFromActorTask::getRepulsionVector(void) {
|
|||||||
repulsionVector;
|
repulsionVector;
|
||||||
int16 i;
|
int16 i;
|
||||||
TilePoint locArray[6];
|
TilePoint locArray[6];
|
||||||
int16 strengthArray[elementsof(locArray)] =
|
int16 strengthArray[ARRAYSIZE(locArray)] =
|
||||||
{ 1, 1, 1, 1, 1, 1 };
|
{ 1, 1, 1, 1, 1, 1 };
|
||||||
int16 distArray[elementsof(locArray)];
|
int16 distArray[ARRAYSIZE(locArray)];
|
||||||
TargetLocationArray tla(
|
TargetLocationArray tla(
|
||||||
elementsof(locArray),
|
ARRAYSIZE(locArray),
|
||||||
locArray,
|
locArray,
|
||||||
distArray);
|
distArray);
|
||||||
|
|
||||||
@ -2728,9 +2728,9 @@ void HuntToBeNearObjectTask::evaluateTarget(void) {
|
|||||||
Actor *a = stack->getActor();
|
Actor *a = stack->getActor();
|
||||||
int16 i;
|
int16 i;
|
||||||
GameObject *objArray[16];
|
GameObject *objArray[16];
|
||||||
int16 distArray[elementsof(objArray)];
|
int16 distArray[ARRAYSIZE(objArray)];
|
||||||
TargetObjectArray toa(
|
TargetObjectArray toa(
|
||||||
elementsof(objArray),
|
ARRAYSIZE(objArray),
|
||||||
objArray,
|
objArray,
|
||||||
distArray);
|
distArray);
|
||||||
SenseInfo info;
|
SenseInfo info;
|
||||||
@ -2867,9 +2867,9 @@ void HuntToPossessTask::evaluateTarget(void) {
|
|||||||
Actor *a = stack->getActor();
|
Actor *a = stack->getActor();
|
||||||
int16 i;
|
int16 i;
|
||||||
GameObject *objArray[16];
|
GameObject *objArray[16];
|
||||||
int16 distArray[elementsof(objArray)];
|
int16 distArray[ARRAYSIZE(objArray)];
|
||||||
TargetObjectArray toa(
|
TargetObjectArray toa(
|
||||||
elementsof(objArray),
|
ARRAYSIZE(objArray),
|
||||||
objArray,
|
objArray,
|
||||||
distArray);
|
distArray);
|
||||||
SenseInfo info;
|
SenseInfo info;
|
||||||
@ -3166,9 +3166,9 @@ void HuntToBeNearActorTask::evaluateTarget(void) {
|
|||||||
Actor *a = stack->getActor();
|
Actor *a = stack->getActor();
|
||||||
int16 i;
|
int16 i;
|
||||||
Actor *actorArray[16];
|
Actor *actorArray[16];
|
||||||
int16 distArray[elementsof(actorArray)];
|
int16 distArray[ARRAYSIZE(actorArray)];
|
||||||
TargetActorArray taa(
|
TargetActorArray taa(
|
||||||
elementsof(actorArray),
|
ARRAYSIZE(actorArray),
|
||||||
actorArray,
|
actorArray,
|
||||||
distArray);
|
distArray);
|
||||||
SenseInfo info;
|
SenseInfo info;
|
||||||
@ -3411,9 +3411,9 @@ void HuntToKillTask::evaluateTarget(void) {
|
|||||||
ActorProto *proto = (ActorProto *)a->proto();
|
ActorProto *proto = (ActorProto *)a->proto();
|
||||||
int16 i;
|
int16 i;
|
||||||
Actor *actorArray[16];
|
Actor *actorArray[16];
|
||||||
int16 distArray[elementsof(actorArray)];
|
int16 distArray[ARRAYSIZE(actorArray)];
|
||||||
TargetActorArray taa(
|
TargetActorArray taa(
|
||||||
elementsof(actorArray),
|
ARRAYSIZE(actorArray),
|
||||||
actorArray,
|
actorArray,
|
||||||
distArray);
|
distArray);
|
||||||
SenseInfo info;
|
SenseInfo info;
|
||||||
@ -3921,8 +3921,8 @@ void BandTask::evaluateTarget(void) {
|
|||||||
TilePoint repulsorVector;
|
TilePoint repulsorVector;
|
||||||
int16 repulsorStrength;
|
int16 repulsorStrength;
|
||||||
TilePoint repulsorVectorArray[6];
|
TilePoint repulsorVectorArray[6];
|
||||||
int16 repulsorStrengthArray[elementsof(repulsorVectorArray)];
|
int16 repulsorStrengthArray[ARRAYSIZE(repulsorVectorArray)];
|
||||||
int16 repulsorDistArray[elementsof(repulsorVectorArray)];
|
int16 repulsorDistArray[ARRAYSIZE(repulsorVectorArray)];
|
||||||
int16 repulsorCount;
|
int16 repulsorCount;
|
||||||
bool repulsorFlag;
|
bool repulsorFlag;
|
||||||
|
|
||||||
@ -3950,7 +3950,7 @@ void BandTask::evaluateTarget(void) {
|
|||||||
int16 j = repulsorCount;
|
int16 j = repulsorCount;
|
||||||
|
|
||||||
if (repulsorDist < repulsorDistArray[j - 1]) {
|
if (repulsorDist < repulsorDistArray[j - 1]) {
|
||||||
if (repulsorCount < (long)elementsof(repulsorVectorArray)) {
|
if (repulsorCount < (long)ARRAYSIZE(repulsorVectorArray)) {
|
||||||
repulsorDistArray[j] = repulsorDistArray[j - 1];
|
repulsorDistArray[j] = repulsorDistArray[j - 1];
|
||||||
repulsorVectorArray[j] = repulsorVectorArray[j - 1];
|
repulsorVectorArray[j] = repulsorVectorArray[j - 1];
|
||||||
repulsorStrengthArray[j] = repulsorStrengthArray[j - 1];
|
repulsorStrengthArray[j] = repulsorStrengthArray[j - 1];
|
||||||
@ -3965,8 +3965,8 @@ void BandTask::evaluateTarget(void) {
|
|||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j < (long)elementsof(repulsorVectorArray)) {
|
if (j < (long)ARRAYSIZE(repulsorVectorArray)) {
|
||||||
if (repulsorCount < (long)elementsof(repulsorVectorArray))
|
if (repulsorCount < (long)ARRAYSIZE(repulsorVectorArray))
|
||||||
repulsorCount++;
|
repulsorCount++;
|
||||||
repulsorDistArray[j] = repulsorDist;
|
repulsorDistArray[j] = repulsorDist;
|
||||||
repulsorVectorArray[j] = repulsorVector;
|
repulsorVectorArray[j] = repulsorVector;
|
||||||
@ -4099,8 +4099,8 @@ bool BandTask::BandAndAvoidEnemiesRepulsorIterator::firstEnemyRepulsor(
|
|||||||
int16 &repulsorStrength) {
|
int16 &repulsorStrength) {
|
||||||
assert(iteratingThruEnemies);
|
assert(iteratingThruEnemies);
|
||||||
|
|
||||||
int16 actorDistArray[elementsof(actorArray)];
|
int16 actorDistArray[ARRAYSIZE(actorArray)];
|
||||||
TargetActorArray taa(elementsof(actorArray), actorArray, actorDistArray);
|
TargetActorArray taa(ARRAYSIZE(actorArray), actorArray, actorDistArray);
|
||||||
ActorPropertyTarget target(actorPropIDEnemy);
|
ActorPropertyTarget target(actorPropIDEnemy);
|
||||||
|
|
||||||
numActors = target.actor(a->world(), a->getLocation(), taa);
|
numActors = target.actor(a->world(), a->getLocation(), taa);
|
||||||
|
@ -984,7 +984,7 @@ static TileActivityTaskList &aTaskList =
|
|||||||
// Constructor
|
// Constructor
|
||||||
|
|
||||||
TileActivityTaskList::TileActivityTaskList(void) {
|
TileActivityTaskList::TileActivityTaskList(void) {
|
||||||
for (uint i = 0; i < elementsof(array); i++) {
|
for (uint i = 0; i < ARRAYSIZE(array); i++) {
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -997,7 +997,7 @@ TileActivityTaskList::TileActivityTaskList(void **buf) {
|
|||||||
|
|
||||||
int16 taskCount;
|
int16 taskCount;
|
||||||
|
|
||||||
for (uint i = 0; i < elementsof(array); i++) {
|
for (uint i = 0; i < ARRAYSIZE(array); i++) {
|
||||||
free.addTail(array[i]);
|
free.addTail(array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2481,7 +2481,7 @@ void WorldMapData::buildInstanceHash(void) {
|
|||||||
if (ai->_data.itemType == activeTypeInstance) {
|
if (ai->_data.itemType == activeTypeInstance) {
|
||||||
hashVal = (((ai->_data.instance.u + ai->_data.instance.h) << 4)
|
hashVal = (((ai->_data.instance.u + ai->_data.instance.h) << 4)
|
||||||
+ ai->_data.instance.v + (ai->_data.instance.groupID << 2))
|
+ ai->_data.instance.v + (ai->_data.instance.groupID << 2))
|
||||||
% elementsof(instHash);
|
% ARRAYSIZE(instHash);
|
||||||
|
|
||||||
itemHash.setVal(hashVal, ai);
|
itemHash.setVal(hashVal, ai);
|
||||||
}
|
}
|
||||||
@ -2496,7 +2496,7 @@ ActiveItem *WorldMapData::findHashedInstance(
|
|||||||
TilePoint &tp,
|
TilePoint &tp,
|
||||||
int16 group) {
|
int16 group) {
|
||||||
int16 hashVal = (((tp.u + tp.z) << 4) + tp.v + (group << 2))
|
int16 hashVal = (((tp.u + tp.z) << 4) + tp.v + (group << 2))
|
||||||
% elementsof(instHash);
|
% ARRAYSIZE(instHash);
|
||||||
|
|
||||||
if (itemHash.contains(hashVal))
|
if (itemHash.contains(hashVal))
|
||||||
return itemHash.getVal(hashVal);
|
return itemHash.getVal(hashVal);
|
||||||
@ -2865,7 +2865,7 @@ void buildRipTables(void) {
|
|||||||
int16 tableIndex;
|
int16 tableIndex;
|
||||||
|
|
||||||
// bit array of available rip tables
|
// bit array of available rip tables
|
||||||
uint8 tableAvail[(elementsof(ripTableList) + 7) >> 3];
|
uint8 tableAvail[(ARRAYSIZE(ripTableList) + 7) >> 3];
|
||||||
|
|
||||||
memset(tableAvail, 0xFF, sizeof(tableAvail));
|
memset(tableAvail, 0xFF, sizeof(tableAvail));
|
||||||
|
|
||||||
@ -2899,7 +2899,7 @@ void buildRipTables(void) {
|
|||||||
|
|
||||||
uint j;
|
uint j;
|
||||||
// Find available table
|
// Find available table
|
||||||
for (j = 0; j < elementsof(ripTableList); j++) {
|
for (j = 0; j < ARRAYSIZE(ripTableList); j++) {
|
||||||
if (tableAvail[j >> 3] & (1 << (j & 0x7)))
|
if (tableAvail[j >> 3] & (1 << (j & 0x7)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ void loadTileModeState(SaveFileReader &saveGame) {
|
|||||||
|
|
||||||
void TileModeSetup(void) {
|
void TileModeSetup(void) {
|
||||||
// Load in decorative panels for the main window (for this mode)
|
// Load in decorative panels for the main window (for this mode)
|
||||||
mainWindow->setDecorations(mainWindowDecorations, elementsof(mainWindowDecorations), imageRes);
|
mainWindow->setDecorations(mainWindowDecorations, ARRAYSIZE(mainWindowDecorations), imageRes);
|
||||||
|
|
||||||
// Test to draw borders.
|
// Test to draw borders.
|
||||||
// REM: We should actually have a routine to refresh the window...
|
// REM: We should actually have a routine to refresh the window...
|
||||||
|
@ -737,7 +737,7 @@ int16 FileDialog(int16 fileProcess) {
|
|||||||
|
|
||||||
|
|
||||||
win->setDecorations(saveWindowDecorations,
|
win->setDecorations(saveWindowDecorations,
|
||||||
elementsof(saveWindowDecorations),
|
ARRAYSIZE(saveWindowDecorations),
|
||||||
decRes, 'S', 'L', 'D');
|
decRes, 'S', 'L', 'D');
|
||||||
|
|
||||||
win->userData = &rInfo;
|
win->userData = &rInfo;
|
||||||
@ -922,7 +922,7 @@ int16 OptionsDialog(bool disableSaveResume) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
win->setDecorations(optionsDecorations,
|
win->setDecorations(optionsDecorations,
|
||||||
elementsof(optionsDecorations),
|
ARRAYSIZE(optionsDecorations),
|
||||||
decRes, 'O', 'P', 'T');
|
decRes, 'O', 'P', 'T');
|
||||||
|
|
||||||
|
|
||||||
@ -1035,7 +1035,7 @@ bool initUserDialog(void) {
|
|||||||
udWin = new ModalWindow(messageWindowRect, 0 nullptr);
|
udWin = new ModalWindow(messageWindowRect, 0 nullptr);
|
||||||
|
|
||||||
udWin->setDecorations(messageDecorations,
|
udWin->setDecorations(messageDecorations,
|
||||||
elementsof(messageDecorations),
|
ARRAYSIZE(messageDecorations),
|
||||||
udDecRes, 'M', 'E', 'S');
|
udDecRes, 'M', 'E', 'S');
|
||||||
|
|
||||||
udWin->userData = &udrInfo;
|
udWin->userData = &udrInfo;
|
||||||
@ -1237,7 +1237,7 @@ int16 userDialog(const char *title, const char *msg, const char *bMsg1,
|
|||||||
new CPlacardPanel(*win, messageTextRects[1], msg, &Onyx10Font, 0, pal, 0, nullptr);
|
new CPlacardPanel(*win, messageTextRects[1], msg, &Onyx10Font, 0, pal, 0, nullptr);
|
||||||
|
|
||||||
win->setDecorations(messageDecorations,
|
win->setDecorations(messageDecorations,
|
||||||
elementsof(messageDecorations),
|
ARRAYSIZE(messageDecorations),
|
||||||
decRes, 'M', 'E', 'S');
|
decRes, 'M', 'E', 'S');
|
||||||
|
|
||||||
|
|
||||||
@ -1539,7 +1539,7 @@ void placardWindow(int8 type, char *text) {
|
|||||||
|
|
||||||
// setup the background imagery
|
// setup the background imagery
|
||||||
win->setDecorations(plaqDecWood,
|
win->setDecorations(plaqDecWood,
|
||||||
elementsof(plaqDecWood),
|
ARRAYSIZE(plaqDecWood),
|
||||||
resContext, 'P', 'L', 'Q');
|
resContext, 'P', 'L', 'Q');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1554,7 +1554,7 @@ void placardWindow(int8 type, char *text) {
|
|||||||
|
|
||||||
// setup the background imagery
|
// setup the background imagery
|
||||||
win->setDecorations(plaqDecStone,
|
win->setDecorations(plaqDecStone,
|
||||||
elementsof(plaqDecStone),
|
ARRAYSIZE(plaqDecStone),
|
||||||
resContext, 'P', 'L', 'Q');
|
resContext, 'P', 'L', 'Q');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1569,7 +1569,7 @@ void placardWindow(int8 type, char *text) {
|
|||||||
|
|
||||||
// setup the background imagery
|
// setup the background imagery
|
||||||
win->setDecorations(plaqDecBrass,
|
win->setDecorations(plaqDecBrass,
|
||||||
elementsof(plaqDecBrass),
|
ARRAYSIZE(plaqDecBrass),
|
||||||
resContext, 'P', 'L', 'Q');
|
resContext, 'P', 'L', 'Q');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -137,7 +137,7 @@ void CVideoBox::init(void) {
|
|||||||
|
|
||||||
// get the decorations for this window
|
// get the decorations for this window
|
||||||
setDecorations(vidDec,
|
setDecorations(vidDec,
|
||||||
elementsof(vidDec),
|
ARRAYSIZE(vidDec),
|
||||||
decRes,
|
decRes,
|
||||||
'V', 'B', 'D');
|
'V', 'B', 'D');
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ void createPalette(
|
|||||||
int i;
|
int i;
|
||||||
uint32 fadeProgress = (elapsedTime << 8) / totalTime_;
|
uint32 fadeProgress = (elapsedTime << 8) / totalTime_;
|
||||||
|
|
||||||
for (i = 0; i < (long)elementsof(newP->entry); i++) {
|
for (i = 0; i < (long)ARRAYSIZE(newP->entry); i++) {
|
||||||
gPaletteEntry *srcPal = &srcP->entry[i];
|
gPaletteEntry *srcPal = &srcP->entry[i];
|
||||||
gPaletteEntry *dstPal = &dstP->entry[i];
|
gPaletteEntry *dstPal = &dstP->entry[i];
|
||||||
gPaletteEntry *curPal = &newP->entry[i];
|
gPaletteEntry *curPal = &newP->entry[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user