本文整理汇总了C++中Hotspot::hotspotId方法的典型用法代码示例。如果您正苦于以下问题:C++ Hotspot::hotspotId方法的具体用法?C++ Hotspot::hotspotId怎么用?C++ Hotspot::hotspotId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hotspot
的用法示例。
在下文中一共展示了Hotspot::hotspotId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deactivateHotspot
void Resources::deactivateHotspot(uint16 hotspotId, bool isDestId) {
HotspotList::iterator i = _activeHotspots.begin();
while (i != _activeHotspots.end()) {
Hotspot *h = (*i).get();
if ((!isDestId && (h->hotspotId() == hotspotId)) ||
(isDestId && (h->destHotspotId() == hotspotId) && (h->hotspotId() == 0xffff))) {
_activeHotspots.erase(i);
break;
}
i++;
}
}
示例2:
Hotspot *Resources::getActiveHotspot(uint16 hotspotId) {
HotspotList::iterator i;
for (i = _activeHotspots.begin(); i != _activeHotspots.end(); ++i) {
Hotspot *rec = (*i).get();
if (rec->hotspotId() == hotspotId) return rec;
}
return NULL;
}
示例3: fighterAnimHandler
void FightsManager::fighterAnimHandler(Hotspot &h) {
FighterRecord &fighter = getDetails(h.hotspotId());
FighterRecord &opponent = getDetails(fighter.fwenemy_ad);
FighterRecord &player = getDetails(PLAYER_ID);
fetchFighterDistance(fighter, opponent);
if (fighter.fwseq_ad) {
fightHandler(h, fighter.fwseq_ad);
return;
}
uint16 seqNum = 0;
if (fighter.fwdist != FIGHT_DISTANCE) {
seqNum = getFighterMove(fighter, fighter.fwnot_near);
} else {
uint16 offset = (fighter.fwhits * fighter.fwdef_len) + fighter.fwdefend_adds + 4;
// Scan for the given sequence
uint16 v = getWord(offset);
while ((v != 0) && (v != player.fwseq_no)) {
offset += 4;
v = getWord(offset);
}
if (v == 0) {
// No sequence match found
seqNum = getFighterMove(fighter, fighter.fwattack_table);
} else {
v = getWord(offset + 2);
seqNum = getFighterMove(fighter, fighter.fwdefend_table);
if (seqNum == 0)
seqNum = getFighterMove(fighter, fighter.fwattack_table);
else if (seqNum == 0xff)
seqNum = v;
}
}
// Set the sequence and pass onto the fight handler
fighter.fwseq_no = seqNum;
fighter.fwseq_ad = getWord(FIGHT_TBL_1 + (seqNum << 1));
}
示例4: fightHandler
void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) {
Resources &res = Resources::getReference();
FighterRecord &fighter = getDetails(h.hotspotId());
FighterRecord &opponent = getDetails(fighter.fwenemy_ad);
uint16 v1, v2;
bool breakFlag = false;
while (!breakFlag) {
if (moveOffset == 0) {
// Player is doing nothing, so check the move number
moveOffset = getWord(FIGHT_PLAYER_MOVE_TABLE + (fighter.fwmove_number << 1));
debugC(ERROR_DETAILED, kLureDebugFights,
"Hotspot %xh fight move=%d, new offset=%xh",
h.hotspotId(), fighter.fwmove_number, moveOffset);
if (moveOffset == 0)
return;
fighter.fwseq_no = fighter.fwmove_number;
fighter.fwseq_ad = moveOffset;
}
uint16 moveValue = getWord(moveOffset);
debugC(ERROR_DETAILED, kLureDebugFights,
"Hotspot %xh script offset=%xh value=%xh",
h.hotspotId(), moveOffset, moveValue);
moveOffset += sizeof(uint16);
if ((moveValue & 0x8000) == 0) {
// Set frame to specified number
h.setFrameNumber(moveValue);
// Set the new fighter position
int16 newX, newY;
newX = h.x() + (int16)getWord(moveOffset);
if (newX < 32) newX = 32;
if (newX > 240) newX = 240;
newY = h.y() + (int16)getWord(moveOffset + 2);
h.setPosition(newX, newY);
if (fighter.fwweapon != 0) {
Hotspot *weaponHotspot = res.getActiveHotspot(fighter.fwweapon);
assert(weaponHotspot);
uint16 newFrameNumber = getWord(moveOffset + 4);
int16 xChange = (int16)getWord(moveOffset + 6);
int16 yChange = (int16)getWord(moveOffset + 8);
weaponHotspot->setFrameNumber(newFrameNumber);
weaponHotspot->setPosition(h.x() + xChange, h.y() + yChange);
}
moveOffset += 5 * sizeof(uint16);
fighter.fwseq_ad = moveOffset;
return;
}
switch (moveValue) {
case 0xFFFA:
// Walk left
if ((fighter.fwmove_number == 5) || (fighter.fwmove_number == 10)) {
if (h.x() < 32) {
breakFlag = true;
} else {
h.setPosition(h.x() - 4, h.y());
fighter.fwtrue_x = h.x();
if (fetchFighterDistance(fighter, opponent) < FIGHT_DISTANCE) {
h.setPosition(h.x() + 4, h.y());
fighter.fwtrue_x += 4;
breakFlag = true;
} else {
removeWeapon(fighter.fwweapon);
fighter.fwtrue_x = h.x();
fighter.fwtrue_y = h.y();
uint16 frameNum = (fighter.fwwalk_roll == 7) ? 0 :
fighter.fwwalk_roll + 1;
fighter.fwwalk_roll = frameNum;
fighter.fwseq_ad = moveOffset;
h.setFrameNumber(frameNum);
return;
}
}
} else {
// Signal to start a new action
moveOffset = 0;
}
break;
case 0xFFF9:
// Walk right
if ((fighter.fwmove_number == 9) || (fighter.fwmove_number == 14)) {
if (h.x() >= 240) {
breakFlag = true;
} else {
removeWeapon(fighter.fwweapon);
h.setPosition(h.x() + 4, h.y());
fighter.fwtrue_x = h.x();
//.........这里部分代码省略.........
示例5: playerAnimHandler
void FightsManager::playerAnimHandler(Hotspot &h) {
FighterRecord &fighter = getDetails(h.hotspotId());
fightHandler(h, fighter.fwseq_ad);
}