本文整理汇总了C++中P_FindSectorFromTag函数的典型用法代码示例。如果您正苦于以下问题:C++ P_FindSectorFromTag函数的具体用法?C++ P_FindSectorFromTag怎么用?C++ P_FindSectorFromTag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了P_FindSectorFromTag函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EV_DoFloorAndCeiling
int EV_DoFloorAndCeiling(line_t *line, byte *args, boolean raise)
{
boolean floor, ceiling;
int secnum;
sector_t *sec;
if(raise)
{
floor = EV_DoFloor(line, args, FLEV_RAISEFLOORBYVALUE);
secnum = -1;
while((secnum = P_FindSectorFromTag(args[0], secnum)) >= 0)
{
sec = §ors[secnum];
sec->specialdata = NULL;
}
ceiling = EV_DoCeiling(line, args, CLEV_RAISEBYVALUE);
}
else
{
floor = EV_DoFloor(line, args, FLEV_LOWERFLOORBYVALUE);
secnum = -1;
while ((secnum = P_FindSectorFromTag(args[0], secnum)) >= 0)
{
sec = §ors[secnum];
sec->specialdata = NULL;
}
ceiling = EV_DoCeiling(line, args, CLEV_LOWERBYVALUE);
}
return (floor|ceiling);
}
开发者ID:shovelmachine,项目名称:hexentouch,代码行数:30,代码来源:p_floor.c
示例2: P_RestorePlayerPosition
// restore the players position -- sector must be the same shape
void P_RestorePlayerPosition(void)
{
sector_t *sec;
int secnum;
// we always save and restore the psprites
memcpy(save_player->psprites, save_psprites, sizeof(save_player->psprites));
// restore player position from x,y offset
if(save_sectag == -1) return; // no sector relativeness
if((secnum = P_FindSectorFromTag(save_sectag, -1)) < 0)
{
// invalid: sector not found
return;
}
sec = §ors[secnum];
// restore position
P_UnsetThingPosition(save_player->mo);
save_player->mo->x = sec->soundorg.x + save_xoffset;
save_player->mo->y = sec->soundorg.y + save_yoffset;
// restore various other things
save_player->mo->angle = save_mobj.angle;
save_player->mo->momx = save_mobj.momx; // keep momentum
save_player->mo->momy = save_mobj.momy;
P_SetThingPosition(save_player->mo);
}
开发者ID:doomtech,项目名称:eternity,代码行数:36,代码来源:p_hubs.cpp
示例3: P_SavePlayerPosition
// save a player's position relative to a particular sector
void P_SavePlayerPosition(player_t *player, int sectag)
{
sector_t *sec;
int secnum;
save_player = player;
// save psprites whatever happens
memcpy(save_psprites, player->psprites, sizeof(player->psprites));
// save sector x,y offset
save_sectag = sectag;
if((secnum = P_FindSectorFromTag(sectag, -1)) < 0)
{
// invalid: sector not found
save_sectag = -1;
return;
}
sec = §ors[secnum];
// use soundorg x and y as 'centre' of sector
save_xoffset = player->mo->x - sec->soundorg.x;
save_yoffset = player->mo->y - sec->soundorg.y;
// save mobj so we can restore various bits of data
// haleyjd 02/04/13: not legit for C++; must replace if rehabilitated
#if 0
memcpy(&save_mobj, player->mo, sizeof(Mobj));
#endif
}
开发者ID:doomtech,项目名称:eternity,代码行数:36,代码来源:p_hubs.cpp
示例4: EV_LightTurnOnPartway
// killough 10/98:
//
// EV_LightTurnOnPartway()
//
// Turn sectors tagged to line lights on to specified or max neighbor level
//
// Passed the activating line's tag, and a light level fraction between
// 0 and 1. Sets the light to min on 0, max on 1, and interpolates in-
// between. Used for doors with gradual lighting effects.
//
// haleyjd 02/28/05: changed to take a tag instead of a line.
//
// Returns true
//
int EV_LightTurnOnPartway(int tag, fixed_t level)
{
int i;
if(level < 0) // clip at extremes
level = 0;
if(level > FRACUNIT)
level = FRACUNIT;
// search all sectors for ones with same tag as activating line
for(i = -1; (i = P_FindSectorFromTag(tag, i)) >= 0;)
{
sector_t *temp, *sector = sectors + i;
int j, bright = 0, min = sector->lightlevel;
for(j = 0; j < sector->linecount; ++j)
{
if((temp = getNextSector(sector->lines[j], sector)))
{
if(temp->lightlevel > bright)
bright = temp->lightlevel;
if(temp->lightlevel < min)
min = temp->lightlevel;
}
}
sector->lightlevel = // Set level in-between extremes
(level * bright + (FRACUNIT - level) * min) >> FRACBITS;
}
return 1;
}
开发者ID:doomtech,项目名称:eternity,代码行数:45,代码来源:p_lights.cpp
示例5: EV_LightTurnOn
//
// TURN LINE'S TAG LIGHTS ON
// [RH] Takes a tag instead of a line
//
void EV_LightTurnOn (int tag, int bright)
{
int secnum = -1;
// [RH] Don't do a linear search
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
{
sector_t *sector = sectors + secnum;
// bright = -1 means to search ([RH] Not 0)
// for highest light level
// surrounding sector
if (bright < 0)
{
int j;
bright = 0;
for (j = 0; j < sector->linecount; j++)
{
sector_t *temp = getNextSector (sector->lines[j], sector);
if (!temp)
continue;
if (temp->lightlevel > bright)
bright = temp->lightlevel;
}
}
sector->lightlevel = CLIPLIGHT(bright);
}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:35,代码来源:p_lights.cpp
示例6: EV_DoPillar
BOOL EV_DoPillar (DPillar::EPillar type, int tag, fixed_t speed, fixed_t height,
fixed_t height2, bool crush)
{
BOOL rtn = false;
int secnum = -1;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
{
sector_t *sec = §ors[secnum];
fixed_t floorheight = P_FloorHeight(sec);
fixed_t ceilingheight = P_CeilingHeight(sec);
if (sec->floordata || sec->ceilingdata)
continue;
if (type == DPillar::pillarBuild && floorheight == ceilingheight)
continue;
if (type == DPillar::pillarOpen && floorheight != ceilingheight)
continue;
rtn = true;
new DPillar (sec, type, speed, height, height2, crush);
P_AddMovingCeiling(sec);
}
return rtn;
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:27,代码来源:p_pillar.cpp
示例7: EV_BuildPillar
int EV_BuildPillar(line_t *line, byte *args, boolean crush)
{
int secnum;
sector_t *sec;
pillar_t *pillar;
int newHeight;
int rtn;
rtn = 0;
secnum = -1;
while((secnum = P_FindSectorFromTag(args[0], secnum)) >= 0)
{
sec = §ors[secnum];
if(sec->specialdata)
continue; // already moving
if(sec->floorheight == sec->ceilingheight)
{ // pillar is already closed
continue;
}
rtn = 1;
if(!args[2])
{
newHeight = sec->floorheight+
((sec->ceilingheight-sec->floorheight)/2);
}
else
{
newHeight = sec->floorheight+(args[2]<<FRACBITS);
}
pillar = Z_Malloc(sizeof(*pillar), PU_LEVSPEC, 0);
sec->specialdata = pillar;
P_AddThinker(&pillar->thinker);
pillar->thinker.function = T_BuildPillar;
pillar->sector = sec;
if(!args[2])
{
pillar->ceilingSpeed = pillar->floorSpeed = args[1]*(FRACUNIT/8);
}
else if(newHeight-sec->floorheight > sec->ceilingheight-newHeight)
{
pillar->floorSpeed = args[1]*(FRACUNIT/8);
pillar->ceilingSpeed = FixedMul(sec->ceilingheight-newHeight,
FixedDiv(pillar->floorSpeed, newHeight-sec->floorheight));
}
else
{
pillar->ceilingSpeed = args[1]*(FRACUNIT/8);
pillar->floorSpeed = FixedMul(newHeight-sec->floorheight,
FixedDiv(pillar->ceilingSpeed, sec->ceilingheight-newHeight));
}
pillar->floordest = newHeight;
pillar->ceilingdest = newHeight;
pillar->direction = 1;
pillar->crush = crush*args[3];
SN_StartSequence((mobj_t *)&pillar->sector->soundorg,
SEQ_PLATFORM+pillar->sector->seqType);
}
return rtn;
}
开发者ID:shovelmachine,项目名称:hexentouch,代码行数:60,代码来源:p_floor.c
示例8: EV_StartFloorWaggle
boolean EV_StartFloorWaggle(int tag, int height, int speed, int offset,
int timer)
{
int sectorIndex;
sector_t *sector;
floorWaggle_t *waggle;
boolean retCode;
retCode = false;
sectorIndex = -1;
while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
{
sector = §ors[sectorIndex];
if(sector->specialdata)
{ // Already busy with another thinker
continue;
}
retCode = true;
waggle = Z_Malloc(sizeof(*waggle), PU_LEVSPEC, 0);
sector->specialdata = waggle;
waggle->thinker.function = T_FloorWaggle;
waggle->sector = sector;
waggle->originalHeight = sector->floorheight;
waggle->accumulator = offset*FRACUNIT;
waggle->accDelta = speed<<10;
waggle->scale = 0;
waggle->targetScale = height<<10;
waggle->scaleDelta = waggle->targetScale
/(35+((3*35)*height)/255);
waggle->ticker = timer ? timer*35 : -1;
waggle->state = WGLSTATE_EXPAND;
P_AddThinker(&waggle->thinker);
}
return retCode;
}
开发者ID:shovelmachine,项目名称:hexentouch,代码行数:35,代码来源:p_floor.c
示例9: P_DoSectorLightChange
int P_DoSectorLightChange(line_t* line, short tag) {
int j = 0;
int ptr1 = 0;
int ptr2 = 0;
sector_t* sec1;
sector_t* sec2;
int secnum;
int rtn;
secnum = P_FindSectorFromTag(tag);
if(secnum == -1) {
return 0;
}
sec2 = §ors[secnum];
secnum = -1;
rtn = 0;
while((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) {
sec1 = §ors[secnum];
rtn = 1;
for(j = 0; j < 5; j++) {
ptr1 = (sec1->colors[j]);
ptr2 = (sec2->colors[j]);
P_UpdateLightThinker(&lights[ptr1], &lights[ptr2]);
}
}
return 1;
}
开发者ID:directhex,项目名称:doom64,代码行数:33,代码来源:p_lights.c
示例10: ACS_funcSectorDamage
//
// ACS_funcSectorDamage
//
static void ACS_funcSectorDamage(ACS_FUNCARG)
{
int32_t tag = args[0];
int32_t damage = args[1];
int mod = E_DamageTypeNumForName(ACSVM::GetString(args[2]));
uint32_t flags = args[4];
int secnum = -1;
sector_t *sector;
while((secnum = P_FindSectorFromTag(tag, secnum)) >= 0)
{
sector = §ors[secnum];
for(Mobj *mo = sector->thinglist; mo; mo = mo->snext)
{
if(mo->player && !(flags & SECDAM_PLAYERS))
continue;
if(!mo->player && !(flags & SECDAM_NONPLAYERS))
continue;
if(mo->z != mo->floorz && !(flags & SECDAM_IN_AIR))
continue;
P_DamageMobj(mo, NULL, NULL, damage, mod);
}
}
}
开发者ID:Blastfrog,项目名称:eternity,代码行数:31,代码来源:acs_func.cpp
示例11: ACS_thingCountSector
//
// ACS_thingCountSector
//
static int32_t ACS_thingCountSector(int32_t tag, mobjtype_t type, int32_t tid)
{
sector_t *sector;
int count = 0;
int secnum = -1;
while((secnum = P_FindSectorFromTag(tag, secnum)) >= 0)
{
sector = §ors[secnum];
for(Mobj *mo = sector->thinglist; mo; mo = mo->snext)
{
if((type == 0 || mo->type == type) && (tid == 0 || mo->tid == tid))
{
// don't count killable things that are dead
if(((mo->flags & MF_COUNTKILL) || (mo->flags3 & MF3_KILLABLE)) &&
mo->health <= 0)
continue;
++count;
}
}
}
return count;
}
开发者ID:Blastfrog,项目名称:eternity,代码行数:28,代码来源:acs_func.cpp
示例12: EV_StartLightFading
void EV_StartLightFading (int tag, int value, int tics)
{
int secnum;
secnum = -1;
while ((secnum = P_FindSectorFromTag (tag,secnum)) >= 0)
{
sector_t *sec = §ors[secnum];
if (sec->lightingdata)
continue;
if (tics <= 0)
{
sec->SetLightLevel(value);
}
else
{
// No need to fade if lightlevel is already at desired value.
if (sec->lightlevel == value)
continue;
new DGlow2 (sec, sec->lightlevel, value, tics, true);
}
}
}
开发者ID:1Akula1,项目名称:gzdoom,代码行数:25,代码来源:p_lights.cpp
示例13: EV_LightChange
//
// [RH] New function to adjust tagged sectors' light levels
// by a relative amount. Light levels are clipped to
// within the range 0-255 inclusive.
//
void EV_LightChange (int tag, int value)
{
int secnum = -1;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0) {
int newlight = sectors[secnum].lightlevel + value;
sectors[secnum].lightlevel = CLIPLIGHT(newlight);
}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:14,代码来源:p_lights.cpp
示例14: EV_LightChange
void EV_LightChange (int tag, int value)
{
int secnum = -1;
while ((secnum = P_FindSectorFromTag (tag, secnum)) >= 0)
{
sectors[secnum].SetLightLevel(sectors[secnum].lightlevel + value);
}
}
开发者ID:1Akula1,项目名称:gzdoom,代码行数:9,代码来源:p_lights.cpp
示例15: EV_GlowLight
//
// EV_GlowLight
//
// haleyjd:
// Parameterized glow effect. Uses the fading thinker, but sets it up to
// perpetually fade between two different light levels. The glow always starts
// by fading the sector toward the lower light level, whether that requires
// fading up or down.
//
int EV_GlowLight(line_t *line, int tag, int maxval, int minval, int speed)
{
int i, rtn = 0;
LightFadeThinker *lf;
bool backside = false;
// speed <= 0? hell no.
if(speed <= 0 || maxval == minval)
return rtn;
// ensure min and max have proper relationship
if(maxval < minval)
{
int temp = maxval;
maxval = minval;
minval = temp;
}
if(line && tag == 0)
{
if(!line->backsector)
return rtn;
i = line->backsector - sectors;
backside = true;
goto dobackside;
}
// search all sectors for ones with tag
for(i = -1; (i = P_FindSectorFromTag(tag, i)) >= 0;)
{
dobackside:
rtn = 1;
lf = new LightFadeThinker;
lf->addThinker();
lf->sector = §ors[i];
lf->glowmin = minval * FRACUNIT;
lf->glowmax = maxval * FRACUNIT;
lf->glowspeed = speed;
// start out fading to min level
lf->destlevel = lf->glowmin; // dest. light level
lf->lightlevel = lf->sector->lightlevel * FRACUNIT; // curr. light level
lf->step = (lf->destlevel - lf->lightlevel) / speed; // delta per frame
lf->type = fade_glow;
if(backside)
return rtn;
}
return rtn;
}
开发者ID:doomtech,项目名称:eternity,代码行数:64,代码来源:p_lights.cpp
示例16: P_ChangeCeilingTex
//
// P_ChangeCeilingTex
//
// Changes the ceiling flat of all tagged sectors.
//
void P_ChangeCeilingTex(const char *name, int tag)
{
int flatnum;
int secnum = -1;
if((flatnum = R_CheckForFlat(name)) == -1)
return;
while((secnum = P_FindSectorFromTag(tag, secnum)) >= 0)
P_SetSectorCeilingPic(§ors[secnum], flatnum);
}
开发者ID:chungy,项目名称:eternity,代码行数:16,代码来源:p_ceilng.cpp
示例17: ACS_funcGetSectorFloorZ
//
// ACS_funcGetSectorFloorZ
//
static void ACS_funcGetSectorFloorZ(ACS_FUNCARG)
{
int secnum = P_FindSectorFromTag(args[0], -1);
if(secnum >= 0)
{
// TODO/FIXME: sloped sectors
*retn++ = sectors[secnum].floorheight;
}
else
*retn++ = 0;
}
开发者ID:Blastfrog,项目名称:eternity,代码行数:15,代码来源:acs_func.cpp
示例18: EV_DoDoor
int EV_DoDoor(line_t *line, byte *args, vldoor_e type)
{
int secnum;
int retcode;
sector_t *sec;
vldoor_t *door;
fixed_t speed;
speed = args[1]*FRACUNIT/8;
secnum = -1;
retcode = 0;
while((secnum = P_FindSectorFromTag(args[0], secnum)) >= 0)
{
sec = §ors[secnum];
if(sec->specialdata)
{
continue;
}
// Add new door thinker
retcode = 1;
door = Z_Malloc(sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker(&door->thinker);
sec->specialdata = door;
door->thinker.function = T_VerticalDoor;
door->sector = sec;
switch(type)
{
case DREV_CLOSE:
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->direction = -1;
break;
case DREV_CLOSE30THENOPEN:
door->topheight = sec->ceilingheight;
door->direction = -1;
break;
case DREV_NORMAL:
case DREV_OPEN:
door->direction = 1;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
break;
default:
break;
}
door->type = type;
door->speed = speed;
door->topwait = args[2]; // line->arg3
SN_StartSequence((mobj_t *)&door->sector->soundorg,
SEQ_DOOR_STONE+door->sector->seqType);
}
return(retcode);
}
开发者ID:BruceJawn,项目名称:flash-doom,代码行数:53,代码来源:P_DOORS.C
示例19: TagBusy
static boolean TagBusy(int tag)
{
int sectorIndex;
sectorIndex = -1;
while ((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
{
if (sectors[sectorIndex].specialdata)
{
return true;
}
}
return false;
}
开发者ID:MP2E,项目名称:chocolate-doom,代码行数:14,代码来源:p_acs.c
示例20: EV_BuildStairs
int EV_BuildStairs(line_t *line, byte *args, int direction,
stairs_e stairsType)
{
int secnum;
int height;
int delay;
int resetDelay;
sector_t *sec;
sector_t *qSec;
int type;
// Set global stairs variables
TextureChange = 0;
Direction = direction;
StepDelta = Direction*(args[2]*FRACUNIT);
Speed = args[1]*(FRACUNIT/8);
resetDelay = args[4];
delay = args[3];
if(stairsType == STAIRS_PHASED)
{
StartDelayDelta = args[3];
StartDelay = StartDelayDelta;
resetDelay = StartDelayDelta;
delay = 0;
TextureChange = args[4];
}
secnum = -1;
validcount++;
while ((secnum = P_FindSectorFromTag(args[0], secnum)) >= 0)
{
sec = §ors[secnum];
Texture = sec->floorpic;
StartHeight = sec->floorheight;
// ALREADY MOVING? IF SO, KEEP GOING...
if (sec->specialdata)
continue;
QueueStairSector(sec, 0, sec->floorheight);
sec->special = 0;
}
while((qSec = DequeueStairSector(&type, &height)) != NULL)
{
ProcessStairSector(qSec, type, height, stairsType, delay, resetDelay);
}
return(1);
}
开发者ID:shovelmachine,项目名称:hexentouch,代码行数:50,代码来源:p_floor.c
注:本文中的P_FindSectorFromTag函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论