当前位置: 首页>>代码示例>>C++>>正文


C++ P_AddThinker函数代码示例

本文整理汇总了C++中P_AddThinker函数的典型用法代码示例。如果您正苦于以下问题:C++ P_AddThinker函数的具体用法?C++ P_AddThinker怎么用?C++ P_AddThinker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了P_AddThinker函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Z_Malloc

void
EV_SlidingDoor
( line_t*		line,
  mobj_t*		thing )
{
	sector_t*			sec;
	slidedoor_t*		door;

	// DOOM II ONLY...
	if (gamemode != commercial)
		return;

	// Make sure door isn't already being animated
	sec = line->frontsector;
	door = NULL;
	if (sec->specialdata)
	{
		if (!thing->player)
			return;

		door = sec->specialdata;
		if (door->type == sdt_openAndClose)
		{
			if (door->status == sd_waiting)
				door->status = sd_closing;
		}
		else
			return;
	}

	// Init sliding door vars
	if (!door)
	{
		door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
		P_AddThinker (&door->thinker);
		sec->specialdata = door;

		door->type = sdt_openAndClose;
		door->status = sd_opening;
		door->whichDoorIndex = P_FindSlidingDoorType(line);

		if (door->whichDoorIndex < 0)
			I_Error("EV_SlidingDoor: Can't use texture for sliding door!");

		door->frontsector = sec;
		door->backsector = line->backsector;
		door->thinker.function = T_SlidingDoor;
		door->timer = SWAITTICS;
		door->frame = 0;
		door->line = line;
	}
}
开发者ID:FulcronZ,项目名称:NyuziProcessor,代码行数:52,代码来源:p_doors.c

示例2: P_SpawnGlowingLight

void P_SpawnGlowingLight(sector_t * sector)
{
    glow_t *g;

    g = Z_Malloc(sizeof(*g), PU_LEVSPEC, 0);
    P_AddThinker(&g->thinker);
    g->sector = sector;
    g->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
    g->maxlight = sector->lightlevel;
    g->thinker.function = T_Glow;
    g->direction = -1;

    sector->special = 0;
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:14,代码来源:p_lights.c

示例3: P_StartACS

boolean P_StartACS(int number, int map, byte * args, mobj_t * activator,
                   line_t * line, int side)
{
    int i;
    acs_t *script;
    int infoIndex;
    aste_t *statePtr;

    NewScript = NULL;
    if (map && map != gamemap)
    {                           // Add to the script store
        return AddToACSStore(map, number, args);
    }
    infoIndex = GetACSIndex(number);
    if (infoIndex == -1)
    {                           // Script not found
        //I_Error("P_StartACS: Unknown script number %d", number);
        snprintf(ErrorMsg, sizeof(ErrorMsg),
                 "P_STARTACS ERROR: UNKNOWN SCRIPT %d", number);
        P_SetMessage(&players[consoleplayer], ErrorMsg, true);
    }
    statePtr = &ACSInfo[infoIndex].state;
    if (*statePtr == ASTE_SUSPENDED)
    {                           // Resume a suspended script
        *statePtr = ASTE_RUNNING;
        return true;
    }
    if (*statePtr != ASTE_INACTIVE)
    {                           // Script is already executing
        return false;
    }
    script = Z_Malloc(sizeof(acs_t), PU_LEVSPEC, 0);
    memset(script, 0, sizeof(acs_t));
    script->number = number;
    script->infoIndex = infoIndex;
    script->activator = activator;
    script->line = line;
    script->side = side;
    script->ip = ACSInfo[infoIndex].address;
    script->thinker.function = T_InterpretACS;
    for (i = 0; i < ACSInfo[infoIndex].argCount; i++)
    {
        script->vars[i] = args[i];
    }
    *statePtr = ASTE_RUNNING;
    P_AddThinker(&script->thinker);
    NewScript = script;
    return true;
}
开发者ID:MP2E,项目名称:chocolate-doom,代码行数:49,代码来源:p_acs.c

示例4: P_UnArchiveThinkers

void P_UnArchiveThinkers(void)
{
    byte tclass;
    thinker_t *currentthinker, *next;
    mobj_t *mobj;

    //
    // remove all the current thinkers
    //
    currentthinker = thinkercap.next;
    while (currentthinker != &thinkercap)
    {
        next = currentthinker->next;
        if (currentthinker->function == P_MobjThinker)
            P_RemoveMobj((mobj_t *) currentthinker);
        else
            Z_Free(currentthinker);
        currentthinker = next;
    }
    P_InitThinkers();

    // read in saved thinkers
    while (1)
    {
        tclass = SV_ReadByte();
        switch (tclass)
        {
            case tc_end:
                return;         // end of list

            case tc_mobj:
                mobj = Z_Malloc(sizeof(*mobj), PU_LEVEL, NULL);
                saveg_read_mobj_t(mobj);
                mobj->target = NULL;
                P_SetThingPosition(mobj);
                mobj->info = &mobjinfo[mobj->type];
                mobj->floorz = mobj->subsector->sector->floorheight;
                mobj->ceilingz = mobj->subsector->sector->ceilingheight;
                mobj->thinker.function = P_MobjThinker;
                P_AddThinker(&mobj->thinker);
                break;

            default:
                I_Error("Unknown tclass %i in savegame", tclass);
        }

    }

}
开发者ID:twipley,项目名称:chocolate-doom,代码行数:49,代码来源:p_saveg.c

示例5: P_SpawnDoorCloseIn30

//==================================================================
//
//      Spawn a door that closes after 30 seconds
//
//==================================================================
void P_SpawnDoorCloseIn30(sector_t * sec)
{
    vldoor_t *door;

    door = Z_Malloc(sizeof(*door), PU_LEVSPEC, 0);
    P_AddThinker(&door->thinker);
    sec->specialdata = door;
    sec->special = 0;
    door->thinker.function = T_VerticalDoor;
    door->sector = sec;
    door->direction = 0;
    door->type = normal;
    door->speed = VDOORSPEED;
    door->topcountdown = 30 * 35;
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:20,代码来源:p_doors.c

示例6: P_SpawnStrobeAltFlash

void P_SpawnStrobeAltFlash(sector_t* sector, int speed) {      // 0x80015C44
    strobe_t* flash;

    flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);

    P_AddThinker(&flash->thinker);

    flash->sector = sector;
    flash->darktime = speed;
    flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
    flash->special = sector->special;
    flash->maxlight = 127;
    flash->brighttime = 1;
    flash->count = 1;
}
开发者ID:directhex,项目名称:doom64,代码行数:15,代码来源:p_lights.c

示例7: P_SpawnStrobeFlash

void P_SpawnStrobeFlash(sector_t* sector, int speed) {
    strobe_t* flash;

    flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);

    P_AddThinker(&flash->thinker);

    flash->sector = sector;
    flash->darktime = speed;
    flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
    flash->special = sector->special;
    flash->maxlight = 16;
    flash->brighttime = 3;
    flash->count = (P_Random(pr_lights) & 7) + 1;
}
开发者ID:directhex,项目名称:doom64,代码行数:15,代码来源:p_lights.c

示例8: P_CombineLightSpecials

void P_CombineLightSpecials(sector_t *sector) {
    actionf_p1 func;
    thinker_t *thinker;
    combine_t *combine;

    switch(sector->special) {
    case 1:
        func = T_LightFlash;
        break;
    case 2:
    case 3:
    case 202:
    case 203:
    case 204:
    case 205:
    case 206:
    case 208:
        func = T_StrobeFlash;
        break;
    case 8:
    case 9:
    case 11:
        func = T_Glow;
        break;
    case 17:
        func = T_FireFlicker;
        break;
    default:
        return;
    }

    for(thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next) {
        if((actionf_p1)func != (actionf_p1)thinker->function.acp1) {
            continue;
        }

        combine = Z_Malloc(sizeof(*combine), PU_LEVSPEC, 0);

        P_AddThinker(&combine->thinker);

        combine->sector = sector;
        combine->special = sector->special;
        combine->combiner = thinker;
        combine->func = func;
        combine->thinker.function.acp1 = (actionf_p1)T_Combine;
        return;
    }
}
开发者ID:directhex,项目名称:doom64,代码行数:48,代码来源:p_lights.c

示例9: P_SpawnGlowingLight

//
// P_SpawnGlowingLight()
//
// Spawns a glowing light (smooth oscillation from min to max) thinker
//
// Passed the sector that spawned the thinker
// Returns nothing
//
void P_SpawnGlowingLight(sector_t*  sector)
{
  glow_t* g;

  g = Z_Malloc( sizeof(*g), PU_LEVSPEC, 0);

  P_AddThinker(&g->thinker);

  g->sector = sector;
  g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
  g->maxlight = sector->lightlevel;
  g->thinker.function.acp1 = (actionf_p1) T_Glow;
  g->direction = -1;

  sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type
}
开发者ID:hexameron,项目名称:DOOM,代码行数:24,代码来源:p_lights.c

示例10: StartOpenACS

static void StartOpenACS(int number, int infoIndex, int *address)
{
    acs_t *script;

    script = Z_Malloc(sizeof(acs_t), PU_LEVSPEC, 0);
    memset(script, 0, sizeof(acs_t));
    script->number = number;

    // World objects are allotted 1 second for initialization
    script->delayCount = 35;

    script->infoIndex = infoIndex;
    script->ip = address;
    script->thinker.function = T_InterpretACS;
    P_AddThinker(&script->thinker);
}
开发者ID:MP2E,项目名称:chocolate-doom,代码行数:16,代码来源:p_acs.c

示例11: P_SpawnLightFlash

//==================================================================
//
//      P_SpawnLightFlash
//
//      After the map has been loaded, scan each sector for specials that spawn thinkers
//
//==================================================================
void P_SpawnLightFlash(sector_t * sector)
{
    lightflash_t *flash;

    sector->special = 0;        // nothing special about it during gameplay

    flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
    P_AddThinker(&flash->thinker);
    flash->thinker.function = T_LightFlash;
    flash->sector = sector;
    flash->maxlight = sector->lightlevel;

    flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
    flash->maxtime = 64;
    flash->mintime = 7;
    flash->count = (P_Random() & flash->maxtime) + 1;
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:24,代码来源:p_lights.c

示例12: P_SpawnFireFlicker

//
// P_SpawnFireFlicker
//
void P_SpawnFireFlicker(sector_t *sector)
{
    fireflicker_t       *flick = Z_Malloc(sizeof(*flick), PU_LEVSPEC, 0);

    // Note that we are resetting sector attributes.
    // Nothing special about it during gameplay.
    sector->special = 0;

    memset(flick, 0, sizeof(*flick));
    P_AddThinker(&flick->thinker);

    flick->thinker.function = T_FireFlicker;
    flick->sector = sector;
    flick->maxlight = sector->lightlevel;
    flick->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel) + 16;
    flick->count = 4;
}
开发者ID:Clever-Boy,项目名称:doomretro,代码行数:20,代码来源:p_lights.c

示例13: P_SpawnFireFlicker

//
// P_SpawnFireFlicker
//
// [STRIFE] 
// haleyjd 2011023: Changes to minimum light level and initial duration
//
void P_SpawnFireFlicker (sector_t*      sector)
{
    fireflicker_t*      flick;

    // Note that we are resetting sector attributes.
    // Nothing special about it during gameplay.
    sector->special = 0; 

    flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);

    P_AddThinker (&flick->thinker);

    flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
    flick->sector = sector;
    flick->maxlight = sector->lightlevel;
    flick->minlight = sector->lightlevel - 32; // [STRIFE] changed from min surrounding+16
    flick->count = 2;                          // [STRIFE]: Initial count 4 -> 2
}
开发者ID:Azarien,项目名称:chocolate-doom,代码行数:24,代码来源:p_lights.c

示例14: P_SpawnDoorRaiseIn5Mins

//==================================================================
//
//      Spawn a door that opens after 5 minutes
//
//==================================================================
void P_SpawnDoorRaiseIn5Mins(sector_t * sec, int secnum)
{
    vldoor_t *door;

    door = Z_Malloc(sizeof(*door), PU_LEVSPEC, 0);
    P_AddThinker(&door->thinker);
    sec->specialdata = door;
    sec->special = 0;
    door->thinker.function = T_VerticalDoor;
    door->sector = sec;
    door->direction = 2;
    door->type = raiseIn5Mins;
    door->speed = VDOORSPEED;
    door->topheight = P_FindLowestCeilingSurrounding(sec);
    door->topheight -= 4 * FRACUNIT;
    door->topwait = VDOORWAIT;
    door->topcountdown = 5 * 60 * 35;
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:23,代码来源:p_doors.c

示例15: P_SpawnFireFlicker

//
// P_SpawnFireFlicker()
//
// Spawns a fire flicker lighting thinker
//
// Passed the sector that spawned the thinker
// Returns nothing
//
void P_SpawnFireFlicker (sector_t*  sector)
{
  fireflicker_t*  flick;

  // Note that we are resetting sector attributes.
  // Nothing special about it during gameplay.
  sector->special &= ~31; //jff 3/14/98 clear non-generalized sector type

  flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);

  P_AddThinker (&flick->thinker);

  flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
  flick->sector = sector;
  flick->maxlight = sector->lightlevel;
  flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
  flick->count = 4;
}
开发者ID:hexameron,项目名称:DOOM,代码行数:26,代码来源:p_lights.c


注:本文中的P_AddThinker函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。