本文整理汇总了C++中Sector::getSectorId方法的典型用法代码示例。如果您正苦于以下问题:C++ Sector::getSectorId方法的具体用法?C++ Sector::getSectorId怎么用?C++ Sector::getSectorId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sector
的用法示例。
在下文中一共展示了Sector::getSectorId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: L1_MakeSectorActive
void L1_MakeSectorActive() {
lua_Object sectorObj = lua_getparam(1);
if (!lua_isnumber(sectorObj) && !lua_isstring(sectorObj))
return;
// FIXME: This happens on initial load. Are we initting something in the wrong order?
if (!g_grim->getCurrScene()) {
warning("!!!! Trying to call MakeSectorActive without a scene");
return;
}
bool visible = !lua_isnil(lua_getparam(2));
int numSectors = g_grim->getCurrScene()->getSectorCount();
if (lua_isstring(sectorObj)) {
const char *name = lua_getstring(sectorObj);
for (int i = 0; i < numSectors; i++) {
Sector *sector = g_grim->getCurrScene()->getSectorBase(i);
if (strmatch(sector->getName(), name)) {
sector->setVisible(visible);
return;
}
}
} else if (lua_isnumber(sectorObj)) {
int id = (int)lua_getnumber(sectorObj);
for (int i = 0; i < numSectors; i++) {
Sector *sector = g_grim->getCurrScene()->getSectorBase(i);
if (sector->getSectorId() == id) {
sector->setVisible(visible);
return;
}
}
}
}
示例2: L1_IsPointInSector
void L1_IsPointInSector() {
lua_Object xObj = lua_getparam(1);
lua_Object yObj = lua_getparam(2);
lua_Object zObj = lua_getparam(3);
lua_Object nameObj = lua_getparam(4);
if (!lua_isstring(nameObj)) {
lua_pushnil();
return;
}
const char *name = lua_getstring(nameObj);
float x = lua_getnumber(xObj);
float y = lua_getnumber(yObj);
float z = lua_getnumber(zObj);
Graphics::Vector3d pos(x, y, z);
int numSectors = g_grim->getCurrScene()->getSectorCount();
for (int i = 0; i < numSectors; i++) {
Sector *sector = g_grim->getCurrScene()->getSectorBase(i);
if (strstr(sector->getName(), name)) {
if (sector->isPointInSector(pos)) {
lua_pushnumber(sector->getSectorId());
lua_pushstring(sector->getName());
lua_pushnumber(sector->getType());
return;
}
}
}
lua_pushnil();
}
示例3: L1_IsActorInSector
void L1_IsActorInSector() {
lua_Object actorObj = lua_getparam(1);
lua_Object nameObj = lua_getparam(2);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
if (!lua_isstring(nameObj)) {
lua_pushnil();
return;
}
Actor *actor = getactor(actorObj);
const char *name = lua_getstring(nameObj);
int numSectors = g_grim->getCurrScene()->getSectorCount();
for (int i = 0; i < numSectors; i++) {
Sector *sector = g_grim->getCurrScene()->getSectorBase(i);
if (strstr(sector->getName(), name)) {
if (sector->isPointInSector(actor->getPos())) {
lua_pushnumber(sector->getSectorId());
lua_pushstring(sector->getName());
lua_pushnumber(sector->getType());
return;
}
}
}
lua_pushnil();
}
示例4: L1_GetPointSector
/* Find the sector (of any type) which contains
* the requested coordinate (x,y,z).
*/
void L1_GetPointSector() {
lua_Object xObj = lua_getparam(1);
lua_Object yObj = lua_getparam(2);
lua_Object zObj = lua_getparam(3);
lua_Object typeObj = lua_getparam(4);
Sector::SectorType sectorType;
if (!lua_isnumber(xObj) || !lua_isnumber(yObj) || !lua_isnumber(zObj)) {
lua_pushnil();
return;
}
if (lua_isnil(typeObj))
sectorType = Sector::WalkType;
else
sectorType = (Sector::SectorType)(int)lua_getnumber(typeObj);
float x = lua_getnumber(xObj);
float y = lua_getnumber(yObj);
float z = lua_getnumber(zObj);
Graphics::Vector3d point(x, y, z);
Sector *result = g_grim->getCurrScene()->findPointSector(point, sectorType);
if (result) {
lua_pushnumber(result->getSectorId());
lua_pushstring(const_cast<char *>(result->getName()));
lua_pushnumber(result->getType());
} else {
lua_pushnil();
}
}
示例5: L1_GetActorSector
void L1_GetActorSector() {
lua_Object actorObj = lua_getparam(1);
lua_Object typeObj = lua_getparam(2);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
if (!lua_isnumber(typeObj))
return;
Actor *actor = getactor(actorObj);
Sector::SectorType sectorType = (Sector::SectorType)(int)lua_getnumber(typeObj);
Graphics::Vector3d pos = actor->getPos();
Sector *result = g_grim->getCurrScene()->findPointSector(pos, sectorType);
if (result) {
lua_pushnumber(result->getSectorId());
lua_pushstring(const_cast<char *>(result->getName()));
lua_pushnumber(result->getType());
} else {
lua_pushnil();
}
}
示例6: loadText
void Set::loadText(TextSplitter &ts){
char tempBuf[256];
ts.expectString("section: colormaps");
ts.scanString(" numcolormaps %d", 1, &_numCmaps);
_cmaps = new ObjectPtr<CMap>[_numCmaps];
char cmap_name[256];
for (int i = 0; i < _numCmaps; i++) {
ts.scanString(" colormap %256s", 1, cmap_name);
_cmaps[i] = g_resourceloader->getColormap(cmap_name);
}
if (ts.checkString("section: objectstates") || ts.checkString("sections: object_states")) {
ts.nextLine();
ts.scanString(" tot_objects %d", 1, &_numObjectStates);
char object_name[256];
for (int l = 0; l < _numObjectStates; l++) {
ts.scanString(" object %256s", 1, object_name);
}
} else {
_numObjectStates = 0;
}
ts.expectString("section: setups");
ts.scanString(" numsetups %d", 1, &_numSetups);
_setups = new Setup[_numSetups];
for (int i = 0; i < _numSetups; i++)
_setups[i].load(ts);
_currSetup = _setups;
_lightsConfigured = false;
_numSectors = -1;
_numLights = -1;
_lights = NULL;
_sectors = NULL;
_minVolume = 0;
_maxVolume = 0;
// Lights are optional
if (ts.isEof())
return;
ts.expectString("section: lights");
ts.scanString(" numlights %d", 1, &_numLights);
_lights = new Light[_numLights];
for (int i = 0; i < _numLights; i++)
_lights[i].load(ts);
// Calculate the number of sectors
ts.expectString("section: sectors");
if (ts.isEof()) // Sectors are optional, but section: doesn't seem to be
return;
int sectorStart = ts.getLineNumber();
_numSectors = 0;
// Find the number of sectors (while the sectors usually
// count down from the highest number there are a few
// cases where they count up, see hh.set for example)
while (!ts.isEof()) {
ts.scanString(" %s", 1, tempBuf);
if (!scumm_stricmp(tempBuf, "sector"))
_numSectors++;
}
// Allocate and fill an array of sector info
_sectors = new Sector*[_numSectors];
ts.setLineNumber(sectorStart);
for (int i = 0; i < _numSectors; i++) {
// Use the ids as index for the sector in the array.
// This way when looping they are checked from the id 0 sto the last,
// which seems important for sets with overlapping camera sectors, like ga.set.
Sector *s = new Sector();
s->load(ts);
_sectors[s->getSectorId()] = s;
}
}